Java Code Examples for org.apache.hadoop.hbase.HBaseTestingUtility#createPreSplitLoadTestTable()

The following examples show how to use org.apache.hadoop.hbase.HBaseTestingUtility#createPreSplitLoadTestTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadTestTool.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void initTestTable() throws IOException {
  Durability durability = Durability.USE_DEFAULT;
  if (deferredLogFlush) {
    durability = Durability.ASYNC_WAL;
  }

  HBaseTestingUtility.createPreSplitLoadTestTable(conf, tableName,
    getColumnFamilies(), compressAlgo, dataBlockEncodingAlgo, numRegionsPerServer,
      regionReplication, durability);
  applyColumnFamilyOptions(tableName, getColumnFamilies());
}
 
Example 2
Source File: TestMiniClusterLoadSequential.java    From hbase with Apache License 2.0 4 votes vote down vote up
protected void createPreSplitLoadTestTable(TableDescriptor tableDescriptor,
    ColumnFamilyDescriptor familyDescriptor) throws IOException {
  HBaseTestingUtility.createPreSplitLoadTestTable(conf, tableDescriptor, familyDescriptor);
  TEST_UTIL.waitUntilAllRegionsAssigned(tableDescriptor.getTableName());
}
 
Example 3
Source File: RestartMetaTest.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
protected int doWork() throws Exception {
  ProcessBasedLocalHBaseCluster hbaseCluster =
      new ProcessBasedLocalHBaseCluster(conf, NUM_DATANODES, numRegionServers);
  hbaseCluster.startMiniDFS();

  // start the process based HBase cluster
  hbaseCluster.startHBase();

  // create tables if needed
  HBaseTestingUtility.createPreSplitLoadTestTable(conf, TABLE_NAME,
      HFileTestUtil.DEFAULT_COLUMN_FAMILY, Compression.Algorithm.NONE,
      DataBlockEncoding.NONE);

  LOG.debug("Loading data....\n\n");
  loadData();

  LOG.debug("Sleeping for " + SLEEP_SEC_AFTER_DATA_LOAD +
      " seconds....\n\n");
  Threads.sleep(5 * SLEEP_SEC_AFTER_DATA_LOAD);

  Connection connection = ConnectionFactory.createConnection(conf);

  int metaRSPort = HBaseTestingUtility.getMetaRSPort(connection);

  LOG.debug("Killing hbase:meta region server running on port " + metaRSPort);
  hbaseCluster.killRegionServer(metaRSPort);
  Threads.sleep(2000);

  LOG.debug("Restarting region server running on port metaRSPort");
  hbaseCluster.startRegionServer(metaRSPort);
  Threads.sleep(2000);

  LOG.debug("Trying to scan meta");

  Table metaTable = connection.getTable(TableName.META_TABLE_NAME);
  ResultScanner scanner = metaTable.getScanner(new Scan());
  Result result;
  while ((result = scanner.next()) != null) {
    LOG.info("Region assignment from META: "
        + Bytes.toStringBinary(result.getRow())
        + " => "
        + Bytes.toStringBinary(result.getFamilyMap(HConstants.CATALOG_FAMILY)
            .get(HConstants.SERVER_QUALIFIER)));
  }
  metaTable.close();
  connection.close();
  return 0;
}