ashulin commented on code in PR #2620:
URL:
https://github.com/apache/incubator-seatunnel/pull/2620#discussion_r963013521
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java:
##########
@@ -146,9 +227,47 @@ public static Map<Long, Integer>
getPipelineTasks(Set<TaskLocation> pipelineSubt
.collect(Collectors.toMap(Map.Entry::getKey, entry ->
entry.getValue().size()));
}
- public void startTriggerPendingCheckpoint(long triggerTimestamp) {
- CompletableFuture<PendingCheckpoint> completableFuture = new
CompletableFuture<>();
- CompletableFuture.supplyAsync(() -> {
+ public PassiveCompletableFuture<PendingCheckpoint> startSavepoint() {
+ CompletableFuture<PendingCheckpoint> savepoint =
createPendingCheckpoint(Instant.now().toEpochMilli(),
CheckpointType.SAVEPOINT_TYPE);
+ startTriggerPendingCheckpoint(savepoint);
+ return new PassiveCompletableFuture<>(savepoint);
+ }
+
+ private void
startTriggerPendingCheckpoint(CompletableFuture<PendingCheckpoint>
pendingCompletableFuture) {
+ // Trigger the barrier and wait for all tasks to ACK
+ pendingCompletableFuture.thenAcceptAsync(pendingCheckpoint -> {
+ if (CheckpointType.AUTO_SAVEPOINT_TYPE !=
pendingCheckpoint.getCheckpointType()) {
+ LOG.debug("trigger checkpoint barrier" + pendingCheckpoint);
+ CompletableFuture.supplyAsync(() ->
+ new
CheckpointBarrier(pendingCheckpoint.getCheckpointId(),
+ pendingCheckpoint.getCheckpointTimestamp(),
+ pendingCheckpoint.getCheckpointType()))
+ .thenApplyAsync(this::triggerCheckpoint)
+ .thenApplyAsync(invocationFutures ->
CompletableFuture.allOf(invocationFutures).join());
+ }
+ LOG.debug("wait checkpoint completed: " + pendingCheckpoint);
+ pendingCheckpoint.getCompletableFuture()
+ .thenAcceptAsync(this::completePendingCheckpoint);
Review Comment:
Handled by `this#cleanPendingCheckpoint()`
--
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]