HBASE-1027 Make global flusher check work with percentages rather than...; moved synchronized so only global flush if testing thread finds we are over limit; everythread that went in was flushing

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@723481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-12-04 23:05:28 +00:00
parent 6c33c1b1b3
commit 2987febc16
1 changed files with 5 additions and 5 deletions

View File

@ -249,15 +249,14 @@ class MemcacheFlusher extends Thread implements FlushRequester {
* to the lower limit. This method blocks callers until we're down to a safe
* amount of memcache consumption.
*/
public void reclaimMemcacheMemory() {
public synchronized void reclaimMemcacheMemory() {
if (server.getGlobalMemcacheSize() >= globalMemcacheLimit) {
flushSomeRegions();
}
}
/*
* Emergency! Need to flush memory. While running this method all updates
* to this regionserver are blocked.
* Emergency! Need to flush memory.
*/
private synchronized void flushSomeRegions() {
// keep flushing until we hit the low water mark
@ -277,7 +276,8 @@ class MemcacheFlusher extends Thread implements FlushRequester {
}
HRegion biggestMemcacheRegion = m.remove(m.firstKey());
LOG.info("Forced flushing of " + biggestMemcacheRegion.toString() +
" because global memcache limit of " + this.globalMemcacheLimit +
" because global memcache limit of " +
StringUtils.humanReadableInt(this.globalMemcacheLimit) +
" exceeded; currently " +
StringUtils.humanReadableInt(globalMemcacheSize) + " and flushing till " +
StringUtils.humanReadableInt(this.globalMemcacheLimitLowMark));