Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed May 5, 2023
1 parent 3d0e223 commit cac75d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions balancer/weightedroundrobin/balancer.go
Expand Up @@ -120,7 +120,7 @@ func (b *wrrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error
b.resolverErr = nil
cfg, ok := ccs.BalancerConfig.(*lbConfig)
if !ok {
return fmt.Errorf("wrr: received nil or illegal BalancerConfig: %v", ccs.BalancerConfig)
return fmt.Errorf("wrr: received nil or illegal BalancerConfig (type %T): %v", ccs.BalancerConfig, ccs.BalancerConfig)
}

b.cfg = cfg
Expand Down Expand Up @@ -206,7 +206,7 @@ func (b *wrrBalancer) ResolverError(err error) {
func (b *wrrBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
wsc := b.scMap[sc]
if wsc == nil {
b.logger.Errorf("UpdateSubConnStateChange called with an unknown SubConn: %p, %v", sc, state)
b.logger.Errorf("UpdateSubConnState called with an unknown SubConn: %p, %v", sc, state)
return
}
if b.logger.V(2) {
Expand Down
11 changes: 7 additions & 4 deletions balancer/weightedroundrobin/balancer_test.go
Expand Up @@ -388,8 +388,10 @@ func (s) TestBalancer_TwoAddresses_ErrorPenalty(t *testing.T) {
srv2 := startServer(t, reportOOB)

// srv1 starts loaded and srv2 starts without load; ensure RPCs are routed
// disproportionately to srv2 (10:1). Errors are set (but ignored
// initially) such that RPCs will be routed 50/50.
// disproportionately to srv2 (10:1). EPS values are set (but ignored
// initially due to ErrorUtilizationPenalty=0). Later EUP will be updated
// to 0.9 which will cause the weights to be equal and RPCs to be routed
// 50/50.
srv1.oobMetrics.SetQPS(10.0)
srv1.oobMetrics.SetCPUUtilization(1.0)
srv1.oobMetrics.SetEPS(0)
Expand Down Expand Up @@ -432,7 +434,7 @@ func (s) TestBalancer_TwoAddresses_ErrorPenalty(t *testing.T) {
}

// Tests that the blackout period causes backends to use 0 as their weight
// until the backout period elapses.
// (meaning to use the average weight) until the blackout period elapses.
func (s) TestBalancer_TwoAddresses_BlackoutPeriod(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down Expand Up @@ -509,7 +511,8 @@ func (s) TestBalancer_TwoAddresses_BlackoutPeriod(t *testing.T) {
}

// Tests that the weight expiration period causes backends to use 0 as their
// weight once the expiration period elapses.
// weight (meaning to use the average weight) once the expiration period
// elapses.
func (s) TestBalancer_TwoAddresses_WeightExpiration(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down

0 comments on commit cac75d4

Please sign in to comment.