timothyw553 commented on code in PR #19242:
URL: https://github.com/apache/iceberg/pull/19242#discussion_r4795578703


##########
core/src/main/java/org/apache/iceberg/RewriteTablePathUtil.java:
##########
@@ -462,9 +615,21 @@ public static RewriteResult<DeleteFile> 
rewriteDeleteManifest(
     return result;
   }
 
+  private static Predicate<ManifestEntry<?>> committedAfter(
+      long startSequenceNumber, Set<Long> startSnapshotIds) {
+    return entry -> {
+      Long fileSequenceNumber = entry.fileSequenceNumber();
+      if (startSequenceNumber > 0 && fileSequenceNumber != null) {
+        return fileSequenceNumber > startSequenceNumber;

Review Comment:
   what happens if two concurrent rest replacements both get the same sequence 
number? if the first becomes the start version, `fileSequenceNumber > 
startSequenceNumber` will be false for the second one and skip its files, 
leaving an unreadable copy. could we also track the snapshot ids added after 
the start version and check them here and in 
`RewriteTablePathSparkAction#committedAfter` across all four spark versions, 
with a rest regression test?
   ```diff
   -        return fileSequenceNumber > startSequenceNumber;
   +        return fileSequenceNumber > startSequenceNumber
   +            || addedSnapshotIds.contains(entry.snapshotId());
   ```



##########
core/src/main/java/org/apache/iceberg/RewriteTablePathUtil.java:
##########
@@ -462,9 +615,21 @@ public static RewriteResult<DeleteFile> 
rewriteDeleteManifest(
     return result;
   }
 
+  private static Predicate<ManifestEntry<?>> committedAfter(
+      long startSequenceNumber, Set<Long> startSnapshotIds) {
+    return entry -> {
+      Long fileSequenceNumber = entry.fileSequenceNumber();
+      if (startSequenceNumber > 0 && fileSequenceNumber != null) {
+        return fileSequenceNumber > startSequenceNumber;
+      }
+
+      return !startSnapshotIds.contains(entry.snapshotId());

Review Comment:
   for v1 tables without sequence numbers, `startSnapshotIds` only has 
snapshots still in the start metadata, so live files from expired snapshots 
look new and get copied again here and in `RewriteTablePathSparkAction`. also 
`rewriteDataManifestWithoutStartSequenceNumberSkipsStartSnapshots` skips 
`formatVersion < 2`, so v1 isn't actually covered. should we compare against 
manifest/file paths reachable from the start version instead, or if the 
repeated copying is intentional for v1, document it and add a v1 test?



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