Skip to content

fix(spanner): recompute default host on toBuilder().setUniverseDomain() - #15134

Open
sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-tobuilder-universe-domain-host
Open

sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-tobuilder-universe-domain-host

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Calling toBuilder().setUniverseDomain(...) on a built SpannerOptions instance previously retained the materialized default host (https://spanner.googleapis.com) because Builder(SpannerOptions) copied options.getHost() and ServiceOptions.Builder(ServiceOptions) copied the resolved host.

Track only the explicitly configured host in SpannerOptions and restore that value in Builder(SpannerOptions), allowing default hosts to be recomputed via getDefaultHost() when the universe domain changes while preserving explicit custom hosts, emulator hosts, and Omni hosts.

Calling toBuilder().setUniverseDomain(...) on a built SpannerOptions instance previously retained the materialized default host (https://spanner.googleapis.com) because Builder(SpannerOptions) copied options.getHost() and ServiceOptions.Builder(ServiceOptions) copied the resolved host.

Track only the explicitly configured host in SpannerOptions and restore that value in Builder(SpannerOptions), allowing default hosts to be recomputed via getDefaultHost() when the universe domain changes while preserving explicit custom hosts, emulator hosts, and Omni hosts.
@sakthivelmanii
sakthivelmanii requested review from a team as code owners November 21, 2026 20:57

@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 updates SpannerOptions to track the explicitly configured host separately from the materialized default host. This ensures that subsequent calls to setUniverseDomain() correctly recompute the default host when using toBuilder(). Additionally, several unit tests were added to verify the behavior of toBuilder() under various configurations of universe domains, custom hosts, and emulator hosts. I have no feedback to provide.

This branch has not been deployed

No deployments
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.

1 participant