[#11194] feat(maintenance): Add builtin-iceberg-expire-snapshots job#11206
Open
laserninja wants to merge 1 commit into
Open
[#11194] feat(maintenance): Add builtin-iceberg-expire-snapshots job#11206laserninja wants to merge 1 commit into
laserninja wants to merge 1 commit into
Conversation
…s job Add IcebergExpireSnapshotsJob that expires old Iceberg table snapshots via Spark's expire_snapshots procedure. Supports configurable parameters: older_than, retain_last, and stream_results. Register the new job in BuiltInJobTemplateProvider.
Code Coverage Report
Files
|
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.
What changes were proposed in this pull request?
Add a new built-in Iceberg maintenance job
builtin-iceberg-expire-snapshotsthat expires old snapshots from Iceberg tables via Spark'sexpire_snapshotsprocedure.Changes:
IcebergExpireSnapshotsJobclass inmaintenance/jobsfollowing the same pattern asIcebergRewriteDataFilesJobolder_than(timestamp),retain_last(number of snapshots to keep),stream_results(boolean)escapeSqlString()andescapeSqlIdentifier()retain_last(must be positive integer) andstream_results(must be true/false)BuiltInJobTemplateProviderWhy are the changes needed?
Without periodic snapshot expiration, Iceberg table metadata grows indefinitely, accumulating snapshot JSON files and manifest lists that slow down table operations and waste storage. The existing built-in jobs (
builtin-iceberg-rewrite-data-filesandbuiltin-iceberg-update-stats) cover data compaction and metrics but do not address metadata cleanup.This is one of the most critical Iceberg housekeeping operations. PR #10500 added Trino-side delegation for
expire_snapshotsas a procedure, but there is no server-side built-in job that can be triggered automatically via the Optimizer.Fix: #11194
Note: This PR covers the job layer. The end-to-end policy/strategy integration (e.g.
IcebergSnapshotExpirationContent,SnapshotExpirationStrategyHandler) can be added as a follow-up, as discussed in the issue.Does this PR introduce any user-facing change?
No user-facing API changes. Adds a new built-in job template
builtin-iceberg-expire-snapshotsthat will be available for maintenance job scheduling.How was this patch tested?
TestIcebergExpireSnapshotsJobwith 40 unit tests covering:maintenance:jobsmodule pass with 0 failures