dramaticlly commented on code in PR #14287:
URL: https://github.com/apache/iceberg/pull/14287#discussion_r2449970918
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -69,7 +69,7 @@ class RemoveSnapshots implements ExpireSnapshots {
private final Set<Long> idsToRemove = Sets.newHashSet();
private final long now;
private final long defaultMaxRefAgeMs;
- private boolean cleanExpiredFiles = true;
+ private final CleanupLevel defaultCleanupLevel = CleanupLevel.ALL;
Review Comment:
To me, it provides some semantic understanding for default clean up level,
as it currently default to ALL.
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -103,7 +104,12 @@ class RemoveSnapshots implements ExpireSnapshots {
@Override
public ExpireSnapshots cleanExpiredFiles(boolean clean) {
- this.cleanExpiredFiles = clean;
+ LOG.warn("cleanExpiredFiles(boolean) is deprecated. Use
cleanMode(CleanupMode) instead.");
+ Preconditions.checkArgument(
Review Comment:
I think there's some nuance here and value to keep:
Take what I included in the unit test for an example here, use preconditions
check here prevent the case where both
`cleanupLevel(ExpireSnapshots.CleanupLevel.METADATA_ONLY)` and
`cleanExpiredFiles(false)` is configured on snapshot expiration, as the
intention is unclear at the moment, override to either NONE or METADATA_ONLY
could potentially result in undesired results.
Although unlikely, for the corner case discussed here when `client called
cleanupLevel(ALL)` and also set the cleanExpiredFiles
- if cleanExpiredFiles = true, then cleanupLevel ends up resolve to ALL and
logic is equivalent
- if cleanExpiredFiles = false, we allow such override to happen and end up
with cleanupLevel=None and retain all files, I think it's acceptable as we are
moving from most restrictive and least restrictive, and those files can be
later cleaned with orphan removal.
--
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]