From 6e0e4d90e9bc3864c73df95376f3af5056eb044b Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Fri, 30 Jul 2021 19:34:25 +0100 Subject: [PATCH] HADOOP-17628 change directWriteAlways() method to shouldUseDirectWrite() Change-Id: Ie64af6e109935243cd4c65454cf8ee66ec6fbf58 --- .../contract/s3a/ITestS3AContractDistCp.java | 2 +- .../contract/AbstractContractDistCpTest.java | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractDistCp.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractDistCp.java index 04fa94bf8623b..f4f5c176b37f8 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractDistCp.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractDistCp.java @@ -55,7 +55,7 @@ protected Configuration createConfiguration() { } @Override - protected boolean directWriteAlways() { + protected boolean shouldUseDirectWrite() { return true; } diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java index 736dfd592638c..04aeea665c244 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/contract/AbstractContractDistCpTest.java @@ -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; }