mukund-thakur commented on code in PR #6752:
URL: https://github.com/apache/hadoop/pull/6752#discussion_r1609025458
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java:
##########
@@ -223,6 +225,21 @@ public void initialize(URI uri, Configuration
configuration)
}
}
+ if ((abfsConfiguration.createEncryptionContextProvider() != null
+ || StringUtils.isNotEmpty(
+ abfsConfiguration.getEncodedClientProvidedEncryptionKey()))
+ && !getIsNamespaceEnabled(
+ new TracingContext(clientCorrelationId, fileSystemId,
+ FSOperationType.CREATE_FILESYSTEM, tracingHeaderFormat,
listener))) {
+ /*
+ * Close the filesystem gracefully before throwing exception. Graceful
close
+ * will ensure that all resources are released properly.
+ */
+ close();
+ throw new PathIOException(uri.getPath(),
+ CPK_IN_NON_HNS_ACCOUNT_ERROR_MESSAGE);
Review Comment:
maybe add what needs to be configured correctly.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java:
##########
@@ -223,6 +225,21 @@ public void initialize(URI uri, Configuration
configuration)
}
}
+ if ((abfsConfiguration.createEncryptionContextProvider() != null
Review Comment:
maybe exctract into small methods with self explanatory names which can make
this check easier to understand.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java:
##########
@@ -223,6 +225,21 @@ public void initialize(URI uri, Configuration
configuration)
}
}
+ if ((abfsConfiguration.createEncryptionContextProvider() != null
+ || StringUtils.isNotEmpty(
+ abfsConfiguration.getEncodedClientProvidedEncryptionKey()))
+ && !getIsNamespaceEnabled(
+ new TracingContext(clientCorrelationId, fileSystemId,
+ FSOperationType.CREATE_FILESYSTEM, tracingHeaderFormat,
listener))) {
+ /*
+ * Close the filesystem gracefully before throwing exception. Graceful
close
+ * will ensure that all resources are released properly.
+ */
+ close();
Review Comment:
what if close() throws exception?
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/AbfsHttpConstants.java:
##########
@@ -165,5 +165,8 @@ public static ApiVersion getCurrentVersion() {
*/
public static final Integer HTTP_STATUS_CATEGORY_QUOTIENT = 100;
+ public static final String CPK_IN_NON_HNS_ACCOUNT_ERROR_MESSAGE =
+ "Non HNS account can not have CPK configs enabled.";
Review Comment:
add the property names here such that it is easier for a user to find and
remove those.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java:
##########
@@ -223,6 +225,21 @@ public void initialize(URI uri, Configuration
configuration)
}
}
+ if ((abfsConfiguration.createEncryptionContextProvider() != null
Review Comment:
add a comment explaining the logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]