Repository navigation
fix(maintenance): require full snapshot history for orphan cleanup - #2699
Draft
laskoviymishka wants to merge 1 commit into
Draft
laskoviymishka wants to merge 1 commit into
laskoviymishka wants to merge 1 commit into
Conversation
A REST table loaded with snapshot-loading-mode=refs only carries the snapshots that a branch or tag points at. Orphan cleanup collected referenced files from Metadata().Snapshots(), so the files of every other snapshot were planned as orphans and deleted. planOrphanFiles now fails before touching the filesystem when the table it plans from has refs-only history, and the error says to reload with snapshot-loading-mode=all. PlanOrphanFiles and dry runs check the table they were given; a real DeleteOrphanFiles checks the refreshed table, since Refresh reloads through the catalog and keeps the load mode. ExecuteOrphanCleanup only runs plans that passed the check, and PurgeFiles removes the whole table either way, so both are unchanged. Table.SnapshotHistoryLimitedToRefs exposes the load mode so the maintenance package can read it. Signed-off-by: laskoviymishka <laskoviymishka@gmail.com>
This branch has not been deployed
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.
On a REST table loaded with
snapshot-loading-mode=refs,Metadata().Snapshots()only holds the snapshots a branch or tag points at, so orphan cleanup planned the files of every other snapshot as orphans and deleted them.planOrphanFiles, which bothPlanOrphanFilesandDeleteOrphanFilesgo through, now fails before listing anything when the table has refs-only history and says to reload withsnapshot-loading-mode=all. A real delete checks the refreshed table, becauseRefreshkeeps the catalog's load mode. To letmaintenancesee the mode, this addsTable.SnapshotHistoryLimitedToRefs. It is part of the v0.8.0 RC blockers (item B4) and replaces #2599.New tests cover plan, dry run and delete on a refs-only table, plus a full table whose refresh comes back refs-only; they fail without the guard, and the full-history path still removes the orphan.
go build ./...,go vet ./...andgo test ./table/... ./cmd/iceberg/...pass.This is only a guard:
iceberg clean-orphan-filesagainst a refs-mode REST server now fails rather than loading full history. Reloading throughFullSnapshotHistoryLoader, as #2601 does for expiration, could be a follow-up.