Repository navigation
fix(spanner): include channelProvider in SpannerPoolKey for pool isolation - #15281
Merged
Merged
Conversation
…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.
Contributor
There was a problem hiding this comment.
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.
olavloite
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Statement
channelProvider(such as a custom TLS, mTLS, or proxyExternalChannelProvider) shared the sameSpannerPoolkey as default connections or connections with a differentchannelProvider, causing pooled clients to silently reuse an unintended transport channel.channelProviderorgrpc_interceptor_providervalue ("") did not share a pool key with connections where the property was omitted, even though both resolve to the default behavior at runtime.Solution
channelProviderclass name in the connection pool key so each distinctchannelProviderreceives an isolatedSpannerclient and transport channel while connections with the samechannelProvidercontinue to share a pool.channelProviderandgrpc_interceptor_providervalues ("") to unset (null) so omitted and empty values share the same default pool while whitespace or invalid class names continue to fail closed.