bharathv commented on a change in pull request #1110: HBASE-23761: The new
cache entry can overflow the maxSize in CachedEn…
URL: https://github.com/apache/hbase/pull/1110#discussion_r373720985
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java
##########
@@ -65,14 +65,15 @@ public LruCachedBlockQueue(long maxSize, long blockSize) {
* @param cb block to try to add to the queue
*/
public void add(LruCachedBlock cb) {
- if(heapSize < maxSize) {
+ long cbSize = cb.heapSize();
+ if(heapSize + cbSize < maxSize) {
queue.add(cb);
- heapSize += cb.heapSize();
+ heapSize += cbSize;
} else {
LruCachedBlock head = queue.peek();
if(cb.compareTo(head) > 0) {
heapSize += cb.heapSize();
- heapSize -= head.heapSize();
+ heapSize -= cbSize;
Review comment:
why does this line change? IIUC, we are removing the current 'head' and
adding the input cache block, so the existing code makes sense?
or did you mean to change the line above ?
----------------------------------------------------------------
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