Repository navigation
Conversation
Add the history.expire.max-snapshot-age-ms / min-snapshots-to-keep / max-ref-age-ms properties to TableProperties (same shape as commit.retry.*). The expire action now falls back to these when a knob is not set explicitly, mirroring Java RemoveSnapshots' constructor: the cutoff defaults to now - max-snapshot-age-ms (5 days) so age-based selection always runs, retain_last defaults to min-snapshots-to-keep, and refs without their own max_ref_age_ms age out against max-ref-age-ms (Long.MAX_VALUE, i.e. never). Completes the history.expire.* default fallback deferred by apache#2591. Ref apache#2145
dhruvarya-db
force-pushed
the
feat-expire-snapshots-table-property-defaults
branch
from
June 17, 2026 01:53
58c07ff to
6144e10
Compare
blackmwk
approved these changes
Jun 17, 2026
blackmwk
left a comment
Contributor
There was a problem hiding this comment.
Thanks @dhruvarya-db for this pr!
This was referenced Jun 17, 2026
amogh-jahagirdar
pushed a commit
that referenced
this pull request
Jun 23, 2026
…ots (#2667) ## Which issue does this PR close? Part of #2145. Extends #2591 (the `ExpireSnapshotsAction`) and #2664 (the `history.expire.*` defaults). ## What changes are included in this PR? When `ExpireSnapshotsAction` expires snapshots, it now also drops the statistics and partition-statistics metadata entries tied to each expired snapshot, mirroring Java `RemoveSnapshots` (`TableMetadata.Builder.removeSnapshots`, which calls `removeStatistics`/`removePartitionStatistics` for each removed snapshot). For every expired snapshot that has a statistics entry, `commit()` emits a `RemoveStatistics` update; likewise `RemovePartitionStatistics` for a partition-statistics entry. Only entries that actually exist produce an update, matching Java's behavior of recording a change only when an entry is present. This is metadata-only, physical deletion of the puffin files those entries point at is part of the file-cleanup maintenance operation (mirroring Java's `FileCleanupStrategy`), not this PR. ## Are these changes tested? Yes. New unit tests cover: an expired snapshot's statistics and partition-statistics entries are removed while a retained snapshot keeps its own; an expired snapshot with no statistics emits no removal; and only the statistics variant that is actually present is removed. --------- Co-authored-by: Dhruv Arya <[email protected]>
This was referenced Aug 20, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
What changes are included in this PR?
Defaults snapshot expiry to the table's
history.expire.*properties when the corresponding knob is not set explicitly, completing the default fallback that #2591 deferred (itsplan()carried twoTODOs for exactly this).TablePropertiesgains three fields (and their consts/defaults), in the same shape as the existingcommit.retry.*properties:history.expire.max-snapshot-age-ms(default 5 days)history.expire.min-snapshots-to-keep(default 1)history.expire.max-ref-age-ms(defaulti64::MAX, i.e. never)ExpireSnapshotsAction::plan()now mirrors JavaRemoveSnapshots' constructor:now - max-snapshot-age-ms, so age-based selection always runs even for an explicit-id-only call (only file cleanup, out of scope here, keys off an explicit id in Java);retain_lastdefaults tomin-snapshots-to-keep;max_ref_age_msage out againstmax-ref-age-ms(default never).Defaults and names mirror Java's
TableProperties(MAX_SNAPSHOT_AGE_MS_DEFAULT = 5 days,MIN_SNAPSHOTS_TO_KEEP_DEFAULT = 1,MAX_REF_AGE_MS_DEFAULT = Long.MAX_VALUE).Are these changes tested?
Yes — unit tests in
expire_snapshots.rs(27 total, up from 25). Two new tests cover the always-on default cutoff (a >5-day-old snapshot is expired with no args while a recent one is kept) and thehistory.expire.min-snapshots-to-keepfloor (the whole chain is retained despite age). Explicit-id-only tests pin the cutoff off to isolate that behavior now that the default age path always runs.public-api.txtregenerated for the new public fields/consts; clippy and fmt are clean.