wenshao commented on code in PR #7595:
URL: https://github.com/apache/paimon/pull/7595#discussion_r3043224462


##########
paimon-core/src/main/java/org/apache/paimon/operation/FileStoreCommitImpl.java:
##########
@@ -743,15 +745,53 @@ private int tryOverwritePartition(
             List<IndexManifestEntry> indexFiles,
             long identifier,
             @Nullable Long watermark,
-            Map<String, String> properties) {
-        return tryCommit(
-                latestSnapshot ->
-                        scanner.readOverwriteChanges(
-                                options.bucket(),
-                                changes,
-                                indexFiles,
+            Map<String, String> properties,
+            @Nullable Long baseSnapshotId) {
+        // When baseSnapshotId is provided, detect concurrent writes between 
the base and latest
+        if (baseSnapshotId != null && 
!options.sortCompactSkipOverwriteConflictDetection()) {
+            Snapshot latestSnapshot = snapshotManager.latestSnapshot();
+            if (latestSnapshot != null && latestSnapshot.id() > 
baseSnapshotId) {
+                List<BinaryRow> changedPartitions =
+                        changes.stream()
+                                .map(ManifestEntry::partition)
+                                .distinct()
+                                .collect(Collectors.toList());
+                List<SimpleFileEntry> incrementalChanges =
+                        readIncrementalChanges(
+                                snapshotManager.snapshot(baseSnapshotId),
                                 latestSnapshot,
-                                partitionFilter),
+                                changedPartitions);
+                Collection<SimpleFileEntry> mergedIncremental =

Review Comment:
   **[Critical]** 这里把 `readIncrementalChanges(...)` 调成了当前类方法,但实际定义在 `scanner` 
上;同时 `Collection<SimpleFileEntry>` 缺少 `java.util.Collection` 
import。这两处都会导致新增冲突检测逻辑无法编译。
   
   建议改为 `scanner.readIncrementalChanges(...)`,并补充 `java.util.Collection` import。
   
   _— gpt-5.4 via Qwen Code /review_



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

Reply via email to