Skip to content

fix(spanner): include channelProvider in SpannerPoolKey for pool isolation - #15281

Merged
sakthivelmanii merged 1 commit into
mainfrom
fix/spanner-pool-key-channel-provider
Dec 1, 2026
Merged

sakthivelmanii merged 1 commit into
mainfrom
fix/spanner-pool-key-channel-provider

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Problem Statement

  • Connections configured with a custom channelProvider (such as a custom TLS, mTLS, or proxy ExternalChannelProvider) shared the same SpannerPool key as default connections or connections with a different channelProvider, causing pooled clients to silently reuse an unintended transport channel.
  • Connections with an empty channelProvider or grpc_interceptor_provider value ("") did not share a pool key with connections where the property was omitted, even though both resolve to the default behavior at runtime.

Solution

  • Include the configured channelProvider class name in the connection pool key so each distinct channelProvider receives an isolated Spanner client and transport channel while connections with the same channelProvider continue to share a pool.
  • Normalize empty channelProvider and grpc_interceptor_provider values ("") to unset (null) so omitted and empty values share the same default pool while whitespace or invalid class names continue to fail closed.

…ation

## Problem Statement

- Connections configured with a custom `channelProvider` (such as a custom TLS, mTLS, or proxy `ExternalChannelProvider`) shared the same `SpannerPool` key as default connections or connections with a different `channelProvider`, causing pooled clients to silently reuse an unintended transport channel.
- Connections with an empty `channelProvider` or `grpc_interceptor_provider` value (`""`) did not share a pool key with connections where the property was omitted, even though both resolve to the default behavior at runtime.

## Solution

- Include the configured `channelProvider` class name in the connection pool key so each distinct `channelProvider` receives an isolated `Spanner` client and transport channel while connections with the same `channelProvider` continue to share a pool.
- Normalize empty `channelProvider` and `grpc_interceptor_provider` values (`""`) to unset (`null`) so omitted and empty values share the same default pool while whitespace or invalid class names continue to fail closed.
@sakthivelmanii
sakthivelmanii requested review from a team as code owners November 30, 2026 07:32

@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 incorporates the configured external channel provider into the SpannerPoolKey to ensure proper isolation of Spanner instances in the pool when different channel providers are used. It also normalizes empty string values to null for both channel provider and gRPC interceptor provider names so that omitted and empty values share the same pool key. Comprehensive unit tests have been added to verify these normalization and isolation behaviors. I have no feedback to provide as there are no review comments.

@sakthivelmanii
sakthivelmanii merged commit c30ff49 into main Dec 1, 2026
197 checks passed
@sakthivelmanii
sakthivelmanii deleted the fix/spanner-pool-key-channel-provider branch December 1, 2026 15:08
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