tkalkirill commented on code in PR #6799:
URL: https://github.com/apache/ignite-3/pull/6799#discussion_r2438444984
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/compaction/Compactor.java:
##########
@@ -485,4 +500,45 @@ 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() {
+ boolean casResult = pauseLatchRef.compareAndSet(null, new
CountDownLatch(1));
+
+ assert casResult : "It is expected that there will be no parallel
pause, resume or previous one has ended: " + pauseLatchRef.get();
+ }
+
+ /** Resumes the compactor if it was paused. It is expected that this
method will not be called multiple times in parallel. */
+ public void resume() {
+ CountDownLatch latch = pauseLatchRef.get();
+
+ boolean casResult = pauseLatchRef.compareAndSet(latch, null);
Review Comment:
I would leave this check, rare races can happen, I would like to fight them
as soon as possible.
--
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]