HBASE-1947 If HBase starts/stops often in less than 24 hours,

you end up with lots of store files


git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@832188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-11-02 23:28:02 +00:00
parent a9680f4e8b
commit 96dfa4a2bf
4 changed files with 30 additions and 3 deletions

View File

@ -151,6 +151,8 @@ Release 0.21.0 - Unreleased
HBASE-1943 Remove AgileJSON; unused
HBASE-1944 Add a "deferred log flush" attribute to HTD
HBASE-1945 Remove META and ROOT memcache size bandaid
HBASE-1947 If HBase starts/stops often in less than 24 hours,
you end up with lots of store files
OPTIMIZATIONS
HBASE-410 [testing] Speed up the test suite

View File

@ -2501,6 +2501,20 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
return old;
}
/**
* Checks every store to see if one has too many
* store files
* @return true if any store has too many store files
*/
public boolean hasTooManyStoreFiles() {
for(Store store : stores.values()) {
if(store.hasTooManyStoreFiles()) {
return true;
}
}
return false;
}
/**
* Facility for dumping and compacting catalog tables.
* Only does catalog tables since these are only tables we for sure know

View File

@ -1428,10 +1428,12 @@ public class HRegionServer implements HConstants, HRegionInterface,
if (region == null) {
try {
region = instantiateRegion(regionInfo);
// Startup a compaction early if one is needed, if region has references.
if (region.hasReferences()) {
// Startup a compaction early if one is needed, if region has references
// or if a store has too many store files
if (region.hasReferences() || region.hasTooManyStoreFiles()) {
this.compactSplitThread.compactionRequested(region,
"Region has references on open");
region.hasReferences() ? "Region has references on open" :
"Region has too many store files");
}
} catch (Throwable e) {
Throwable t = cleanup(e,

View File

@ -1501,6 +1501,15 @@ public class Store implements HConstants, HeapSize {
this.lock.readLock().unlock();
}
}
/**
* See if there's too much store files in this store
* @return true if number of store files is greater than
* the number defined in compactionThreshold
*/
public boolean hasTooManyStoreFiles() {
return this.storefiles.size() > this.compactionThreshold;
}
public static final long FIXED_OVERHEAD = ClassSize.align(
ClassSize.OBJECT + (17 * ClassSize.REFERENCE) +