HBASE-1664 Disable 1058 on catalog tables

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@794867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-16 21:29:05 +00:00
parent 935eb0fb1c
commit 8439231fe7
2 changed files with 49 additions and 36 deletions

View File

@ -270,6 +270,7 @@ Release 0.20.0 - Unreleased
HBASE-1663 Request compaction only once instead of every time 500ms each HBASE-1663 Request compaction only once instead of every time 500ms each
time we cycle the hstore.getStorefilesCount() > time we cycle the hstore.getStorefilesCount() >
this.blockingStoreFilesNumber loop this.blockingStoreFilesNumber loop
HBASE-1058 Disable 1058 on catalog tables
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

View File

@ -222,41 +222,7 @@ class MemStoreFlusher extends Thread implements FlushRequester {
* not flushed. * not flushed.
*/ */
private boolean flushRegion(HRegion region, boolean removeFromQueue) { private boolean flushRegion(HRegion region, boolean removeFromQueue) {
int count = 0; checkStoreFileCount(region);
boolean triggered = false;
boolean finished = false;
while (count++ < (blockingWaitTime / 500)) {
finished = true;
for (Store hstore: region.stores.values()) {
if (hstore.getStorefilesCount() > this.blockingStoreFilesNumber) {
// only log once
if (!triggered) {
LOG.info("Too many store files for region " + region + ": " +
hstore.getStorefilesCount() + ", requesting compaction and " +
"waiting");
this.server.compactSplitThread.compactionRequested(region, getName());
triggered = true;
}
// pending compaction, not finished
finished = false;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
if (triggered && finished) {
LOG.info("Compaction has completed, we waited " + (count * 500) + "ms, "
+ "finishing flush of region " + region);
break;
}
}
if (triggered && !finished) {
LOG.warn("Tried to hold up flushing for compactions of region " + region +
" but have waited longer than " + blockingWaitTime + "ms, continuing");
}
synchronized (regionsInQueue) { synchronized (regionsInQueue) {
// See comment above for removeFromQueue on why we do not // See comment above for removeFromQueue on why we do not
// take the region out of the set. If removeFromQueue is true, remove it // take the region out of the set. If removeFromQueue is true, remove it
@ -298,6 +264,52 @@ class MemStoreFlusher extends Thread implements FlushRequester {
return true; return true;
} }
/*
* If too many store files already, schedule a compaction and pause a while
* before going on with compaction.
* @param region Region to check.
*/
private void checkStoreFileCount(final HRegion region) {
// If catalog region, do not ever hold up writes (isMetaRegion returns
// true if ROOT or META region).
if (region.getRegionInfo().isMetaRegion()) return;
int count = 0;
boolean triggered = false;
boolean finished = false;
while (count++ < (blockingWaitTime / 500)) {
finished = true;
for (Store hstore: region.stores.values()) {
if (hstore.getStorefilesCount() > this.blockingStoreFilesNumber) {
// only log once
if (!triggered) {
LOG.info("Too many store files for region " + region + ": " +
hstore.getStorefilesCount() + ", requesting compaction and " +
"waiting");
this.server.compactSplitThread.compactionRequested(region, getName());
triggered = true;
}
// pending compaction, not finished
finished = false;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignore
}
}
}
if (triggered && finished) {
LOG.info("Compaction has completed, we waited " + (count * 500) + "ms, "
+ "finishing flush of region " + region);
break;
}
}
if (triggered && !finished) {
LOG.warn("Tried to hold up flushing for compactions of region " + region +
" but have waited longer than " + blockingWaitTime + "ms, continuing");
}
}
/** /**
* Check if the regionserver's memstore memory usage is greater than the * Check if the regionserver's memstore memory usage is greater than the
* limit. If so, flush regions with the biggest memstores until we're down * limit. If so, flush regions with the biggest memstores until we're down