openinx commented on a change in pull request #479: HBASE-22802 Avoid temp
ByteBuffer allocation in FileIOEngine#read
URL: https://github.com/apache/hbase/pull/479#discussion_r313251457
##########
File path:
hbase-common/src/main/java/org/apache/hadoop/hbase/nio/MultiByteBuff.java
##########
@@ -1064,28 +1065,58 @@ public void get(ByteBuffer out, int sourceOffset, int
length) {
return output;
}
- @Override
- public int read(ReadableByteChannel channel) throws IOException {
+ private int internalRead(ReadableByteChannel channel, long offset,
+ ChannelReader reader) throws IOException {
checkRefCount();
int total = 0;
while (true) {
- // Read max possible into the current BB
- int len = channelRead(channel, this.curItem);
- if (len > 0)
+ int len = read(channel, this.curItem, offset, reader);
Review comment:
Seems we can also create a iterator to read & fill the ByteBuff ? Similar
with the BufferIterator in ByteBufferArray, I think that would be more
clearer.... Can be a following issue ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services