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
HBASE-21946 Use ByteBuffer pread instead of byte[] pread in HFileBlock when applicable #3434
HBASE-21946 Use ByteBuffer pread instead of byte[] pread in HFileBlock when applicable #3434
Conversation
Change-Id: Iea1eb7439217f25341d03dcf06c22a27ff40a4d7
🎊 +1 overall
This message was automatically generated. |
hbase-common/src/main/java/org/apache/hadoop/hbase/io/util/BlockIOUtils.java
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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 do not have a UT to verify the code path where hasCapability returns true?
Change-Id: Ie02bee58dfdca6d3ed3f493982fa54b016a8563e
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Thanks @Apache9 . Took me a few days because I initially thought it's either impossible or requires lots of dirty hack to add a UT. But turns out it's quite straightforward. I'll merge later. |
…k when applicable (apache#3434) Signed-off-by: Duo Zhang <zhangduo@apache.org>
…pread in HFileBlock when applicable (apache#3434) Signed-off-by: Duo Zhang <zhangduo@apache.org> (cherry picked from commit 4a3c7d7)
Use StreamCapabilities.hasCapabilities() to determine if the pread is supported by the input stream. Use reflection to invoke the bytebuffer pread method when it is available (because the ByteBufferPositionedReadable API is not available until Hadoop 3.3). This way, we can maintain backward compatibility for any Hadoop version above 2.9.
Passed a few unit tests building with Hadoop 3.3.1 and 3.1.2. Open this PR to run through the whole precommit test.