Search in sources :

Example 1 with HbckChore

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());
}
Also used : HbckChore(org.apache.hadoop.hbase.master.HbckChore) RegionInfo(org.apache.hadoop.hbase.client.RegionInfo) MasterProcedureEnv(org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv) IOException(java.io.IOException) Result(org.apache.hadoop.hbase.client.Result) TableName(org.apache.hadoop.hbase.TableName) GCMultipleMergedRegionsProcedure(org.apache.hadoop.hbase.master.assignment.GCMultipleMergedRegionsProcedure) HMaster(org.apache.hadoop.hbase.master.HMaster) Map(java.util.Map) Test(org.junit.Test)

Example 2 with HbckChore

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);
}
Also used : HbckChore(org.apache.hadoop.hbase.master.HbckChore) Test(org.junit.Test)

Example 3 with HbckChore

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);
}
Also used : HbckChore(org.apache.hadoop.hbase.master.HbckChore) Before(org.junit.Before)

Aggregations

HbckChore (org.apache.hadoop.hbase.master.HbckChore)3 Test (org.junit.Test)2 IOException (java.io.IOException)1 Map (java.util.Map)1 TableName (org.apache.hadoop.hbase.TableName)1 RegionInfo (org.apache.hadoop.hbase.client.RegionInfo)1 Result (org.apache.hadoop.hbase.client.Result)1 HMaster (org.apache.hadoop.hbase.master.HMaster)1 GCMultipleMergedRegionsProcedure (org.apache.hadoop.hbase.master.assignment.GCMultipleMergedRegionsProcedure)1 MasterProcedureEnv (org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)1 Before (org.junit.Before)1