[GitHub] [hadoop] dineshchitlangia commented on a change in pull request #1586: HDDS-2240. Command line tool for OM HA.

2019-10-03 Thread GitBox
dineshchitlangia commented on a change in pull request #1586: HDDS-2240. 
Command line tool for OM HA.
URL: https://github.com/apache/hadoop/pull/1586#discussion_r331326857
 
 

 ##
 File path: hadoop-ozone/common/src/main/bin/ozone
 ##
 @@ -55,6 +55,7 @@ function hadoop_usage
   hadoop_add_subcommand "version" client "print the version"
   hadoop_add_subcommand "dtutil" client "operations related to delegation 
tokens"
   hadoop_add_subcommand "upgrade" client "HDFS to Ozone in-place upgrade tool"
+  hadoop_add_subcommand "omha" client "OM HA tool"
 
 Review comment:
   NIT: Have we named this command `omha` because we have plans in future to 
also add similar command for SCM?
   If not, how about naming the command as `haadmin` , `omadmin`, `admin`.
   Not a deal breaker but was just thinking if we can keep it similar to hdfs.


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


With regards,
Apache Git Services

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] dineshchitlangia commented on a change in pull request #1586: HDDS-2240. Command line tool for OM HA.

2019-10-03 Thread GitBox
dineshchitlangia commented on a change in pull request #1586: HDDS-2240. 
Command line tool for OM HA.
URL: https://github.com/apache/hadoop/pull/1586#discussion_r331325033
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerHA.java
 ##
 @@ -0,0 +1,76 @@
+package org.apache.hadoop.ozone.om;
+
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.tracing.TracingUtil;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
+import 
org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB;
+import org.apache.hadoop.security.UserGroupInformation;
+import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.apache.ratis.protocol.ClientId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * A command line tool for making calls in OM HA protocols.
+ */
+@Command(name = "ozone omha",
+hidden = true, description = "Command line tool for OM HA.",
+versionProvider = HddsVersionProvider.class,
+mixinStandardHelpOptions = true)
+public class OzoneManagerHA extends GenericCli {
+  private OzoneConfiguration conf;
+  private static final Logger LOG =
+  LoggerFactory.getLogger(OzoneManagerHA.class);
+
+  public static void main(String[] args) throws Exception {
+TracingUtil.initTracing("OzoneManager");
+new OzoneManagerHA().run(args);
+  }
+
+  private OzoneManagerHA() {
+super();
+  }
+
+  /**
+   * This function implements a sub-command to allow the OM to be
+   * initialized from the command line.
+   */
+  @CommandLine.Command(name = "--getservicestate",
+  customSynopsis = "ozone om [global options] --getservicestate " +
+  "--serviceId=",
+  hidden = false,
+  description = "Get the Ratis server state of all OMs belonging to given" 
+
+  " OM Service ID",
+  mixinStandardHelpOptions = true,
+  versionProvider = HddsVersionProvider.class)
+  public void getRoleInfoOm(@CommandLine.Option(names = { "--serviceId" },
+  description = "The OM Service ID of the OMs to get the server states 
for",
+  paramLabel = "id") String serviceId)
+  throws Exception {
+conf = createOzoneConfiguration();
+Map serviceStates = getServiceStates(conf, serviceId);
+for (String nodeId : serviceStates.keySet()) {
+  System.out.println(nodeId + " : " + serviceStates.get(nodeId));
+}
 
 Review comment:
   It will be better to use entrySet() instead of keySet() for performance as 
it would avoid the lookup on L61. Although this method will not be doing 
extensive amount of work, I believe it is still worth making this change.


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


With regards,
Apache Git Services

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] dineshchitlangia commented on a change in pull request #1586: HDDS-2240. Command line tool for OM HA.

2019-10-03 Thread GitBox
dineshchitlangia commented on a change in pull request #1586: HDDS-2240. 
Command line tool for OM HA.
URL: https://github.com/apache/hadoop/pull/1586#discussion_r331325219
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerHA.java
 ##
 @@ -0,0 +1,76 @@
+package org.apache.hadoop.ozone.om;
+
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.tracing.TracingUtil;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
+import 
org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB;
+import org.apache.hadoop.security.UserGroupInformation;
+import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.apache.ratis.protocol.ClientId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * A command line tool for making calls in OM HA protocols.
+ */
+@Command(name = "ozone omha",
+hidden = true, description = "Command line tool for OM HA.",
+versionProvider = HddsVersionProvider.class,
+mixinStandardHelpOptions = true)
+public class OzoneManagerHA extends GenericCli {
 
 Review comment:
   Declare this class as final.


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


With regards,
Apache Git Services

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] dineshchitlangia commented on a change in pull request #1586: HDDS-2240. Command line tool for OM HA.

2019-10-03 Thread GitBox
dineshchitlangia commented on a change in pull request #1586: HDDS-2240. 
Command line tool for OM HA.
URL: https://github.com/apache/hadoop/pull/1586#discussion_r331325033
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerHA.java
 ##
 @@ -0,0 +1,76 @@
+package org.apache.hadoop.ozone.om;
+
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.tracing.TracingUtil;
+import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
+import 
org.apache.hadoop.ozone.om.protocolPB.OzoneManagerProtocolClientSideTranslatorPB;
+import org.apache.hadoop.security.UserGroupInformation;
+import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.apache.ratis.protocol.ClientId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.IOException;
+import java.util.Map;
+
+
+/**
+ * A command line tool for making calls in OM HA protocols.
+ */
+@Command(name = "ozone omha",
+hidden = true, description = "Command line tool for OM HA.",
+versionProvider = HddsVersionProvider.class,
+mixinStandardHelpOptions = true)
+public class OzoneManagerHA extends GenericCli {
+  private OzoneConfiguration conf;
+  private static final Logger LOG =
+  LoggerFactory.getLogger(OzoneManagerHA.class);
+
+  public static void main(String[] args) throws Exception {
+TracingUtil.initTracing("OzoneManager");
+new OzoneManagerHA().run(args);
+  }
+
+  private OzoneManagerHA() {
+super();
+  }
+
+  /**
+   * This function implements a sub-command to allow the OM to be
+   * initialized from the command line.
+   */
+  @CommandLine.Command(name = "--getservicestate",
+  customSynopsis = "ozone om [global options] --getservicestate " +
+  "--serviceId=",
+  hidden = false,
+  description = "Get the Ratis server state of all OMs belonging to given" 
+
+  " OM Service ID",
+  mixinStandardHelpOptions = true,
+  versionProvider = HddsVersionProvider.class)
+  public void getRoleInfoOm(@CommandLine.Option(names = { "--serviceId" },
+  description = "The OM Service ID of the OMs to get the server states 
for",
+  paramLabel = "id") String serviceId)
+  throws Exception {
+conf = createOzoneConfiguration();
+Map serviceStates = getServiceStates(conf, serviceId);
+for (String nodeId : serviceStates.keySet()) {
+  System.out.println(nodeId + " : " + serviceStates.get(nodeId));
+}
 
 Review comment:
   It will be better to use entrySet() instead of keySet() for performance. 
Although this method will not be doing extensive amount of work, I believe it 
is still worth making this change.


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


With regards,
Apache Git Services

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org