-
Notifications
You must be signed in to change notification settings - Fork 69
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
Core: Add AzAffinityAllNodes Read Strategy #2986
base: main
Are you sure you want to change the base?
Core: Add AzAffinityAllNodes Read Strategy #2986
Conversation
glide-core/redis-rs/redis/src/cluster_async/connections_container.rs
Outdated
Show resolved
Hide resolved
@@ -302,6 +302,103 @@ mod cluster_async { | |||
); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn test_routing_by_slot_to_replica_with_az_affinity_all_nodes_strategy_to_half_replicas() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run the exiting test twice, once for AZAffinity and once for the new strategy
@@ -392,6 +489,209 @@ mod cluster_async { | |||
); | |||
} | |||
|
|||
#[tokio::test] | |||
async fn test_routing_by_slot_to_replica_with_az_affinity_all_nodes_strategy_to_all_replicas() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. use the existing test
let cluster = | ||
TestClusterContext::new((replica_num * primaries_num) + primaries_num, replica_num); | ||
let client_az = "us-east-1a".to_string(); | ||
let other_az = "us-east-1b".to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need it. it will be empty string anyway, and different from client az
.route_command( | ||
&cmd, | ||
RoutingInfo::SingleNode(SingleNodeRoutingInfo::SpecificNode(Route::new( | ||
10923, // This should target the third primary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you not use the same slot as previous tests that mapped to the foo key?
@@ -288,6 +288,64 @@ where | |||
} | |||
} | |||
|
|||
/// Returns the node's connection in the same availability zone as `client_az`, | |||
/// checking replicas first, then primary, and falling back to any available node. | |||
pub(crate) fn round_robin_read_from_replica_with_az_awareness_all_nodes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to create a helping function and to use the same logic for both functions with flag, this one and the already exits round_robin_read_from_replica_with_az_awareness
function. Both functions logic except of step 2, is duplicate
Signed-off-by: Muhammad Awawdi <[email protected]>
a36c302
to
5183314
Compare
…asAndPrimary Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Issue link
This Pull Request is linked to issue (URL): #2792
Checklist
Before submitting the PR make sure the following are checked: