-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix failed invalidation across databases when using replication #105
Merged
Conversation
This file contains 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
@Bpless @tgross @jbalogh I believe the Multi DB changes in PR #29 / PR #36 caused a regression described by the test in this PR (https://github.com/django-cache-machine/django-cache-machine/pull/105/files#diff-7053fe2d125e8267cc59b02ee849855bR569). I can think of a few ways to fix this but am not sure what would be best:
Would appreciate any feedback! Thanks. |
…B while allowing invalidation of both master & slave cached objects when only one is modified or deleted
Also @kmtracey ^^ |
tobiasmcnulty
changed the title
test showing failed invalidation when using database replication
fix failed invalidation across databases when using replication
Oct 17, 2015
…ave flushed the whole cache, or there was some odd connection between completely unrelated objects that shared no attributes)
tobiasmcnulty
added a commit
that referenced
this pull request
Oct 22, 2015
…dation fix failed invalidation across databases when using replication
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.
In 0.8, a regression was introduced (I believe by the changes in PR #29 or PR #36) that broke invalidation when an object previously cached from a slave database was later modified via the master database.
This test and change fixes that by removing the database from the flush key, thereby creating flush lists that are shared across databases. Objects are still cached per DB (so
obj._state.db
will be correct), but all cached objects/queries across DBs should be invalidated when one changes.Getting this test working required a few changes to the way multi-DB tests are run, namely:
TEST_MIRROR
setting rather than simply duplicating the test data across DBs (without this, there's no way to remove an object from one DB without invalidating it on that DB)TransactionTestCase
(undocumented, but required by TEST_MIRROR setting)TEST_MIRROR
also does not appear to work with sqlite)