pvary commented on code in PR #18270:
URL: https://github.com/apache/iceberg/pull/18270#discussion_r4120026659


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergCommitter.java:
##########
@@ -138,8 +141,13 @@ public void 
commit(Collection<CommitRequest<IcebergCommittable>> commitRequests)
     }
 
     IcebergCommittable last = 
commitRequestMap.lastEntry().getValue().getCommittable();
+    // Only consult the table's commit history when the job was restored from 
a checkpoint or
+    // savepoint. After a stateless restart the checkpoint counter starts 
over, so reusing the
+    // previous run's max committed checkpoint id would silently discard every 
new commit.
     long maxCommittedCheckpointId =
-        SinkUtil.getMaxCommittedCheckpointId(table, last.jobId(), 
last.operatorId(), branch);
+        isRestored

Review Comment:
   Instead of isRestored, do we want to compare the restored checkpoint id with 
the one in the table? Like:
   ```
   long maxCommitted = SinkUtil.getMaxCommittedCheckpointId(...);
   if (maxCommitted > restoredCheckpointId) {   // absent => 
INITIAL_CHECKPOINT_ID
     maxCommitted = SinkUtil.INITIAL_CHECKPOINT_ID;
   }
   ```
   
   This would also fix if we try to restore the first checkpointid



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to