pnowojski commented on a change in pull request #17572:
URL: https://github.com/apache/flink/pull/17572#discussion_r738225561
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointsCleaner.java
##########
@@ -89,9 +95,34 @@ private void cleanup(
checkpoint.getCheckpointID(),
e);
} finally {
- numberOfCheckpointsToClean.decrementAndGet();
+ decrementNumberOfCheckpointsToClean();
postCleanupAction.run();
}
});
}
+
+ private synchronized void decrementNumberOfCheckpointsToClean() {
+ numberOfCheckpointsToClean--;
+ maybeCompleteCloseUnsafe();
+ }
+
+ private void maybeCompleteCloseUnsafe() {
+ if (numberOfCheckpointsToClean == 0 && cleanUpFuture != null) {
+ cleanUpFuture.complete(null);
+ }
+ }
+
+ private synchronized void incrementNumberOfCheckpointsToClean() {
+ checkState(cleanUpFuture == null, "CheckpointsCleaner has already been
closed");
+ numberOfCheckpointsToClean++;
+ }
+
+ @Override
+ public synchronized CompletableFuture<Void> closeAsync() {
+ if (cleanUpFuture == null) {
+ cleanUpFuture = new CompletableFuture<>();
Review comment:
After an offline discussion we agreed that this proposal is fine, while
alternative would be more complicated.
--
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]