sanpwc commented on code in PR #1599:
URL: https://github.com/apache/ignite-3/pull/1599#discussion_r1091920169


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1952,50 +1952,56 @@ public void onError(Throwable e) {
         
metaStorageMgr.registerPrefixWatch(ByteArray.fromString(STABLE_ASSIGNMENTS_PREFIX),
 new WatchListener() {
             @Override
             public void onUpdate(WatchEvent evt) {
-                if (!busyLock.enterBusy()) {
-                    throw new IgniteInternalException(new 
NodeStoppingException());
-                }
-
-                try {
-                    assert evt.single();
+                inBusyLock(busyLock, () -> {
+                    assert evt.single() : evt;
 
                     Entry stableAssignmentsWatchEvent = 
evt.entryEvent().newEntry();
 
                     if (stableAssignmentsWatchEvent.value() == null) {
                         return;
                     }
 
-                    int part = 
extractPartitionNumber(stableAssignmentsWatchEvent.key());
-                    UUID tblId = 
extractTableId(stableAssignmentsWatchEvent.key(), STABLE_ASSIGNMENTS_PREFIX);
+                    int partitionId = 
extractPartitionNumber(stableAssignmentsWatchEvent.key());
+                    UUID tableId = 
extractTableId(stableAssignmentsWatchEvent.key(), STABLE_ASSIGNMENTS_PREFIX);
 
-                    TablePartitionId replicaGrpId = new 
TablePartitionId(tblId, part);
+                    TablePartitionId replicaGrpId = new 
TablePartitionId(tableId, partitionId);
 
                     Set<Assignment> stableAssignments = 
ByteUtils.fromBytes(stableAssignmentsWatchEvent.value());
 
-                    byte[] pendingFromMetastorage = 
metaStorageMgr.get(pendingPartAssignmentsKey(replicaGrpId),
-                            
stableAssignmentsWatchEvent.revision()).join().value();
+                    byte[] pendingAssignmentsFromMetaStorage = 
metaStorageMgr.get(
+                            pendingPartAssignmentsKey(replicaGrpId),
+                            stableAssignmentsWatchEvent.revision()
+                    ).join().value();
 
-                    Set<Assignment> pendingAssignments = 
pendingFromMetastorage == null
+                    Set<Assignment> pendingAssignments = 
pendingAssignmentsFromMetaStorage == null
                             ? Set.of()
-                            : ByteUtils.fromBytes(pendingFromMetastorage);
+                            : 
ByteUtils.fromBytes(pendingAssignmentsFromMetaStorage);
 
                     String localMemberName = 
clusterService.topologyService().localMember().name();
 
                     boolean shouldStopLocalServices = 
Stream.concat(stableAssignments.stream(), pendingAssignments.stream())
                             .noneMatch(assignment -> 
assignment.consistentId().equals(localMemberName));
 
                     if (shouldStopLocalServices) {
+                        TableImpl table = tablesByIdVv.latest().get(tableId);
+
+                        CompletableFuture<Void> destroyMvPartitionStorageFuture
+                                = 
table.internalTable().storage().destroyPartition(partitionId);
+
+                        
table.internalTable().txStateStorage().destroyTxStateStorage(partitionId);
+
+                        // Necessary evil.

Review Comment:
   And what about storage recreation?
   What I want to say is that if we want to drop the storage with some id X we 
can put destroyMvPartitionStorageFuture to the map using X as a key, and if we 
try to recreate the storage with same id we can chain storage creation with 
storage drop.
   
   > we do not need to wait for the data to be cleared, it can take a long time.
   
   That's a bit confusing. You've told that it's O(1)
   
   > But in fact, deleting storages is done in almost O(1)



-- 
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]

Reply via email to