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



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
##########
@@ -317,8 +377,18 @@ public static OzoneManagerRatisServer newOMRatisServer(
         .build();
 
     List<RaftPeer> raftPeers = new ArrayList<>();
-    // Add this Ratis server to the Ratis ring
-    raftPeers.add(localRaftPeer);
+
+    // If the OM is started in bootstrap mode, do not add it to the ratis ring.
+    // It will be added later using SetConfiguration from the leader OM.
+    if (isBootstrapping) {

Review comment:
       It could possibly cause a different ring to form with the new OMs.
   The most likely scenario is that the new OMs would shutdown. But we need to 
find a mechanism to find this erroneous scenario and address it. 
   I think it should be done in a different Jira though.

##########
File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/AddOMSubcommand.java
##########
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.admin.om;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.ozone.client.OzoneClientException;
+import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMNodeInfo;
+import 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRoleInfo;
+import org.apache.hadoop.util.StringUtils;
+import picocli.CommandLine;
+
+import java.util.concurrent.Callable;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_HTTPS_ADDRESS_KEY;
+import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_HTTP_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static 
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_RATIS_PORT_DEFAULT;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_RATIS_PORT_KEY;
+
+/**
+ * Handler of om roles command.
+ */
[email protected](
+    name = "addom", aliases = "addoms, addnewom, addnewoms",
+    description = "Adds newly Bootstrapped OM(s) to the cluster. " +
+        "\nNote - New OM(s) should be started in bootstrap mode before " +
+        "running this command." +
+        "\nNote - Configuration files of all existing " +
+        "OM(s) MUST be updated with information about the new OM(s) (" +
+        OZONE_OM_NODES_KEY + ", " + OZONE_OM_ADDRESS_KEY + ", " +
+        OZONE_OM_HTTP_ADDRESS_KEY + ", " + OZONE_OM_HTTPS_ADDRESS_KEY + ", " +
+        OZONE_OM_RATIS_PORT_KEY + ").",
+    mixinStandardHelpOptions = true,
+    versionProvider = HddsVersionProvider.class)
+public class AddOMSubcommand implements Callable<Void> {
+
+  @CommandLine.ParentCommand
+  private OMAdmin parent;
+
+  @CommandLine.Option(names = {"-id", "--service-id"},
+      description = "OM Service ID",
+      required = true)
+  private String omServiceId;
+
+  @CommandLine.Option(names = {"-nodeid", "-nodeids", "--new-node-ids"},
+      description = "A comma separated list of node IDs of the new OM(s). ",
+      required = true)
+  private String newNodeIds;
+
+  private OzoneManagerProtocol ozoneManagerClient;
+
+  @Override
+  public Void call() throws Exception {
+    boolean success = false;
+    try {
+      ozoneManagerClient =  parent.createOmClient(omServiceId);
+
+      List<OMNodeInfo> newOMNodeInfos = getNewNodeInfos();
+
+      if (!newOMNodeInfos.isEmpty()) {

Review comment:
       Done.

##########
File path: hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
##########
@@ -1203,11 +1203,41 @@ message UpdateGetS3SecretRequest {
     required string awsSecret = 2;
 }
 
+message OMNodeInfo {
+    required string nodeId = 1;
+    required string hostAddress = 2;
+    required uint32 rpcPort = 3;
+    required uint32 ratisPort = 4;
+    required string httpAddr = 5;
+    required string httpsAddr = 6;
+    optional string serviceId = 7;
+}
+
+enum BootstrapErrorCode {
+    RATIS_NOT_ENABLED = 1;
+    LEADER_UNDETERMINED = 2;
+    RATIS_BOOTSTRAP_ERROR = 3;
+}
+
+message BootstrapRequest {

Review comment:
       Done.

##########
File path: hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
##########
@@ -1203,11 +1203,41 @@ message UpdateGetS3SecretRequest {
     required string awsSecret = 2;
 }
 
+message OMNodeInfo {
+    required string nodeId = 1;
+    required string hostAddress = 2;
+    required uint32 rpcPort = 3;

Review comment:
       Done.




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