Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HADOOP-17628 change directWriteAlways() method to shouldUseDirectWrite()
Browse files Browse the repository at this point in the history
Change-Id: Ie64af6e109935243cd4c65454cf8ee66ec6fbf58
steveloughran committed Jul 30, 2021
1 parent de1cfdb commit 6e0e4d9
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ protected Configuration createConfiguration() {
}

@Override
protected boolean directWriteAlways() {
protected boolean shouldUseDirectWrite() {
return true;
}

Original file line number Diff line number Diff line change
@@ -350,7 +350,7 @@ private Job distCpUpdate(final Path srcDir, final Path destDir)
.withDeleteMissing(true)
.withSyncFolder(true)
.withCRC(true)
.withDirectWrite(directWriteAlways())
.withDirectWrite(shouldUseDirectWrite())
.withOverwrite(false)));
}

@@ -404,7 +404,7 @@ public void testTrackDeepDirectoryStructureToRemote() throws Exception {
inputDirUnderOutputDir)
.withTrackMissing(trackDir)
.withSyncFolder(true)
.withDirectWrite(directWriteAlways())
.withDirectWrite(shouldUseDirectWrite())
.withOverwrite(false)));

lsR("tracked udpate", remoteFS, destDir);
@@ -598,13 +598,13 @@ protected int getDefaultDistCPSizeKb() {
/**
* Executes DistCp and asserts that the job finished successfully.
* The choice of direct/indirect is based on the value of
* {@link #directWriteAlways()}.
* {@link #shouldUseDirectWrite()}.
* @param src source path
* @param dst destination path
* @throws Exception if there is a failure
*/
private void runDistCp(Path src, Path dst) throws Exception {
if (directWriteAlways()) {
if (shouldUseDirectWrite()) {
runDistCpDirectWrite(src, dst);
} else {
runDistCpWithRename(src, dst);
@@ -651,7 +651,7 @@ private static void mkdirs(FileSystem fs, Path dir) throws Exception {
@Test
public void testDirectWrite() throws Exception {
describe("copy file from local to remote using direct write option");
if (directWriteAlways()) {
if (shouldUseDirectWrite()) {
skip("not needed as all other tests use the -direct option.");
}
directWrite(localFS, localDir, remoteFS, remoteDir, true);
@@ -710,32 +710,32 @@ private int getTotalFiles() {
* false by default; enable for stores where rename is slow.
* @return true if direct write should be used in all tests.
*/
protected boolean directWriteAlways() {
protected boolean shouldUseDirectWrite() {
return false;
}

/**
* Return the default options for distcp, including,
* if {@link #directWriteAlways()} is true,
* if {@link #shouldUseDirectWrite()} is true,
* the -direct option.
* Append or prepend this to string CLIs.
* @return default options.
*/
protected String getDefaultCLIOptions() {
return directWriteAlways()
return shouldUseDirectWrite()
? " -direct "
: "";
}

/**
* Return the default options for distcp, including,
* if {@link #directWriteAlways()} is true,
* if {@link #shouldUseDirectWrite()} is true,
* the -direct option, null if there are no
* defaults.
* @return default options.
*/
protected String getDefaultCLIOptionsOrNull() {
return directWriteAlways()
return shouldUseDirectWrite()
? " -direct "
: null;
}

0 comments on commit 6e0e4d9

Please sign in to comment.