Skip to content

chore(spanner): wire channel pool into client - #6793

Open
olavloite wants to merge 2 commits into
googleapis:mainfrom
olavloite:spanner-wire-channel-pool-into-client
Open

olavloite wants to merge 2 commits into
googleapis:mainfrom
olavloite:spanner-wire-channel-pool-into-client

Conversation

@olavloite

Copy link
Copy Markdown
Contributor
  • Wire ChannelPool into the Spanner client and builder via SpannerPoolBuilderExt.
  • Support configuring static and dynamic channel pools through extensions, SPANNER_NUM_CHANNELS, or emulator defaults.
  • Dial initial pool channels concurrently during client construction.
  • Add pick_channel and resolve_affinity on Spanner for channel selection.
  • Update SessionMaintainer and CacheSubscriber to lease channels from the pool.

@olavloite
olavloite requested review from a team as code owners September 14, 2026 13:39
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Sep 14, 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 integrates the ChannelPool into the Spanner client, replacing manual channel management with a robust pool that supports both static and dynamic configurations. It updates various client methods and routing logic to lease channels from the pool using pick_channel and resolve_affinity, and adds comprehensive tests for pool builder extensions and configuration resolution. A critical issue was identified in ActiveRpcGuard's implementation of StreamGuard::record_error_code, which currently causes infinite recursion and must be updated to delegate to the underlying entry.

Comment thread src/spanner/src/channel_pool/entry.rs
- Wire ChannelPool into the Spanner client and builder via SpannerPoolBuilderExt.
- Support configuring static and dynamic channel pools through extensions, SPANNER_NUM_CHANNELS, or emulator defaults.
- Dial initial pool channels concurrently during client construction.
- Add pick_channel and resolve_affinity on Spanner for channel selection.
- Update SessionMaintainer and CacheSubscriber to lease channels from the pool.
@olavloite
olavloite force-pushed the spanner-wire-channel-pool-into-client branch from afbbcd2 to 268d6d4 Compare September 14, 2026 13:51
@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 integrates the ChannelPool into the Spanner client, replacing the previous round-robin channel selection with a robust channel pool mechanism. It introduces support for both static and dynamic channel pool configurations, enabling concurrent channel dialing during client initialization via JoinSet. Additionally, it updates client operations, routing, and session maintenance to utilize channel leases and record RPC call results for health and penalty tracking. There are no review comments provided, so I have no feedback to offer.

@olavloite
olavloite requested a review from rahul2393 September 14, 2026 13:56
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (597aa88) to head (8b487c3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6793      +/-   ##
==========================================
+ Coverage   97.01%   97.06%   +0.04%     
==========================================
  Files         326      326              
  Lines      107548   107976     +428     
==========================================
+ Hits       104342   104808     +466     
+ Misses       3206     3168      -38     

☔ 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