HADOOP-8775. MR2 distcp permits non-positive value to -bandwidth option which causes job never to complete. Contributed by Sandy Ryza.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1382121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2cdffe63d5
commit
ee6d9ff79d
|
@ -269,6 +269,9 @@ Release 2.0.1-alpha - UNRELEASED
|
|||
HADOOP-8431. Running distcp wo args throws IllegalArgumentException.
|
||||
(Sandy Ryza via eli)
|
||||
|
||||
HADOOP-8775. MR2 distcp permits non-positive value to -bandwidth option
|
||||
which causes job never to complete. (Sandy Ryza via atm)
|
||||
|
||||
BREAKDOWN OF HDFS-3042 SUBTASKS
|
||||
|
||||
HADOOP-8220. ZKFailoverController doesn't handle failure to become active
|
||||
|
|
|
@ -156,6 +156,10 @@ public class OptionsParser {
|
|||
try {
|
||||
Integer mapBandwidth = Integer.parseInt(
|
||||
getVal(command, DistCpOptionSwitch.BANDWIDTH.getSwitch()).trim());
|
||||
if (mapBandwidth.intValue() <= 0) {
|
||||
throw new IllegalArgumentException("Bandwidth specified is not positive: " +
|
||||
mapBandwidth);
|
||||
}
|
||||
option.setMapBandwidth(mapBandwidth);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("Bandwidth specified is invalid: " +
|
||||
|
|
|
@ -111,6 +111,24 @@ public class TestOptionsParser {
|
|||
Assert.assertEquals(options.getMapBandwidth(), 11);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testParseNonPositiveBandwidth() {
|
||||
OptionsParser.parse(new String[] {
|
||||
"-bandwidth",
|
||||
"-11",
|
||||
"hdfs://localhost:8020/source/first",
|
||||
"hdfs://localhost:8020/target/"});
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testParseZeroBandwidth() {
|
||||
OptionsParser.parse(new String[] {
|
||||
"-bandwidth",
|
||||
"0",
|
||||
"hdfs://localhost:8020/source/first",
|
||||
"hdfs://localhost:8020/target/"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSkipCRC() {
|
||||
DistCpOptions options = OptionsParser.parse(new String[] {
|
||||
|
|
Loading…
Reference in New Issue