neils-dev commented on code in PR #3409:
URL: https://github.com/apache/ozone/pull/3409#discussion_r1098041892


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMFailoverProxyProviderBase.java:
##########
@@ -172,12 +175,23 @@ public RetryAction shouldRetry(Exception exception, int 
retries,
           OMNotLeaderException notLeaderException =
               getNotLeaderException(exception);
           if (notLeaderException != null) {
-            // TODO: NotLeaderException should include the host
-            //  address of the suggested leader along with the nodeID.
-            //  Failing over just based on nodeID is not very robust.
-
             // Prepare the next OM to be tried. This will help with calculation
             // of the wait times needed get creating the retryAction.
+            if (notLeaderException.getSuggestedLeaderAddress() != null &&
+                notLeaderException.getSuggestedLeaderNodeId() != null) {
+              String suggestedLeaderAddress =
+                  notLeaderException.getSuggestedLeaderAddress();
+              String suggestedNodeId =
+                  notLeaderException.getSuggestedLeaderNodeId();
+              if (omNodeAddressMap.containsKey(suggestedNodeId) &&

Review Comment:
   _Instead_ of calling `notLeaderException.getSuggestedLeaderAddress() `and 
`getSuggestedLeaderNodeId() ` twice, first checking if non-null then setting 
variables `suggestedLeaderAddress` and `suggestedNodeID`, _we can just_ call 
once setting the local variables and check if variables are non-null later 
before `setNextOmProxy()`.



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