diff --git a/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java b/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java index 18c15f12b05..00aa48de726 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/MemcacheFlusher.java @@ -223,32 +223,26 @@ class MemcacheFlusher extends Thread implements FlushRequester { */ private boolean flushRegion(HRegion region, boolean removeFromQueue) { // Wait until it is safe to flush. - // TODO: Fix. This block doesn't work if more than one store. - int count = 0; - boolean triggered = false; - while (count++ < (blockingWaitTime / 500)) { + boolean toomany; + do { + toomany = false; for (Store hstore: region.stores.values()) { int files = hstore.getStorefilesCount(); if (files > this.blockingStoreFilesNumber) { - if (!triggered) { - server.compactSplitThread.compactionRequested(region, getName()); - LOG.info("Too many store files in store " + hstore + ": " + - files + ", pausing"); - triggered = true; + if (LOG.isDebugEnabled()) { + LOG.debug("Too many store files in store " + hstore + ": " + + files + ", waiting"); } + toomany = true; + server.compactSplitThread.compactionRequested(region, getName()); try { - Thread.sleep(500); + Thread.sleep(blockingWaitTime); } catch (InterruptedException e) { // ignore } - continue; } } - if (triggered) { - LOG.info("Compaction triggered on region " + region + ", proceeding"); - } - break; - } + } while (toomany); synchronized (regionsInQueue) { // See comment above for removeFromQueue on why we do not // take the region out of the set. If removeFromQueue is true, remove it