You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/12/15 05:07:56 UTC

[GitHub] [ozone] fapifta commented on a change in pull request #1494: HDDS-4330. Bootstrap new OM node

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org