Repository navigation
fix: invalidate CacheStore entries after bulk deletion - #4696
Open
Harshit-2118 wants to merge 2 commits into
Open
Harshit-2118 wants to merge 2 commits into
Harshit-2118 wants to merge 2 commits into
Conversation
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.
Summary
Fixes #4695.
CacheStore.clear()andCacheStore.delete_dir()previously deleted entries in the source store without invalidating cached data, leaving stale full-key or byte-range entries and out-of-sync size/LRU tracking. This fix performs the source deletion first, invalidates the persistent cache and matching tracked entries, and updatescurrent_sizeand LRU tracking under the state lock. Directory boundaries are preserved: deletingdata/leaves the keydataand the prefixdatabase/alone.For reviewers
Range invalidation removes its tuple-key tracking and subtracts its sizes. The following loop handles only full-key entries, subtracting each size once before removing its tracking. Persistent cache deletion also removes stale entries that are not tracked by this instance.
The 12 new cases cover full/range reads, clear and directory deletion, trailing-slash and empty prefixes, untracked persistent entries, public group reopening in formats 2 and 3, shared read-only views, a disk-backed cache, size-budget reuse/LRU eviction, and source-error controls. Against unchanged main
13f4bf5, they give 10 failures and 2 passing controls; with the fix all 12 pass. The selected cache/wrapper/memory/local-store suite reports 562 passed and 159 GPU-only skips. Ruff check/format, focused mypy and changelog validation pass. A fresh run of the 12 new cases also passes against the unchanged upstream head.Source errors raised before deletion propagate before cache invalidation. This does not add rollback for partially failing backends or atomicity for concurrent reads and deletion. The full project suite and hosted CI have not been run locally.
Author attestation
TODO