Skip to content

Commit 90c541e

Browse files
committed
[core] Add Check for retry commit
1 parent 39b894b commit 90c541e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,22 @@ CommitResult tryCommitOnce(
886886
ConflictCheck conflictCheck,
887887
@Nullable String newStatsFileName) {
888888
long startMillis = System.currentTimeMillis();
889+
890+
// Check if the commit has been completed. At this point, there will be no more repeated
891+
// commits and just return success
892+
if (retryResult != null && latestSnapshot != null) {
893+
long lastLatestSnapshot = Snapshot.FIRST_SNAPSHOT_ID;
894+
if (retryResult.latestSnapshot != null) {
895+
lastLatestSnapshot = retryResult.latestSnapshot.id();
896+
}
897+
for (long i = lastLatestSnapshot + 1; i <= latestSnapshot.id(); i++) {
898+
Snapshot snapshot = snapshotManager.snapshot(i);
899+
if (snapshot.commitUser().equals(commitUser)
900+
&& snapshot.commitIdentifier() == identifier) {
901+
return new SuccessResult();
902+
}
903+
}
904+
}
889905
long newSnapshotId =
890906
latestSnapshot == null ? Snapshot.FIRST_SNAPSHOT_ID : latestSnapshot.id() + 1;
891907

0 commit comments

Comments
 (0)