From c48ed3e96c8e97d888d1af6175c9ec4521503539 Mon Sep 17 00:00:00 2001 From: sreeb-msft <111426823+sreeb-msft@users.noreply.github.com> Date: Fri, 2 Sep 2022 17:03:12 +0530 Subject: [PATCH] HADOOP-18408. ABFS: ITestAbfsManifestCommitProtocol fails on nonHNS configuration (#4758) ITestAbfsManifestCommitProtocol to set requireRenameResilience to false for nonHNS configuration (#4758) Contributed by Sree Bhattacharyya --- .../committer/manifest/TestRenameStageFailure.java | 2 +- .../fs/azurebfs/AbstractAbfsIntegrationTest.java | 12 +++++++++++- .../commit/ITestAbfsRenameStageFailure.java | 13 ++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/committer/manifest/TestRenameStageFailure.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/committer/manifest/TestRenameStageFailure.java index b794f5814d..11d2beda5d 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/committer/manifest/TestRenameStageFailure.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/lib/output/committer/manifest/TestRenameStageFailure.java @@ -115,7 +115,7 @@ public void setup() throws Exception { * Does this test suite require rename resilience in the store/FS? * @return true if the store operations are resilient. */ - protected boolean requireRenameResilience() { + protected boolean requireRenameResilience() throws IOException { return false; } diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java index 4a5507526c..2c99267d91 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java @@ -149,6 +149,17 @@ protected boolean getIsNamespaceEnabled(AzureBlobFileSystem fs) return fs.getIsNamespaceEnabled(getTestTracingContext(fs, false)); } + public static TracingContext getSampleTracingContext(AzureBlobFileSystem fs, + boolean needsPrimaryReqId) { + String correlationId, fsId; + TracingHeaderFormat format; + correlationId = "test-corr-id"; + fsId = "test-filesystem-id"; + format = TracingHeaderFormat.ALL_ID_FORMAT; + return new TracingContext(correlationId, fsId, + FSOperationType.TEST_OP, needsPrimaryReqId, format, null); + } + public TracingContext getTestTracingContext(AzureBlobFileSystem fs, boolean needsPrimaryReqId) { String correlationId, fsId; @@ -167,7 +178,6 @@ public TracingContext getTestTracingContext(AzureBlobFileSystem fs, FSOperationType.TEST_OP, needsPrimaryReqId, format, null); } - @Before public void setup() throws Exception { //Create filesystem first to make sure getWasbFileSystem() can return an existing filesystem. diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/commit/ITestAbfsRenameStageFailure.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/commit/ITestAbfsRenameStageFailure.java index 5547d081c9..6b9830e8f3 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/commit/ITestAbfsRenameStageFailure.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/commit/ITestAbfsRenameStageFailure.java @@ -19,11 +19,13 @@ package org.apache.hadoop.fs.azurebfs.commit; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.azurebfs.AbstractAbfsIntegrationTest; +import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem; import org.apache.hadoop.fs.azurebfs.contract.ABFSContractTestBinding; import org.apache.hadoop.fs.azurebfs.contract.AbfsFileSystemContract; +import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AzureBlobFileSystemException; import org.apache.hadoop.fs.contract.AbstractFSContract; import org.apache.hadoop.mapreduce.lib.output.committer.manifest.TestRenameStageFailure; - /** * Rename failure logic on ABFS. * This will go through the resilient rename operation. @@ -41,6 +43,11 @@ public ITestAbfsRenameStageFailure() throws Exception { binding = new ABFSContractTestBinding(); } + protected boolean isNamespaceEnabled() throws AzureBlobFileSystemException { + AzureBlobFileSystem fs = (AzureBlobFileSystem) getFileSystem(); + return fs.getAbfsStore().getIsNamespaceEnabled(AbstractAbfsIntegrationTest.getSampleTracingContext(fs, false)); + } + @Override public void setup() throws Exception { binding.setup(); @@ -58,8 +65,8 @@ protected AbstractFSContract createContract(final Configuration conf) { } @Override - protected boolean requireRenameResilience() { - return true; + protected boolean requireRenameResilience() throws AzureBlobFileSystemException { + return isNamespaceEnabled(); } @Override