JingsongLi commented on code in PR #6670:
URL: https://github.com/apache/paimon/pull/6670#discussion_r2560101887
##########
paimon-core/src/main/java/org/apache/paimon/operation/commit/ConflictDetection.java:
##########
@@ -91,12 +99,61 @@ public ConflictDetection(
this.bucketMode = bucketMode;
this.deletionVectorsEnabled = deletionVectorsEnabled;
this.indexFileHandler = indexFileHandler;
+ this.scan = scan;
}
public void withPartitionExpire(PartitionExpire partitionExpire) {
this.partitionExpire = partitionExpire;
}
+ public void commitStrictModeCheck(
+ @Nullable Long strictModeLastSafeSnapshot,
+ long newSnapshotId,
+ SnapshotManager snapshotManager) {
+ if (strictModeLastSafeSnapshot != null && strictModeLastSafeSnapshot
>= 0) {
+ for (long id = strictModeLastSafeSnapshot + 1; id < newSnapshotId;
id++) {
+ Snapshot snapshot = snapshotManager.snapshot(id);
+ if (snapshot.commitUser().equals(commitUser)) {
+ continue;
+ }
+ if (snapshot.commitKind() == CommitKind.COMPACT
+ || snapshot.commitKind() == CommitKind.OVERWRITE) {
+ throw new RuntimeException(
+ String.format(
+ "When trying to commit snapshot %d, "
+ + "commit user %s has found a %s
snapshot (id: %d) by another user %s. "
+ + "Giving up committing as %s is
set.",
+ newSnapshotId,
+ commitUser,
+ snapshot.commitKind().name(),
+ id,
+ snapshot.commitUser(),
+
CoreOptions.COMMIT_STRICT_MODE_LAST_SAFE_SNAPSHOT.key()));
+ }
+ if (snapshot.commitKind() == CommitKind.APPEND) {
Review Comment:
Maybe add this check for OVERWRITE commit only.
--
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]