Xushaohong commented on code in PR #4128:
URL: https://github.com/apache/ozone/pull/4128#discussion_r1057669981
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java:
##########
@@ -776,4 +790,90 @@ public static
ContainerProtos.ContainerCommandResponseProto processForDebug(
return msg;
}
+
+ /**
+ * Use raft client to send admin request, transfer the leadership.
+ * If not isRandom, then use host to match the target leader.
+ * 1. Set priority and send setConfiguration request
+ * 2. Trigger transferLeadership API.
+ *
+ * @param server the Raft server
+ * @param groupId the Raft group Id
+ * @param host the string of the host, should be IP:PORT format
+ * @param isRandom whether to choose random follower as target leader
+ * @param curLeader the current Raft leader
+ * @throws IOException
+ */
+ public static void transferRatisLeadership(RaftServer server,
Review Comment:
We mainly use the Raft client to trigger two admin APIs, setConfiguration
and transferLeadership. Such the process is short-term and straightforward, so
we need not keep any state which needs to hold the class.
--
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]