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


##########
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();

Review Comment:
   I think we probably want to use something like the following because it 
ensures that snapshots known at the time of the original table load are present 
and retained.
   
   ```java
         // Format version 1 does not have accurate sequence numbering, so 
remove based on timestamp
         if (this.formatVersion == 1) {
           List<Long> knownSnapshots = 
snapshotLog.stream().map(HistoryEntry::snapshotId)
                   .collect(Collectors.toList());
           loadedSnapshots.removeIf(s -> 
!knownSnapshots.contains(s.snapshotId()));
         }
   ```



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