Repository navigation
Stores: lock MappingStore setitem/delitem, snapshot iteration (#68) - #73
Merged
Merged
Conversation
…ore iteration (#68) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Addresses the three follow-ups of #68 (review of #67):
MappingStore.__setitem__/__delitem__now run under the store lock, likeadd/remove/update, so anupdateracing one of them cannot bring a deleted key back into the backing mapping.MemoryStore.__iter__(and soMappingStore) iterates a snapshot taken under the lock, and__len__takes the lock, so a movingupdatecan no longer raise "dictionary changed size during iteration". (MemoryStoreis not aMappingsubclass and defines noitems()/values(), so__iter__was the only iteration path.)TestUpdatetests were run against a real PostgreSQL server (all oftest_store_postgres.pypasses), and a moving-update-under-concurrency case was added (test_moving_update_under_concurrent_readers: the id is looked up byall()and by an interval query while it alternates between two intervals).tests/test_store_update.py: iteration under moving updates for both stores, and a delitem-vs-update consistency check on the backing mapping. All three fail onmainand pass here.Closes #68
🤖 Generated with Claude Code