Core: Delete orphaned merged DV files on cache invalidation and commit failure - #17309
Open
wangyum wants to merge 1 commit into
Open
Core: Delete orphaned merged DV files on cache invalidation and commit failure#17309wangyum wants to merge 1 commit into
wangyum wants to merge 1 commit into
Conversation
Member
Author
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
MergingSnapshotProducer.mergeDVs()writes a Puffin file each time duplicate DVs are merged. When the delete manifest cache is invalidated (by a subsequentaddDeletescall) or the commit fails, only the manifest files were deleted — the Puffin files were left orphaned on disk.Why
After #15006,
mergeDVs()writes a Puffin file (e.g.merged-dvs-<snapshotId>-<n>.puffin) and caches the resulting delete manifests. Two cleanup paths missed the Puffin files:newDeleteFilesAsManifests): deleted the cached manifests but not the Puffin files they referenced.cleanUncommittedAppends): deleted uncommitted delete manifests but not their Puffin files.The orphaned files can only be removed by
remove_orphan_files. No data corruption — read correctness is preserved.How
Track merged DV file locations in a
cachedMergedDVLocationsfield (parallelingcachedNewDeleteManifests) and delete them in both cleanup paths. The location is resolved through theFileIOso its scheme matchesDeleteFile.location()(e.g. stripping afile:URI scheme).Tests
testMergedDVPuffinFileCleanedUpOnCacheInvalidation— verifies the Puffin file is deleted when a subsequentaddDeletesinvalidates the cache, and the committed snapshot has a correctly merged DV.testMergedDVPuffinFileCleanedUpOnCommitFailure— verifies the Puffin file is deleted when the commit fails (via injectedfailCommits).Closes #17307
AI Disclosure