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-22802 Avoid temp ByteBuffer allocation in FileIOEngine#read #583
Conversation
💔 -1 overall
This message was automatically generated. |
TestMasterShutdown seems not related, let's fix the failed UT |
37d18f1
to
8967cb3
Compare
while (buffsIterator.hasNext()) { | ||
ByteBuffer buffer = buffsIterator.next(); | ||
while (buffer.hasRemaining()) { | ||
int len = channel.write(curItem, offset); |
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.
Better to use buffer instead of curItem here, otherwise seems strange here although no much difference in logics. Also maybe we can try to combine the buffsIterator and curItem & curItemIndex into one iterator, seems they are doing the same thing , say tracking the current buffer.
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.
Better to use buffer instead of curItem here
nice find, use buffer instead
maybe we can try to combine the buffsIterator and curItem & curItemIndex into one iterator
I think it's not easy to do that, the curItem is referenced in so many methods, maybe we should keep the current logic to avoid possible BUGs.
public static RefCnt create() { | ||
return new RefCnt(ByteBuffAllocator.NONE); | ||
} | ||
public static final RefCnt NONE = new RefCnt(ByteBuffAllocator.NONE) { |
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.
Is this right ? before we will create a RefCnt which will still increase/decrement the its reference count value, but with a NONE de-allocator to deallocate the memory (means donothing).... now we will create a RefCnt with reference count value to be 1, and never change... I'm afraid that if upper layer depends one the ref cnt value, then will be messed up..
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 RefCnt#NONE is mainly to avoid the creation of temporary objects, but your worries are necessary, will revert it.
8967cb3
to
21b2b87
Compare
💔 -1 overall
This message was automatically generated. |
21b2b87
to
ebb76e4
Compare
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 patch looks good to me now.
💔 -1 overall
This message was automatically generated. |
No description provided.