Repository navigation
fix(spanner): preserve per-call CallCredentials on DirectPath-to-CloudPath fallback - #15283
Merged
sakthivelmanii merged 1 commit intoDec 1, 2026
Merged
Conversation
…dPath fallback ## Problem Statement - When `java-spanner` falls back from DirectPath to CloudPath, the CloudPath fallback channel unconditionally overwrites per-call `CallCredentials` with the client's default credentials. - Requests configured with narrower per-call or per-tenant credentials via `SpannerOptions.CallCredentialsProvider` or `CallContextConfigurator` silently execute under the broader client default identity after fallback. ## Solution - Preserve any existing per-call `CallCredentials` on outgoing `CallOptions` during DirectPath-to-CloudPath fallback, and attach the client's default credentials only when no call credentials are already present. - Construct the default `CallCredentials` wrapper once during channel setup instead of allocating a new wrapper on every fallback RPC.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the GCP fallback credentials handling in GapicSpannerRpc by introducing a new ClientInterceptor via createFallbackDefaultCredentialsInterceptor. This interceptor ensures that default credentials are only attached to outgoing RPCs on the CloudPath fallback channel when no per-call credentials are already present, thereby preserving custom credentials configured via providers or configurators. Additionally, comprehensive unit tests have been added to GapicSpannerRpcTest to validate this behavior across various fallback scenarios. There are no review comments to address, and the implementation looks solid.
olavloite
approved these changes
Dec 1, 2026
sakthivelmanii
deleted the
fix/spanner-fallback-preserve-call-credentials
branch
December 1, 2026 16:50
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
java-spannerfalls back from DirectPath to CloudPath, the CloudPath fallback channel unconditionally overwrites per-callCallCredentialswith the client's default credentials.SpannerOptions.CallCredentialsProviderorCallContextConfiguratorsilently execute under the broader client default identity after fallback.Solution
CallCredentialson outgoingCallOptionsduring DirectPath-to-CloudPath fallback, and attach the client's default credentials only when no call credentials are already present.CallCredentialswrapper once during channel setup instead of allocating a new wrapper on every fallback RPC.