-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
clientv3: health balancer #8545
Conversation
clientv3/retry.go
Outdated
if err == nil { | ||
return nil | ||
} | ||
if grpc.Code(err) == codes.Unavailable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gRPC is deprecating grpc.Code
.
ev, _ := status.FromError(err)
if ev.Code() == codes.Unavailable {
?
6020a87
to
149943f
Compare
clientv3/health_balancer.go
Outdated
cancel() | ||
if err != nil { | ||
if ev, _ := status.FromError(err); ev.Code() == codes.Unavailable && | ||
grpc.ErrorDesc(err) == "unknown service grpc.health.v1.Health" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define this string as const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/grpc.ErrorDesc/rpctypes.ErrorDesc
?
grpc.ErrorDesc
is being deprecated.
lgtm in general. @gyuho or @fanminshi should give this a more close look. |
clientv3/health_balancer.go
Outdated
if len(hb.addrs) == 1 || len(hb.unhealthy) == 0 || len(hb.unhealthy) == len(hb.addrs) { | ||
return hbAddrs | ||
} | ||
addrs := make([]grpc.Address, len(hb.addrs)-len(hb.unhealthy)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/make([]grpc.Address, len(hb.addrs)-len(hb.unhealthy))/make([]grpc.Address, 0, len(hb.addrs)-len(hb.unhealthy))
ff1eb43
to
7b5729a
Compare
7b5729a
to
49e5e78
Compare
Codecov Report
@@ Coverage Diff @@
## master #8545 +/- ##
=========================================
Coverage ? 65.94%
=========================================
Files ? 361
Lines ? 29710
Branches ? 0
=========================================
Hits ? 19592
Misses ? 8451
Partials ? 1667
Continue to review full report at Codecov.
|
got this working; |
select { | ||
case b.updateAddrsC <- notifyNext: | ||
case <-b.stopc: | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return on <-b.stopc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the channel is closed, so it'll pass through the next select without blocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. Thanks!
Works with the watch keepalive test from the grpc ping timeout patch.
Supersedes #8327
Fixes #8326