amogh-jahagirdar commented on code in PR #4578:
URL: https://github.com/apache/iceberg/pull/4578#discussion_r873091830
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -75,32 +80,40 @@ public void accept(String file) {
private final TableOperations ops;
private final Set<Long> idsToRemove = Sets.newHashSet();
+ private final long now;
+ private final long defaultMaxRefAgeMs;
private boolean cleanExpiredFiles = true;
private TableMetadata base;
private long expireOlderThan;
- private int minNumSnapshots;
+ private int defaultMinNumSnapshots;
private Consumer<String> deleteFunc = defaultDelete;
private ExecutorService deleteExecutorService =
DEFAULT_DELETE_EXECUTOR_SERVICE;
private ExecutorService planExecutorService = ThreadPools.getWorkerPool();
RemoveSnapshots(TableOperations ops) {
this.ops = ops;
this.base = ops.current();
+ ValidationException.check(
+ PropertyUtil.propertyAsBoolean(base.properties(), GC_ENABLED,
GC_ENABLED_DEFAULT),
+ "Cannot expire snapshots: GC is disabled (deleting files may corrupt
other tables)");
long maxSnapshotAgeMs = PropertyUtil.propertyAsLong(
base.properties(),
MAX_SNAPSHOT_AGE_MS,
MAX_SNAPSHOT_AGE_MS_DEFAULT);
- this.expireOlderThan = System.currentTimeMillis() - maxSnapshotAgeMs;
- this.minNumSnapshots = PropertyUtil.propertyAsInt(
+ this.now = System.currentTimeMillis();
+ this.expireOlderThan = now - maxSnapshotAgeMs;
+ this.defaultMinNumSnapshots = PropertyUtil.propertyAsInt(
Review Comment:
Good point, I've updated this and the defaultExpireOlderThan
--
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]