ivandika3 commented on code in PR #5549:
URL: https://github.com/apache/ozone/pull/5549#discussion_r1390110446


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java:
##########
@@ -545,6 +552,39 @@ null, raftGroup, createRetryPolicy(conf), tlsConfig, 
conf)) {
             targetPeerId, reply);
         throw new IOException(reply.getException());
       }
+    } finally {
+      // Raft peers priorities need to be reset regardless of the result
+      // of transfer leadership
+      resetPriorities(conf, raftGroup, tlsConfig);
+    }
+  }
+
+  private static void resetPriorities(ConfigurationSource conf,
+      RaftGroup raftGroup, GrpcTlsConfig tlsConfig) {
+    List<RaftPeer> resetPeers = new ArrayList<>();
+    for (RaftPeer peer : raftGroup.getPeers()) {
+      resetPeers.add(
+          RaftPeer.newBuilder(peer)
+              .setPriority(NEUTRAL_PRIORITY)
+              .build()
+      );
+    }
+    LOG.info("Resetting Raft peers priorities after transfer leadership");
+    try (RaftClient raftClient = newRaftClient(SupportedRpcType.GRPC, null,
+        null, raftGroup, createRetryPolicy(conf), tlsConfig, conf)) {

Review Comment:
   Updated based on the patch diff.



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