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

priority: sync priority with child in use #5549

Merged
merged 1 commit into from Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion xds/internal/balancer/priority/balancer.go
Expand Up @@ -260,7 +260,7 @@ func (b *priorityBalancer) run() {
b.handleChildStateUpdate(s.name, s.s)
case resumePickerUpdates:
b.inhibitPickerUpdates = false
b.syncPriority("")
b.syncPriority(b.childInUse)
close(s.done)
}
b.mu.Unlock()
Expand Down
3 changes: 2 additions & 1 deletion xds/internal/balancer/priority/balancer_priority.go
Expand Up @@ -69,6 +69,7 @@ var (
// Caller must hold b.mu.
func (b *priorityBalancer) syncPriority(childUpdating string) {
if b.inhibitPickerUpdates {
b.logger.Infof("Skipping update from child with name %q", childUpdating)
return
}
for p, name := range b.priorities {
Expand All @@ -84,7 +85,7 @@ func (b *priorityBalancer) syncPriority(childUpdating string) {
(child.state.ConnectivityState == connectivity.Connecting && child.initTimer != nil) ||
p == len(b.priorities)-1 {
if b.childInUse != child.name || child.name == childUpdating {
logger.Warningf("ciu, cn, cu: %v, %v, %v", b.childInUse, child.name, childUpdating)
b.logger.Warningf("childInUse, childUpdating: %q, %q", b.childInUse, child.name)
// If we switch children or the child in use just updated its
// picker, push the child's picker to the parent.
b.cc.UpdateState(child.state)
Expand Down
6 changes: 0 additions & 6 deletions xds/internal/balancer/priority/balancer_test.go
Expand Up @@ -176,8 +176,6 @@ func (s) TestPriority_HighPriorityReady(t *testing.T) {
}

select {
case <-cc.NewPickerCh:
t.Fatalf("got unexpected new picker")
case <-cc.NewSubConnCh:
t.Fatalf("got unexpected new SubConn")
case <-cc.RemoveSubConnCh:
Expand Down Expand Up @@ -277,8 +275,6 @@ func (s) TestPriority_SwitchPriority(t *testing.T) {
}

select {
case <-cc.NewPickerCh:
t.Fatalf("got unexpected new picker")
case sc := <-cc.NewSubConnCh:
t.Fatalf("got unexpected new SubConn, %s", sc)
case <-cc.RemoveSubConnCh:
Expand Down Expand Up @@ -1194,8 +1190,6 @@ func (s) TestPriority_MoveReadyChildToHigherPriority(t *testing.T) {
// Because this was a ready child moved to a higher priority, no new subconn
// or picker should be updated.
select {
case <-cc.NewPickerCh:
t.Fatalf("got unexpected new picker")
case <-cc.NewSubConnCh:
t.Fatalf("got unexpected new SubConn")
case <-cc.RemoveSubConnCh:
Expand Down