コード例 #1
0
 /**
  * Start up a mini cluster and put a small table of many empty regions into it.
  *
  * @throws Exception
  */
 @BeforeClass
 public static void beforeAllTests() throws Exception {
   TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
   TEST_UTIL.startMiniCluster(2);
   // Create a table of three families.  This will assign a region.
   TEST_UTIL.createTable(Bytes.toBytes(TABLENAME), FAMILIES);
   HTable t = new HTable(TEST_UTIL.getConfiguration(), TABLENAME);
   int countOfRegions = TEST_UTIL.createMultiRegions(t, getTestFamily());
   TEST_UTIL.waitUntilAllRegionsAssigned(countOfRegions);
   addToEachStartKey(countOfRegions);
   t.close();
 }
コード例 #2
0
 /**
  * Create a Mob table.
  *
  * @param util
  * @param tableName
  * @param families
  * @return An HTable instance for the created table.
  * @throws IOException
  */
 public static Table createMobTable(
     final HBaseTestingUtility util, final TableName tableName, final byte[]... families)
     throws IOException {
   HTableDescriptor htd = new HTableDescriptor(tableName);
   for (byte[] family : families) {
     HColumnDescriptor hcd = new HColumnDescriptor(family);
     // Disable blooms (they are on by default as of 0.95) but we disable them
     // here because
     // tests have hard coded counts of what to expect in block cache, etc.,
     // and blooms being
     // on is interfering.
     hcd.setBloomFilterType(BloomType.NONE);
     hcd.setMobEnabled(true);
     hcd.setMobThreshold(0L);
     htd.addFamily(hcd);
   }
   util.getHBaseAdmin().createTable(htd);
   // HBaseAdmin only waits for regions to appear in hbase:meta we should wait
   // until they are assigned
   util.waitUntilAllRegionsAssigned(htd.getTableName());
   return ConnectionFactory.createConnection(util.getConfiguration()).getTable(htd.getTableName());
 }