From 416c7ded543316b3d9997705f09bf2ed05946a95 Mon Sep 17 00:00:00 2001 From: Robert Joseph Evans Date: Mon, 12 Nov 2012 22:43:07 +0000 Subject: [PATCH] HADOOP-9022. Hadoop distcp tool fails to copy file if -m 0 specified (Jonathan Eagles vai bobby) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1408488 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/tools/DistCpOptions.java | 2 +- .../java/org/apache/hadoop/tools/TestOptionsParser.java | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 2975033312..bb999f2273 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -1143,6 +1143,9 @@ Release 0.23.5 - UNRELEASED HADOOP-8986. Server$Call object is never released after it is sent (bobby) + HADOOP-9022. Hadoop distcp tool fails to copy file if -m 0 specified + (Jonathan Eagles vai bobby) + Release 0.23.4 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java index 87c3e8a1d5..f605767e1c 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java @@ -274,7 +274,7 @@ public int getMaxMaps() { * @param maxMaps - Number of maps */ public void setMaxMaps(int maxMaps) { - this.maxMaps = maxMaps; + this.maxMaps = Math.max(maxMaps, 1); } /** Get the map bandwidth in MB diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestOptionsParser.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestOptionsParser.java index 5ab345c724..fb6e29212e 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestOptionsParser.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestOptionsParser.java @@ -275,6 +275,13 @@ public void testParseMaps() { "hdfs://localhost:8020/target/"}); Assert.assertEquals(options.getMaxMaps(), 1); + options = OptionsParser.parse(new String[] { + "-m", + "0", + "hdfs://localhost:8020/source/first", + "hdfs://localhost:8020/target/"}); + Assert.assertEquals(options.getMaxMaps(), 1); + try { OptionsParser.parse(new String[] { "-m",