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/04/05 21:31:18 UTC
[45/50] [abbrv] hadoop git commit: HDFS-10239. Fsshell mv fails if
port usage doesn't match in src and destination paths. Contributed by Kuhu
Shukla.
HDFS-10239. Fsshell mv fails if port usage doesn't match in src and destination paths. Contributed by Kuhu Shukla.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/91746450
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/91746450
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/91746450
Branch: refs/heads/HDFS-1312
Commit: 917464505c0e930ebeb4c775d829e51c56a48686
Parents: 6be28bc
Author: Kihwal Lee <ki...@apache.org>
Authored: Tue Apr 5 09:07:24 2016 -0500
Committer: Kihwal Lee <ki...@apache.org>
Committed: Tue Apr 5 09:07:24 2016 -0500
----------------------------------------------------------------------
.../apache/hadoop/fs/shell/MoveCommands.java | 6 +++-
.../org/apache/hadoop/hdfs/TestDFSShell.java | 31 ++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/91746450/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java
index 02a3b25..d359282 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/MoveCommands.java
@@ -100,7 +100,11 @@ class MoveCommands {
@Override
protected void processPath(PathData src, PathData target) throws IOException {
- if (!src.fs.getUri().equals(target.fs.getUri())) {
+ String srcUri = src.fs.getUri().getScheme() + "://" +
+ src.fs.getUri().getHost();
+ String dstUri = target.fs.getUri().getScheme() + "://" +
+ target.fs.getUri().getHost();
+ if (!srcUri.equals(dstUri)) {
throw new PathIOException(src.toString(),
"Does not match target filesystem");
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/91746450/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
index 41cd5c0..b75ac11 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java
@@ -559,6 +559,37 @@ public class TestDFSShell {
}
}
+ @Test
+ public void testMoveWithTargetPortEmpty() throws Exception {
+ Configuration conf = new HdfsConfiguration();
+ MiniDFSCluster cluster = null;
+ try {
+ cluster = new MiniDFSCluster.Builder(conf)
+ .format(true)
+ .numDataNodes(2)
+ .nameNodePort(8020)
+ .waitSafeMode(true)
+ .build();
+ FileSystem srcFs = cluster.getFileSystem();
+ FsShell shell = new FsShell();
+ shell.setConf(conf);
+ String[] argv = new String[2];
+ argv[0] = "-mkdir";
+ argv[1] = "/testfile";
+ ToolRunner.run(shell, argv);
+ argv = new String[3];
+ argv[0] = "-mv";
+ argv[1] = srcFs.getUri() + "/testfile";
+ argv[2] = "hdfs://localhost/testfile2";
+ int ret = ToolRunner.run(shell, argv);
+ assertEquals("mv should have succeeded", 0, ret);
+ } finally {
+ if (cluster != null) {
+ cluster.shutdown();
+ }
+ }
+ }
+
@Test (timeout = 30000)
public void testURIPaths() throws Exception {
Configuration srcConf = new HdfsConfiguration();