sanpwc commented on code in PR #2792:
URL: https://github.com/apache/ignite-3/pull/2792#discussion_r1381710049
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -989,73 +999,46 @@ public void stop() {
* @param tables Tables to stop.
*/
private void cleanUpTablesResources(Map<Integer, TableImpl> tables) {
- for (TableImpl table : tables.values()) {
- table.beforeClose();
-
- List<Runnable> stopping = new ArrayList<>();
+ var futures = new ArrayList<CompletableFuture<Void>>();
- AtomicReference<Throwable> throwable = new AtomicReference<>();
+ for (TableImpl table : tables.values()) {
+ futures.add(runAsync(() -> {
+ Stream.Builder<ManuallyCloseable> stopping = Stream.builder();
- AtomicBoolean nodeStoppingEx = new AtomicBoolean();
+ stopping.add(table::beforeClose);
- InternalTable internalTable = table.internalTable();
+ InternalTable internalTable = table.internalTable();
- for (int p = 0; p < internalTable.partitions(); p++) {
- int partitionId = p;
+ for (int p = 0; p < internalTable.partitions(); p++) {
+ TablePartitionId replicationGroupId = new
TablePartitionId(table.tableId(), p);
- TablePartitionId replicationGroupId = new
TablePartitionId(table.tableId(), p);
+ stopping.add(() ->
raftMgr.stopRaftNodes(replicationGroupId));
Review Comment:
The order seems strange to me. Initially it was also confusing but because
we've stooped network at the very beginning we might receive
NodeStoppingException when replica tried to touch already stopped raft endpoint
(and having NodeStoppingException is fine). Currently we will probably fail
with something like "UnknownRaftGroup" because we've originally stopped raft
before stopping replica. Basically the order of stopping will should be
opposite to the order of starting, right?
And, yep, you might say that busyLocks will protect us, but they won't.
Let's even put aside the fact that not all the operations are covered with
busyLocks. Besides that busyLocks only covers local operations, so e.g. on
message send you may exit the busylock and within given point you may start
beforeNodeStop that will stop the raft endpoint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]