fix(redis): Preserve shared Redis index hashes when dropping a storage#1942
Open
vdusek wants to merge 1 commit into
Open
fix(redis): Preserve shared Redis index hashes when dropping a storage#1942vdusek wants to merge 1 commit into
vdusek wants to merge 1 commit into
Conversation
`RedisClientMixin._drop` used `DEL` on the shared `id_to_name` and `name_to_id` index hashes, wiping the id/name mappings of every other storage of the same type and breaking subsequent open-by-ID calls. Use `HDEL` to remove only the dropped storage's fields.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1942 +/- ##
==========================================
+ Coverage 92.85% 92.95% +0.10%
==========================================
Files 167 167
Lines 11714 11714
==========================================
+ Hits 10877 10889 +12
+ Misses 837 825 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
RedisClientMixin._dropcalledpipe.delete(f'{MAIN_KEY}:id_to_name', storage_id)(and the same forname_to_id), but RedisDELdeletes whole top-level keys — it does not remove a field from a hash. Sinceid_to_nameandname_to_idare shared hashes holding the mappings for every storage of a given type, dropping any single Dataset/KVS/RequestQueue wiped the entire index, breaking subsequentopen(id=...)calls for all sibling storages (open-by-name kept working, since it reads metadata directly).This replaces the two
DELcalls withHDEL, removing only the dropped storage's fields, and adds a regression test verifying that a sibling storage's index entries survive a drop and that it can still be opened by ID.