HBASE-3189 Stagger Major Compactions
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1030255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c48a1061a7
commit
c767ca49d1
|
@ -1092,6 +1092,7 @@ Release 0.21.0 - Unreleased
|
|||
logic
|
||||
HBASE-3180 Review periodic master logging, especially ServerManager once
|
||||
a minute
|
||||
HBASE-3189 Stagger Major Compactions (Nicolas Spiegelberg via Stack)
|
||||
|
||||
|
||||
NEW FEATURES
|
||||
|
|
|
@ -190,13 +190,7 @@ public class Store implements HeapSize {
|
|||
this.blockingStoreFileCount =
|
||||
conf.getInt("hbase.hstore.blockingStoreFiles", -1);
|
||||
|
||||
this.majorCompactionTime =
|
||||
conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 86400000);
|
||||
if (family.getValue(HConstants.MAJOR_COMPACTION_PERIOD) != null) {
|
||||
String strCompactionTime =
|
||||
family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
|
||||
this.majorCompactionTime = (new Long(strCompactionTime)).longValue();
|
||||
}
|
||||
this.majorCompactionTime = getNextMajorCompactTime();
|
||||
|
||||
this.maxFilesToCompact = conf.getInt("hbase.hstore.compaction.max", 10);
|
||||
if (Store.closeCheckInterval == 0) {
|
||||
|
@ -789,10 +783,31 @@ public class Store implements HeapSize {
|
|||
"; time since last major compaction " + (now - lowTimestamp) + "ms");
|
||||
}
|
||||
result = true;
|
||||
this.majorCompactionTime = getNextMajorCompactTime();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
long getNextMajorCompactTime() {
|
||||
// default = 24hrs
|
||||
long ret = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 1000*60*60*24);
|
||||
if (family.getValue(HConstants.MAJOR_COMPACTION_PERIOD) != null) {
|
||||
String strCompactionTime =
|
||||
family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
|
||||
ret = (new Long(strCompactionTime)).longValue();
|
||||
}
|
||||
|
||||
if (ret > 0) {
|
||||
// default = +/- 4 hrs
|
||||
long jitter = conf.getLong("hbase.hregion.majorcompaction.jitter",
|
||||
1000*60*60*4);
|
||||
if (jitter > 0) {
|
||||
ret += jitter - Math.round(jitter * 2 * Math.random());
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a minor/major compaction. Uses the scan infrastructure to make it easy.
|
||||
|
|
Loading…
Reference in New Issue