Xushaohong commented on code in PR #4265:
URL: https://github.com/apache/ozone/pull/4265#discussion_r1104013312


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java:
##########
@@ -488,4 +490,62 @@ public static void debug(ByteBuf buf, String name, Logger 
log) {
     }
     log.debug("{}: {}\n  {}", name, buf, builder);
   }
+
+
+  /**
+   * Use raft client to send admin request, transfer the leadership.
+   * 1. Set priority and send setConfiguration request
+   * 2. Trigger transferLeadership API.
+   *
+   * @param division      the Raft division
+   * @param targetPeerId  the target expected leader
+   * @throws IOException
+   */
+  public static void transferRatisLeadership(ConfigurationSource conf,
+      RaftServer.Division division, RaftPeerId targetPeerId)
+      throws IOException {
+    RaftGroup raftGroup = division.getGroup();
+    // TODO: need a common raft client related conf.
+    RaftClient raftClient = newRaftClient(SupportedRpcType.GRPC, null,

Review Comment:
   updated



##########
hadoop-hdds/interface-client/src/main/proto/hdds.proto:
##########
@@ -452,3 +452,10 @@ message ContainerBalancerConfigurationProto {
     required bool shouldRun = 18;
     optional int32 nextIterationIndex = 19;
 }
+
+message TransferLeadershipRequestProto {
+    required string nodeId = 1;

Review Comment:
   Got it 



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