grpc: add a field to represent receipt of a good resolver update #5235
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.
Add a field in
ClientConn
to represent the receipt of a good resolver update.cc.mu
, and will be used to determine if a valid balancer is expected to be configured on the channel.cc.balancerWrapper != nil
. We plan to change theccBalancerWrapper
implementation to wrap agracefulswitch.Balancer
instead of a regularbalancer.Balancer
and once we do that, thecc.balancerWrapper
field will be initialized at dial time and will never becomenil
.This PR also makes the following changes to the implementation (without changing behavior):
cc.updateResolverState
callscc.applyServiceConfigAndBalancer
when a valid service config is received and callscc.maybeApplyDefaultServiceConfig
otherwisecc.maybeApplyDefaultServiceConfig
determines the default service config to apply and callscc.applyServiceConfigAndBalancer
cc.applyServiceConfigAndBalancer
applies the service config and if the LB policy changes, it callscc.switchBalancer
The PR introduces the following changes:
cc.updateResolverState
callscc.onResolverError
if the update contains an errorcc.tryApplyServiceConfig
which attempts to apply the most appropriate service config, and returns an error if the service configs are invalidcc.tryApplyServiceConfig
is written to align more with the pseudo-code we use to reason about expected behaviorcc.tryApplyServiceConfig
might callcc.maybeApplyDefaultServiceConfig
orcc.applyServiceConfigAndBalancer
cc.applyServiceConfigAndBalancer
is split up intocc.applyServiceConfig
andcc.applyBalancer
RELEASE NOTES: none