Skip to content

chore(spanner): implement location router and transaction affinity tracking - #6276

Open
olavloite wants to merge 1 commit into
googleapis:mainfrom
olavloite:spanner-location-router
Open

chore(spanner): implement location router and transaction affinity tracking#6276
olavloite wants to merge 1 commit into
googleapis:mainfrom
olavloite:spanner-location-router

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Implements LocationRouter, the core connection resolution engine for location-aware routing in the Spanner Rust client.

@olavloite
olavloite requested review from a team as code owners August 4, 2026 17:13
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Aug 4, 2026

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

Copy link
Copy Markdown
Contributor

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 the LocationRouter module to handle Spanner client request routing, including transaction affinity tracking, key range cache lookups, endpoint cooldowns, and default fallback connections. The feedback suggests addressing a potential memory leak risk in the unbounded AffinityTracker by implementing a bounded cache or ensuring cleanup on drop, and simplifying a comparison expression for better readability.

Comment thread src/spanner/src/routing/location_router.rs
Comment thread src/spanner/src/routing/location_router.rs
…acking

Implements `LocationRouter`, the core connection resolution engine for location-aware routing in the Spanner Rust client.
@olavloite
olavloite force-pushed the spanner-location-router branch from a62e035 to f20a36c Compare August 4, 2026 17:41
@olavloite

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 the LocationRouter module in the Spanner client routing system, which resolves the optimal server connection for a given request context by evaluating transaction affinity, querying the key range cache, and bypassing endpoints currently on cooldown. A comprehensive suite of unit tests is also added to verify its behavior. There are no review comments, and I have no feedback to provide.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.92285% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.25%. Comparing base (35b9590) to head (f20a36c).

Files with missing lines Patch % Lines
src/spanner/src/routing/location_router.rs 97.92% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6276    +/-   ##
========================================
  Coverage   96.24%   96.25%            
========================================
  Files         280      281     +1     
  Lines       72146    72483   +337     
========================================
+ Hits        69440    69770   +330     
- Misses       2706     2713     +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant