當前位置: 首頁>>代碼示例>>Java>>正文


Java HTable.getConfiguration方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.HTable.getConfiguration方法的典型用法代碼示例。如果您正苦於以下問題:Java HTable.getConfiguration方法的具體用法?Java HTable.getConfiguration怎麽用?Java HTable.getConfiguration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.HTable的用法示例。


在下文中一共展示了HTable.getConfiguration方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RegionSizeCalculator

import org.apache.hadoop.hbase.client.HTable; //導入方法依賴的package包/類
/**
 * Computes size of each region for table and given column families.
 * 
 * @deprecated Use {@link #RegionSizeCalculator(RegionLocator, Admin)} instead.
 */
@Deprecated
public RegionSizeCalculator(HTable table) throws IOException {
  HBaseAdmin admin = new HBaseAdmin(table.getConfiguration());
  try {
    init(table.getRegionLocator(), admin);
  } finally {
    admin.close();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:RegionSizeCalculator.java

示例2: testMasterRestartAtRegionSplitPendingCatalogJanitor

import org.apache.hadoop.hbase.client.HTable; //導入方法依賴的package包/類
/**
 * Verifies HBASE-5806.  Here the case is that splitting is completed but before the
 * CJ could remove the parent region the master is killed and restarted.
 * @throws IOException
 * @throws InterruptedException
 * @throws NodeExistsException
 * @throws KeeperException
 */
@Test (timeout = 300000)
public void testMasterRestartAtRegionSplitPendingCatalogJanitor()
    throws IOException, InterruptedException, NodeExistsException,
    KeeperException, ServiceException {
  final TableName tableName = TableName
      .valueOf("testMasterRestartAtRegionSplitPendingCatalogJanitor");

  // Create table then get the single region for our new table.
  HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
  List<HRegion> regions = cluster.getRegions(tableName);
  HRegionInfo hri = getAndCheckSingleTableRegion(regions);

  int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri);

  // Turn off balancer so it doesn't cut in and mess up our placements.
  this.admin.setBalancerRunning(false, true);
  // Turn off the meta scanner so it don't remove parent on us.
  cluster.getMaster().setCatalogJanitorEnabled(false);
  ZooKeeperWatcher zkw = new ZooKeeperWatcher(t.getConfiguration(),
    "testMasterRestartAtRegionSplitPendingCatalogJanitor", new UselessTestAbortable());
  try {
    // Add a bit of load up into the table so splittable.
    TESTING_UTIL.loadTable(t, HConstants.CATALOG_FAMILY, false);
    // Get region pre-split.
    HRegionServer server = cluster.getRegionServer(tableRegionIndex);
    printOutRegions(server, "Initial regions: ");

    this.admin.split(hri.getRegionNameAsString());
    checkAndGetDaughters(tableName);
    // Assert the ephemeral node is up in zk.
    String path = ZKAssign.getNodeName(zkw, hri.getEncodedName());
    Stat stats = zkw.getRecoverableZooKeeper().exists(path, false);
    LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
        + stats);
    String node = ZKAssign.getNodeName(zkw, hri.getEncodedName());
    Stat stat = new Stat();
    byte[] data = ZKUtil.getDataNoWatch(zkw, node, stat);
    // ZKUtil.create
    for (int i=0; data != null && i<60; i++) {
      Thread.sleep(1000);
      data = ZKUtil.getDataNoWatch(zkw, node, stat);
    }
    assertNull("Waited too long for ZK node to be removed: "+node, data);

    MockMasterWithoutCatalogJanitor master = abortAndWaitForMaster();

    this.admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());

    // Update the region to be offline and split, so that HRegionInfo#equals
    // returns true in checking rebuilt region states map.
    hri.setOffline(true);
    hri.setSplit(true);
    RegionStates regionStates = master.getAssignmentManager().getRegionStates();
    assertTrue("Split parent should be in SPLIT state",
      regionStates.isRegionInState(hri, State.SPLIT));
    ServerName regionServerOfRegion = regionStates.getRegionServerOfRegion(hri);
    assertTrue(regionServerOfRegion == null);
  } finally {
    this.admin.setBalancerRunning(true, false);
    cluster.getMaster().setCatalogJanitorEnabled(true);
    t.close();
    zkw.close();
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:73,代碼來源:TestSplitTransactionOnCluster.java


注:本文中的org.apache.hadoop.hbase.client.HTable.getConfiguration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。