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


Java MetaReader.fullScanMetaAndPrint方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.catalog.MetaReader.fullScanMetaAndPrint方法的典型用法代码示例。如果您正苦于以下问题:Java MetaReader.fullScanMetaAndPrint方法的具体用法?Java MetaReader.fullScanMetaAndPrint怎么用?Java MetaReader.fullScanMetaAndPrint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.catalog.MetaReader的用法示例。


在下文中一共展示了MetaReader.fullScanMetaAndPrint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test3686a

import org.apache.hadoop.hbase.catalog.MetaReader; //导入方法依赖的package包/类
/**
 * Test that scanner won't miss any rows if the region server it was reading
 * from failed. Before 3686, it would skip rows in the scan.
 * @throws Exception
 */
@Test(timeout=300000)
public void test3686a() throws Exception {
  LOG.info("START ************ TEST3686A---1");
  HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME);
  LOG.info("START ************ TEST3686A---1111");

  Scan scan = new Scan();
  scan.setCaching(SCANNER_CACHING);
  LOG.info("************ TEST3686A");
  MetaReader.fullScanMetaAndPrint(TEST_UTIL.getHBaseCluster().getMaster().getCatalogTracker());
  // Set a very high timeout, we want to test what happens when a RS
  // fails but the region is recovered before the lease times out.
  // Since the RS is already created, this conf is client-side only for
  // this new table
  Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
  conf.setInt(
      HConstants.HBASE_REGIONSERVER_LEASE_PERIOD_KEY, SCANNER_TIMEOUT*100);
  HTable table = new HTable(conf, TABLE_NAME);
  LOG.info("START ************ TEST3686A---22");

  ResultScanner r = table.getScanner(scan);
  LOG.info("START ************ TEST3686A---33");

  int count = 1;
  r.next();
  LOG.info("START ************ TEST3686A---44");

  // Kill after one call to next(), which got 5 rows.
  rs.abort("die!");
  while(r.next() != null) {
    count ++;
  }
  assertEquals(NB_ROWS, count);
  r.close();
  table.close();
  LOG.info("************ END TEST3686A");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:43,代码来源:TestScannerTimeout.java

示例2: testMetaMigration

