peterxcli opened a new pull request, #11763: URL: https://github.com/apache/ozone/pull/11763
## What changes were proposed in this pull request? The OM gRPC server reports a failed `submitRequest` as `Status.INTERNAL` with the description `class: message`, and `GrpcOmTransport` rebuilds the exception from that text: it splits it at the first `:` and creates the class 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 in `OMNotLeaderException` never reaches the retry policy. With this change: - A new `OMGrpcError` message in `OmClientProtocol.proto` carries an error code (`NOT_LEADER`, `LEADER_NOT_READY`, `READ_INDEX_FAILED`, `READ_FAILED` or `INTERNAL`), the message and the suggested leader node ID. The OM gRPC server sends it in a binary gRPC trailer. - `OMGrpcErrorUtils` is the one place that maps an OM exception to an `OMGrpcError` on the server, and the code back to the OM exception on the client. There is no text parsing and no reflection. - `unwrapException` gives the retry policy a `ServiceException` with the OM exception as its cause. The `get*Exception` helpers in `OMFailoverProxyProviderBase` now accept such a cause as well as a `RemoteException`, and the four of them share one implementation. - The retry policy finds the suggested leader by node ID. It used to compare the address too, but the OM sends `InetAddress#toString` (`host/ip`) while the proxy has `host:port`, so it never matched. Since the retry policy now recognizes the gRPC errors, the gRPC leader path also waits for a not-ready leader instead of failing over. HDDS-17448 (#11760) covers follower read. 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? - `TestOMGrpcErrorUtils`: every code maps back to its exception type and message, including the suggested leader; any other exception becomes `INTERNAL_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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
