jackye1995 commented on a change in pull request #3104:
URL: https://github.com/apache/iceberg/pull/3104#discussion_r784271405



##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -502,7 +519,10 @@ public TableMetadata replaceCurrentSnapshot(Snapshot 
snapshot) {
   }
 
   public TableMetadata removeSnapshotsIf(Predicate<Snapshot> removeIf) {
-    List<Snapshot> toRemove = 
snapshots.stream().filter(removeIf).collect(Collectors.toList());
+    List<Snapshot> toRemove = snapshots.stream()
+        .filter(removeIf)
+        .filter(snapshot -> !refsById.containsKey(snapshot.snapshotId()))
+        .collect(Collectors.toList());

Review comment:
       added https://github.com/apache/iceberg/issues/3900 to track this




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