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

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

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


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -499,8 +499,11 @@ 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
-      if (this.formatVersion == 1) {
+      // Format version 1 does not have accurate sequence numbering, so remove by timestamp only if
+      // we don't have any other branches.
+      if (this.formatVersion == 1
+          && refs.containsKey(SnapshotRef.MAIN_BRANCH)
+          && refs.size() == 1) {

Review Comment:
   I don't see a reason that we need to clear out newer snapshots for v1 tables. I think we were just trying to avoid the case where a newer sequence number causes a failure. It should be fine for a v1 table to have newer snapshots, since extra snapshots don't affect the current table state or branching. It's probably safer just to keep them all.



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