amogh-jahagirdar commented on code in PR #4578:
URL: https://github.com/apache/iceberg/pull/4578#discussion_r862561447
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -112,6 +137,11 @@ public ExpireSnapshots cleanExpiredFiles(boolean clean) {
@Override
public ExpireSnapshots expireSnapshotId(long expireSnapshotId) {
LOG.info("Expiring snapshot with id: {}", expireSnapshotId);
+ List<Map.Entry<String, SnapshotRef>> refsForSnapshot =
base.refs().entrySet().stream()
+ .filter(refEntry -> refEntry.getValue().snapshotId() ==
expireSnapshotId)
+ .collect(Collectors.toList());
+ Preconditions.checkArgument(refsForSnapshot.isEmpty(), "Cannot expire %d.
There are %d references to it",
+ expireSnapshotId, refsForSnapshot.size());
Review Comment:
Wrong place to put this check, we should do it in the internalApply after
computing which refs will be retained. then we can check if the snapshots of
the refs to be retained contains any of the individual snapshots in idsToRemove.
--
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]