-
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
base: trunk
Are you sure you want to change the base?
Conversation
void setIsNamespaceEnabledAccount(String isNamespaceEnabledAccount) { | ||
this.isNamespaceEnabledAccount = isNamespaceEnabledAccount; | ||
public void setIsNamespaceEnabledAccount(Trilean isNamespaceEnabledAccount) { | ||
isNamespaceEnabled = isNamespaceEnabledAccount; |
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.
why did we remove the **this.**isNamespaceEnabled part?
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.
reverted this.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -443,7 +428,7 @@ private synchronized boolean getNamespaceEnabledInformationFromServer( | |||
*/ | |||
@VisibleForTesting | |||
boolean isNamespaceEnabled() throws TrileanConversionException { | |||
return this.isNamespaceEnabled.toBoolean(); | |||
return abfsConfiguration.getIsNamespaceEnabledAccount().toBoolean(); |
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.
here also should we have a try-catch block for TrileanConversionException like we have in AbfsClient-line 1722?
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 method should throw an exception if namespace enabled isn't initialized, so a try-catch block isn't necessary here.
* @throws Exception if any error occurs during configuration setup or evaluation | ||
*/ | ||
@Test | ||
public void testNameSpaceConfigNotSet() throws Exception { |
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.
Would it be better if we have a single test to verify the expected isnamespace enabled value for all 3 cases? We could set and reset the values along with the respective assertions
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.
Yaa, make sense. I can make it one and will write similar test to set the config from store.
* @throws Exception if any error occurs during configuration setup or evaluation | ||
*/ | ||
@Test | ||
public void testNameSpaceConfigNotSet() throws Exception { |
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.
Should we also test if setting and getting namespace enabled values from store and client level would point to abfsconfiguration class?
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.
There is already a test case ensureGetAclDetermineHnsStatusAccurately() for this, will add check on client's getIsNamespace as well in the same method.
* @throws Exception if any error occurs during configuration setup or evaluation | ||
*/ | ||
@Test | ||
public void testNameSpaceConfig() throws Exception { |
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.
Here also validate that client returns the same value as what is set in the config
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.
Added.
// In DFS endpoint, renamePath is O(1) API call and idempotency issue can happen. | ||
// For blob endpoint, client orchestrates the rename operation. | ||
assumeDfsServiceType(); | ||
AzureBlobFileSystem fs = getFileSystem(); | ||
Assume.assumeTrue(!getIsNamespaceEnabled(fs)); |
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 isHnsDisabled function
🎊 +1 overall
This message was automatically generated. |
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.
Code Changes looks good. Added a few comments.
One test sugestion. Even without any config present, just after the file system init without making any hdfs call, both store and client should be able to get the value of isNamespace enabled without an network calls
@@ -443,7 +428,7 @@ private synchronized boolean getNamespaceEnabledInformationFromServer( | |||
*/ | |||
@VisibleForTesting | |||
boolean isNamespaceEnabled() throws TrileanConversionException { | |||
return this.isNamespaceEnabled.toBoolean(); | |||
return abfsConfiguration.getIsNamespaceEnabledAccount().toBoolean(); |
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.
Better to use getter here and other places for abfsconfiguration. This will make sure same object is being referred everywhere and can easily be mocked if needed in future.
@@ -1525,8 +1529,8 @@ void setMaxBackoffIntervalMilliseconds(int maxBackoffInterval) { | |||
} | |||
|
|||
@VisibleForTesting | |||
void setIsNamespaceEnabledAccount(String isNamespaceEnabledAccount) { | |||
this.isNamespaceEnabledAccount = isNamespaceEnabledAccount; | |||
public void setIsNamespaceEnabledAccount(Trilean isNamespaceEnabledAccount) { |
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.
We should be setting this value on abfsconfiguration object only when we know the exact value. Do we really need this to be Trilean? I think we should pass the definitive argument and do the Boolean to Trilean conversion here just to make sure that no one accidently sets UNKNOWN here.
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.
Make sense, made changes accordingly.
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
============================================================
|
🎊 +1 overall
This message was automatically generated. |
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.
+1
Thanks for taking my comments
@@ -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. |
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.
Should this be AbfsDriverException?
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.
AzureBlobFileSystemException is parent of AbfsDriverException, so fine to throw it like this,
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
return isNamespaceEnabled(); | ||
} | ||
try { | ||
LOG.debug("Get root ACL status"); | ||
getClient(AbfsServiceType.DFS).getAclStatus(AbfsHttpConstants.ROOT_PATH, tracingContext); | ||
// If getAcl succeeds, namespace is enabled. | ||
setNamespaceEnabled(Trilean.TRUE); | ||
setNamespaceEnabled(true); |
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.
&& abfsConfiguration.getFsConfiguredServiceType() == BLOB) { | ||
// Current filesystem init restricts HNS-Blob combination | ||
// so namespace check not required. | ||
if (BLOB == abfsConfiguration.getFsConfiguredServiceType()) { |
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.
Why was the FNS check removed ?
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.
Currently, we only support FNS over Blob endpoint. HNS-Blob will fail during init only.
After having offline discussion with the team, I made this change.
JIRA: https://issues.apache.org/jira/browse/HADOOP-19595
Currently, we keep the namespaceEnabled information at both the client and store levels, updating it in both locations when a filesystem is created. With this PR, we've moved this information to the ABFS configuration class, allowing anyone who needs it to access it from there. This update helps minimize confusion and removes data redundancy.