Skip to content

fix(datastore): reset auto-generated channelProvider on toBuilder mutations - #15415

Open
jinseopkim0 wants to merge 2 commits into
mainfrom
fix/datastore-tobuilder-channel-provider
Open

jinseopkim0 wants to merge 2 commits into
mainfrom
fix/datastore-tobuilder-channel-provider

Conversation

@jinseopkim0

@jinseopkim0 jinseopkim0 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

b/588887355#comment11

Track whether channelProvider was explicitly configured on DatastoreOptions so toBuilder() rebuilds auto-generated gRPC channel providers when setHost(), setUniverseDomain(), setTransportOptions(), or setOpenTelemetryOptions() is called.

@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 hasCustomChannelProvider flag in DatastoreOptions to track whether the TransportChannelProvider was explicitly provided or auto-generated. This ensures that auto-generated providers are correctly cleared and rebuilt when configuration settings like host, transport options, universe domain, or OpenTelemetry options change. The review feedback correctly identifies a serialization issue where hasCustomChannelProvider is not marked as transient, which could lead to inconsistent state and stale endpoints after deserialization since channelProvider itself is transient.

@jinseopkim0

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@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 hasCustomChannelProvider flag to DatastoreOptions to track whether a channel provider was explicitly supplied by the caller. This ensures that auto-generated channel providers are correctly cleared and rebuilt when configuration settings like transport options, host, universe domain, or OpenTelemetry options are modified. The review feedback suggests several improvements: adding null checks to prevent a potential NullPointerException when comparing transport options, and checking if the host, universe domain, or OpenTelemetry options have actually changed before clearing the channel provider to avoid unnecessary recreation.

@jinseopkim0
jinseopkim0 requested a review from lqiu96 December 3, 2026 00:03
@jinseopkim0
jinseopkim0 marked this pull request as ready for review December 3, 2026 00:03
@jinseopkim0
jinseopkim0 requested a review from a team as a code owner December 3, 2026 00:03
@jinseopkim0
jinseopkim0 enabled auto-merge (squash) December 3, 2026 00:07

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