-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19139.No GetPathStatus for opening AbfsInputStream #6699
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 69 commits
e2a4e05
8d4756b
4aae0c8
2d6f0cb
5939e60
c8a6a00
4ad349c
ee1f4c3
cfc4f8e
cc09403
6cb1773
bd920a5
37bc691
7ecabf9
2c9da9e
58a399c
7d22917
52e19c0
8c76674
a06a2a1
8f44c96
b66eea6
45a0796
b1fd443
38f5592
074fb39
99e397c
fe1df56
0475b3e
a1c56c2
dc898c8
9e7bb6c
cb929f9
e7b121a
51373f0
9b998d4
7d1a274
cd9b0de
0c454d7
5c3553b
b224fa2
2fc5bbd
e7cfec5
2f51126
02b3421
4c08320
f62f868
36ba7c0
7978c27
8d38aed
811693d
065919a
9e73700
1b3ba1b
f4fef33
caf6c56
480a705
e7cd9a3
4154485
caa0756
5ddf14a
0b53e1e
bd86173
44ffeb3
01239aa
ffefdb3
20f4f2b
0a1b23c
19c1d94
429a518
d096f3d
9231959
4547f53
4df6b02
c8299fc
6de6b88
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 |
|---|---|---|
|
|
@@ -856,16 +856,17 @@ public AbfsInputStream openFileForRead(Path path, | |
| LOG.debug("openFileForRead filesystem: {} path: {}", | ||
| client.getFileSystem(), path); | ||
|
|
||
| FileStatus fileStatus = parameters.map(OpenFileParameters::getStatus) | ||
| final FileStatus fileStatus = parameters.map(OpenFileParameters::getStatus) | ||
| .orElse(null); | ||
| String relativePath = getRelativePath(path); | ||
| String resourceType, eTag; | ||
| long contentLength; | ||
| String resourceType = null, eTag = null; | ||
| long contentLength = -1; | ||
| ContextEncryptionAdapter contextEncryptionAdapter = NoContextEncryptionAdapter.getInstance(); | ||
| /* | ||
| * GetPathStatus API has to be called in case of: | ||
|
||
| * 1. fileStatus is null or not an object of VersionedFileStatus: as eTag | ||
| * would not be there in the fileStatus object. | ||
| * would not be there in the fileStatus object. This shall be called | ||
| * only if inputStream's lazy optimization is disabled. | ||
| * 2. fileStatus is an object of VersionedFileStatus and the object doesn't | ||
| * have encryptionContext field when client's encryptionType is | ||
| * ENCRYPTION_CONTEXT. | ||
|
|
@@ -890,28 +891,32 @@ public AbfsInputStream openFileForRead(Path path, | |
| encryptionContext.getBytes(StandardCharsets.UTF_8)); | ||
| } | ||
| } else { | ||
| AbfsHttpOperation op = client.getPathStatus(relativePath, false, | ||
| tracingContext, null).getResult(); | ||
| resourceType = op.getResponseHeader( | ||
| HttpHeaderConfigurations.X_MS_RESOURCE_TYPE); | ||
| contentLength = Long.parseLong( | ||
| op.getResponseHeader(HttpHeaderConfigurations.CONTENT_LENGTH)); | ||
| eTag = op.getResponseHeader(HttpHeaderConfigurations.ETAG); | ||
| /* | ||
| * For file created with ENCRYPTION_CONTEXT, client shall receive | ||
| * encryptionContext from header field: X_MS_ENCRYPTION_CONTEXT. | ||
| */ | ||
| if (client.getEncryptionType() == EncryptionType.ENCRYPTION_CONTEXT) { | ||
| final String fileEncryptionContext = op.getResponseHeader( | ||
| HttpHeaderConfigurations.X_MS_ENCRYPTION_CONTEXT); | ||
| if (fileEncryptionContext == null) { | ||
| LOG.debug("EncryptionContext missing in GetPathStatus response"); | ||
| throw new PathIOException(path.toString(), | ||
| "EncryptionContext not present in GetPathStatus response headers"); | ||
| if (client.getEncryptionType() == EncryptionType.ENCRYPTION_CONTEXT | ||
|
||
| || !abfsConfiguration.isInputStreamLazyOptimizationEnabled()) { | ||
| final AbfsHttpOperation op = client.getPathStatus(relativePath, false, | ||
| tracingContext, null).getResult(); | ||
| resourceType = op.getResponseHeader( | ||
| HttpHeaderConfigurations.X_MS_RESOURCE_TYPE); | ||
| contentLength = Long.parseLong( | ||
| op.getResponseHeader(HttpHeaderConfigurations.CONTENT_LENGTH)); | ||
| eTag = op.getResponseHeader(HttpHeaderConfigurations.ETAG); | ||
|
|
||
| /* | ||
| * For file created with ENCRYPTION_CONTEXT, client shall receive | ||
| * encryptionContext from header field: X_MS_ENCRYPTION_CONTEXT. | ||
| */ | ||
| if (client.getEncryptionType() == EncryptionType.ENCRYPTION_CONTEXT) { | ||
| final String fileEncryptionContext = op.getResponseHeader( | ||
| HttpHeaderConfigurations.X_MS_ENCRYPTION_CONTEXT); | ||
| if (fileEncryptionContext == null) { | ||
| LOG.debug("EncryptionContext missing in GetPathStatus response"); | ||
| throw new PathIOException(path.toString(), | ||
| "EncryptionContext not present in GetPathStatus response headers"); | ||
| } | ||
| contextEncryptionAdapter = new ContextProviderEncryptionAdapter( | ||
| client.getEncryptionContextProvider(), getRelativePath(path), | ||
| fileEncryptionContext.getBytes(StandardCharsets.UTF_8)); | ||
| } | ||
| contextEncryptionAdapter = new ContextProviderEncryptionAdapter( | ||
| client.getEncryptionContextProvider(), getRelativePath(path), | ||
| fileEncryptionContext.getBytes(StandardCharsets.UTF_8)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -958,6 +963,8 @@ AZURE_FOOTER_READ_BUFFER_SIZE, getAbfsConfiguration().getFooterReadBufferSize()) | |
| .withBufferedPreadDisabled(bufferedPreadDisabled) | ||
| .withEncryptionAdapter(contextEncryptionAdapter) | ||
| .withAbfsBackRef(fsBackRef) | ||
| .withPrefetchTriggerOnFirstRead( | ||
| abfsConfiguration.isPrefetchOnFirstReadEnabled()) | ||
| .build(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,7 @@ public final class AbfsHttpConstants { | |
| public static final String HTTP_HEADER_PREFIX = "x-ms-"; | ||
| public static final String HASH = "#"; | ||
| public static final String TRUE = "true"; | ||
| public static final String FALSE = "false"; | ||
|
|
||
| public static final String PLUS_ENCODE = "%20"; | ||
| public static final String FORWARD_SLASH_ENCODE = "%2F"; | ||
|
|
@@ -169,6 +170,8 @@ public static ApiVersion getCurrentVersion() { | |
| */ | ||
| public static final Integer HTTP_STATUS_CATEGORY_QUOTIENT = 100; | ||
|
|
||
| public static final Integer READ_PATH_REQUEST_NOT_SATISFIABLE = 416; | ||
|
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 we name this as per format followed by other HTTP Status code constants:
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. 416 is not given constant in HttpUrlConnection class. Hence, maintaining a new constant in AbfsHttpConstants
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. That makes sense. But what I was proposing is to name this new variable as per the format followed by HttpUrlConnection class. What are your thoughts?? |
||
|
|
||
| /** | ||
| * List of configurations that are related to Customer-Provided-Keys. | ||
| * <ol> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.