Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();
Expand All @@ -58,8 +65,8 @@ protected AbstractFSContract createContract(final Configuration conf) {
}

@Override
protected boolean requireRenameResilience() {
return true;
protected boolean requireRenameResilience() throws AzureBlobFileSystemException {
return isNamespaceEnabled();
}

@Override
Expand Down