HBASE-1583 Start/Stop of large cluster untenable

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@794905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-16 23:24:21 +00:00
parent 53b3084c85
commit ef30d39681
4 changed files with 31 additions and 10 deletions

View File

@ -272,6 +272,7 @@ Release 0.20.0 - Unreleased
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 HBASE-1058 Disable 1058 on catalog tables
HBASE-1583 Start/Stop of large cluster untenable
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

@ -26,17 +26,16 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import org.apache.hadoop.util.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.RemoteExceptionHandler;
import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.RemoteExceptionHandler;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.util.Writables;
import org.apache.hadoop.util.StringUtils;
/** /**
* Compact region on request and then run split if appropriate * Compact region on request and then run split if appropriate

View File

@ -343,6 +343,20 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
" available; sequence id is " + this.minSequenceId); " available; sequence id is " + this.minSequenceId);
} }
/**
* @return True if this region has references.
*/
boolean hasReferences() {
for (Map.Entry<byte [], Store> e: this.stores.entrySet()) {
for (Map.Entry<Long, StoreFile> ee:
e.getValue().getStorefiles().entrySet()) {
// Found a reference, return.
if (ee.getValue().isReference()) return true;
}
}
return false;
}
/* /*
* Write out an info file under the region directory. Useful recovering * Write out an info file under the region directory. Useful recovering
* mangled regions. * mangled regions.
@ -747,6 +761,10 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
*/ */
byte [] compactStores(final boolean majorCompaction) byte [] compactStores(final boolean majorCompaction)
throws IOException { throws IOException {
if (this.closing.get() || this.closed.get()) {
LOG.debug("Skipping compaction on " + this + " because closing/closed");
return null;
}
splitsAndClosesLock.readLock().lock(); splitsAndClosesLock.readLock().lock();
try { try {
byte [] splitRow = null; byte [] splitRow = null;
@ -1493,6 +1511,7 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
Progressable reporter) Progressable reporter)
throws UnsupportedEncodingException, IOException { throws UnsupportedEncodingException, IOException {
// Nothing to do (Replaying is done in HStores) // Nothing to do (Replaying is done in HStores)
// Used by subclasses; e.g. THBase.
} }
protected Store instantiateHStore(Path baseDir, protected Store instantiateHStore(Path baseDir,

View File

@ -1553,9 +1553,11 @@ public class HRegionServer implements HConstants, HRegionInterface,
if (region == null) { if (region == null) {
try { try {
region = instantiateRegion(regionInfo); region = instantiateRegion(regionInfo);
// Startup a compaction early if one is needed. // Startup a compaction early if one is needed, if region has references.
this.compactSplitThread. if (region.hasReferences()) {
compactionRequested(region, "Region open check"); this.compactSplitThread.compactionRequested(region,
"Region has references on open");
}
} catch (Throwable e) { } catch (Throwable e) {
Throwable t = cleanup(e, Throwable t = cleanup(e,
"Error opening " + regionInfo.getRegionNameAsString()); "Error opening " + regionInfo.getRegionNameAsString());