[
https://issues.apache.org/jira/browse/HDDS-2240?focusedWorklogId=323157&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-323157
]
ASF GitHub Bot logged work on HDDS-2240:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Oct/19 02:58
Start Date: 04/Oct/19 02:58
Worklog Time Spent: 10m
Work Description: dineshchitlangia commented on 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=<OMServiceID>",
+ 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<String, String> 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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 323157)
Time Spent: 50m (was: 40m)
> Command line tool for OM HA
> ---------------------------
>
> Key: HDDS-2240
> URL: https://issues.apache.org/jira/browse/HDDS-2240
> Project: Hadoop Distributed Data Store
> Issue Type: Sub-task
> Reporter: Hanisha Koneru
> Assignee: Hanisha Koneru
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> A command line tool (*ozone omha*) to get information related to OM HA.
> This Jira proposes to add the _getServiceState_ option for OM HA which lists
> all the OMs in the service and their corresponding Ratis server roles
> (LEADER/ FOLLOWER).
> We can later add more options to this tool.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]