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
This commit is contained in:
Robert Joseph Evans 2012-11-12 22:43:07 +00:00
parent c1a2098304
commit 416c7ded54
3 changed files with 11 additions and 1 deletions

View File

@ -1143,6 +1143,9 @@ Release 0.23.5 - UNRELEASED
HADOOP-8986. Server$Call object is never released after it is sent (bobby) 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 Release 0.23.4 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -274,7 +274,7 @@ public class DistCpOptions {
* @param maxMaps - Number of maps * @param maxMaps - Number of maps
*/ */
public void setMaxMaps(int maxMaps) { public void setMaxMaps(int maxMaps) {
this.maxMaps = maxMaps; this.maxMaps = Math.max(maxMaps, 1);
} }
/** Get the map bandwidth in MB /** Get the map bandwidth in MB

View File

@ -275,6 +275,13 @@ public class TestOptionsParser {
"hdfs://localhost:8020/target/"}); "hdfs://localhost:8020/target/"});
Assert.assertEquals(options.getMaxMaps(), 1); 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 { try {
OptionsParser.parse(new String[] { OptionsParser.parse(new String[] {
"-m", "-m",