You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "linyanghao (via GitHub)" <gi...@apache.org> on 2023/04/03 06:51:52 UTC

[GitHub] [iceberg] linyanghao commented on a diff in pull request #7249: Avoid conflicts between rewrite datafiles and flink CDC writes

linyanghao commented on code in PR #7249:
URL: https://github.com/apache/iceberg/pull/7249#discussion_r1155546151


##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -453,20 +459,47 @@ private void validateNoNewDeletesForDataFiles(
       // fail
       DeleteFile[] deleteFiles = deletes.forDataFile(startingSequenceNumber, dataFile);
       if (ignoreEqualityDeletes) {
-        ValidationException.check(
-            Arrays.stream(deleteFiles)
-                .noneMatch(deleteFile -> deleteFile.content() == FileContent.POSITION_DELETES),
-            "Cannot commit, found new position delete for replaced data file: %s",
-            dataFile);
+        if (!ignorePositionDeletes) {
+          ValidationException.check(
+              Arrays.stream(deleteFiles)
+                  .noneMatch(deleteFile -> deleteFile.content() == FileContent.POSITION_DELETES),
+              "Cannot commit, found new position delete for replaced data file: %s",
+              dataFile);
+        }
       } else {
-        ValidationException.check(
-            deleteFiles.length == 0,
-            "Cannot commit, found new delete for replaced data file: %s",
-            dataFile);
+        if (ignorePositionDeletes) {
+          ValidationException.check(
+              Arrays.stream(deleteFiles)
+                  .noneMatch(deleteFile -> deleteFile.content() == FileContent.EQUALITY_DELETES),
+              "Cannot commit, found new equality delete for replaced data file: %s",
+              dataFile);
+        } else {
+          ValidationException.check(
+              deleteFiles.length == 0,
+              "Cannot commit, found new delete for replaced data file: %s",
+              dataFile);
+        }

Review Comment:
   That's a good point!



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org