HADOOP-8143. Change distcp to have -pb on by default. Contributed by Mithun Radhakrishnan

This commit is contained in:
Jason Lowe 2017-06-20 09:53:47 -05:00
parent 8c0769dee4
commit dd65eea74b
2 changed files with 4 additions and 1 deletions

View File

@ -187,6 +187,9 @@ public static DistCpOptions parse(String[] args)
if (command.hasOption(DistCpOptionSwitch.PRESERVE_STATUS.getSwitch())) { if (command.hasOption(DistCpOptionSwitch.PRESERVE_STATUS.getSwitch())) {
builder.preserve( builder.preserve(
getVal(command, DistCpOptionSwitch.PRESERVE_STATUS.getSwitch())); getVal(command, DistCpOptionSwitch.PRESERVE_STATUS.getSwitch()));
} else {
// No "preserve" settings specified. Preserve block-size.
builder.preserve(DistCpOptions.FileAttribute.BLOCKSIZE);
} }
if (command.hasOption(DistCpOptionSwitch.FILE_LIMIT.getSwitch())) { if (command.hasOption(DistCpOptionSwitch.FILE_LIMIT.getSwitch())) {

View File

@ -413,7 +413,7 @@ public void testPreserve() {
"-f", "-f",
"hdfs://localhost:9820/source/first", "hdfs://localhost:9820/source/first",
"hdfs://localhost:9820/target/"}); "hdfs://localhost:9820/target/"});
Assert.assertFalse(options.shouldPreserve(FileAttribute.BLOCKSIZE)); Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION)); Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION)); Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
Assert.assertFalse(options.shouldPreserve(FileAttribute.USER)); Assert.assertFalse(options.shouldPreserve(FileAttribute.USER));