-
Notifications
You must be signed in to change notification settings - Fork 4.6k
endpointsharding: cast EndpointMap values to *balancerWrapper instead of Balancer #8069
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
endpointsharding: cast EndpointMap values to *balancerWrapper instead of Balancer #8069
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8069 +/- ##
==========================================
+ Coverage 82.25% 82.38% +0.12%
==========================================
Files 387 387
Lines 39040 39065 +25
==========================================
+ Hits 32114 32182 +68
+ Misses 5593 5557 -36
+ Partials 1333 1326 -7
|
|
|
||
| // Execute the resolver error path. pickfirst will ignore the resolver error | ||
| // as it has a good resolver state. | ||
| mr.ReportError(errors.New("test error")) |
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.
This tests that the operation was a nop, which isn't really a good test of the functionality. I.e. the child could not even get the call and the test would still pass. I think it would be better to have a test that calls ResolverError before it's working and ensures that it results in pick errors / TF state.
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 children of enpointsharding wouldn't get created if the resolver doesn't produce a good list of endpoints first.
I can use a stub child balancer which modifies pickfirst's behaviour of ignoring resolver errors when it has a working state.
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.
Good point. Or you should be able to make it start failing (disconnect subchannel) and then produce a ResolverError. The errors from pick should change IIUC
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.
I stopped the backends, reported a resolver error and verified the RPC error message.
6234f46 to
28b14ff
Compare
28b14ff to
a96f1db
Compare
| cc, err := grpc.NewClient(mr.Scheme()+":///", grpc.WithResolvers(mr), grpc.WithTransportCredentials(insecure.NewCredentials())) | ||
| dOpts := []grpc.DialOption{ | ||
| grpc.WithResolvers(mr), grpc.WithTransportCredentials(insecure.NewCredentials()), | ||
| // Use a large backoff dealy to avoid the error picker being updated |
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/dealy/delay
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.
Fixed the typo.
| // too quickly. | ||
| grpc.WithConnectParams(grpc.ConnectParams{ | ||
| Backoff: backoff.Config{ | ||
| BaseDelay: 100 * time.Second, |
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.
Nit/Optional: This could be 2*defaultTestTimeout instead of an arbitrarily large value.
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.
Changed.
| for ; ctx.Err() == nil; <-time.After(time.Millisecond) { | ||
| _, err := client.EmptyCall(ctx, &testpb.Empty{}) | ||
| if err == nil { | ||
| t.Fatalf("EmptyCall returned unexpected error: <nil>, want %q", "test error") |
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.
Nit: instead of saying unexpected error nil, it could say succeeded when expected to fail with "test error"
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.
Changed the error message.
In #8031, the
balancer.Balancerembedding inbalancerWrapperwas removed. This causesendpointshardingto panic when casting theEndpointMapvalue to abalancer.Balancer. This PR fixes the bug and adds a test.RELEASE NOTES: None