zentol commented on a change in pull request #19191:
URL: https://github.com/apache/flink/pull/19191#discussion_r831163556
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ZooKeeperCheckpointIDCounter.java
##########
@@ -118,11 +122,46 @@ public void start() throws Exception {
if (jobStatus.isGloballyTerminalState()) {
LOG.info("Removing {} from ZooKeeper", counterPath);
+ final CompletableFuture<Void> deletionFuture = new
CompletableFuture<>();
try {
- client.delete().inBackground().forPath(counterPath);
+ client.delete()
+ .inBackground(
+ (curatorFramework, curatorEvent) -> {
+ Preconditions.checkArgument(
+ curatorEvent.getType()
+ ==
CuratorEventType.DELETE,
+ "An unexpected
CuratorEvent was monitored: "
+ +
curatorEvent.getType());
+ Preconditions.checkArgument(
+
counterPath.equals(curatorEvent.getPath()),
+ "An unexpected path was
selected for deletion: "
+ +
curatorEvent.getPath());
+
+ final KeeperException.Code
eventCode =
+ KeeperException.Code.get(
+
curatorEvent.getResultCode());
+ if (Sets.immutableEnumSet(
+
KeeperException.Code.OK,
+
KeeperException.Code.NONODE)
+ .contains(eventCode)) {
+ deletionFuture.complete(null);
+ } else {
+
deletionFuture.completeExceptionally(
+ KeeperException.create(
+
KeeperException.Code.get(
+
curatorEvent
+
.getResultCode())));
Review comment:
Can you give an example for how this will look like in practice?
--
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]