fapifta commented on a change in pull request #1494:
URL: https://github.com/apache/ozone/pull/1494#discussion_r543050237



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
##########
@@ -137,6 +141,59 @@ public OMResponse submitRequest(OMRequest omRequest) 
throws ServiceException {
     return processReply(omRequest, raftClientReply);
   }
 
+  /**
+   * Add a new OM to the Ratis ring.
+   * @return true if the new OM is successfully added to the ratis ring,
+   * false otherwise.
+   */
+  public boolean bootstrapNewOMs(List<OMNodeDetails> newOMNodes) {
+    StringBuilder newOMNodeIdsBuilder = new StringBuilder();
+    newOMNodes.stream().forEach(newOMNode ->
+        newOMNodeIdsBuilder.append(", ").append(newOMNode.getOMNodeId()));
+    String newOMNodeIds = newOMNodeIdsBuilder.toString().substring(2);
+    LOG.info("Bootstrapping new OM(s): {}", newOMNodeIds);
+
+    List<RaftPeer> newRaftPeerList = new ArrayList<>();
+    newRaftPeerList.addAll(raftPeers);
+
+    for (OMNodeDetails newOMNode : newOMNodes) {
+      String newOMNodeId = newOMNode.getOMNodeId();
+      RaftPeerId newOMRaftPeerId = RaftPeerId.valueOf(newOMNodeId);
+      InetSocketAddress newOMRatisAddr = new InetSocketAddress(
+          newOMNode.getHostName(), newOMNode.getRatisPort());
+
+      newRaftPeerList.add(RaftPeer.newBuilder()
+          .setId(newOMRaftPeerId)
+          .setAddress(newOMRatisAddr)
+          .build());
+    }
+
+    if (LOG.isDebugEnabled()) {

Review comment:
       nit: old log4j habit, we should not need this check as parameters are 
evaluated only if debug is enabled with this format. same is true for line 384




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

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