-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19795: ABFS. GetPathStatus Optimization on OpenFileForRead #8212
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?
Changes from all commits
bb27ec4
16253aa
68f905c
bb42e3c
94d2336
46b3e18
3560cc5
f3b6b57
c53a82f
ba7131c
621c89e
b935f8f
e13fd56
b173e07
1cf2643
4c184d8
63f7ac1
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 |
|---|---|---|
|
|
@@ -68,7 +68,7 @@ protected int readOneBlock(final byte[] b, final int off, final int len) throws | |
| // If buffer is empty, then fill the buffer. | ||
| if (getBCursor() == getLimit()) { | ||
| // If EOF, then return -1 | ||
| if (getFCursor() >= getContentLength()) { | ||
| if (!(shouldRestrictGpsOnOpenFile() && isFirstRead()) && getFCursor() >= getContentLength()) { | ||
|
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 decouple Currently, if both
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. As discussed, for first reads we have other validation in place |
||
| return -1; | ||
| } | ||
|
|
||
|
|
@@ -83,7 +83,14 @@ protected int readOneBlock(final byte[] b, final int off, final int len) throws | |
|
|
||
| // Reset Read Type back to normal and set again based on code flow. | ||
| getTracingContext().setReadType(ReadType.NORMAL_READ); | ||
| if (shouldAlwaysReadBufferSize()) { | ||
|
|
||
| // If restrictGpsOnOpenFile config is enabled, skip prefetch for the first read since contentLength | ||
| // is not available yet. | ||
| if (shouldRestrictGpsOnOpenFile() && isFirstRead()) { | ||
| LOG.debug("RestrictGpsOnOpenFile is enabled. Skip readahead for first read."); | ||
| bytesRead = readInternal(getFCursor(), getBuffer(), 0, getBufferSize(), true); | ||
| } | ||
| else if (shouldAlwaysReadBufferSize()) { | ||
| bytesRead = readInternal(getFCursor(), getBuffer(), 0, getBufferSize(), false); | ||
| } else { | ||
| // Enable readAhead when reading sequentially | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1347,7 +1347,7 @@ public AbfsRestOperation checkAccess(String path, | |
| public boolean checkIsDir(AbfsHttpOperation result) { | ||
| String resourceType = result.getResponseHeader( | ||
| HttpHeaderConfigurations.X_MS_RESOURCE_TYPE); | ||
| return StringUtils.equalsIgnoreCase(resourceType, DIRECTORY); | ||
| return resourceType != null && StringUtils.equalsIgnoreCase(resourceType, DIRECTORY); | ||
|
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. This check is not needed here as equalsIgnoreCase internally checks if resourceType is null or not.
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. As discussed, returns NPE if not present |
||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
Won't this lead to going ahead and opening the stream without checks? Do we fail later for this case ?
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.
Yes, the checks with this config would be happening after the first read then. If the read fails there then we throw the appropriate exception