davidradl commented on code in PR #26433:
URL: https://github.com/apache/flink/pull/26433#discussion_r2035640177


##########
flink-runtime/src/main/java/org/apache/flink/streaming/runtime/operators/sink/CommitterOperator.java:
##########
@@ -151,24 +149,23 @@ public void snapshotState(StateSnapshotContext context) 
throws Exception {
 
     @Override
     public void endInput() throws Exception {
-        endInput = true;
         if (!isCheckpointingEnabled || isBatchMode) {
             // There will be no final checkpoint, all committables should be 
committed here
-            commitAndEmitCheckpoints();
+            commitAndEmitCheckpoints(lastCompletedCheckpointId + 1);
         }
     }
 
     @Override
     public void notifyCheckpointComplete(long checkpointId) throws Exception {
         super.notifyCheckpointComplete(checkpointId);
-        lastCompletedCheckpointId = Math.max(lastCompletedCheckpointId, 
checkpointId);
-        commitAndEmitCheckpoints();
+        commitAndEmitCheckpoints(Math.max(lastCompletedCheckpointId, 
checkpointId));
     }
 
-    private void commitAndEmitCheckpoints() throws IOException, 
InterruptedException {
-        long completedCheckpointId = endInput ? EOI : 
lastCompletedCheckpointId;
+    private void commitAndEmitCheckpoints(long checkpointId)
+            throws IOException, InterruptedException {
+        lastCompletedCheckpointId = checkpointId;

Review Comment:
   nit: probably a basic question, but shouldn't we update the 
`lastCompletedCheckpointId` variable after we have completed the checkpoint, 
which I assume happens in the subsequent for loop? I was expecting the 
`lastCompletedCheckpointId` to be updated after the checkpointing loop in case 
there was an error during the checkpointing. 



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to