import org.apache.hadoop.hbase.catalog.MetaReader; //导入方法依赖的package包/类
@Test
public void testMetaMigration() throws Exception {
  LOG.info("Starting testMetaWithLegacyHRI");
  final byte [] FAMILY = Bytes.toBytes("family");
  HTableDescriptor htd = new HTableDescriptor("testMetaMigration");
  HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
    htd.addFamily(hcd);
  Configuration conf = TEST_UTIL.getConfiguration();
  createMultiRegionsWithLegacyHRI(conf, htd, FAMILY,
      new byte[][]{
          HConstants.EMPTY_START_ROW,
          Bytes.toBytes("region_a"),
          Bytes.toBytes("region_b")});
  CatalogTracker ct =
    TEST_UTIL.getMiniHBaseCluster().getMaster().getCatalogTracker();
  // Erase the current version of root meta for this test.
  undoVersionInMeta();
  MetaReader.fullScanMetaAndPrint(ct);
  LOG.info("Meta Print completed.testUpdatesOnMetaWithLegacyHRI");

  Set<HTableDescriptor> htds =
    MetaMigrationRemovingHTD.updateMetaWithNewRegionInfo(
      TEST_UTIL.getHBaseCluster().getMaster());
  MetaReader.fullScanMetaAndPrint(ct);
  // Should be one entry only and it should be for the table we just added.
  assertEquals(1, htds.size());
  assertTrue(htds.contains(htd));
  // Assert that the flag in ROOT is updated to reflect the correct status
  boolean metaUpdated =
    MetaMigrationRemovingHTD.isMetaHRIUpdated(
      TEST_UTIL.getMiniHBaseCluster().getMaster());
  assertEquals(true, metaUpdated);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:34,代码来源:TestMetaMigrationRemovingHTD.java

示例3: test3686a

import org.apache.hadoop.hbase.catalog.MetaReader; //导入方法依赖的package包/类
/**
 * Test that scanner won't miss any rows if the region server it was reading
 * from failed. Before 3686, it would skip rows in the scan.
 * @throws Exception
 */
@Test(timeout=300000)
public void test3686a() throws Exception {
  LOG.info("START ************ TEST3686A---1");
  HRegionServer rs = TEST_UTIL.getRSForFirstRegionInTable(TABLE_NAME);
  LOG.info("START ************ TEST3686A---1111");

  Scan scan = new Scan();
  scan.setCaching(SCANNER_CACHING);
  LOG.info("************ TEST3686A");
  MetaReader.fullScanMetaAndPrint(TEST_UTIL.getHBaseCluster().getMaster().getCatalogTracker());
  // Set a very high timeout, we want to test what happens when a RS
  // fails but the region is recovered before the lease times out.
  // Since the RS is already created, this conf is client-side only for
  // this new table
  Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
  conf.setInt(
      HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, SCANNER_TIMEOUT*100);
  HTable table = new HTable(conf, TABLE_NAME);
  LOG.info("START ************ TEST3686A---22");

  ResultScanner r = table.getScanner(scan);
  LOG.info("START ************ TEST3686A---33");

  int count = 1;
  r.next();
  LOG.info("START ************ TEST3686A---44");

  // Kill after one call to next(), which got 5 rows.
  rs.abort("die!");
  while(r.next() != null) {
    count ++;
  }
  assertEquals(NB_ROWS, count);
  r.close();
  table.close();
  LOG.info("************ END TEST3686A");
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:43,代码来源:TestScannerTimeout.java

示例4: testRebalanceOnRegionServerNumberChange

import org.apache.hadoop.hbase.catalog.MetaReader; //导入方法依赖的package包/类
/**
 * For HBASE-71. Try a few different configurations of starting and stopping
 * region servers to see if the assignment or regions is pretty balanced.
 * @throws IOException
 * @throws InterruptedException
 */
@Test
public void testRebalanceOnRegionServerNumberChange()
throws IOException, InterruptedException {
  HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
  admin.createTable(this.desc, Arrays.copyOfRange(HBaseTestingUtility.KEYS,
      1, HBaseTestingUtility.KEYS.length));
  this.table = new HTable(UTIL.getConfiguration(), this.desc.getName());
  CatalogTracker ct = new CatalogTracker(UTIL.getConfiguration());
  ct.start();
  try {
    MetaReader.fullScanMetaAndPrint(ct);
  } finally {
    ct.stop();
  }
  assertEquals("Test table should have right number of regions",
    HBaseTestingUtility.KEYS.length,
    this.table.getStartKeys().length);

  // verify that the region assignments are balanced to start out
  assertRegionsAreBalanced();

  // add a region server - total of 2
  LOG.info("Started second server=" +
    UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // add a region server - total of 3
  LOG.info("Started third server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // kill a region server - total of 2
  LOG.info("Stopped third server=" + UTIL.getHBaseCluster().stopRegionServer(2, false));
  UTIL.getHBaseCluster().waitOnRegionServer(2);
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // start two more region servers - total of 4
  LOG.info("Readding third server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  LOG.info("Added fourth server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  for (int i = 0; i < 6; i++){
    LOG.info("Adding " + (i + 5) + "th region server");
    UTIL.getHBaseCluster().startRegionServer();
  }
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();
  table.close();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:62,代码来源:TestRegionRebalancing.java

示例5: testRebalanceOnRegionServerNumberChange

import org.apache.hadoop.hbase.catalog.MetaReader; //导入方法依赖的package包/类
/**
 * For HBASE-71. Try a few different configurations of starting and stopping
 * region servers to see if the assignment or regions is pretty balanced.
 * @throws IOException
 * @throws InterruptedException
 */
@Test (timeout=300000)
public void testRebalanceOnRegionServerNumberChange()
throws IOException, InterruptedException {
  HBaseAdmin admin = new HBaseAdmin(UTIL.getConfiguration());
  admin.createTable(this.desc, Arrays.copyOfRange(HBaseTestingUtility.KEYS,
      1, HBaseTestingUtility.KEYS.length));
  this.table = new HTable(UTIL.getConfiguration(), this.desc.getTableName());
  CatalogTracker ct = new CatalogTracker(UTIL.getConfiguration());
  ct.start();
  try {
    MetaReader.fullScanMetaAndPrint(ct);
  } finally {
    ct.stop();
  }
  assertEquals("Test table should have right number of regions",
    HBaseTestingUtility.KEYS.length,
    this.table.getStartKeys().length);

  // verify that the region assignments are balanced to start out
  assertRegionsAreBalanced();

  // add a region server - total of 2
  LOG.info("Started second server=" +
    UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // add a region server - total of 3
  LOG.info("Started third server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // kill a region server - total of 2
  LOG.info("Stopped third server=" + UTIL.getHBaseCluster().stopRegionServer(2, false));
  UTIL.getHBaseCluster().waitOnRegionServer(2);
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  // start two more region servers - total of 4
  LOG.info("Readding third server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  LOG.info("Added fourth server=" +
      UTIL.getHBaseCluster().startRegionServer().getRegionServer().getServerName());
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();

  for (int i = 0; i < 6; i++){
    LOG.info("Adding " + (i + 5) + "th region server");
    UTIL.getHBaseCluster().startRegionServer();
  }
  UTIL.getHBaseCluster().getMaster().balance();
  assertRegionsAreBalanced();
  table.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:62,代码来源:TestRegionRebalancing.java


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