-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Open
bhattmanish98
wants to merge
13
commits into
apache:trunk
Choose a base branch
from
ABFSDriver:HADOOP-19595
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+217
−70
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
37d6a1e
Moved namespace details to configuration class
bhattmanish98 179a18e
Moved Testcase to namespace test class
bhattmanish98 8e13f7b
Test cases fixes
bhattmanish98 ad210ef
Add Asserts in test case
bhattmanish98 fd0d14e
Changes based on PR review
bhattmanish98 fa95fcf
Error fixes
bhattmanish98 71c8148
Merge branch 'trunk' of https://github.com/ABFSDriver/AbfsHadoop into…
bhattmanish98 c4703b2
Pulled latest trunk changes
bhattmanish98 67c1562
Merge branch 'trunk' of https://github.com/ABFSDriver/AbfsHadoop into…
bhattmanish98 5eb0616
Change Account details in test class
bhattmanish98 6032492
Required comments added
bhattmanish98 ef93413
removed unused import
bhattmanish98 0b909fd
Commit to retrigger yetus build
bhattmanish98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,9 +66,11 @@ | |
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AbfsRestOperationException; | ||
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.AzureBlobFileSystemException; | ||
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidAbfsRestOperationException; | ||
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidConfigurationValueException; | ||
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 +198,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 +443,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 +1323,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 (abfsConfiguration.getFsConfiguredServiceType() == BLOB) { | ||
sb.append(SEMICOLON) | ||
.append(SINGLE_WHITE_SPACE) | ||
.append(FNS_BLOB_USER_AGENT_IDENTIFIER); | ||
|
@@ -1724,20 +1726,20 @@ protected String getUserAgent() { | |
|
||
/** | ||
* Checks if the namespace is enabled. | ||
* Filesystem init will fail if namespace is not correctly configured, | ||
* so instead of swallowing the exception, we should throw the exception | ||
* in case namespace is not configured correctly. | ||
* | ||
* @return True if the namespace is enabled, false otherwise. | ||
* @throws AzureBlobFileSystemException if the conversion fails. | ||
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? 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 InvalidConfigurationValueException("Failed to determine account type", ex); | ||
} | ||
} | ||
|
||
protected boolean isRenameResilience() { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.