Gargi-jais11 commented on code in PR #9546:
URL: https://github.com/apache/ozone/pull/9546#discussion_r2660301627
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java:
##########
@@ -201,7 +200,7 @@ public OMResponse submitRequest(OMRequest payload) throws
IOException {
}
Exception exp = new Exception(e);
tryOtherHost = shouldRetry(unwrapException(exp),
- expectedFailoverCount);
+ expectedFailoverCount, requestFailoverCount++);
Review Comment:
Using `requestFailoverCount++` (post-increment) passes the OLD value to
shouldRetry(), giving one extra retry attempt beyond maxFailovers.
Example with maxFailovers=16:
- 1st failure: passes 0, increments to 1, checks (0 < 16) → RETRY ✓
- 2nd failure: passes 1, increments to 2, checks (1 < 16) → RETRY ✓
- ...
- 16th failure: passes 15, increments to 16, checks (15 < 16) → RETRY ✓
(extra!)
- 17th failure: passes 16, increments to 17, checks (16 < 16) → FAIL ✗
Result: 17 attempts instead of 16 configured.
**Test confirms this behavior:**
`TestS3GrpcOmTransport.testGrpcFailoverProxyCalculatesFailoverCountPerRequest()`
expects 3 attempts with maxFailoverAttempts=2 (lines 225-227).
**Recommendation:**
If intentional, document why. Otherwise, we should use pre-increment.
And update the test expectation from 3 to 2.
--
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]