HADOOP-18269. Misleading method name in DistCpOptions.(#4216)

Contributed by guophilipse

Change-Id: I5e75d030406997339c20e970483825e529d9cd10
This commit is contained in:
GuoPhilipse 2022-05-30 21:02:47 +08:00 committed by Steve Loughran
parent 91f19bf8fa
commit dd9b8af9c4
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0
5 changed files with 22 additions and 5 deletions

View File

@ -669,11 +669,28 @@ public final class DistCpOptions {
return this; return this;
} }
/**
* whether builder with crc.
* @param newSkipCRC whether to skip crc check
* @return Builder object whether to skip crc check
* @deprecated Use {@link #withSkipCRC(boolean)} instead.
*/
@Deprecated
public Builder withCRC(boolean newSkipCRC) { public Builder withCRC(boolean newSkipCRC) {
this.skipCRC = newSkipCRC; this.skipCRC = newSkipCRC;
return this; return this;
} }
/**
* whether builder with crc.
* @param newSkipCRC whether to skip crc check
* @return Builder object whether to skip crc check
*/
public Builder withSkipCRC(boolean newSkipCRC) {
this.skipCRC = newSkipCRC;
return this;
}
public Builder withBlocking(boolean newBlocking) { public Builder withBlocking(boolean newBlocking) {
this.blocking = newBlocking; this.blocking = newBlocking;
return this; return this;

View File

@ -108,7 +108,7 @@ public class OptionsParser {
command.hasOption(DistCpOptionSwitch.OVERWRITE.getSwitch())) command.hasOption(DistCpOptionSwitch.OVERWRITE.getSwitch()))
.withAppend( .withAppend(
command.hasOption(DistCpOptionSwitch.APPEND.getSwitch())) command.hasOption(DistCpOptionSwitch.APPEND.getSwitch()))
.withCRC( .withSkipCRC(
command.hasOption(DistCpOptionSwitch.SKIP_CRC.getSwitch())) command.hasOption(DistCpOptionSwitch.SKIP_CRC.getSwitch()))
.withBlocking( .withBlocking(
!command.hasOption(DistCpOptionSwitch.BLOCKING.getSwitch())) !command.hasOption(DistCpOptionSwitch.BLOCKING.getSwitch()))

View File

@ -128,7 +128,7 @@ public class TestDistCpOptions {
new Path("hdfs://localhost:8020/target/")); new Path("hdfs://localhost:8020/target/"));
Assert.assertFalse(builder.build().shouldSkipCRC()); Assert.assertFalse(builder.build().shouldSkipCRC());
final DistCpOptions options = builder.withSyncFolder(true).withCRC(true) final DistCpOptions options = builder.withSyncFolder(true).withSkipCRC(true)
.build(); .build();
Assert.assertTrue(options.shouldSyncFolder()); Assert.assertTrue(options.shouldSyncFolder());
Assert.assertTrue(options.shouldSkipCRC()); Assert.assertTrue(options.shouldSkipCRC());
@ -391,7 +391,7 @@ public class TestDistCpOptions {
new Path("hdfs://localhost:8020/target/")) new Path("hdfs://localhost:8020/target/"))
.withSyncFolder(true) .withSyncFolder(true)
.withAppend(true) .withAppend(true)
.withCRC(true) .withSkipCRC(true)
.build(); .build();
fail("Append should fail if skipCrc option is specified"); fail("Append should fail if skipCrc option is specified");
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View File

@ -349,7 +349,7 @@ public abstract class AbstractContractDistCpTest
Collections.singletonList(srcDir), destDir) Collections.singletonList(srcDir), destDir)
.withDeleteMissing(true) .withDeleteMissing(true)
.withSyncFolder(true) .withSyncFolder(true)
.withCRC(true) .withSkipCRC(true)
.withDirectWrite(shouldUseDirectWrite()) .withDirectWrite(shouldUseDirectWrite())
.withOverwrite(false))); .withOverwrite(false)));
} }

View File

@ -536,7 +536,7 @@ public class TestCopyCommitter {
Collections.singletonList(new Path(sourceBase)), Collections.singletonList(new Path(sourceBase)),
new Path("/out")) new Path("/out"))
.withBlocksPerChunk(blocksPerChunk) .withBlocksPerChunk(blocksPerChunk)
.withCRC(skipCrc) .withSkipCRC(skipCrc)
.build(); .build();
options.appendToConf(conf); options.appendToConf(conf);
conf.setBoolean( conf.setBoolean(