Repository navigation
Conversation
… exception class names
peterxcli
marked this pull request as ready for review
October 26, 2026 00:57
peterxcli
requested review from
Gargi-jais11,
Russole,
chihsuan,
chungen0126 and
smengcl
October 26, 2026 00:58
peterxcli
commented
Oct 26, 2026
|
|
||
| optional string message = 1; | ||
| // Not set for any other error. | ||
| oneof error { |
Member
Author
There was a problem hiding this comment.
this allow us to add more error type and structural info in future
# Conflicts: # hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java # hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestS3GrpcOmTransport.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
The OM gRPC server reports a failed
submitRequestasStatus.INTERNALwith the descriptionclass: message, andGrpcOmTransportrebuilds the exception from that text: it splits it at the first:, and the class is then created by reflection. This is fragile, it lets the server pick the class the client loads, and it keeps nothing but the message. In particular, the suggested leader inOMNotLeaderExceptionnever reaches the retry policy.With this change:
OMGrpcErrorProtomessage inOmClientProtocol.protocarries the message and aoneofwith a variant for each OM error the client handles:NotLeader(with the suggested leader node ID),LeaderNotReady,ReadIndexFailedandReadFailed. No variant means any other error. The OM gRPC server sends it in a binary gRPC trailer.OMGrpcError, its Java form, is the one place that maps an OM exception to the error on the server, and the variant back to the OM exception on the client. There is no text parsing and no reflection.unwrapExceptiongives the retry policy aServiceExceptionwith the OM exception as its cause. Theget*Exceptionhelpers inOMFailoverProxyProviderBasenow accept such a cause as well as aRemoteException, and the four of them share one implementation.InetAddress#toString(host/ip) while the proxy hashost:port, so it never matched.HDDS-17448 (#11760) already gives the retry policy the shape it recognizes, by parsing the description. This change keeps that behavior and replaces the parsing.
Compatibility: the description keeps its old format, so older gRPC clients still work. A new client talking to an older OM gets no trailer, treats the error as a plain failure and fails over to the next OM. The Hadoop RPC client is unchanged.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17462
How was this patch tested?
TestOMGrpcError: every variant maps back to its exception type and message, including the suggested leader; any other exception becomesINTERNAL_ERROR; the description keeps the old format.TestGrpcOzoneManagerServer: the OM gRPC server sends the error with the suggested leader.TestOMFailoverProxyProvider: a not-leader error goes to the suggested leader, not just to the next OM.TestS3GrpcOmTransport: over gRPC, the client goes from a not-leader OM straight to the suggested leader.The fake OM servers in the gRPC tests now build their errors the same way as the OM gRPC server.