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

balancer/weightedtarget: pause picker updates during UpdateClientConnState #5527

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

dfawley
Copy link
Member

@dfawley dfawley commented Jul 21, 2022

#5211

Even though the picker is updated synchronously in UpdateClientConnState, multiple updates could result in UpdateState calls to the parent if this is not done to suppress them.

RELEASE NOTES: n/a

@dfawley dfawley added the Type: Feature New features or improvements in behavior label Jul 21, 2022
@dfawley dfawley added this to the 1.49 Release milestone Jul 21, 2022
@dfawley dfawley requested a review from easwars July 21, 2022 16:29
Comment on lines 1222 to 1250
type updateStateBalancerBuilder struct{}

func (updateStateBalancerBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer {
return &updateStateBalancer{cc: cc}
}

const updateStateBalancerName = "update_state_balancer"

func (updateStateBalancerBuilder) Name() string {
return updateStateBalancerName
}

func init() {
balancer.Register(updateStateBalancerBuilder{})
}

type updateStateBalancer struct {
cc balancer.ClientConn
balancer.Balancer
}

func (b *updateStateBalancer) UpdateClientConnState(s balancer.ClientConnState) error {
b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.TransientFailure, Picker: nil})
b.cc.UpdateState(balancer.State{ConnectivityState: connectivity.Ready, Picker: nil})
return nil
}

func (b *updateStateBalancer) Close() {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace this with a stub balancer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, good call. Done.

@easwars easwars assigned dfawley and unassigned easwars Jul 21, 2022
@dfawley dfawley assigned easwars and unassigned dfawley Jul 21, 2022
@easwars easwars assigned dfawley and unassigned easwars Jul 21, 2022
@dfawley dfawley merged commit 86117db into grpc:master Jul 21, 2022
@dfawley dfawley deleted the weitar_picker branch July 21, 2022 17:51
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants