Conversation
Collaborator
|
Are you still interested in updating this PR? It now needs a rebase and several correctness fixes before it can be reconsidered:
Please let us know if you plan to continue the work. |
Author
|
@mcollina yes, I’m still interested. I’ll update the PR. |
gulbaki
force-pushed
the
implement-az-affinity-strategy
branch
2 times, most recently
from
July 28, 2026 13:38
7500a0d to
8cab4a3
Compare
Add AZAffinity read strategies and get node zone data with HELLO 2. Wait for all node metadata before routing reads and add tests for replica selection. Signed-off-by: Baki Gul <bbkgull@gmail.com>
gulbaki
force-pushed
the
implement-az-affinity-strategy
branch
from
July 30, 2026 14:36
8cab4a3 to
a62eecc
Compare
Author
|
@mcollina Hi, I’ve updated and pushed the PR. The requested fixes are complete, |
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: #23
Implements support for AZAffinity and AZAffinityReplicasAndPrimary read strategies based on the Valkey blog post on AZ Affinity.
Developers can now use:
scaleReads: "AZAffinity" | "AZAffinityReplicasAndPrimary", clientAz: "zone-a" // etc.During Redis initialization, a HELLO 3 call is made to retrieve the availabilityZone, which is then saved under each node instance.
A new selectNodeAz method was introduced. This method is called internally when scaleReads is set to AZAffinity or AZAffinityReplicasAndPrimary. Based on the strategy, it routes commands to the most suitable node:
AZAffinity logic:
AZAffinityReplicasAndPrimary logic:
Tests
Tests were added to cover each of the above scenarios.
However, two tests sometimes pass and sometimes fail:
I couldn't figure out exactly why this happens. I couldn’t find a solution
AZAffinity → selects remote replica when no local replica existsAZAffinityReplicasAndPrimary → selects local primary when no local replica existsand I’m unsure if I’ve placed the test logic in the best place,
or if additional handling is needed in selectNodeAz or elsewhere