You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2016/07/01 20:00:12 UTC
hbase git commit: HBASE-16157 Revert - ChiaPing has new fix
Repository: hbase
Updated Branches:
refs/heads/master d92a99da0 -> fe75edb55
HBASE-16157 Revert - ChiaPing has new fix
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fe75edb5
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fe75edb5
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fe75edb5
Branch: refs/heads/master
Commit: fe75edb556649a101482b974eead2d506f78efe4
Parents: d92a99d
Author: tedyu <yu...@gmail.com>
Authored: Fri Jul 1 13:00:05 2016 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Fri Jul 1 13:00:05 2016 -0700
----------------------------------------------------------------------
.../hadoop/hbase/io/hfile/LruBlockCache.java | 15 +--------
.../hbase/io/hfile/TestLruBlockCache.java | 32 --------------------
2 files changed, 1 insertion(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/fe75edb5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
index 8894dcd..c380318 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
@@ -511,10 +511,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
* @return the heap size of evicted block
*/
protected long evictBlock(LruCachedBlock block, boolean evictedByEvictionProcess) {
- boolean found = map.remove(block.getCacheKey()) != null;
- if (!found) {
- return 0;
- }
+ map.remove(block.getCacheKey());
updateSizeMetrics(block, true);
long val = elements.decrementAndGet();
if (LOG.isTraceEnabled()) {
@@ -546,16 +543,6 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize {
}
}
- @VisibleForTesting
- boolean isEvictionInProgress() {
- return evictionInProgress;
- }
-
- @VisibleForTesting
- long getOverhead() {
- return overhead;
- }
-
/**
* Eviction method.
*/
http://git-wip-us.apache.org/repos/asf/hbase/blob/fe75edb5/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
index 4d0732e..d7f9aba 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
@@ -44,34 +44,7 @@ import org.junit.experimental.categories.Category;
@Category({IOTests.class, SmallTests.class})
public class TestLruBlockCache {
- @Test
- public void testCurrentSize() throws Exception {
- long maxSize = 100000;
- int numBlocks = 9;
- int testRuns = 10;
- long blockSize = calculateBlockSizeDefault(maxSize, numBlocks);
- assertTrue("calculateBlockSize appears broken.", blockSize * numBlocks <= maxSize);
- LruBlockCache cache = new LruBlockCache(maxSize, blockSize);
- EvictionThread evictionThread = cache.getEvictionThread();
- assertTrue(evictionThread != null);
- while (!evictionThread.isEnteringRun()) {
- Thread.sleep(1);
- }
- int blockCount = 0;
- String hfileName = "hfile";
- for (int run = 0; run != testRuns; ++run) {
- while (!cache.isEvictionInProgress()) {
- CachedItem block = new CachedItem(hfileName, (int) blockSize, blockCount++);
- boolean inMemory = Math.random() > 0.5;
- cache.cacheBlock(block.cacheKey, block, inMemory, false);
- }
- assertEquals(true, cache.isEvictionInProgress());
- cache.evictBlocksByHfileName(hfileName);
- assertEquals(0, cache.getBlockCount());
- assertEquals(cache.getOverhead(), cache.getCurrentSize());
- }
- }
@Test
public void testBackgroundEvictionThread() throws Exception {
long maxSize = 100000;
@@ -812,11 +785,6 @@ public class TestLruBlockCache {
BlockCacheKey cacheKey;
int size;
- CachedItem(String blockName, int size, int offset) {
- this.cacheKey = new BlockCacheKey(blockName, offset);
- this.size = size;
- }
-
CachedItem(String blockName, int size) {
this.cacheKey = new BlockCacheKey(blockName, 0);
this.size = size;