Skip to content

chore(spanner): add ReplicaSelector interface and impl#12728

Open
olavloite wants to merge 1 commit intomainfrom
spanner-replica-selector
Open

chore(spanner): add ReplicaSelector interface and impl#12728
olavloite wants to merge 1 commit intomainfrom
spanner-replica-selector

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

Adds a ReplicaSelector interface and a default implementation for a ReplicaSelector that uses the power-of-2-random-choices selection strategy. Other strategies can be implemented in the future.

@olavloite olavloite requested review from a team as code owners April 9, 2026 13:45
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new ReplicaSelector interface and its implementation, PowerOfTwoReplicaSelector, which selects a replica from a list of candidates using a "Power of 2 Random Choices" strategy based on their scores. Comprehensive unit tests are also included for this new functionality. The review feedback suggests a simplification for the random index selection logic within the PowerOfTwoReplicaSelector to enhance readability.

Adds a ReplicaSelector interface and a default implementation for a ReplicaSelector
that uses the power-of-2-random-choices selection strategy. Other strategies can
be implemented in the future.
@olavloite olavloite force-pushed the spanner-replica-selector branch from dc3fd84 to 556d357 Compare April 9, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants