fix failed invalidation across databases when using replication #105
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)