tkalkirill commented on code in PR #1325:
URL: https://github.com/apache/ignite-3/pull/1325#discussion_r1031374874


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/Checkpointer.java:
##########
@@ -775,4 +799,41 @@ private void 
renameDeltaFileOnCheckpointThread(GroupPartitionId partitionId) thr
     void updateLastProgressAfterReleaseWriteLock() {
         afterReleaseWriteLockCheckpointProgress = currentCheckpointProgress;
     }
+
+    /**
+     * Callback on destruction of the partition of the corresponding group.
+     *
+     * <p>If the checkpoint is in progress, then wait until it finishes 
processing the partition that we are going to destroy, in order to
+     * prevent the situation when we want to destroy the partition file along 
with its delta files, and at this time the checkpoint performs
+     * I/O operations on them.
+     *
+     * @param groupId Group ID.
+     * @param partitionId Partition ID.
+     * @throws IgniteInternalCheckedException If there are errors while 
processing the callback.
+     */
+    void onPartitionDestruction(int groupId, int partitionId) throws 
IgniteInternalCheckedException {
+        CheckpointProgressImpl currentCheckpointProgress = 
this.currentCheckpointProgress;
+
+        if (currentCheckpointProgress == null || 
!currentCheckpointProgress.inProgress()) {
+            return;
+        }
+
+        CompletableFuture<Void> processedPartitionFuture = 
currentCheckpointProgress.getProcessedPartitionFuture(groupId, partitionId);
+
+        if (processedPartitionFuture != null) {
+            try {
+                // Time is taken arbitrarily, but long enough to allow time 
for the future to complete.
+                processedPartitionFuture.get(10, SECONDS);

Review Comment:
   Tried to fix it



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/checkpoint/CheckpointManager.java:
##########
@@ -307,11 +312,23 @@ static int[] 
pageIndexesForDeltaFilePageStore(CheckpointDirtyPagesView partition
     }
 
     /**
-     * Adds the number of delta files to compact.
+     * Callback on adding delta files so we can start compacting them.
+     */
+    public void onAddingDeltaFiles() {
+        compactor.onAddingDeltaFiles();
+    }
+
+    /**
+     * Callback on destruction of the partition of the corresponding group.
+     *
+     * <p>Prepares the checkpointer and compactor for partition destruction.
      *
-     * @param count Number of delta files.
+     * @param groupId Group ID.
+     * @param partitionId Partition ID.
+     * @throws IgniteInternalCheckedException If there are errors while 
processing the callback.
      */
-    public void addDeltaFileCountForCompaction(int count) {
-        compactor.addDeltaFiles(count);
+    public void onPartitionDestruction(int groupId, int partitionId) throws 
IgniteInternalCheckedException {

Review Comment:
   Tried to fix it



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