HBASE-1602 HRegionServer won't go down since we added in new LruBlockCache
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@790424 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
64eabfece1
commit
de1cc3ec7b
|
@ -239,6 +239,7 @@ Release 0.20.0 - Unreleased
|
|||
interface
|
||||
HBASE-1594 Fix scan addcolumns after hbase-1385 commit (broken hudson build)
|
||||
HBASE-1595 hadoop-default.xml and zoo.cfg in hbase jar
|
||||
HBASE-1602 HRegionServer won't go down since we added in new LruBlockCache
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
|
@ -46,5 +46,10 @@ public interface BlockCache {
|
|||
* @param blockName Block number to fetch.
|
||||
* @return Block or null if block is not in the cache.
|
||||
*/
|
||||
public ByteBuffer getBlock(String blockName);
|
||||
public ByteBuffer getBlock(String blockName);
|
||||
|
||||
/**
|
||||
* Shutdown the cache.
|
||||
*/
|
||||
public void shutdown();
|
||||
}
|
|
@ -22,12 +22,12 @@ package org.apache.hadoop.hbase.io.hfile;
|
|||
import java.lang.ref.WeakReference;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -108,7 +108,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
|||
private final EvictionThread evictionThread;
|
||||
|
||||
/** Statistics thread schedule pool (for heavy debugging, could remove) */
|
||||
private final ScheduledExecutorService scheduleThreadPool =
|
||||
private final ScheduledExecutorService scheduleThreadPool =
|
||||
Executors.newScheduledThreadPool(1);
|
||||
|
||||
/** Current size of cache */
|
||||
|
@ -320,7 +320,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
|||
|
||||
long bytesToFree = size.get() - minSize();
|
||||
|
||||
LOG.info("Block cache LRU eviction started. Attempting to free " +
|
||||
LOG.debug("Block cache LRU eviction started. Attempting to free " +
|
||||
bytesToFree + " bytes");
|
||||
|
||||
if(bytesToFree <= 0) return;
|
||||
|
@ -372,7 +372,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
|||
remainingBuckets--;
|
||||
}
|
||||
|
||||
LOG.info("Block cache LRU eviction completed. " +
|
||||
LOG.debug("Block cache LRU eviction completed. " +
|
||||
"Freed " + bytesFreed + " bytes");
|
||||
|
||||
} finally {
|
||||
|
@ -659,5 +659,8 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
|||
private long memorySize() {
|
||||
return (long)Math.floor(this.maxSize * this.memoryFactor * this.minFactor);
|
||||
}
|
||||
|
||||
|
||||
public void shutdown() {
|
||||
this.scheduleThreadPool.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,8 @@ public class SimpleBlockCache implements BlockCache {
|
|||
boolean inMemory) {
|
||||
cache.put(blockName, new Ref(blockName, buf, q));
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
|
|
@ -602,6 +602,9 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// Send cache a shutdown.
|
||||
LruBlockCache c = (LruBlockCache)StoreFile.getBlockCache(this.conf);
|
||||
if (c != null) c.shutdown();
|
||||
|
||||
// Send interrupts to wake up threads if sleeping so they notice shutdown.
|
||||
// TODO: Should we check they are alive? If OOME could have exited already
|
||||
|
|
Loading…
Reference in New Issue