HBASE-19672 Correct comments for default values of major compaction in SortedCompactionPolicy#getNextMajorCompactTime()
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
24b7fc92f0
commit
5b3513a5ee
|
@ -285,8 +285,19 @@ public final class HConstants {
|
||||||
/** Parameter name for how often we should try to write a version file, before failing */
|
/** Parameter name for how often we should try to write a version file, before failing */
|
||||||
public static final int DEFAULT_VERSION_FILE_WRITE_ATTEMPTS = 3;
|
public static final int DEFAULT_VERSION_FILE_WRITE_ATTEMPTS = 3;
|
||||||
|
|
||||||
/** Parameter name for how often a region should should perform a major compaction */
|
/** Parameter name and default value for how often a region should perform a major compaction */
|
||||||
public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
|
public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
|
||||||
|
public static final long DEFAULT_MAJOR_COMPACTION_PERIOD = 1000 * 60 * 60 * 24 * 7; // 7 days
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter name and default value for major compaction jitter.
|
||||||
|
* Used as a multiplier applied to {@link HConstants#MAJOR_COMPACTION_PERIOD}
|
||||||
|
* to cause compaction to occur a given amount of time either side of
|
||||||
|
* {@link HConstants#MAJOR_COMPACTION_PERIOD}.
|
||||||
|
* Default to 0.5 so jitter has us fall evenly either side of when the compaction should run.
|
||||||
|
*/
|
||||||
|
public static final String MAJOR_COMPACTION_JITTER = "hbase.hregion.majorcompaction.jitter";
|
||||||
|
public static final float DEFAULT_MAJOR_COMPACTION_JITTER = 0.50F;
|
||||||
|
|
||||||
/** Parameter name for the maximum batch of KVs to be used in flushes and compactions */
|
/** Parameter name for the maximum batch of KVs to be used in flushes and compactions */
|
||||||
public static final String COMPACTION_KV_MAX = "hbase.hstore.compaction.kv.max";
|
public static final String COMPACTION_KV_MAX = "hbase.hstore.compaction.kv.max";
|
||||||
|
|
|
@ -127,9 +127,10 @@ public class CompactionConfiguration {
|
||||||
|
|
||||||
throttlePoint = conf.getLong("hbase.regionserver.thread.compaction.throttle",
|
throttlePoint = conf.getLong("hbase.regionserver.thread.compaction.throttle",
|
||||||
2 * maxFilesToCompact * storeConfigInfo.getMemStoreFlushSize());
|
2 * maxFilesToCompact * storeConfigInfo.getMemStoreFlushSize());
|
||||||
majorCompactionPeriod = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 1000*60*60*24*7);
|
majorCompactionPeriod = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD,
|
||||||
// Make it 0.5 so jitter has us fall evenly either side of when the compaction should run
|
HConstants.DEFAULT_MAJOR_COMPACTION_PERIOD);
|
||||||
majorCompactionJitter = conf.getFloat("hbase.hregion.majorcompaction.jitter", 0.50F);
|
majorCompactionJitter = conf.getFloat(HConstants.MAJOR_COMPACTION_JITTER,
|
||||||
|
HConstants.DEFAULT_MAJOR_COMPACTION_JITTER);
|
||||||
minLocalityToForceCompact = conf.getFloat(HBASE_HSTORE_MIN_LOCALITY_TO_SKIP_MAJOR_COMPACT, 0f);
|
minLocalityToForceCompact = conf.getFloat(HBASE_HSTORE_MIN_LOCALITY_TO_SKIP_MAJOR_COMPACT, 0f);
|
||||||
|
|
||||||
dateTieredMaxStoreFileAgeMillis = conf.getLong(DATE_TIERED_MAX_AGE_MILLIS_KEY, Long.MAX_VALUE);
|
dateTieredMaxStoreFileAgeMillis = conf.getLong(DATE_TIERED_MAX_AGE_MILLIS_KEY, Long.MAX_VALUE);
|
||||||
|
|
|
@ -119,16 +119,21 @@ public abstract class SortedCompactionPolicy extends CompactionPolicy {
|
||||||
* @return When to run next major compaction
|
* @return When to run next major compaction
|
||||||
*/
|
*/
|
||||||
public long getNextMajorCompactTime(Collection<HStoreFile> filesToCompact) {
|
public long getNextMajorCompactTime(Collection<HStoreFile> filesToCompact) {
|
||||||
// default = 24hrs
|
/** Default to {@link org.apache.hadoop.hbase.HConstants#DEFAULT_MAJOR_COMPACTION_PERIOD}. */
|
||||||
long period = comConf.getMajorCompactionPeriod();
|
long period = comConf.getMajorCompactionPeriod();
|
||||||
if (period <= 0) {
|
if (period <= 0) {
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
// default = 20% = +/- 4.8 hrs
|
|
||||||
|
/**
|
||||||
|
* Default to {@link org.apache.hadoop.hbase.HConstants#DEFAULT_MAJOR_COMPACTION_JITTER},
|
||||||
|
* that is, +/- 3.5 days (7 days * 0.5).
|
||||||
|
*/
|
||||||
double jitterPct = comConf.getMajorCompactionJitter();
|
double jitterPct = comConf.getMajorCompactionJitter();
|
||||||
if (jitterPct <= 0) {
|
if (jitterPct <= 0) {
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
// deterministic jitter avoids a major compaction storm on restart
|
// deterministic jitter avoids a major compaction storm on restart
|
||||||
OptionalInt seed = StoreUtils.getDeterministicRandomSeed(filesToCompact);
|
OptionalInt seed = StoreUtils.getDeterministicRandomSeed(filesToCompact);
|
||||||
if (seed.isPresent()) {
|
if (seed.isPresent()) {
|
||||||
|
|
Loading…
Reference in New Issue