Repository navigation
HDDS-17448. gRPC OM client should retry a not-ready leader like the Hadoop RPC client - #11760
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for the follow-up on #11418! @peterxcli LGTM
ivandika3
left a comment
There was a problem hiding this comment.
Thanks @peterxcli , LGTM +1. Left some minor comments.
| while (tryOtherHost) { | ||
| tryOtherHost = false; |
There was a problem hiding this comment.
Nit: Let's take this opportunity to cleanup this tryOtherHost condition. It's currently not used. We can also rename it to shouldRetry.
Also the
if (!tryOtherHost) {
throw new OMException(resultCode);
}is not needed since outside the loop we already throw OMException.
Additionally, shouldRetry actually does a failover so shouldRetry might not be a good method name.
I'm OK if you defer this to a follow up ticket. The GrpcOmTransport is readability is pretty poor IMO so we might need to have a wider cleanup / refactor. To name a few
- Separate the concern for exception handling by using some kind of gRPC StatusRuntimeException to Hadoop RemoteException adapter.
- Rename
hosttocurrentHost(orleaderHostif it's supposed to be pointed to the leader). - Separate the gRPC channel building to a separate method
- Do a compatibility test on the gRPC exception message so that it can be parsed by the client.
|
Thanks @peterxcli for the patch, @chihsuan, @ivandika3, @Russole for the review. |
What changes were proposed in this pull request?
When the OM leader is not ready yet, for example right after a leader change, the Hadoop RPC client keeps retrying that OM with a growing wait. The gRPC client used by the S3 Gateway doesn't:
OMLeaderNotReadyExceptionwhen it gets aServiceException, butGrpcOmTransport#unwrapExceptionhands it the OM exception itself. So the gRPC client treats a not-ready leader like any other failure and fails over to the next OM without waiting.With this change:
unwrapExceptionreturns aServiceExceptionwith theRemoteExceptioncause for errors from the OM, the same shape the Hadoop RPC client passes to the retry policy. This also drops the reflection that rebuilt the OM exception there.submitRequestToLeaderup toGrpcOmTransport#submitRequest, so it covers both follower read and the leader path, likeRetryProxydoes for the Hadoop RPC client.OMLeaderNotReadyExceptionto that loop instead of falling back to the leader, the same asHadoopRpcOMFollowerReadFailoverProxyProvider.A follower read error that can't fail over, like
RESOURCE_EXHAUSTED, now ends as anOMException, the same as on the leader path, instead of a rawStatusRuntimeException.The client still reads the exception class and message from the status description. Replacing that with a structured error from the OM is HDDS-17462.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17448
How was this patch tested?
New tests in
TestS3GrpcOmTransport, with an OM leader that isn't ready for its first two requests:TestGrpcOMFollowerReadFailoverProxyProvidernow expectsOMLeaderNotReadyExceptionto be thrown to the caller. All three tests fail without the fix.