Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xds: Allow child of cluster_impl LB to change (1.54.x backport) #10103

Merged

Conversation

temawi
Copy link
Contributor

@temawi temawi commented Apr 25, 2023

Backport of #10091

Under normal conditions the child LB of ClusterImplLoadBalancer does not fluctuate, based on the field used to configure load balancing in the xDS Cluster proto it is either:

1. WrrLocalityLoadBalancer if the newer load_balancing_policy field is used
2. WeightedTargetLoadBalancer if the legacy lb_policy field is used

(The premise set here is off, see comment)

ClusterImplLoadBalancer currently assumes that this child does not change and so does not change the child LB when the name resolver sends an update. If the control plane does switch to using a different field for LB config, that update will have an LB config meant for the other child LB type. This will result in a ClassCastException and a channel panic.

To address this, ClusterImplLoadBalancer will now use GracefulSwitchLoadBalancer and makes sure if the child policy changes the correct LB implementation is switched to.

Closes #10006

Under normal conditions the child LB of `ClusterImplLoadBalancer` does
not fluctuate, based on the field used to configure load balancing in
the xDS `Cluster` proto it is either:

1. `WrrLocalityLoadBalancer` if the newer `load_balancing_policy` field
   is used
2. `WeightedTargetLoadBalancer` if the legacy `lb_policy` field is used

`ClusterImplLoadBalancer` currently assumes that this child does not
change and so does not change the child LB when the name resolver sends an
update. If the control plane does switch to using a different field for
LB config, that update will have an LB config meant for the other child
LB type. This will result in a ClassCastException and a channel panic.

To address this, `ClusterImplLoadBalancer` will now use
`GracefulSwitchLoadBalancer` and makes sure if the child policy changes
the correct LB implementation is switched to.
@temawi temawi requested a review from ejona86 April 25, 2023 21:15
@temawi temawi merged commit 1d5aff5 into grpc:v1.54.x Apr 25, 2023
12 checks passed
@temawi temawi deleted the backport-clusterimpl-graceful-switch-1.54 branch April 25, 2023 22:04
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants