Search in sources :

Example 1 with HbckInfo

use of org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo in project hbase by apache.

the class TestHBaseFsckComparator method testDiffTable.

@Test
public void testDiffTable() {
    HbckInfo hi1 = genHbckInfo(table, keyA, keyC, 0);
    HbckInfo hi2 = genHbckInfo(table2, keyA, keyC, 0);
    assertTrue(HBaseFsck.cmp.compare(hi1, hi2) < 0);
    assertTrue(HBaseFsck.cmp.compare(hi2, hi1) > 0);
}
Also used : HbckInfo(org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo) Test(org.junit.Test)

Example 2 with HbckInfo

use of org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo in project hbase by apache.

the class TestHBaseFsckComparator method testEquals.

@Test
public void testEquals() {
    HbckInfo hi1 = genHbckInfo(table, keyA, keyB, 0);
    HbckInfo hi2 = genHbckInfo(table, keyA, keyB, 0);
    assertEquals(0, HBaseFsck.cmp.compare(hi1, hi2));
    assertEquals(0, HBaseFsck.cmp.compare(hi2, hi1));
}
Also used : HbckInfo(org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo) Test(org.junit.Test)

Example 3 with HbckInfo

use of org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo in project hbase by apache.

the class TestOfflineMetaRebuildOverlap method testMetaRebuildOverlapFail.

@Test(timeout = 120000)
public void testMetaRebuildOverlapFail() throws Exception {
    // Add a new .regioninfo meta entry in hdfs
    byte[] startKey = splits[0];
    byte[] endKey = splits[2];
    createRegion(conf, htbl, startKey, endKey);
    wipeOutMeta();
    // is meta really messed up?
    assertEquals(1, scanMeta());
    assertErrors(doFsck(conf, false), new ERROR_CODE[] { ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED });
    // Note, would like to check # of tables, but this takes a while to time
    // out.
    // shutdown the minicluster
    TEST_UTIL.shutdownMiniHBaseCluster();
    TEST_UTIL.shutdownMiniZKCluster();
    // attempt to rebuild meta table from scratch
    HBaseFsck fsck = new HBaseFsck(conf);
    assertFalse(fsck.rebuildMeta(false));
    Multimap<byte[], HbckInfo> problems = fsck.getOverlapGroups(table);
    assertEquals(1, problems.keySet().size());
    assertEquals(3, problems.size());
    // bring up the minicluster
    // tables seem enabled by default
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.restartHBaseCluster(3);
    LOG.info("Waiting for no more RIT");
    TEST_UTIL.waitUntilNoRegionsInTransition(60000);
    LOG.info("No more RIT in ZK, now doing final test verification");
    // Meta still messed up.
    assertEquals(1, scanMeta());
    HTableDescriptor[] htbls = getTables(TEST_UTIL.getConfiguration());
    LOG.info("Tables present after restart: " + Arrays.toString(htbls));
    // After HBASE-451 HBaseAdmin.listTables() gets table descriptors from FS,
    // so the table is still present and this should be 1.
    assertEquals(1, htbls.length);
    assertErrors(doFsck(conf, false), new ERROR_CODE[] { ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED, ERROR_CODE.NOT_IN_META_OR_DEPLOYED });
}
Also used : HBaseFsck(org.apache.hadoop.hbase.util.HBaseFsck) HbckInfo(org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) Test(org.junit.Test)

Example 4 with HbckInfo

use of org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo in project hbase by apache.

the class TestHBaseFsckComparator method testEqualsInstance.

@Test
public void testEqualsInstance() {
    HbckInfo hi1 = genHbckInfo(table, keyA, keyB, 0);
    HbckInfo hi2 = hi1;
    assertEquals(0, HBaseFsck.cmp.compare(hi1, hi2));
    assertEquals(0, HBaseFsck.cmp.compare(hi2, hi1));
}
Also used : HbckInfo(org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo) Test(org.junit.Test)

Example 5 with HbckInfo

use of org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo in project hbase by apache.

the class TestHBaseFsckComparator method testDiffStartKey.

@Test
public void testDiffStartKey() {
    HbckInfo hi1 = genHbckInfo(table, keyStart, keyC, 0);
    HbckInfo hi2 = genHbckInfo(table, keyA, keyC, 0);
    assertTrue(HBaseFsck.cmp.compare(hi1, hi2) < 0);
    assertTrue(HBaseFsck.cmp.compare(hi2, hi1) > 0);
}
Also used : HbckInfo(org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo) Test(org.junit.Test)

Aggregations

HbckInfo (org.apache.hadoop.hbase.util.HBaseFsck.HbckInfo)7 Test (org.junit.Test)7 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)1 HBaseFsck (org.apache.hadoop.hbase.util.HBaseFsck)1