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