[core][flink][spark] Introduce remove_orphan_blobs to clean orphan blobs. - #9207
Open
Stephen0421 wants to merge 2 commits into
Open
[core][flink][spark] Introduce remove_orphan_blobs to clean orphan blobs.#9207Stephen0421 wants to merge 2 commits into
Stephen0421 wants to merge 2 commits into
Conversation
Contributor
|
I think we should introduce new procedure to clean blob orphan files. |
Contributor
Author
ok, I will extract the function to a new procedure. |
…ve_orphan_files Collect pack reachability from live data-file .blobref sidecars and delete unused .managed.blob files older than older_than. Missing or unreadable sidecars on live files skip all pack deletes for that run. This is conservative best-effort GC: compaction can reuse a pack without refreshing mtime, so older_than is not a concurrent delete fence.
Stephen0421
force-pushed
the
support-clean-orphan-blob
branch
from
August 14, 2026 03:50
699bede to
c1422dc
Compare
Stephen0421
force-pushed
the
support-clean-orphan-blob
branch
2 times, most recently
from
August 14, 2026 04:06
3bdee24 to
3b3db80
Compare
Stephen0421
force-pushed
the
support-clean-orphan-blob
branch
from
August 14, 2026 06:38
3b3db80 to
b34c779
Compare
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.
Purpose
PK managed BLOB packs (
.managed.blob) are shared payloads, not first-class data files. Compaction reuses pack bytes without copying them, so snapshot expire only deletes the data file and its.blobrefextra file. Unreferenced packs previously accumulated forever.This change reclaims those packs through a dedicated
remove_orphan_blobsprocedure (local / Flink / Spark):ADDdata files'.blobrefsidecars.storageRootId + relativePath), not basename, so same-named packs in different directories are not mixed..managed.blobfiles older thanolder_than(1 day by default).ADDentries whose data files are already gone after expire are ignored, so they do not abort pack GC.remove_orphan_filesnever deletes.managed.blobpacks.This is a conservative, best-effort first version. There is still no commit lease. Compaction can reuse a pack without refreshing mtime, so
older_thandoes not fence a compact that commits after the second collection and before delete. Keep a non-zeroolder_than. Do not treat this as strictly proven concurrent-safe delete semantics.Out of scope: expire-time incremental pack delete,
FileStoreCommitImpl.abortpack cleanup, and Append / Data Evolution.blobfiles (already handled as ordinary data files).Tests
ManagedBlobReachabilityCollectorTest: empty extras / empty sidecar, referenced packs, missing sidecar (live vs already gone), corrupt / unsupported version, unsafe merge.ManagedBlobOrphanFilesCleanTest: delete unreferenced pack, keep referenced pack, join by full pack path, empty sidecar does not block others, missing / corrupt / unsupported sidecar skips all packs, unreferenced pack after update+expire, abort when used set changes between the two collections, the deterministic compact+expire interleaving that shows a stale snapshot list neither skips nor retains a reused live pack, and a stale compaction that cannot commit after the final mark.LocalOrphanFilesCleanTest:remove_orphan_fileskeeps managed packs (fail-safe).RemoveOrphanBlobsActionITCaseBase: local and distributed — delete unreferenced pack; missing sidecar skips pack GC and does not delete other orphan files.RemoveOrphanBlobsProcedureTest: same two cases × local / distributed.