HBASE-16651 LRUBlockCache#returnBlock should try return block to Victim Handler L2 cache.

This commit is contained in:
anoopsamjohn 2016-09-22 11:20:11 +05:30
parent c9d0d11e18
commit 19bbf44554
2 changed files with 9 additions and 3 deletions

View File

@ -358,8 +358,7 @@ public class CombinedBlockCache implements ResizableBlockCache, HeapSize {
@Override
public void returnBlock(BlockCacheKey cacheKey, Cacheable block) {
// A noop
this.lruCache.returnBlock(cacheKey, block);
// returnBlock is meaningful for L2 cache alone.
this.l2Cache.returnBlock(cacheKey, block);
}

View File

@ -1156,6 +1156,13 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
@Override
public void returnBlock(BlockCacheKey cacheKey, Cacheable block) {
// There is no SHARED type here. Just return
// There is no SHARED type here in L1. But the block might have been served from the Victim
// handler L2 cache. (when the Combined mode = false). So just try return this block to
// L2 victim handler cache.
// Note : In case of CombinedBlockCache, we will have this victimHandler configured for L1
// cache. But CombinedBlockCache will only call returnBlock on L2 cache.
if (this.victimHandler != null) {
this.victimHandler.returnBlock(cacheKey, block);
}
}
}