roundrobin: Delegate subchannel creation to pickfirst#7966
roundrobin: Delegate subchannel creation to pickfirst#7966arjan-bal merged 13 commits intogrpc:masterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7966 +/- ##
==========================================
- Coverage 82.36% 82.05% -0.31%
==========================================
Files 387 387
Lines 39065 39067 +2
==========================================
- Hits 32174 32058 -116
- Misses 5562 5670 +108
- Partials 1329 1339 +10
|
01ef7af to
3a594f6
Compare
balancer/roundrobin/roundrobin.go
Outdated
| func init() { | ||
| balancer.Register(newBuilder()) | ||
| var err error | ||
| endpointShardingLBConfig, err = endpointsharding.ParseConfig(json.RawMessage(endpointsharding.PickFirstConfig)) |
There was a problem hiding this comment.
This was in the other PR, too.
Probably we should have endpointsharding produce a parsed PF config if it's going to be used frequently?
test/roundrobin_test.go
Outdated
| // Send a resolver update with a valid backend to push the channel to Ready | ||
| // and unblock the above RPC. | ||
| r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: backends[0].Address}}}) | ||
| r.UpdateState(resolver.State{Endpoints: []resolver.Endpoint{ |
There was a problem hiding this comment.
This needed to be done eventually. But maybe for similar things in the future...it could have been easier for this PR (and may still be easier when dealing with future migration PRs) to make the manual resolver's UpdateState and InitialState methods set Endpoints according to the default behavior if it's unset.
There was a problem hiding this comment.
This change was not required since the code to populate endpoints based using addresses is present in resolver_wrapper.go:
Lines 125 to 132 in f35fb34
I've reverted changes to tests that use the manual resolver. In tests that call balancer.UpdateClientConnState directly, without creating a real channel, conversion from addresses to endpoints is required.
balancer/roundrobin/roundrobin.go
Outdated
| func (b *rrBalancer) ExitIdle() { | ||
| // Should always be ok, as child is endpoint sharding. | ||
| if ei, ok := b.child.(balancer.ExitIdler); ok { | ||
| ei.ExitIdle() | ||
| } | ||
| } |
There was a problem hiding this comment.
This is still necessary, unfortunately, as only balancer.Balancer functions are transferred when embedding.
|
Closing for now and prioritizing the changes to make Ringhash a petiole policy. Will also make the changes to have the metrics recorder retrieved from a method on the ClientConn as per the offline discussion. Will re-open when I'm back on this. |
f5c0d0c to
10484d1
Compare
This PR switches round round robin to defer to pick first instead of creating and handling SubConns itself. This is part of Dualstack, and makes this a petiole. This PR makes roundrobin a wrapper around the endpoint sharding policy that implements the roundrobin logic.
RELEASE NOTES: