Skip to content

Commit

Permalink
HADOOP-18269. Misleading method name in DistCpOptions.(#4216)
Browse files Browse the repository at this point in the history
Contributed by guophilipse
  • Loading branch information
GuoPhilipse authored May 30, 2022
1 parent 835f39c commit ba6520f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,28 @@ public Builder withAppend(boolean newAppend) {
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) {
this.skipCRC = newSkipCRC;
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) {
this.blocking = newBlocking;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static DistCpOptions parse(String[] args)
command.hasOption(DistCpOptionSwitch.OVERWRITE.getSwitch()))
.withAppend(
command.hasOption(DistCpOptionSwitch.APPEND.getSwitch()))
.withCRC(
.withSkipCRC(
command.hasOption(DistCpOptionSwitch.SKIP_CRC.getSwitch()))
.withBlocking(
!command.hasOption(DistCpOptionSwitch.BLOCKING.getSwitch()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testSetSkipCRC() {
new Path("hdfs://localhost:8020/target/"));
Assert.assertFalse(builder.build().shouldSkipCRC());

final DistCpOptions options = builder.withSyncFolder(true).withCRC(true)
final DistCpOptions options = builder.withSyncFolder(true).withSkipCRC(true)
.build();
Assert.assertTrue(options.shouldSyncFolder());
Assert.assertTrue(options.shouldSkipCRC());
Expand Down Expand Up @@ -391,7 +391,7 @@ public void testAppendOption() {
new Path("hdfs://localhost:8020/target/"))
.withSyncFolder(true)
.withAppend(true)
.withCRC(true)
.withSkipCRC(true)
.build();
fail("Append should fail if skipCrc option is specified");
} catch (IllegalArgumentException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private Job distCpUpdate(final Path srcDir, final Path destDir)
Collections.singletonList(srcDir), destDir)
.withDeleteMissing(true)
.withSyncFolder(true)
.withCRC(true)
.withSkipCRC(true)
.withDirectWrite(shouldUseDirectWrite())
.withOverwrite(false)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ private void testCommitWithChecksumMismatch(boolean skipCrc)
Collections.singletonList(new Path(sourceBase)),
new Path("/out"))
.withBlocksPerChunk(blocksPerChunk)
.withCRC(skipCrc)
.withSkipCRC(skipCrc)
.build();
options.appendToConf(conf);
conf.setBoolean(
Expand Down

0 comments on commit ba6520f

Please sign in to comment.