This is an automated email from the ASF dual-hosted git repository. stevel pushed a commit to branch branch-3.2 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push: new 1d4390e HADOOP-16044. ABFS: Better exception handling of DNS errors followup 1d4390e is described below commit 1d4390e16b05eec3e985df05ee3378501ea4bc4d Author: Da Zhou <da.z...@microsoft.com> AuthorDate: Mon Jan 14 19:45:30 2019 +0000 HADOOP-16044. ABFS: Better exception handling of DNS errors followup Contributed by Da Zhou. (cherry picked from commit 30863c5ae3a7ad69b6b4853bad2e8f22c7c67639) --- .../hadoop/fs/azurebfs/services/AbfsRestOperation.java | 14 ++++---------- .../org/apache/hadoop/fs/azurebfs/ITestAbfsClient.java | 8 ++++++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsRestOperation.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsRestOperation.java index 3761f4d..fa8f742 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsRestOperation.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsRestOperation.java @@ -34,8 +34,6 @@ import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidAbfsRestOperati import org.apache.hadoop.fs.azurebfs.constants.HttpHeaderConfigurations; import org.apache.hadoop.fs.azurebfs.oauth2.AzureADAuthenticator.HttpException; -import static org.apache.hadoop.fs.azurebfs.contracts.services.AzureServiceErrorCode.UNKNOWN; - /** * The AbfsRestOperation for Rest AbfsClient. */ @@ -169,6 +167,10 @@ public class AbfsRestOperation { httpOperation.processResponse(buffer, bufferOffset, bufferLength); } catch (IOException ex) { + if (ex instanceof UnknownHostException) { + LOG.warn(String.format("Unknown host name: %s. Retrying to resolve the host name...", httpOperation.getUrl().getHost())); + } + if (LOG.isDebugEnabled()) { if (httpOperation != null) { LOG.debug("HttpRequestFailure: " + httpOperation.toString(), ex); @@ -177,14 +179,6 @@ public class AbfsRestOperation { } } - if (ex instanceof UnknownHostException) { - throw new AbfsRestOperationException( - UNKNOWN.getStatusCode(), - UNKNOWN.getErrorCode(), - String.format("Can not reach endpoint: %s, please check the account setting in configuration file", ex.getMessage()), - ex); - } - if (!client.getRetryPolicy().shouldRetry(retryCount, -1)) { throw new InvalidAbfsRestOperationException(ex); } diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsClient.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsClient.java index ddc1dce..bc05e7d 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsClient.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsClient.java @@ -21,6 +21,7 @@ package org.apache.hadoop.fs.azurebfs; import java.util.UUID; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.apache.hadoop.fs.FileSystem; @@ -55,8 +56,11 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest { } } + @Ignore("Enable this to verify the log warning message format for HostNotFoundException") @Test - public void verifyUnknownHost() throws Exception { + public void testUnknownHost() throws Exception { + // When hitting hostName not found exception, the retry will take about 14 mins until failed. + // This test is to verify that the "Unknown host name: %s. Retrying to resolve the host name..." is logged as warning during the retry. AbfsConfiguration conf = this.getConfiguration(); String accountName = this.getAccountName(); String fakeAccountName = "fake" + UUID.randomUUID() + accountName.substring(accountName.indexOf(".")); @@ -66,7 +70,7 @@ public final class ITestAbfsClient extends AbstractAbfsIntegrationTest { conf.set(FS_AZURE_ACCOUNT_KEY + "." + fakeAccountName, this.getAccountKey()); intercept(AbfsRestOperationException.class, - "Can not reach endpoint: " + fakeAccountName, + "UnknownHostException: " + fakeAccountName, () -> FileSystem.get(conf.getRawConfiguration())); } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org