chore(spanner): wire location-aware routing into unary RPCs - #6562
chore(spanner): wire location-aware routing into unary RPCs#6562olavloite wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements location-aware routing for unary database RPCs (such as commit, rollback, execute_sql, and begin_transaction) in the Spanner client. It refactors routing resolution using a unified RoutingContext and introduces pre-route and post-route hooks to manage transaction affinity. Additionally, comprehensive mock tests are added to verify routing behaviors. The feedback suggests removing a redundant check for an empty or all KeySet in extract_proto_read_key_set_routing_key, as this is already handled internally by extract_key_from_proto_key_set.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6562 +/- ##
==========================================
+ Coverage 96.51% 96.53% +0.01%
==========================================
Files 304 304
Lines 87943 88397 +454
==========================================
+ Hits 84875 85330 +455
+ Misses 3068 3067 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9fdf5ba to
40e3c87
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements location-aware routing for Spanner RPCs, including transaction affinity tracking for read-write transactions and support for partition read and query operations. It introduces pre-route and post-route hooks to the define_db_rpc macro to manage routing context and transaction affinity, along with comprehensive tests to verify the new logic. The reviewer suggested using the 'let Some(...) else' pattern in the pre_route methods to simplify early returns, which improves code readability and aligns with the repository's style guide.
- Wire `LocationRouter` into unary database RPCs (`begin_transaction`, `commit`, `rollback`, `execute_sql`, `execute_batch_dml`, `partition_read`, `partition_query`). - Add routing key extraction for `PartitionReadRequest` and `PartitionQueryRequest`. - Track and enforce transaction server affinity for read-write transactions (including inline begin and commit/rollback lifecycle clearing). - Ingest inline `CacheUpdate` from unary responses (`CommitResponse`, `Transaction`, `ResultSet`, `ExecuteBatchDmlResponse`).
40e3c87 to
06f7279
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements location-aware routing and transaction affinity tracking for unary database RPCs (such as begin_transaction, commit, execute_sql, execute_batch_dml, rollback, partition_query, and partition_read) in the Spanner client. It refactors the RPC macro definitions to support pre-routing and post-routing hooks, introduces a structured RoutingContext to manage routing decisions, and adds comprehensive unit and mock integration tests to validate the routing logic and affinity lifecycle. I have no feedback to provide as there are no review comments to assess.
LocationRouterinto unary database RPCs (begin_transaction,commit,rollback,execute_sql,execute_batch_dml,partition_read,partition_query).PartitionReadRequestandPartitionQueryRequest.CacheUpdatefrom unary responses (CommitResponse,Transaction,ResultSet,ExecuteBatchDmlResponse).