Open
Conversation
…onnection into aks/sync-query-cache-changes
Owner
|
Thank you for showing the problem raising and solving method. |
aa79f93 to
29d4a30
Compare
3bf0c11 to
50a20ae
Compare
Contributor
Author
|
Hi Tsukasa-san, ひさしぶりですね。 Have you considered how to maintain cache-coherency in the replica caches when master-writes occur? |
Owner
|
Hello Mr.Stebbens. Good to see you again. |
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.
This PR adds support for syncing query cache changes from the master connection cache to the replica query caches.
The new test script confirms that a cache syncing problems exists, with
replica_query_cache_syncdisabled, and then confirms that the problem does not occur whenreplica_query_cache_syncis enabled.The feature is controlled by a class variable
@@replica_query_cache_syncthat is false by default -- in order to maintain backward compatibility and not provide any query cache behavior by default.This PR was tested with the support for
fake_replicaenabled, which has been submitted as a separate PR.Note: this PR supports both Rails 4.2+ and Rails 5
Also: I'm not happy with this PR as it currently stands. I wanted to show the problem, and a solution, but am not sure that this is the Right solution.
For example, I think query cache syncing should turn on automatically if query caching is enabled. What value would there be in not syncing when query caching is enabled?
Also, the tests pass most of the time, but once in a while, one of the tests fail, with the symptom of a recursive loop starting with the
clear_query_cachemethod. Due to other urgencies, haven't had time to dig in a identify the root cause of this infrequent, spurious test failure.Lastly, there needs to be a way to select the appropriate corresponding replica connection pool from any given master connection -- so that when the master connection invokes
clear_query_cache(after anupdateorinserton that connection), it is easy (low-cost) to also triggerclear_query_cacheon the replica connections in the replica connection pool.