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
|
interface
|
||||||
HBASE-1594 Fix scan addcolumns after hbase-1385 commit (broken hudson build)
|
HBASE-1594 Fix scan addcolumns after hbase-1385 commit (broken hudson build)
|
||||||
HBASE-1595 hadoop-default.xml and zoo.cfg in hbase jar
|
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
|
IMPROVEMENTS
|
||||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||||
|
|
|
@ -47,4 +47,9 @@ public interface BlockCache {
|
||||||
* @return Block or null if block is not in the cache.
|
* @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.lang.ref.WeakReference;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.PriorityQueue;
|
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.atomic.AtomicLong;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
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.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -320,7 +320,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
||||||
|
|
||||||
long bytesToFree = size.get() - minSize();
|
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");
|
bytesToFree + " bytes");
|
||||||
|
|
||||||
if(bytesToFree <= 0) return;
|
if(bytesToFree <= 0) return;
|
||||||
|
@ -372,7 +372,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
||||||
remainingBuckets--;
|
remainingBuckets--;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("Block cache LRU eviction completed. " +
|
LOG.debug("Block cache LRU eviction completed. " +
|
||||||
"Freed " + bytesFreed + " bytes");
|
"Freed " + bytesFreed + " bytes");
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -660,4 +660,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
|
||||||
return (long)Math.floor(this.maxSize * this.memoryFactor * this.minFactor);
|
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) {
|
boolean inMemory) {
|
||||||
cache.put(blockName, new Ref(blockName, buf, q));
|
cache.put(blockName, new Ref(blockName, buf, q));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,6 +602,9 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
||||||
e.printStackTrace();
|
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.
|
// 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
|
// TODO: Should we check they are alive? If OOME could have exited already
|
||||||
|
|
Loading…
Reference in New Issue