当前位置: 首页>>代码示例>>Java>>正文


Java TestEndToEndSplitTransaction类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction的典型用法代码示例。如果您正苦于以下问题:Java TestEndToEndSplitTransaction类的具体用法?Java TestEndToEndSplitTransaction怎么用?Java TestEndToEndSplitTransaction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TestEndToEndSplitTransaction类属于org.apache.hadoop.hbase.regionserver包,在下文中一共展示了TestEndToEndSplitTransaction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testValidLingeringSplitParent

import org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction; //导入依赖的package包/类
/**
 * Tests that LINGERING_SPLIT_PARENT is not erroneously reported for
 * valid cases where the daughters are there.
 */
@Test (timeout=180000)
public void testValidLingeringSplitParent() throws Exception {
  TableName table =
      TableName.valueOf("testLingeringSplitParent");
  Table meta = null;
  try {
    setupTable(table);
    assertEquals(ROWKEYS.length, countRows());

    // make sure data in regions, if in wal only there is no data loss
    admin.flush(table);
    HRegionLocation location = tbl.getRegionLocation(Bytes.toBytes("B"));

    meta = connection.getTable(TableName.META_TABLE_NAME, tableExecutorService);
    HRegionInfo hri = location.getRegionInfo();

    // do a regular split
    byte[] regionName = location.getRegionInfo().getRegionName();
    admin.splitRegion(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));
    TestEndToEndSplitTransaction.blockUntilRegionSplit(conf, 60000, regionName, true);

    // TODO: fixHdfsHoles does not work against splits, since the parent dir lingers on
    // for some time until children references are deleted. HBCK erroneously sees this as
    // overlapping regions
    HBaseFsck hbck = doFsck(
      conf, true, true, false, false, false, true, true, true, false, false, false, null);
    assertErrors(hbck, new ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported

    // assert that the split hbase:meta entry is still there.
    Get get = new Get(hri.getRegionName());
    Result result = meta.get(get);
    assertNotNull(result);
    assertNotNull(MetaTableAccessor.getHRegionInfo(result));

    assertEquals(ROWKEYS.length, countRows());

    // assert that we still have the split regions
    assertEquals(tbl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions pre-split.
    assertNoErrors(doFsck(conf, false));
  } finally {
    cleanupTable(table);
    IOUtils.closeQuietly(meta);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:49,代码来源:TestHBaseFsck.java

示例2: testValidLingeringSplitParent

import org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction; //导入依赖的package包/类
/**
 * Tests that LINGERING_SPLIT_PARENT is not erroneously reported for
 * valid cases where the daughters are there.
 */
@Test
public void testValidLingeringSplitParent() throws Exception {
  String table = "testLingeringSplitParent";
  HTable meta = null;
  try {
    setupTable(table);
    assertEquals(ROWKEYS.length, countRows());

    // make sure data in regions, if in hlog only there is no data loss
    TEST_UTIL.getHBaseAdmin().flush(table);
    HRegionLocation location = tbl.getRegionLocation("B");

    meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getName());
    HRegionInfo hri = location.getRegionInfo();

    // do a regular split
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    byte[] regionName = location.getRegionInfo().getRegionName();
    admin.split(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));
    TestEndToEndSplitTransaction.blockUntilRegionSplit(
        TEST_UTIL.getConfiguration(), 60000, regionName, true);

    // TODO: fixHdfsHoles does not work against splits, since the parent dir lingers on
    // for some time until children references are deleted. HBCK erroneously sees this as
    // overlapping regions
    HBaseFsck hbck = doFsck(conf, true, true, false, false, false, true, true, true, null);
    assertErrors(hbck, new ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported

    // assert that the split META entry is still there.
    Get get = new Get(hri.getRegionName());
    Result result = meta.get(get);
    assertNotNull(result);
    assertNotNull(MetaReader.parseCatalogResult(result).getFirst());

    assertEquals(ROWKEYS.length, countRows());

    // assert that we still have the split regions
    assertEquals(tbl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions pre-split.
    assertNoErrors(doFsck(conf, false));
  } finally {
    deleteTable(table);
    IOUtils.closeQuietly(meta);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:49,代码来源:TestHBaseFsck.java

示例3: testValidLingeringSplitParent

import org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction; //导入依赖的package包/类
/**
 * Tests that LINGERING_SPLIT_PARENT is not erroneously reported for
 * valid cases where the daughters are there.
 */
@Test
public void testValidLingeringSplitParent() throws Exception {
  TableName table =
      TableName.valueOf("testLingeringSplitParent");
  HTable meta = null;
  try {
    setupTable(table);
    assertEquals(ROWKEYS.length, countRows());

    // make sure data in regions, if in hlog only there is no data loss
    TEST_UTIL.getHBaseAdmin().flush(table.getName());
    HRegionLocation location = tbl.getRegionLocation("B");

    meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName());
    HRegionInfo hri = location.getRegionInfo();

    // do a regular split
    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
    byte[] regionName = location.getRegionInfo().getRegionName();
    admin.split(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));
    TestEndToEndSplitTransaction.blockUntilRegionSplit(
        TEST_UTIL.getConfiguration(), 60000, regionName, true);

    // TODO: fixHdfsHoles does not work against splits, since the parent dir lingers on
    // for some time until children references are deleted. HBCK erroneously sees this as
    // overlapping regions
    HBaseFsck hbck = doFsck(conf, true, true, false, false, false, true, true, true, false, false, null);
    assertErrors(hbck, new ERROR_CODE[] {}); //no LINGERING_SPLIT_PARENT reported

    // assert that the split hbase:meta entry is still there.
    Get get = new Get(hri.getRegionName());
    Result result = meta.get(get);
    assertNotNull(result);
    assertNotNull(HRegionInfo.getHRegionInfo(result));

    assertEquals(ROWKEYS.length, countRows());

    // assert that we still have the split regions
    assertEquals(tbl.getStartKeys().length, SPLITS.length + 1 + 1); //SPLITS + 1 is # regions pre-split.
    assertNoErrors(doFsck(conf, false));
  } finally {
    deleteTable(table);
    IOUtils.closeQuietly(meta);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:50,代码来源:TestHBaseFsck.java

示例4: setUpBeforeClass

import org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.startMiniCluster(3);
  REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  context = JAXBContext.newInstance(
      TableModel.class,
      TableInfoModel.class,
      TableListModel.class,
      TableRegionModel.class);
  Admin admin = TEST_UTIL.getAdmin();
  if (admin.tableExists(TABLE)) {
    return;
  }
  HTableDescriptor htd = new HTableDescriptor(TABLE);
  htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
  admin.createTable(htd);
  byte[] k = new byte[3];
  byte [][] famAndQf = CellUtil.parseColumn(Bytes.toBytes(COLUMN));
  List<Put> puts = new ArrayList<>();
  for (byte b1 = 'a'; b1 < 'z'; b1++) {
    for (byte b2 = 'a'; b2 < 'z'; b2++) {
      for (byte b3 = 'a'; b3 < 'z'; b3++) {
        k[0] = b1;
        k[1] = b2;
        k[2] = b3;
        Put put = new Put(k);
        put.setDurability(Durability.SKIP_WAL);
        put.addColumn(famAndQf[0], famAndQf[1], k);
        puts.add(put);
      }
    }
  }
  Connection connection = TEST_UTIL.getConnection();

  Table table =  connection.getTable(TABLE);
  table.put(puts);
  table.close();
  // get the initial layout (should just be one region)

  RegionLocator regionLocator = connection.getRegionLocator(TABLE);
  List<HRegionLocation> m = regionLocator.getAllRegionLocations();
  assertEquals(1, m.size());
  // tell the master to split the table
  admin.split(TABLE);
  // give some time for the split to happen

  TestEndToEndSplitTransaction.blockUntilRegionSplit(TEST_UTIL.getConfiguration(), 60000,
    m.get(0).getRegionInfo().getRegionName(), true);
  long timeout = System.currentTimeMillis() + (15 * 1000);
  while (System.currentTimeMillis() < timeout && m.size()!=2){
    try {
      Thread.sleep(250);
    } catch (InterruptedException e) {
      LOG.warn(StringUtils.stringifyException(e));
    }
    // check again
    m = regionLocator.getAllRegionLocations();
  }

  // should have two regions now
  assertEquals(2, m.size());
  regionMap = m;
  LOG.info("regions: " + regionMap);
  regionLocator.close();
}
 
开发者ID:apache,项目名称:hbase,代码行数:68,代码来源:TestTableResource.java


注:本文中的org.apache.hadoop.hbase.regionserver.TestEndToEndSplitTransaction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。