-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19595. ABFS: AbfsConfiguration should store account type information (HNS or FNS) #7765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
37d6a1e
179a18e
8e13f7b
ad210ef
fd0d14e
fa95fcf
71c8148
c4703b2
67c1562
5eb0616
6032492
ef93413
0b909fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,7 @@ | |
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidFileSystemPropertyException; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidUriException; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.SASTokenProviderException; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.TrileanConversionException; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.services.AppendRequestParameters; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.services.AzureServiceErrorCode; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.services.ListResultEntrySchema; | ||
|
|
@@ -196,7 +197,6 @@ public abstract class AbfsClient implements Closeable { | |
| private KeepAliveCache keepAliveCache; | ||
|
|
||
| private AbfsApacheHttpClient abfsApacheHttpClient; | ||
| private static boolean isNamespaceEnabled = false; | ||
|
|
||
| /** | ||
| * logging the rename failure if metadata is in an incomplete state. | ||
|
|
@@ -442,7 +442,7 @@ protected List<AbfsHttpHeader> createCommonHeaders(ApiVersion xMsVersion) { | |
| requestHeaders.add(new AbfsHttpHeader(X_MS_VERSION, xMsVersion.toString())); | ||
| requestHeaders.add(new AbfsHttpHeader(ACCEPT_CHARSET, UTF_8)); | ||
| requestHeaders.add(new AbfsHttpHeader(CONTENT_TYPE, EMPTY_STRING)); | ||
| requestHeaders.add(new AbfsHttpHeader(USER_AGENT, userAgent)); | ||
| requestHeaders.add(new AbfsHttpHeader(USER_AGENT, getUserAgent())); | ||
| return requestHeaders; | ||
| } | ||
|
|
||
|
|
@@ -1322,8 +1322,9 @@ String initializeUserAgent(final AbfsConfiguration abfsConfiguration, | |
| sb.append(abfsConfiguration.getClusterType()); | ||
|
|
||
| // Add a unique identifier in FNS-Blob user agent string | ||
| if (!getIsNamespaceEnabled() | ||
| && abfsConfiguration.getFsConfiguredServiceType() == BLOB) { | ||
| // Current filesystem init restricts HNS-Blob combination | ||
| // so namespace check not required. | ||
| if (BLOB == abfsConfiguration.getFsConfiguredServiceType()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was the FNS check removed ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, we only support FNS over Blob endpoint. HNS-Blob will fail during init only.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense |
||
| sb.append(SEMICOLON) | ||
| .append(SINGLE_WHITE_SPACE) | ||
| .append(FNS_BLOB_USER_AGENT_IDENTIFIER); | ||
|
|
@@ -1726,18 +1727,15 @@ protected String getUserAgent() { | |
| * Checks if the namespace is enabled. | ||
| * | ||
| * @return True if the namespace is enabled, false otherwise. | ||
| * @throws AzureBlobFileSystemException if the conversion fails. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be AbfsDriverException?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AzureBlobFileSystemException is parent of AbfsDriverException, so fine to throw it like this, |
||
| */ | ||
| public static boolean getIsNamespaceEnabled() { | ||
| return isNamespaceEnabled; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the namespace enabled status. | ||
| * | ||
| * @param namespaceEnabled True to enable the namespace, false to disable it. | ||
| */ | ||
| public static void setIsNamespaceEnabled(final boolean namespaceEnabled) { | ||
| isNamespaceEnabled = namespaceEnabled; | ||
| public boolean getIsNamespaceEnabled() throws AzureBlobFileSystemException { | ||
| try { | ||
| return getAbfsConfiguration().getIsNamespaceEnabledAccount().toBoolean(); | ||
| } catch (TrileanConversionException ex) { | ||
| LOG.error("Failed to convert namespace enabled account property to boolean", ex); | ||
| throw new AbfsDriverException("Failed to determine account type", ex); | ||
| } | ||
| } | ||
|
|
||
| protected boolean isRenameResilience() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use true false variable from AbfsHttpConstants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the boolean value, don't think we need to get it from AbfsHttpConstants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional as you mentioned.