HBASE-13803 - Disable the MobCompactionChore when the interval is not

larger than 0 (Jingcheng Du)
This commit is contained in:
ramkrishna 2015-06-01 10:37:54 +05:30
parent b5641d8edf
commit 7693e15b2b
2 changed files with 14 additions and 10 deletions

View File

@ -103,6 +103,7 @@ import org.apache.hadoop.hbase.master.procedure.ProcedurePrepareLatch;
import org.apache.hadoop.hbase.master.procedure.ProcedureSyncWait; import org.apache.hadoop.hbase.master.procedure.ProcedureSyncWait;
import org.apache.hadoop.hbase.master.procedure.TruncateTableProcedure; import org.apache.hadoop.hbase.master.procedure.TruncateTableProcedure;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.mob.MobConstants;
import org.apache.hadoop.hbase.monitoring.MemoryBoundedLogMessageBuffer; import org.apache.hadoop.hbase.monitoring.MemoryBoundedLogMessageBuffer;
import org.apache.hadoop.hbase.monitoring.MonitoredTask; import org.apache.hadoop.hbase.monitoring.MonitoredTask;
import org.apache.hadoop.hbase.monitoring.TaskMonitor; import org.apache.hadoop.hbase.monitoring.TaskMonitor;
@ -795,8 +796,15 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
this.expiredMobFileCleanerChore = new ExpiredMobFileCleanerChore(this); this.expiredMobFileCleanerChore = new ExpiredMobFileCleanerChore(this);
getChoreService().scheduleChore(expiredMobFileCleanerChore); getChoreService().scheduleChore(expiredMobFileCleanerChore);
this.mobCompactChore = new MobCompactionChore(this); int mobCompactionPeriod = conf.getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD);
if (mobCompactionPeriod > 0) {
this.mobCompactChore = new MobCompactionChore(this, mobCompactionPeriod);
getChoreService().scheduleChore(mobCompactChore); getChoreService().scheduleChore(mobCompactChore);
} else {
LOG
.info("The period is " + mobCompactionPeriod + " seconds, MobCompactionChore is disabled");
}
this.mobCompactThread = new MasterMobCompactionThread(this); this.mobCompactThread = new MasterMobCompactionThread(this);
if (this.cpHost != null) { if (this.cpHost != null) {

View File

@ -25,12 +25,11 @@ 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;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hbase.ScheduledChore;
import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.ScheduledChore;
import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableDescriptors;
import org.apache.hadoop.hbase.client.TableState; import org.apache.hadoop.hbase.client.TableState;
import org.apache.hadoop.hbase.mob.MobConstants;
import org.apache.hadoop.hbase.mob.MobUtils; import org.apache.hadoop.hbase.mob.MobUtils;
/** /**
@ -44,12 +43,9 @@ public class MobCompactionChore extends ScheduledChore {
private TableLockManager tableLockManager; private TableLockManager tableLockManager;
private ExecutorService pool; private ExecutorService pool;
public MobCompactionChore(HMaster master) { public MobCompactionChore(HMaster master, int period) {
super(master.getServerName() + "-MobCompactionChore", master, master.getConfiguration() // use the period as initial delay.
.getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD, super(master.getServerName() + "-MobCompactionChore", master, period, period, TimeUnit.SECONDS);
MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD), master.getConfiguration().getInt(
MobConstants.MOB_COMPACTION_CHORE_PERIOD,
MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD), TimeUnit.SECONDS);
this.master = master; this.master = master;
this.tableLockManager = master.getTableLockManager(); this.tableLockManager = master.getTableLockManager();
this.pool = MobUtils.createMobCompactorThreadPool(master.getConfiguration()); this.pool = MobUtils.createMobCompactorThreadPool(master.getConfiguration());