[ 
https://issues.apache.org/jira/browse/HDDS-17462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chu Cheng Li updated HDDS-17462:
--------------------------------
    Target Version/s: 2.3.0
              Status: Patch Available  (was: Open)

> Send structured errors from the OM gRPC server instead of exception class 
> names
> -------------------------------------------------------------------------------
>
>                 Key: HDDS-17462
>                 URL: https://issues.apache.org/jira/browse/HDDS-17462
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Chu Cheng Li
>            Assignee: Chu Cheng Li
>            Priority: Major
>              Labels: pull-request-available
>
> h3. Problem
> * The OM gRPC server sends an OM exception as {{Status.INTERNAL}} with the 
> description {{class: message}}. {{GrpcOmTransport#unwrapException}} splits 
> this text at the first {{:}}. Thus, a change in the text format breaks the 
> client.
> * The client creates the OM exception from the class name, with reflection in 
> {{RemoteException#unwrapRemoteException}}. Thus, the server response selects 
> the class that the client loads.
> * The suggested leader in {{OMNotLeaderException}} does not get to the retry 
> policy. The client creates the exception with the {{String}} constructor, so 
> the suggested node ID and address are {{null}}. The Hadoop RPC client has the 
> same problem.
> * The OM sets the suggested leader address with {{InetAddress#toString}}, for 
> example {{host/10.0.0.1}}. The retry policy compares it with the 
> {{host:port}} address of the OM proxy. Thus, the address does not match, even 
> when it gets to the client.
> h3. Changes
> * Add an {{OMGrpcError}} message to {{OmClientProtocol.proto}}. It has an 
> error code ({{NOT_LEADER}}, {{LEADER_NOT_READY}}, {{READ_INDEX_FAILED}}, 
> {{READ_FAILED}} or {{INTERNAL}}), the message and the suggested leader node 
> ID.
> * {{OzoneManagerServiceGrpc}}: map the OM exception to an {{OMGrpcError}} in 
> one place, and send it in a binary gRPC trailer. Keep the old description for 
> old clients.
> * {{GrpcOmTransport}}: map the error code to the OM exception in one place. 
> Do not parse the description, and do not use reflection.
> * {{OMFailoverProxyProviderBase}}: accept the OM exception as a direct cause, 
> not only in a {{RemoteException}}. Find the suggested leader by its node ID.
> h3. Compatibility
> * An old gRPC client ignores the trailer and reads the description.
> * A new gRPC client and an old OM: there is no trailer. The client handles 
> the error as a plain failure and fails over to the next OM.
> The Hadoop RPC client is out of scope.
> A first version with exception class names in the trailers was in 
> https://github.com/apache/ozone/pull/11760/changes/dad4b1d32700a500a6331af70117825d671e5360
>  (HDDS-17448).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to