Guosmilesmile commented on code in PR #18303:
URL: https://github.com/apache/iceberg/pull/18303#discussion_r4235976786


##########
flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DynamicCommitter.java:
##########
@@ -181,17 +196,29 @@ public void 
commit(Collection<CommitRequest<DynamicCommittable>> commitRequests)
             jobEntry.getValue().tailMap(maxCommittedCheckpointId, false);
         if (!uncommitted.isEmpty()) {
           commitPendingRequests(
-              table, tableKey.branch(), uncommitted, jobKey.jobId(), 
jobKey.operatorId());
+              table,
+              tableKey.branch(),
+              uncommitted,
+              jobKey.jobId(),
+              jobKey.operatorId(),
+              latestSnapshotId);
         }
       }
     }
   }
 
   private static long getMaxCommittedCheckpointId(
-      Iterable<Snapshot> ancestors, String flinkJobId, String operatorId) {
+      Iterable<Snapshot> ancestors,
+      String flinkJobId,
+      String operatorId,
+      @Nullable Long stopAtSnapshotId) {
     long lastCommittedCheckpointId = INITIAL_CHECKPOINT_ID;
 
     for (Snapshot ancestor : ancestors) {
+      if (stopAtSnapshotId != null && stopAtSnapshotId == 
ancestor.snapshotId()) {
+        break;
+      }

Review Comment:
   This is necessary, not an optimization. `IcebergCommitter` has no 
commit-time validator, so #18123 doesn't affect it. DynamicCommitter does: 
after a stateless restart with the same jobId/operatorId, isRestored=false 
skips the pre-check, but MaxCommittedCheckpointIdValidator still finds the 
previous run's max checkpoint ID (e.g., 10 >= 1) and throws an exception that 
commitOperation swallows, silently dropping the commit.
   
   `stopAtSnapshotId` limits validation to snapshots added since the table was 
loaded, preventing concurrent duplicates without blocking valid commits after a 
restart. 
   



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