Skip to content

fix(datastore): reset transport-default host when switching transport via toBuilder - #15414

Open
jinseopkim0 wants to merge 1 commit into
mainfrom
fix/datastore-tobuilder-transport-host
Open

jinseopkim0 wants to merge 1 commit into
mainfrom
fix/datastore-tobuilder-transport-host

Conversation

@jinseopkim0

@jinseopkim0 jinseopkim0 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

b/588887355#comment11

Reset transport-defaulted host when switching between gRPC and HTTP via DatastoreOptions.toBuilder().setTransportOptions(...) and recognize both transport defaults in DatastoreUtils.isDefaultHost().

@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 introduces a hasCustomHost flag in DatastoreOptions to track whether a host was explicitly overridden by the caller or populated as a transport default. This prevents stale default endpoints from carrying over when switching transports (e.g., between gRPC and HTTP) via toBuilder(). It also adds a utility method DatastoreUtils.isDefaultHost() to identify default hosts for both transports and updates the RPC implementations and tests accordingly. The review feedback suggests a minor improvement in DatastoreOptions.java to use the existing setHost(null) helper method instead of manually setting the host field and calling the superclass method.

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