fapaul commented on code in PR #25547:
URL: https://github.com/apache/flink/pull/25547#discussion_r1822429861
##########
flink-runtime/src/main/java/org/apache/flink/streaming/runtime/operators/sink/CommitterOperator.java:
##########
@@ -164,41 +165,37 @@ public void notifyCheckpointComplete(long checkpointId)
throws Exception {
private void commitAndEmitCheckpoints() throws IOException,
InterruptedException {
long completedCheckpointId = endInput ? EOI :
lastCompletedCheckpointId;
- do {
- for (CheckpointCommittableManager<CommT> manager :
-
committableCollector.getCheckpointCommittablesUpTo(completedCheckpointId)) {
- commitAndEmit(manager);
- }
- // !committableCollector.isFinished() indicates that we should
retry
- // Retry should be done here if this is a final checkpoint
(indicated by endInput)
- // WARN: this is an endless retry, may make the job stuck while
finishing
- } while (!committableCollector.isFinished() && endInput);
-
- if (!committableCollector.isFinished()) {
- // if not endInput, we can schedule retrying later
- retryWithDelay();
+ for (CheckpointCommittableManager<CommT> checkpointManager :
+
committableCollector.getCheckpointCommittablesUpTo(completedCheckpointId)) {
+ // ensure that all committables of the first checkpoint are fully
committed before
+ // attempting the next committable
+ commitAndEmit(checkpointManager);
+ committableCollector.remove(checkpointManager);
}
- committableCollector.compact();
}
private void commitAndEmit(CheckpointCommittableManager<CommT>
committableManager)
throws IOException, InterruptedException {
- Collection<CommittableWithLineage<CommT>> committed =
committableManager.commit(committer);
- if (emitDownstream && committableManager.isFinished()) {
- int subtaskId =
getRuntimeContext().getTaskInfo().getIndexOfThisSubtask();
- int numberOfSubtasks =
getRuntimeContext().getTaskInfo().getNumberOfParallelSubtasks();
- output.collect(
- new
StreamRecord<>(committableManager.getSummary(subtaskId, numberOfSubtasks)));
- for (CommittableWithLineage<CommT> committable : committed) {
- output.collect(new
StreamRecord<>(committable.withSubtaskId(subtaskId)));
- }
+ committableManager.commit(committer, MAX_RETRIES);
+ if (emitDownstream) {
+ emit(committableManager);
}
}
- private void retryWithDelay() {
- processingTimeService.registerTimer(
- processingTimeService.getCurrentProcessingTime() + RETRY_DELAY,
- ts -> commitAndEmitCheckpoints());
+ private void emit(CheckpointCommittableManager<CommT> committableManager) {
+ int subtaskId =
getRuntimeContext().getTaskInfo().getIndexOfThisSubtask();
+ int numberOfSubtasks =
getRuntimeContext().getTaskInfo().getNumberOfParallelSubtasks();
Review Comment:
Mostly should looked strange.
--
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]