HBASE-13736 Add delay for the first execution of ExpiredMobFileCleanerChore and MobFileCompactorChore.(Jingcheng)

This commit is contained in:
anoopsjohn 2015-05-21 13:40:25 +05:30
parent 09a00efc0b
commit 5098f365b4
5 changed files with 20 additions and 15 deletions

View File

@ -1598,9 +1598,9 @@ possible configurations would overwhelm and obscure the important.
</property> </property>
<property> <property>
<name>hbase.master.mob.ttl.cleaner.period</name> <name>hbase.master.mob.ttl.cleaner.period</name>
<value>86400000</value> <value>86400</value>
<description> <description>
The period that ExpiredMobFileCleanerChore runs. The unit is millisecond. The period that ExpiredMobFileCleanerChore runs. The unit is second.
The default value is one day. The default value is one day.
</description> </description>
</property> </property>
@ -1635,9 +1635,9 @@ possible configurations would overwhelm and obscure the important.
</property> </property>
<property> <property>
<name>hbase.mob.file.compaction.chore.period</name> <name>hbase.mob.file.compaction.chore.period</name>
<value>604800000</value> <value>604800</value>
<description> <description>
The period that MobFileCompactionChore runs. The unit is millisecond. The period that MobFileCompactionChore runs. The unit is second.
The default value is one week. The default value is one week.
</description> </description>
</property> </property>

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -47,9 +48,10 @@ public class ExpiredMobFileCleanerChore extends ScheduledChore {
private ExpiredMobFileCleaner cleaner; private ExpiredMobFileCleaner cleaner;
public ExpiredMobFileCleanerChore(HMaster master) { public ExpiredMobFileCleanerChore(HMaster master) {
super(master.getServerName() + "-ExpiredMobFileCleanerChore", master, super(master.getServerName() + "-ExpiredMobFileCleanerChore", master, master.getConfiguration()
master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, .getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master
MobConstants.DEFAULT_MOB_CLEANER_PERIOD)); .getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS);
this.master = master; this.master = master;
this.tableLockManager = master.getTableLockManager(); this.tableLockManager = master.getTableLockManager();
cleaner = new ExpiredMobFileCleaner(); cleaner = new ExpiredMobFileCleaner();

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -44,9 +45,11 @@ public class MobFileCompactionChore extends ScheduledChore {
private ExecutorService pool; private ExecutorService pool;
public MobFileCompactionChore(HMaster master) { public MobFileCompactionChore(HMaster master) {
super(master.getServerName() + "-MobFileCompactChore", master, super(master.getServerName() + "-MobFileCompactChore", master, master.getConfiguration()
master.getConfiguration().getInt(MobConstants.MOB_FILE_COMPACTION_CHORE_PERIOD, .getInt(MobConstants.MOB_FILE_COMPACTION_CHORE_PERIOD,
MobConstants.DEFAULT_MOB_FILE_COMPACTION_CHORE_PERIOD)); MobConstants.DEFAULT_MOB_FILE_COMPACTION_CHORE_PERIOD), master.getConfiguration().getInt(
MobConstants.MOB_FILE_COMPACTION_CHORE_PERIOD,
MobConstants.DEFAULT_MOB_FILE_COMPACTION_CHORE_PERIOD), TimeUnit.SECONDS);
this.master = master; this.master = master;
this.tableLockManager = master.getTableLockManager(); this.tableLockManager = master.getTableLockManager();
this.pool = MobUtils.createMobFileCompactorThreadPool(master.getConfiguration()); this.pool = MobUtils.createMobFileCompactorThreadPool(master.getConfiguration());

View File

@ -44,7 +44,7 @@ public class MobConstants {
public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME); public static final byte[] MOB_REGION_NAME_BYTES = Bytes.toBytes(MOB_REGION_NAME);
public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period"; public static final String MOB_CLEANER_PERIOD = "hbase.master.mob.ttl.cleaner.period";
public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60 * 1000; // one day public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
public static final String MOB_SWEEP_TOOL_COMPACTION_START_DATE = public static final String MOB_SWEEP_TOOL_COMPACTION_START_DATE =
"hbase.mob.sweep.tool.compaction.start.date"; "hbase.mob.sweep.tool.compaction.start.date";
@ -106,7 +106,7 @@ public class MobConstants {
public static final String MOB_FILE_COMPACTION_CHORE_PERIOD = public static final String MOB_FILE_COMPACTION_CHORE_PERIOD =
"hbase.mob.file.compaction.chore.period"; "hbase.mob.file.compaction.chore.period";
public static final int DEFAULT_MOB_FILE_COMPACTION_CHORE_PERIOD = public static final int DEFAULT_MOB_FILE_COMPACTION_CHORE_PERIOD =
24 * 60 * 60 * 1000 * 7; // a week 24 * 60 * 60 * 7; // a week
public static final String MOB_FILE_COMPACTOR_CLASS_KEY = "hbase.mob.file.compactor.class"; public static final String MOB_FILE_COMPACTOR_CLASS_KEY = "hbase.mob.file.compactor.class";
/** /**
* The max number of threads used in MobFileCompactor. * The max number of threads used in MobFileCompactor.

View File

@ -166,10 +166,10 @@ HBase MOB currently relies on a MapReduce job called the Sweeper tool for optimi
</description> </description>
</property> </property>
<property> <property>
<name>hbase.mob.cleaner.interval</name> <name>hbase.master.mob.ttl.cleaner.period</name>
<value>86400000</value> <value>86400</value>
<description> <description>
The period that ExpiredMobFileCleaner runs. The unit is millisecond. The period that ExpiredMobFileCleanerChore runs. The unit is second.
The default value is one day. The default value is one day.
</description> </description>
</property> </property>