Phillippko commented on code in PR #6033:
URL: https://github.com/apache/ignite-3/pull/6033#discussion_r2149620414


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryTableStorage.java:
##########
@@ -353,13 +356,40 @@ CompletableFuture<Void> 
clearStorageAndUpdateDataStructures(AbstractPageMemoryMv
     }
 
     private CompletableFuture<Void> 
destroyPartitionPhysically(GroupPartitionId groupPartitionId) {
-        
dataRegion.filePageStoreManager().getStore(groupPartitionId).markToDestroy();
+        FilePageStore store = 
dataRegion.filePageStoreManager().getStore(groupPartitionId);
 
-        dataRegion.pageMemory().invalidate(groupPartitionId.getGroupId(), 
groupPartitionId.getPartitionId());
+        assert store != null : groupPartitionId;
 
-        return 
dataRegion.checkpointManager().onPartitionDestruction(groupPartitionId)
-                .thenAccept(unused -> 
dataRegion.partitionMetaManager().removeMeta(groupPartitionId))
-                .thenCompose(unused -> 
dataRegion.filePageStoreManager().destroyPartition(groupPartitionId));
+        store.markToDestroy();
+
+        CompletableFuture<Void> future = new CompletableFuture<>();
+
+        CheckpointManager checkpointManager = dataRegion.checkpointManager();
+
+        CheckpointListener listener = new CheckpointListener() {
+            @Override
+            public void afterCheckpointEnd(CheckpointProgress progress) {
+                checkpointManager.removeCheckpointListener(this);
+
+                try {
+                    
dataRegion.pageMemory().invalidate(groupPartitionId.getGroupId(), 
groupPartitionId.getPartitionId());
+
+                    
dataRegion.partitionMetaManager().removeMeta(groupPartitionId);
+
+                    future.complete(null);
+                } catch (Exception e) {
+                    future.completeExceptionally(new 
StorageException("Couldn't destroy partition: " + groupPartitionId, e));
+                }
+            }
+        };
+
+        checkpointManager.addCheckpointListener(listener, dataRegion);
+
+        CheckpointProgress checkpoint = 
dataRegion.checkpointManager().forceCheckpoint("Partition destruction");

Review Comment:
   forceCheckpoint actually won't start a new one if there is a checkpoint in 
state before LOCK_RELEASED, so they will be batched. Should I add some delay, 
in case this stage of checkpoint is too fast?



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