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

[GitHub] [iceberg] Fokko commented on a diff in pull request #7621: Core: Include all reachable snapshots with v1 format and REF snapshot mode

Fokko commented on code in PR #7621:
URL: https://github.com/apache/iceberg/pull/7621#discussion_r1207724627


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -499,9 +500,25 @@ private synchronized void ensureSnapshotsLoaded() {
       List<Snapshot> loadedSnapshots = Lists.newArrayList(snapshotsSupplier.get());
       loadedSnapshots.removeIf(s -> s.sequenceNumber() > lastSequenceNumber);
 
-      // Format version 1 does not have accurate sequence numbering, so remove based on timestamp
+      // Format version 1 does not have accurate sequence numbering, so remove based on
+      // ref reachability
       if (this.formatVersion == 1) {
-        loadedSnapshots.removeIf(s -> s.timestampMillis() > currentSnapshot().timestampMillis());
+        Set<Long> snapshotsToKeep = Sets.newHashSet();
+
+        for (Long snapshotId :
+            refs().values().stream().map(SnapshotRef::snapshotId).collect(Collectors.toSet())) {
+          SnapshotUtil.ancestorsOf(

Review Comment:
   Also got bit by that one lol: https://github.com/apache/iceberg/issues/6930



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