Skip to content

chore(spanner): integrate location aware routing with RPCs#13877

Merged
rahul2393 merged 2 commits intomainfrom
feat/key-aware-channel-integration
Mar 10, 2026
Merged

chore(spanner): integrate location aware routing with RPCs#13877
rahul2393 merged 2 commits intomainfrom
feat/key-aware-channel-integration

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

@rahul2393 rahul2393 commented Feb 23, 2026

  • Add locationAwareSpannerClient wrapper that intercepts RPCs and routes
    them to the server endpoint resolved by the existing channelFinder,
    falling back to the default gRPC channel when no endpoint is available
  • Add endpointClientCache that creates and caches per-address gRPC
    connections
  • Add transaction affinity tracking so Commit/Rollback route to the same
    server that handled the transaction, with read-only transactions routed
    independently per-request based on key ranges
  • Move request preparation (prepareReadRequest, etc.) and response
    observation (observePartialResultSet, etc.) from transaction/batch
    code into the client wrapper, keeping routing concerns in one place

@rahul2393 rahul2393 requested review from a team as code owners February 23, 2026 10:01
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 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.

Comment thread spanner/endpoint_client_cache.go Outdated
@rahul2393 rahul2393 force-pushed the feat/key-aware-channel-integration branch 2 times, most recently from accd0bc to 9a5b3ff Compare February 23, 2026 10:23
@rahul2393 rahul2393 force-pushed the feat/key-aware-channel-integration branch from 9a5b3ff to 6ee4bf7 Compare February 23, 2026 10:27
Comment thread spanner/batch.go Outdated
Comment thread spanner/client.go Outdated
Comment thread spanner/endpoint_client_cache.go Outdated
Comment thread spanner/location_aware_client.go Outdated
Comment thread spanner/location_aware_client.go Outdated
Comment thread spanner/sessionclient.go Outdated
@rahul2393 rahul2393 changed the title chore: integrate location aware routing with RPCs chore(spanner): integrate location aware routing with RPCs Mar 9, 2026
@rahul2393 rahul2393 requested a review from olavloite March 9, 2026 09:02
@rahul2393 rahul2393 merged commit b42935d into main Mar 10, 2026
10 checks passed
@rahul2393 rahul2393 deleted the feat/key-aware-channel-integration branch March 10, 2026 18:43
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