HBASE-13072 BucketCache.evictBlock returns true if block does not exist (Duo Zhang)

This commit is contained in:
tedyu 2015-02-19 08:28:13 -08:00
parent 31f17b17f0
commit 18402cc850
1 changed files with 27 additions and 21 deletions

View File

@ -451,7 +451,14 @@ public class BucketCache implements BlockCache, HeapSize {
this.heapSize.addAndGet(-1 * removedBlock.getData().heapSize());
}
BucketEntry bucketEntry = backingMap.get(cacheKey);
if (bucketEntry != null) {
if (bucketEntry == null) {
if (removedBlock != null) {
cacheStats.evicted(0);
return true;
} else {
return false;
}
}
IdLock.Entry lockEntry = null;
try {
lockEntry = offsetLock.getLockEntry(bucketEntry.offset());
@ -473,8 +480,7 @@ public class BucketCache implements BlockCache, HeapSize {
offsetLock.releaseLockEntry(lockEntry);
}
}
}
cacheStats.evicted(bucketEntry == null? 0: bucketEntry.getCachedTime());
cacheStats.evicted(bucketEntry.getCachedTime());
return true;
}