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

   ## What changes were proposed in this pull request?
   `RetryInvocationHandler.Call#invokeMethod` stores the call id in the 
`Client.callId` `ThreadLocal` before every attempt, and the only thing that 
clears it is the `Client.Call` constructor as it builds the `RPC`, while the 
next attempt asserts the slot is empty via 
`Preconditions.checkState(callId.get() == null)` in 
`Client.setCallIdAndRetryCount`. An invocation that returns or throws without 
issuing an `RPC` therefore leaves the `id` behind, and since nothing else 
clears it the calling thread can no longer make any `OM` `RPC` at all — every 
later call on it fails with `IllegalStateException`, including a call from an 
unrelated client instance to a healthy `OM`, which for a pooled thread such as 
an `S3` Gateway handler lasts until the thread is discarded. This patch makes 
the call id self-cleaning: Client gains `clearCallId()`, and `invokeMethod` 
calls it in a `finally`, so no exit can leave an id set and a failure before 
the `RPC` is issued costs one request instead of the threa
 d.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16745
   
   ## How was this patch tested?
   New unit tests:
   
   - TestRetryProxy#testCallIdClearedWhenNoRpcIsIssued — an RpcProxy target 
that throws before issuing an RPC, invoked twice on one thread. Reverting only 
the finally makes it fail with IllegalStateException where the target's own 
exception was expected.
   - 
TestHadoopRpcOMFollowerReadFailoverProxyProvider#testReadAfterDnsRefreshOfCurrentProxy
 — asserts a read still reaches its OM after refreshAddressIfChanged() has 
dropped that node's cached proxy.
   


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