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/base: consider an empty address list an error #3361

Merged
merged 5 commits into from
Feb 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions balancer/base/balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,12 @@ func (b *baseBalancer) regeneratePicker() {
// Build the error from the last connection error and the last
// resolver error. connErr must always be non-nil unless there are
// no SubConns, in which case resolverErr must be non-nil.
err := b.connErr
if b.resolverErr != nil {
if err == nil {
err = b.resolverErr
}
if err != nil {
err = fmt.Errorf("%v; %v", err, b.resolverErr)
}
err := b.resolverErr
dfawley marked this conversation as resolved.
Show resolved Hide resolved
switch {
case err == nil:
err = fmt.Errorf("last connection error: %v", b.connectionErr)
case b.connectionErr != nil:
err = fmt.Errorf("last connection error: %v; %v", b.connectionErr, err)
dfawley marked this conversation as resolved.
Show resolved Hide resolved
}
b.v2Picker = NewErrPickerV2(balancer.TransientFailureError(err))
}
Expand Down Expand Up @@ -225,11 +223,7 @@ func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.Su
b.state = b.csEvltr.RecordTransition(oldS, s)

// Set or clear the last connection error accordingly.
if b.state == connectivity.TransientFailure {
b.connErr = fmt.Errorf("last connection error %v", state.ConnectionError)
} else {
b.connErr = nil
}
b.connErr = state.ConnectionError

// Regenerate picker when one of the following happens:
// - this sc became ready from not-ready
Expand Down