sashapolo commented on code in PR #6799:
URL: https://github.com/apache/ignite-3/pull/6799#discussion_r2438906634


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/compaction/Compactor.java:
##########
@@ -485,4 +500,52 @@ private DeltaFileForCompaction(
             this.deltaFilePageStoreIo = deltaFilePageStoreIo;
         }
     }
+
+    /**
+     * Pauses the compactor until it is resumed or compactor or stopped. It is 
expected that this method will not be called multiple times
+     * in parallel and subsequent calls will strictly be calls after {@link 
#resume}.
+     */
+    public void pause() {
+        synchronized (pauseMux) {
+            assert !paused : "It is expected that a further pause will only 
occur after resume";
+
+            paused = true;
+        }
+    }
+
+    /** Resumes the compactor if it was paused. It is expected that this 
method will not be called multiple times in parallel. */
+    public void resume() {
+        synchronized (pauseMux) {
+            if (paused) {
+                paused = false;
+
+                pauseMux.notifyAll();
+            }
+        }
+    }
+
+    /** Must be called before each IO operation to provide other IO components 
with resources. */
+    private void pauseCompactionIfNeeded() {
+        boolean interrupted = false;
+
+        synchronized (pauseMux) {
+            while (paused) {
+                blockingSectionBegin();
+
+                try {
+                    pauseMux.wait();
+                } catch (InterruptedException e) {

Review Comment:
   I think if you got interrupted, then you need to re-throw this exception, 
not just log it, because I would expect the compaction to stop altogether



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