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:
Michael Stack 2009-07-01 23:57:40 +00:00
parent 64eabfece1
commit de1cc3ec7b
5 changed files with 25 additions and 9 deletions

View File

@ -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

View File

@ -47,4 +47,9 @@ public interface BlockCache {
* @return Block or null if block is not in the cache.
*/
public ByteBuffer getBlock(String blockName);
/**
* Shutdown the cache.
*/
public void shutdown();
}

View File

@ -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;
@ -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 {
@ -660,4 +660,7 @@ public class LruBlockCache implements BlockCache, HeapSize {
return (long)Math.floor(this.maxSize * this.memoryFactor * this.minFactor);
}
public void shutdown() {
this.scheduleThreadPool.shutdown();
}
}

View File

@ -63,4 +63,8 @@ public class SimpleBlockCache implements BlockCache {
boolean inMemory) {
cache.put(blockName, new Ref(blockName, buf, q));
}
public void shutdown() {
// noop
}
}

View File

@ -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