denis-chudov commented on code in PR #2807:
URL: https://github.com/apache/ignite-3/pull/2807#discussion_r1384735823


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1273,71 +1275,58 @@ private void dropTableLocally(long causalityToken, 
CatalogTableDescriptor tableD
         int tableId = tableDescriptor.id();
         int partitions = zoneDescriptor.partitions();
 
-        try {
-            CompletableFuture<?>[] removeStorageFromGcFutures = new 
CompletableFuture<?>[partitions];
-
-            for (int p = 0; p < partitions; p++) {
-                TablePartitionId replicationGroupId = new 
TablePartitionId(tableId, p);
-
-                raftMgr.stopRaftNodes(replicationGroupId);
-
-                removeStorageFromGcFutures[p] = replicaMgr
-                        .stopReplica(replicationGroupId)
-                        .thenCompose((notUsed) -> 
mvGc.removeStorage(replicationGroupId));
+        localPartsByTableIdVv.update(causalityToken, (previousVal, e) -> 
inBusyLock(busyLock, () -> {
+            if (e != null) {
+                return failedFuture(e);
             }
 
-            localPartsByTableIdVv.update(causalityToken, (previousVal, e) -> 
inBusyLock(busyLock, () -> {
-                if (e != null) {
-                    return failedFuture(e);
-                }
+            var newMap = new HashMap<>(previousVal);
+            newMap.remove(tableId);
 
-                var newMap = new HashMap<>(previousVal);
-                newMap.remove(tableId);
+            return completedFuture(newMap);
+        }));
 
-                return completedFuture(newMap);
-            }));
+        tablesByIdVv.update(causalityToken, (previousVal, e) -> 
inBusyLock(busyLock, () -> {
+            if (e != null) {
+                return failedFuture(e);
+            }
 
-            tablesByIdVv.update(causalityToken, (previousVal, e) -> 
inBusyLock(busyLock, () -> {
-                if (e != null) {
-                    return failedFuture(e);
-                }
+            var map = new HashMap<>(previousVal);
 
-                var map = new HashMap<>(previousVal);
+            TableImpl table = map.remove(tableId);
 
-                TableImpl table = map.remove(tableId);
+            assert table != null : tableId;
 
-                assert table != null : tableId;
+            InternalTable internalTable = table.internalTable();
 
-                InternalTable internalTable = table.internalTable();
+            CompletableFuture<?>[] stopReplicaFutures = new 
CompletableFuture<?>[partitions];
 
-                for (int partitionId = 0; partitionId < partitions; 
partitionId++) {
-                    closePartitionTrackers(internalTable, partitionId);
-                }
+            for (int partitionId = 0; partitionId < partitions; partitionId++) 
{
+                var replicationGroupId = new TablePartitionId(tableId, 
partitionId);
 
-                // TODO: IGNITE-18703 Destroy raft log and meta
+                stopReplicaFutures[partitionId] = 
stopPartition(replicationGroupId, table);
+            }
 
-                CompletableFuture<Void> destroyTableStoragesFuture = 
allOf(removeStorageFromGcFutures)
-                        .thenCompose(unused -> allOf(
-                                internalTable.storage().destroy(),
-                                runAsync(() -> 
internalTable.txStateStorage().destroy(), ioExecutor))
-                        );
+            // TODO: IGNITE-18703 Destroy raft log and meta
+            CompletableFuture<Void> destroyTableStoragesFuture = 
allOf(stopReplicaFutures)
+                    .thenCompose(unused -> allOf(
+                            internalTable.storage().destroy(),
+                            runAsync(() -> 
internalTable.txStateStorage().destroy(), ioExecutor))
+                    );

Review Comment:
   Seems you could just use `stopAndDestroyPartition` here



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to