use of org.apache.hadoop.hbase.master.HbckChore in project hbase by apache.
the class TestMetaFixer method testOverlap.
@Test
public void testOverlap() throws Exception {
TableName tn = TableName.valueOf(this.name.getMethodName());
testOverlapCommon(tn);
HMaster services = TEST_UTIL.getHBaseCluster().getMaster();
HbckChore hbckChore = services.getHbckChore();
CatalogJanitor cj = services.getCatalogJanitor();
cj.scan();
Report report = cj.getLastReport();
assertEquals(6, report.getOverlaps().size());
assertEquals(1, MetaFixer.calculateMerges(10, report.getOverlaps()).size());
MetaFixer fixer = new MetaFixer(services);
fixer.fixOverlaps(report);
HBaseTestingUtil.await(10, () -> {
try {
if (cj.scan() > 0) {
// It submits GC once, then it will immediately kick off another GC to test if
// GCMultipleMergedRegionsProcedure is idempotent. If it is not, it will create
// a hole.
Map<RegionInfo, Result> mergedRegions = cj.getLastReport().mergedRegions;
for (Map.Entry<RegionInfo, Result> e : mergedRegions.entrySet()) {
List<RegionInfo> parents = CatalogFamilyFormat.getMergeRegions(e.getValue().rawCells());
if (parents != null) {
ProcedureExecutor<MasterProcedureEnv> pe = services.getMasterProcedureExecutor();
pe.submitProcedure(new GCMultipleMergedRegionsProcedure(pe.getEnvironment(), e.getKey(), parents));
}
}
return true;
}
return false;
} catch (Exception e) {
throw new RuntimeException(e);
}
});
// Wait until all GCs settled down
HBaseTestingUtil.await(10, () -> {
return services.getMasterProcedureExecutor().getActiveProcIds().isEmpty();
});
// No orphan regions on FS
hbckChore.choreForTesting();
assertEquals(0, hbckChore.getOrphanRegionsOnFS().size());
// No holes reported.
cj.scan();
final Report postReport = cj.getLastReport();
assertTrue(postReport.isEmpty());
}
use of org.apache.hadoop.hbase.master.HbckChore in project hbase by apache.
the class TestHbckChore method testChoreDisable.
@Test
public void testChoreDisable() {
// The way to disable to chore is to set hbase.master.hbck.chore.interval <= 0
// When the interval is > 0, the chore should run.
long lastRunTime = hbckChore.getCheckingEndTimestamp();
hbckChore.choreForTesting();
boolean ran = lastRunTime != hbckChore.getCheckingEndTimestamp();
assertTrue(ran);
// When the interval <= 0, the chore shouldn't run
master.getConfiguration().setInt("hbase.master.hbck.chore.interval", 0);
HbckChore hbckChoreWithChangedConf = new HbckChore(master);
lastRunTime = hbckChoreWithChangedConf.getCheckingEndTimestamp();
hbckChoreWithChangedConf.choreForTesting();
ran = lastRunTime != hbckChoreWithChangedConf.getCheckingEndTimestamp();
assertFalse(ran);
}
use of org.apache.hadoop.hbase.master.HbckChore in project hbase by apache.
the class TestHbckChore method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
hbckChore = new HbckChore(master);
}
Aggregations