You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ae...@apache.org on 2016/06/10 02:47:22 UTC
[2/2] hadoop git commit: HDFS-10501. DiskBalancer: Use the default
datanode port if port is not provided. Contributed by Anu Engineer.
HDFS-10501. DiskBalancer: Use the default datanode port if port is not provided. Contributed by Anu Engineer.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4f6fe511
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4f6fe511
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4f6fe511
Branch: refs/heads/HDFS-1312
Commit: 4f6fe511cf6cc85a4916a6add87cd9f0bc295cdc
Parents: 82de3d3
Author: Anu Engineer <ae...@apache.org>
Authored: Thu Jun 9 19:47:01 2016 -0700
Committer: Anu Engineer <ae...@apache.org>
Committed: Thu Jun 9 19:47:01 2016 -0700
----------------------------------------------------------------------
.../server/diskbalancer/command/QueryCommand.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/4f6fe511/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/QueryCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/QueryCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/QueryCommand.java
index 36448b8..ea7dbcc 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/QueryCommand.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/QueryCommand.java
@@ -22,10 +22,12 @@ package org.apache.hadoop.hdfs.server.diskbalancer.command;
import com.google.common.base.Preconditions;
import org.apache.commons.cli.CommandLine;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol;
import org.apache.hadoop.hdfs.server.datanode.DiskBalancerWorkStatus;
import org.apache.hadoop.hdfs.server.diskbalancer.DiskBalancerException;
import org.apache.hadoop.hdfs.tools.DiskBalancer;
+import org.apache.hadoop.net.NetUtils;
/**
* Gets the current status of disk balancer command.
@@ -55,10 +57,22 @@ public class QueryCommand extends Command {
verifyCommandOptions(DiskBalancer.QUERY, cmd);
String nodeName = cmd.getOptionValue(DiskBalancer.QUERY);
Preconditions.checkNotNull(nodeName);
- ClientDatanodeProtocol dataNode = getDataNodeProxy(nodeName);
+ nodeName = nodeName.trim();
+ String nodeAddress = nodeName;
+
+ // if the string is not name:port format use the default port.
+ if(!nodeName.matches("^.*:\\d$")) {
+ int defaultIPC = NetUtils.createSocketAddr(
+ getConf().getTrimmed(DFSConfigKeys.DFS_DATANODE_IPC_ADDRESS_KEY,
+ DFSConfigKeys.DFS_DATANODE_IPC_ADDRESS_DEFAULT)).getPort();
+ nodeAddress = nodeName + ":" + defaultIPC;
+ LOG.debug("Using default data node port : {}", nodeAddress);
+ }
+
+ ClientDatanodeProtocol dataNode = getDataNodeProxy(nodeAddress);
try {
DiskBalancerWorkStatus workStatus = dataNode.queryDiskBalancerPlan();
- System.out.printf("Plan ID: %s Result: %s%n", workStatus.getPlanID(),
+ System.out.printf("Plan ID: %s %nResult: %s%n", workStatus.getPlanID(),
workStatus.getResult().toString());
if(cmd.hasOption(DiskBalancer.VERBOSE)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org