chore(spanner): integrate location aware routing with RPCs#13877
Merged
chore(spanner): integrate location aware routing with RPCs#13877
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and well-structured feature for location-aware routing in the Spanner client. It adds a locationAwareSpannerClient wrapper to intercept RPCs, an endpointClientCache for managing per-endpoint connections, and logic for transaction affinity. The changes are extensive but appear to be well-tested and follow good design patterns by centralizing routing concerns. My main feedback is a potential issue regarding context propagation when creating new endpoint connections, which could lead to hangs if an endpoint is unresponsive. The original comment regarding context.Background() has been retained as it does not conflict with any provided rules.
accd0bc to
9a5b3ff
Compare
9a5b3ff to
6ee4bf7
Compare
olavloite
reviewed
Mar 5, 2026
olavloite
approved these changes
Mar 9, 2026
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.
locationAwareSpannerClientwrapper that intercepts RPCs and routesthem to the server endpoint resolved by the existing
channelFinder,falling back to the default gRPC channel when no endpoint is available
endpointClientCachethat creates and caches per-address gRPCconnections
server that handled the transaction, with read-only transactions routed
independently per-request based on key ranges
prepareReadRequest, etc.) and responseobservation (
observePartialResultSet, etc.) from transaction/batchcode into the client wrapper, keeping routing concerns in one place