Repository navigation
autosharding: implementation of EndpointMap, autosharding client and LB Policy - #13039
shivaspeaks wants to merge 81 commits into
Conversation
…harding-part2-picker
…harding-part3-lazy-endpoints
sauravzg
left a comment
There was a problem hiding this comment.
Reviewed all of source. Some comments may be outdated since this was a large PR and I have been incrementally reviewing it for quite some time.
|
Merged master and updated |
sauravzg
left a comment
There was a problem hiding this comment.
We are very close.
Most of the comments are "just update to the latest spec".
The two critical ones for me are the one about empty string and how we do endpoint location substitution, since they can break production.
I'd feel comfortable to pre-approve the PR and let you handle the remaining if those two are addressed.
| return; | ||
| } | ||
| if (firstIdle == null && holder.state == IDLE) { | ||
| firstIdle = holder; |
There was a problem hiding this comment.
https://github.com/grpc/proposal/pull/551/changes#diff-993dfa07d65f674b8573895450634cea37b295f7ceecf8fa2866bb00efc262a5R843 - This needs to be random IIUC instead of first.
| String hostname = | ||
| endpoint.getAttributes().get(InternalEquivalentAddressGroup.ATTR_ADDRESS_NAME); | ||
| return hostname != null ? hostname : endpoint.getAddresses().get(0).toString(); | ||
| return hostname != null ? hostname : addressName(endpoint.getAddresses().get(0)); |
There was a problem hiding this comment.
We also need to handle the case of empty hostname.
| .setAttributes(attributes) | ||
| .build()); | ||
| if (!status.isOk()) { | ||
| // pick_first only rejects an address list it cannot use at all, which should not happen |
There was a problem hiding this comment.
I recall commenting about it, not sure where it got lost or why you resolved it, I am don't feel comfortable about swallowing errors.
Even if it's rare , if there's a possibility of error , that should be fixed.
What do the other implementations do here?
I am also guessing this means some changes in this methods and it's chain of callers to propagate status.
| byte[] key = args.getHeaders().get(keyHeader); | ||
| // The first value if the header was sent more than once; get() would return the last. | ||
| Iterable<byte[]> keys = args.getHeaders().getAll(keyHeader); | ||
| byte[] key = keys == null ? null : keys.iterator().next(); |
There was a problem hiding this comment.
The grfc was changed to join them with comma likely.
| if (key == null) { | ||
| // wait-for-ready RPCs keep waiting for a picker | ||
| // that can route them, and the others fail. | ||
| return PickResult.withError( |
There was a problem hiding this comment.
the grfc mentions to drop the rpc with internal error.
| * yield null, so the result never depends on resolver ordering. | ||
| */ | ||
| @Nullable | ||
| private static String sharedLocality(List<EquivalentAddressGroup> endpoints) { |
There was a problem hiding this comment.
I don't think this is still correct . This returns incorrect target for cases where it tries to infer shared... when not beneat weighted target . Apart from correctness, the approach might be incorrect, we are trying to substitute an injected dependency with some business logic around how weighted target behaves, which can change in future.
My 2c would be to find a way to inject this by somehow making an internal attirbute in grpc-api or grpc-core and then have WeightedTarget point to it.
Maybe we can add a todo to move WeightedTarget to non xds ? c++ has it outside xds from what it seems which may be the right thing to do ?
| Status.UNAVAILABLE | ||
| .withDescription( | ||
| "autosharding: channel factory rejected key '" | ||
| + channelFactoryKey |
There was a problem hiding this comment.
Not ideal. channelFactoryKey may contain credentials. Might want to escalate to the other implementations to fix this since they seem to be doing it as well.
| // RPCs are queued until a client reports, so the state is IDLE whatever the endpoints | ||
| // report. Reporting CONNECTING instead would keep a parent priority policy's failover | ||
| // timer running while the sharding service answers. | ||
| helper.updateBalancingState(IDLE, ASSIGNMENT_PENDING_PICKER); |
There was a problem hiding this comment.
This behaviour seems to have been changed in the grfc to report connecting. Pair this with changes for the initial connect timeout.
| } | ||
| // A client only reports errors before it has reported an assignment, so an assignment in | ||
| // hand here came from a previous client. The new client's state replaces it. | ||
| logger.log( |
There was a problem hiding this comment.
optional: Should we be logging warnings on each slicer assignment service error? Maybe we use fine? This is not critical so feel free to do what other implementations do.
| } | ||
|
|
||
| @Override | ||
| public void requestConnection() { |
There was a problem hiding this comment.
https://github.com/grpc/proposal/pull/551/changes#diff-993dfa07d65f674b8573895450634cea37b295f7ceecf8fa2866bb00efc262a5R1048-R1057 - This doesn't seem no-op anymore
gRFC A119