Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed Aug 3, 2023
1 parent dd84d10 commit 0adcdb3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions balancer/base/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package base
import (
"errors"
"fmt"
"runtime/debug"

"google.golang.org/grpc/balancer"
"google.golang.org/grpc/connectivity"
Expand Down Expand Up @@ -185,6 +186,7 @@ func (b *baseBalancer) regeneratePicker() {
// UpdateSubConnState is a nop because a StateListener is always set in NewSubConn.
func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
logger.Errorf("base.baseBalancer: UpdateSubConnState(%v, %+v) called unexpectedly", sc, state)
debug.PrintStack()
}

func (b *baseBalancer) updateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
Expand Down Expand Up @@ -214,8 +216,8 @@ func (b *baseBalancer) updateSubConnState(sc balancer.SubConn, state balancer.Su
case connectivity.Idle:
sc.Connect()
case connectivity.Shutdown:
// When an address was removed by resolver, b called RemoveSubConn but
// kept the sc's state in scStates. Remove state for this sc here.
// When an address was removed by resolver, b called Shutdown but kept
// the sc's state in scStates. Remove state for this sc here.
delete(b.scStates, sc)
case connectivity.TransientFailure:
// Save error to be reported via picker.
Expand All @@ -236,7 +238,7 @@ func (b *baseBalancer) updateSubConnState(sc balancer.SubConn, state balancer.Su
}

// Close is a nop because base balancer doesn't have internal state to clean up,
// and it doesn't need to call RemoveSubConn for the SubConns.
// and it doesn't need to call Shutdown for the SubConns.
func (b *baseBalancer) Close() {
}

Expand Down

0 comments on commit 0adcdb3

Please sign in to comment.