symious commented on code in PR #3409:
URL: https://github.com/apache/ozone/pull/3409#discussion_r1014961182


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java:
##########
@@ -34,24 +34,33 @@ public class OMNotLeaderException extends IOException {
 
   private final String currentPeerId;
   private final String leaderPeerId;
+  private final String leaderAddress;
   private static final Pattern CURRENT_PEER_ID_PATTERN =
       Pattern.compile("OM:(.*) is not the leader[.]+.*", Pattern.DOTALL);
   private static final Pattern SUGGESTED_LEADER_PATTERN =
-      Pattern.compile(".*Suggested leader is OM:([^.]*).*", Pattern.DOTALL);
+      Pattern.compile(".*Suggested leader is OM:([^.]*)\\/(.*)\\.",
+          Pattern.DOTALL);
 
   public OMNotLeaderException(RaftPeerId currentPeerId) {
     super("OM:" + currentPeerId + " is not the leader. Could not " +
         "determine the leader node.");
     this.currentPeerId = currentPeerId.toString();
     this.leaderPeerId = null;
+    this.leaderAddress = null;
   }
 
   public OMNotLeaderException(RaftPeerId currentPeerId,
       RaftPeerId suggestedLeaderPeerId) {
+    this(currentPeerId, suggestedLeaderPeerId, null);
+  }
+
+  public OMNotLeaderException(RaftPeerId currentPeerId,
+      RaftPeerId suggestedLeaderPeerId, String suggestedLeaderAddress) {
     super("OM:" + currentPeerId + " is not the leader. Suggested leader is" +
-        " OM:" + suggestedLeaderPeerId + ".");
+        " OM:" + suggestedLeaderPeerId + "/" + suggestedLeaderAddress + ".");

Review Comment:
   @neils-dev Thank you for the review.
   I think the `suggestedLeaderAddress` will return `null` if there are some 
errors on the server side about the Ratis Peer or hostname resolving, which 
should be resolved on server side according to the error logs. Once the server 
side error fix, the client should be able to realise the error config according 
to the exception message.



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