Phillippko commented on code in PR #6033: URL: https://github.com/apache/ignite-3/pull/6033#discussion_r2161695411
########## 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().scheduleCheckpoint(1000, "Partition destruction"); Review Comment: Extracted to a constant, added a TODO to think about the value -- 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