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


##########
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 + "].");
     this.currentPeerId = currentPeerId.toString();
     this.leaderPeerId = suggestedLeaderPeerId.toString();
+    this.leaderAddress = suggestedLeaderAddress;
   }
 
   public OMNotLeaderException(String message) {

Review Comment:
   We should not support this. The caller has to specify either the peer ID or 
the leader ID.



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