- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.4k
HBASE-22802 Avoid temp ByteBuffer allocation in FileIOEngine#read #467
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
| 💔 -1 overall 
 
 
 This message was automatically generated. | 
| 💔 -1 overall 
 
 
 This message was automatically generated. | 
| 💔 -1 overall 
 
 
 This message was automatically generated. | 
| 💔 -1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| 💔 -1 overall 
 
 
 This message was automatically generated. | 
| 🎊 +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.
Skimmed. Looks great to me. Get someone closer in to review I'd say. Nice work.
| return; | ||
| } | ||
| LOG.trace("Caching key={}, item={}", cacheKey, cachedItem); | ||
| if (LOG.isTraceEnabled()) { | 
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.
Don't need this if LOG.isTraceEnabled when using this logging form with the '{}' (Internally it does this test).
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.
Correct
| 🎊 +1 overall 
 
 This message was automatically generated. | 
| return (nBytes > 0) ? nBytes : ret; | ||
| } | ||
|  | ||
| public static int fileRead(FileChannel channel, ByteBuffer buf, long 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.
Looks like we could make some abstraction between the existed channelRead(...) and the newly introduced fileRead (...) ? Similar with the ByteBufferArray#read & ByteBufferArray#write.. Please take a look.
| break; | ||
| } | ||
| } finally { | ||
| buf.limit(originalLimit); | 
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.
Only reset the limit ? should we also reset the position ?
| } | ||
|  | ||
| @Override | ||
| public int read(FileChannel channel, long offset) 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.
Should also make the abstraction between MultiByteBuff#read and MultiByteBuff#write ? As said above.
| return; | ||
| } | ||
| LOG.trace("Caching key={}, item={}", cacheKey, cachedItem); | ||
| if (LOG.isTraceEnabled()) { | 
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.
Correct
| Cacheable cachedBlock = ioEngine.read(bucketEntry); | ||
| // RPC start to reference, so retain here. | ||
| cachedBlock.retain(); | ||
| if (ioEngine.usesSharedMemory()) { | 
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.
One big concern here: now for exclusive memory IOEngine, the refCnt value of all bucketEntry will be 1, means the reference from BucketCache, no RPC reference. Then I think the BucketCache's eviction policy would always evict those blocks despite that the RPC is still using the block, not say the memory leak issue , but the eviction policy is evicting those RPC referring blocks (violate the LRU ? )....
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 eviction policy will compare BucketEntry with it’s accessCounter, so this will not violate the LRU?
| return wrapAsCacheable(ByteBuff.wrap(buffers, this.refCnt)); | ||
| } | ||
|  | ||
| Cacheable wrapAsCacheable(ByteBuff 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.
That's a good thing, make the wrapAsCacheable into two methods. the SharedIOEngine use the former one, and the ExclusiveIOEngine use the later one. Good.
| 💔 -1 overall 
 
 This message was automatically generated. | 
| 🎊 +1 overall 
 
 This message was automatically generated. | 
…sabled table (#465) Signed-off-by: Stack <[email protected]>
…ck chore (#466) Signed-off-by: Guanghao Zhang <[email protected]>
#469) Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Wellington Chevreuil <[email protected]>
) Signed-off-by: Andrew Purtell <[email protected]>
Signed-off-by: stack <[email protected]>
Signed-off-by: stack <[email protected]>
Signed-off-by: stack <[email protected]> Signed-off-by: Jan Hentschel <[email protected]>
Signed-off-by: stack <[email protected]>
Signed-off-by: stack <[email protected]>
Signed-off-by: Duo Zhang <[email protected]>
| 💔 -1 overall 
 
 This message was automatically generated. | 
| sorry, do the wrong rebase, close this pr first | 
No description provided.