Tejaskriya commented on code in PR #6083:
URL: https://github.com/apache/ozone/pull/6083#discussion_r1470631438
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DecommissionStatusSubCommand.java:
##########
@@ -94,4 +133,95 @@ private void printDetails(DatanodeDetails datanode) {
" (" + datanode.getNetworkLocation() + "/" + datanode.getIpAddress()
+ "/" + datanode.getHostName() + ")");
}
+ private void printCounts(DatanodeDetails datanode, Map<String, Object>
counts, int numDecomNodes) {
+ try {
+ for (int i = 1; i <= numDecomNodes; i++) {
+ if (datanode.getHostName().equals(counts.get("tag.datanode." + i))) {
+ int pipelines = ((Double)counts.get("PipelinesWaitingToCloseDN." +
i)).intValue();
+ int underReplicated = ((Double)counts.get("UnderReplicatedDN." +
i)).intValue();
+ int unclosed = ((Double)counts.get("UnclosedContainersDN." +
i)).intValue();
+ long startTime = ((Double)counts.get("StartTimeDN." +
i)).longValue();
+ System.out.print("Decommission started at : ");
+ Date date = new Date(startTime);
+ DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss z");
+ System.out.println(formatter.format(date));
+ System.out.println("No. of Pipelines: " + pipelines);
+ System.out.println("No. of UnderReplicated containers: " +
underReplicated);
+ System.out.println("No. of Unclosed Containers: " + unclosed);
+ return;
+ }
+ }
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ } catch (NullPointerException ex) {
+ System.err.println("Error getting pipeline and container counts for " +
datanode.getHostName());
+ }
+ }
+
+ private Map<String, Object> getCounts() {
+ Map<String, Object> finalResult = new HashMap<>();
+ try {
+ StringBuffer url = new StringBuffer();
+ final OzoneConfiguration ozoneConf = parent
+ .getParent()
+ .getParent()
+ .getOzoneConf();
+ final String protocol;
+ final URLConnectionFactory connectionFactory =
URLConnectionFactory.newDefaultURLConnectionFactory(ozoneConf);
+ final HttpConfig.Policy webPolicy = getHttpPolicy(ozoneConf);
+ String host;
+ InputStream inputStream;
+ int errorCode;
+
+ if (webPolicy.isHttpsEnabled()) {
+ protocol = HTTPS_SCHEME;
+ host = ozoneConf.get(OZONE_SCM_HTTPS_ADDRESS_KEY,
+ OZONE_SCM_HTTP_BIND_HOST_DEFAULT +
OZONE_SCM_HTTPS_BIND_PORT_DEFAULT);
+ url.append(protocol).append("://").append(host).append("/jmx")
+
.append("?qry=Hadoop:service=StorageContainerManager,name=NodeDecommissionMetrics");
+
+ HttpsURLConnection httpsURLConnection = (HttpsURLConnection)
connectionFactory
+ .openConnection(new URL(url.toString()));
+ httpsURLConnection.connect();
+ errorCode = httpsURLConnection.getResponseCode();
+ inputStream = httpsURLConnection.getInputStream();
+ } else {
+ protocol = HTTP_SCHEME;
+ host = ozoneConf.get(OZONE_SCM_HTTP_ADDRESS_KEY,
+ OZONE_SCM_HTTP_BIND_HOST_DEFAULT +
OZONE_SCM_HTTP_BIND_PORT_DEFAULT);
Review Comment:
Oh that's right, Thanks for catching that! I have fixed it now
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]