Repository navigation
Conversation
…eredis#3381 A transaction with primary-only work must still run on the primary when the caller uses PreferAnyServer, the same way seredis#3381 already does for PreferReplica. A read-only transaction with PreferAnyServer should spread over both nodes.
Member
|
thanks for the input; I don't think I have time to think about side-effects on this before 3.5.0, but: will review shortly after |
This branch has not been deployed
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.
Fixes #2974
With only one or two replicas, PreferReplica leaves the primary idle for reads. This adds a flag that lets a read go to any node, primary or replica, so reads are spread across all of them. It still picks one server per call, like the other flags.
Name is a placeholder for now (PreferAnyServer). Happy to rename it if you prefer something else.
What changed:
CommandFlags.PreferAnyServer = 16, using the slot that was marked as reserved for more prefer/demand options.Tests:
PreferAnyServerUnitTestson the in-process server (standalone and cluster, keyed and keyless, combined flags, primary-only commands, no replicas).GetServerTestsBase.PreferAnyServerReadsFromPrimaryAndReplicaagainst real Redis (standalone and cluster), with NoRedirect so a wrong node would fail.Checklist