-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10511. Support ByteBufferPositionedReadable in OzoneFSInputStream. #6372
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
Conversation
jojochuang
left a comment
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.
Looks functionally correct. Need a closer look to make sure it doesn't send extra readChunk requests and so on which degrades performance.
We should also update stream capability: add
case StreamCapabilities.PREADBYTEBUFFER:
| * @see #read(long, ByteBuffer) | ||
| */ | ||
| void readFully(long position, ByteBuffer buf) throws IOException; | ||
| } |
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 will use the ByteBufferPositionedReadable interface defined in hadoop-common directly. This file can be removed. Is there dependency problem for this?
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.
The problem is that some of the acceptance tests run with Hadoop 3.2 runtime which does not have this API.
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 interface is added in Hadoop 3.3, so the older hadoop version client fails to load ozone fs jar. This file can be removed when we drop support for older hadoop version.
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.
I see. Oh, there are comments explaining this.
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneFSInputStream.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneFSInputStream.java
Outdated
Show resolved
Hide resolved
|
|
||
| // Buffer size more than actual data, still read should succeed | ||
| ByteBuffer buffer1 = ByteBuffer.allocate(30 * 1024 * 1024 * 2); | ||
| readBytes = inputStream.read(12, buffer1); |
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.
Can you add readBytes check, to make sure the bytes read value is as expected?
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.
Also can you add
- file position check, make sure file position is not changed after read or readFully.
- boundary check, such as illegal position value.
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.
Done
ChenSammi
left a comment
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.
The last patch looks good to me. Thanks @ashishkumar50 .
|
Thanks @ashishkumar50 @ChenSammi |
|
Confirmed it's being used by Apache HBase 2.5.0 and above. |
…m. (apache#6372) Co-authored-by: ashishk <[email protected]>
…m. (apache#6372) Co-authored-by: ashishk <[email protected]>
What changes were proposed in this pull request?
Support ByteBufferPositionedReadable in OzoneFSInputStream.
This will benefit HBase read.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10511
How was this patch tested?
New integration test