Skip to content

Commit

Permalink
don't apply defaultSC upon receipt of invalid service config (#5257)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Mar 22, 2022
1 parent 51ddcba commit 597e5d1
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 102 deletions.
12 changes: 5 additions & 7 deletions clientconn.go
Expand Up @@ -653,13 +653,11 @@ func (cc *ClientConn) updateResolverState(s resolver.State, err error) error {
} else {
ret = balancer.ErrBadResolverState
if cc.sc == nil {
if cc.dopts.defaultServiceConfig != nil {
cc.applyServiceConfigAndBalancer(cc.dopts.defaultServiceConfig, &defaultConfigSelector{cc.dopts.defaultServiceConfig}, s.Addresses)
} else {
cc.applyFailingLB(s.ServiceConfig)
cc.mu.Unlock()
return ret
}
// Apply the failing LB only if we haven't received valid service config
// from the name resolver in the past.
cc.applyFailingLB(s.ServiceConfig)
cc.mu.Unlock()
return ret
}
}
}
Expand Down
94 changes: 0 additions & 94 deletions resolver_conn_wrapper_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions service_config.go
Expand Up @@ -381,6 +381,9 @@ func init() {
//
// If any of them is NOT *ServiceConfig, return false.
func equalServiceConfig(a, b serviceconfig.Config) bool {
if a == nil && b == nil {
return true
}
aa, ok := a.(*ServiceConfig)
if !ok {
return false
Expand Down
1 change: 0 additions & 1 deletion test/resolver_test.go → test/config_selector_test.go
Expand Up @@ -211,5 +211,4 @@ func (s) TestConfigSelector(t *testing.T) {
}
})
}

}

0 comments on commit 597e5d1

Please sign in to comment.