peterxcli opened a new pull request, #11760:
URL: https://github.com/apache/ozone/pull/11760

   ## 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:
   - The OM retry policy only recognizes `OMLeaderNotReadyException` when it 
gets a `ServiceException`, but `GrpcOmTransport#unwrapException` hands 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.
   - Only the leader path has a retry loop. When a follower read reaches a 
not-ready leader, it falls back to the leader path and sends another request 
right away.
   
   With this change:
   - `unwrapException` returns a `ServiceException` with the `RemoteException` 
cause 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.
   - The retry loop moves from `submitRequestToLeader` up to 
`GrpcOmTransport#submitRequest`, so it covers both follower read and the leader 
path, like `RetryProxy` does for the Hadoop RPC client.
   - The gRPC follower read throws `OMLeaderNotReadyException` to that loop 
instead of falling back to the leader, the same as 
`HadoopRpcOMFollowerReadFailoverProxyProvider`.
   
   A follower read error that can't fail over, like `RESOURCE_EXHAUSTED`, now 
ends as an `OMException`, the same as on the leader path, instead of a raw 
`StatusRuntimeException`.
   
   ## 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:
   - a leader request is retried on the same OM until it succeeds, and the 
other OM never sees it;
   - a follower read is retried the same way, and every retry is still a 
follower read.
   
   `TestGrpcOMFollowerReadFailoverProxyProvider` now expects 
`OMLeaderNotReadyException` to be thrown to the caller. All three tests fail 
without the fix.
   


-- 
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]

Reply via email to