Skip to content

Commit dd65eea

Browse files
committed
HADOOP-8143. Change distcp to have -pb on by default. Contributed by Mithun Radhakrishnan
1 parent 8c0769d commit dd65eea

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/OptionsParser.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ public static DistCpOptions parse(String[] args)
187187
if (command.hasOption(DistCpOptionSwitch.PRESERVE_STATUS.getSwitch())) {
188188
builder.preserve(
189189
getVal(command, DistCpOptionSwitch.PRESERVE_STATUS.getSwitch()));
190+
} else {
191+
// No "preserve" settings specified. Preserve block-size.
192+
builder.preserve(DistCpOptions.FileAttribute.BLOCKSIZE);
190193
}
191194

192195
if (command.hasOption(DistCpOptionSwitch.FILE_LIMIT.getSwitch())) {

hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestOptionsParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public void testPreserve() {
413413
"-f",
414414
"hdfs://localhost:9820/source/first",
415415
"hdfs://localhost:9820/target/"});
416-
Assert.assertFalse(options.shouldPreserve(FileAttribute.BLOCKSIZE));
416+
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
417417
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
418418
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
419419
Assert.assertFalse(options.shouldPreserve(FileAttribute.USER));

0 commit comments

Comments
 (0)