-
Notifications
You must be signed in to change notification settings - Fork 9.2k
[ABFS][FNSOverBlob] Making AbfsClient Abstract for supporting both DFS and Blob Endpoint #6846
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
Closed
anujmodi2021
wants to merge
14
commits into
apache:trunk
from
ABFSDriver:HADOOP-19187_abfsClientRefactor
Closed
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
799ec05
Refactor AbfsClient into DFS and Blob Client
6d07716
Test Fixes
0ec3a68
Added a few basic tests
7e5db73
Yetus and Javadoc Errors
b07e4b5
Javadocs Errors
c4dfd58
Addressing Comments
f0af6e2
Checkstyle Suppressions
28b98c6
Merge branch 'trunk' into HADOOP-19187_abfsClientRefactor
70b893d
Refactor Service Type Configurations
bb64661
Stop Blob Endpoint Init
25d6434
PR Checks
58e91f7
Test Fixes
df9cc8e
Test Fixes
f94f8e9
Merge branch 'trunk' into HADOOP-19187_abfsClientRefactor
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
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 |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ | |
|
|
||
| import org.apache.hadoop.classification.VisibleForTesting; | ||
| import org.apache.hadoop.fs.azurebfs.constants.AbfsServiceType; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.UnsupportedAbfsOperationException; | ||
| import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidConfigurationValueException; | ||
| import org.apache.hadoop.fs.azurebfs.extensions.EncryptionContextProvider; | ||
| import org.apache.hadoop.fs.azurebfs.security.ContextProviderEncryptionAdapter; | ||
| import org.apache.hadoop.fs.azurebfs.security.ContextEncryptionAdapter; | ||
|
|
@@ -164,6 +164,7 @@ | |
| import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_ABFS_ENDPOINT; | ||
| import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.AZURE_FOOTER_READ_BUFFER_SIZE; | ||
| import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_BUFFERED_PREAD_DISABLE; | ||
| import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_FNS_ACCOUNT_SERVICE_TYPE; | ||
| import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_IDENTITY_TRANSFORM_CLASS; | ||
| import static org.apache.hadoop.fs.azurebfs.constants.HttpHeaderConfigurations.X_MS_ENCRYPTION_CONTEXT; | ||
|
|
||
|
|
@@ -177,7 +178,6 @@ public class AzureBlobFileSystemStore implements Closeable, ListingSupport { | |
|
|
||
| private AbfsClient client; | ||
| private AbfsClientHandler clientHandler; | ||
| private AbfsServiceType defaultServiceType; | ||
| private URI uri; | ||
| private String userName; | ||
| private String primaryUserGroup; | ||
|
|
@@ -222,7 +222,6 @@ public class AzureBlobFileSystemStore implements Closeable, ListingSupport { | |
| public AzureBlobFileSystemStore( | ||
| AzureBlobFileSystemStoreBuilder abfsStoreBuilder) throws IOException { | ||
| this.uri = abfsStoreBuilder.uri; | ||
| this.defaultServiceType = getDefaultServiceType(abfsStoreBuilder.configuration); | ||
| String[] authorityParts = authorityParts(uri); | ||
| final String fileSystemName = authorityParts[0]; | ||
| final String accountName = authorityParts[1]; | ||
|
|
@@ -231,7 +230,8 @@ public AzureBlobFileSystemStore( | |
| leaseRefs = Collections.synchronizedMap(new WeakHashMap<>()); | ||
|
|
||
| try { | ||
| this.abfsConfiguration = new AbfsConfiguration(abfsStoreBuilder.configuration, accountName); | ||
| this.abfsConfiguration = new AbfsConfiguration( | ||
| abfsStoreBuilder.configuration, accountName, identifyAbfsServiceType()); | ||
| } catch (IllegalAccessException exception) { | ||
| throw new FileSystemOperationUnhandledException(exception); | ||
| } | ||
|
|
@@ -293,6 +293,21 @@ public AzureBlobFileSystemStore( | |
| "abfs-bounded"); | ||
| } | ||
|
|
||
| public void validateConfiguredServiceType(TracingContext tracingContext) | ||
| throws AzureBlobFileSystemException { | ||
| // Todo: [FnsOverBlob] - Fail FS Init with Blob Endpoint Until FNS over Blob is ready. | ||
| if (getConfiguredServiceType() == AbfsServiceType.BLOB) { | ||
| throw new InvalidConfigurationValueException(FS_DEFAULT_NAME_KEY); | ||
| } | ||
| if (getIsNamespaceEnabled(tracingContext) && getConfiguredServiceType() == AbfsServiceType.BLOB) { | ||
| // This could be because of either wrongly configured url or wrongly configured fns service type. | ||
| if(identifyAbfsServiceType() == AbfsServiceType.BLOB) { | ||
| throw new InvalidConfigurationValueException(FS_DEFAULT_NAME_KEY); | ||
| } | ||
| throw new InvalidConfigurationValueException(FS_AZURE_FNS_ACCOUNT_SERVICE_TYPE); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the given key in Azure Storage should be stored as a page | ||
| * blob instead of block blob. | ||
|
|
@@ -1776,38 +1791,40 @@ private void initializeClient(URI uri, String fileSystemName, | |
| dfsClient = new AbfsDfsClient(baseUrl, creds, abfsConfiguration, | ||
| tokenProvider, encryptionContextProvider, | ||
| populateAbfsClientContext()); | ||
| blobClient = defaultServiceType == AbfsServiceType.BLOB | ||
| || abfsConfiguration.isBlobClientInitRequired() | ||
| blobClient = abfsConfiguration.isBlobClientInitRequired() | ||
| ? new AbfsBlobClient(baseUrl, creds, abfsConfiguration, tokenProvider, | ||
| encryptionContextProvider, populateAbfsClientContext()) | ||
| : null; | ||
| } else { | ||
| dfsClient = new AbfsDfsClient(baseUrl, creds, abfsConfiguration, | ||
| sasTokenProvider, encryptionContextProvider, | ||
| populateAbfsClientContext()); | ||
| blobClient = defaultServiceType == AbfsServiceType.BLOB | ||
| || abfsConfiguration.isBlobClientInitRequired() | ||
| blobClient = abfsConfiguration.isBlobClientInitRequired() | ||
| ? new AbfsBlobClient(baseUrl, creds, abfsConfiguration, sasTokenProvider, | ||
| encryptionContextProvider, populateAbfsClientContext()) | ||
| : null; | ||
| } | ||
|
|
||
| this.clientHandler = new AbfsClientHandler(defaultServiceType, dfsClient, blobClient); | ||
| this.clientHandler = new AbfsClientHandler(getConfiguredServiceType(), | ||
| dfsClient, blobClient); | ||
| this.client = clientHandler.getClient(); | ||
|
|
||
| LOG.trace("AbfsClient init complete"); | ||
| } | ||
|
|
||
| private AbfsServiceType getDefaultServiceType(Configuration conf) | ||
| throws UnsupportedAbfsOperationException{ | ||
| if (conf.get(FS_DEFAULT_NAME_KEY).contains(AbfsServiceType.BLOB.toString().toLowerCase())) { | ||
| // Todo: [FnsOverBlob] return "AbfsServiceType.BLOB" once the code is ready for Blob Endpoint Support. | ||
| throw new UnsupportedAbfsOperationException( | ||
| "Blob Endpoint Support is not yet implemented. Please use DFS Endpoint."); | ||
| private AbfsServiceType identifyAbfsServiceType() { | ||
| if (uri.toString().contains(FileSystemUriSchemes.ABFS_BLOB_DOMAIN_NAME)) { | ||
| return AbfsServiceType.BLOB; | ||
| } | ||
| // Incase of DFS Domain name or any other custom endpoint, the service | ||
| // type is to be identified as default DFS. | ||
| return AbfsServiceType.DFS; | ||
|
||
| } | ||
|
|
||
| private AbfsServiceType getConfiguredServiceType() { | ||
| return abfsConfiguration.getFsConfiguredServiceType(); | ||
| } | ||
|
|
||
| /** | ||
| * Populate a new AbfsClientContext instance with the desired properties. | ||
| * | ||
|
|
||
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
31 changes: 0 additions & 31 deletions
31
...org/apache/hadoop/fs/azurebfs/contracts/exceptions/UnsupportedAbfsOperationException.java
This file was deleted.
Oops, something went wrong.
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.
we should also inform what is wrong with the config.