@Before public void setUp() throws Exception { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); }
@Before public void setup() throws IOException { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); dir = TEST_UTIL.getDataTestDir("TestHRegion").toString(); method = name.getMethodName(); tableName = TableName.valueOf(method); CONF.set(CompactingMemStore.IN_MEMORY_FLUSH_THRESHOLD_FACTOR_KEY, String.valueOf(0.09)); }
private void setUp(boolean useBucketCache) throws IOException { test_util = HBaseTestingUtility.createLocalHTU(); conf = test_util.getConfiguration(); if (useBucketCache) { conf.setInt("hbase.bucketcache.size", 400); conf.setStrings(HConstants.BUCKET_CACHE_IOENGINE_KEY, "offheap"); conf.setInt("hbase.bucketcache.writer.threads", 10); conf.setFloat("hfile.block.cache.size", 0.2f); conf.setFloat("hbase.regionserver.global.memstore.size", 0.1f); } tableName = TableName.valueOf(name.getMethodName()); }
@BeforeClass public static void setupBeforeClass() throws Exception { testUtil = HBaseTestingUtility.createLocalHTU(); testUtil.startMiniCluster(); conn = (ConnectionImplementation) testUtil.getConnection(); }
@Before public void setup() throws IOException { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); // Disable block cache. CONF.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f); dir = TEST_UTIL.getDataTestDir("TestHRegion").toString(); tableName = TableName.valueOf(name.getMethodName()); }
@BeforeClass public static void setup() throws Exception { final TableName tableName = TableName.valueOf("tableName"); TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); THRESHOLD = CONF.getInt(RSRpcServices.BATCH_ROWS_THRESHOLD_NAME, RSRpcServices.BATCH_ROWS_THRESHOLD_DEFAULT); TEST_UTIL.startMiniCluster(); TEST_UTIL.createTable(tableName, TEST_FAM); RS = TEST_UTIL.getRSForFirstRegionInTable(tableName); }
protected void compactingSetUp() throws Exception { super.internalSetUp(); Configuration conf = new Configuration(); conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, true); conf.setFloat(MemStoreLAB.CHUNK_POOL_MAXSIZE_KEY, 0.2f); conf.setInt(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, 1000); HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf); HColumnDescriptor hcd = new HColumnDescriptor(FAMILY); HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("foobar")); htd.addFamily(hcd); HRegionInfo info = new HRegionInfo(TableName.valueOf("foobar"), null, null, false); WAL wal = hbaseUtility.createWal(conf, hbaseUtility.getDataTestDir(), info); this.region = HRegion.createHRegion(info, hbaseUtility.getDataTestDir(), conf, htd, wal, true); //this.region = hbaseUtility.createTestRegion("foobar", hcd); this.regionServicesForStores = region.getRegionServicesForStores(); this.store = new HStore(region, hcd, conf); long globalMemStoreLimit = (long) (ManagementFactory.getMemoryMXBean().getHeapMemoryUsage() .getMax() * MemorySizeUtil.getGlobalMemStoreHeapPercent(conf, false)); chunkCreator = ChunkCreator.initialize(MemStoreLABImpl.CHUNK_SIZE_DEFAULT, false, globalMemStoreLimit, 0.4f, MemStoreLAB.POOL_INITIAL_SIZE_DEFAULT, null); assertTrue(chunkCreator != null); }
@Before public void setup() throws Exception { testUtil = HBaseTestingUtility.createLocalHTU(); testDir = testUtil.getDataTestDir("TestStoreFileRefresherChore"); FSUtils.setRootDir(testUtil.getConfiguration(), testDir); }
@Before public void setUp() throws Exception { UTIL = HBaseTestingUtility.createLocalHTU(); conf = UTIL.getConfiguration(); conf.set(MobConstants.MOB_FILE_CACHE_SIZE_KEY, TEST_CACHE_SIZE); HTableDescriptor htd = UTIL.createTableDescriptor("testMobFileCache"); HColumnDescriptor hcd1 = new HColumnDescriptor(FAMILY1); hcd1.setMobEnabled(true); hcd1.setMobThreshold(0); HColumnDescriptor hcd2 = new HColumnDescriptor(FAMILY2); hcd2.setMobEnabled(true); hcd2.setMobThreshold(0); HColumnDescriptor hcd3 = new HColumnDescriptor(FAMILY3); hcd3.setMobEnabled(true); hcd3.setMobThreshold(0); htd.addFamily(hcd1); htd.addFamily(hcd2); htd.addFamily(hcd3); RegionInfo regionInfo = RegionInfoBuilder.newBuilder(htd.getTableName()).build(); mobFileCache = new MobFileCache(conf); region = HBaseTestingUtility .createRegionAndWAL(regionInfo, UTIL.getDataTestDir(), conf, htd, mobFileCache); }
protected void checkShouldFlush(Configuration conf, boolean expected) throws Exception { try { EnvironmentEdgeForMemstoreTest edge = new EnvironmentEdgeForMemstoreTest(); EnvironmentEdgeManager.injectEdge(edge); HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf); String cf = "foo"; HRegion region = hbaseUtility.createTestRegion("foobar", ColumnFamilyDescriptorBuilder.of(cf)); edge.setCurrentTimeMillis(1234); Put p = new Put(Bytes.toBytes("r")); p.add(KeyValueTestUtil.create("r", cf, "q", 100, "v")); region.put(p); edge.setCurrentTimeMillis(1234 + 100); StringBuilder sb = new StringBuilder(); assertTrue(!region.shouldFlush(sb)); edge.setCurrentTimeMillis(1234 + 10000); assertTrue(region.shouldFlush(sb) == expected); } finally { EnvironmentEdgeManager.reset(); } }
@Before public void setup() throws Exception { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); rootDir = TEST_UTIL.getDataTestDir(TABLE_NAME_STR); fs = TEST_UTIL.getTestFileSystem(); conf = TEST_UTIL.getConfiguration(); SnapshotTestingUtils.SnapshotMock snapshotMock = new SnapshotTestingUtils.SnapshotMock(conf, fs, rootDir); builder = snapshotMock.createSnapshotV2("snapshot", TABLE_NAME_STR, 0); snapshotDir = builder.commit(); snapshotDesc = builder.getSnapshotDescription(); }
@Test public void testShouldFlushMeta() throws Exception { // write an edit in the META and ensure the shouldFlush (that the periodic memstore // flusher invokes) returns true after SYSTEM_CACHE_FLUSH_INTERVAL (even though // the MEMSTORE_PERIODIC_FLUSH_INTERVAL is set to a higher value) Configuration conf = new Configuration(); conf.setInt(HRegion.MEMSTORE_PERIODIC_FLUSH_INTERVAL, HRegion.SYSTEM_CACHE_FLUSH_INTERVAL * 10); HBaseTestingUtility hbaseUtility = HBaseTestingUtility.createLocalHTU(conf); Path testDir = hbaseUtility.getDataTestDir(); EnvironmentEdgeForMemstoreTest edge = new EnvironmentEdgeForMemstoreTest(); EnvironmentEdgeManager.injectEdge(edge); edge.setCurrentTimeMillis(1234); WALFactory wFactory = new WALFactory(conf, "1234"); HRegion meta = HRegion.createHRegion(RegionInfoBuilder.FIRST_META_REGIONINFO, testDir, conf, FSTableDescriptors.createMetaTableDescriptor(conf), wFactory.getWAL(RegionInfoBuilder.FIRST_META_REGIONINFO)); // parameterized tests add [#] suffix get rid of [ and ]. TableDescriptor desc = TableDescriptorBuilder .newBuilder(TableName.valueOf(name.getMethodName().replaceAll("[\\[\\]]", "_"))) .setColumnFamily(ColumnFamilyDescriptorBuilder.of("foo")).build(); RegionInfo hri = RegionInfoBuilder.newBuilder(desc.getTableName()) .setStartKey(Bytes.toBytes("row_0200")).setEndKey(Bytes.toBytes("row_0300")).build(); HRegion r = HRegion.createHRegion(hri, testDir, conf, desc, wFactory.getWAL(hri)); addRegionToMETA(meta, r); edge.setCurrentTimeMillis(1234 + 100); StringBuilder sb = new StringBuilder(); assertTrue(meta.shouldFlush(sb) == false); edge.setCurrentTimeMillis(edge.currentTime() + HRegion.SYSTEM_CACHE_FLUSH_INTERVAL + 1); assertTrue(meta.shouldFlush(sb) == true); }
@Before public void setUp() throws Exception { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); }
private void setUp(boolean useBucketCache) throws IOException { test_util = HBaseTestingUtility.createLocalHTU(); conf = test_util.getConfiguration(); if (useBucketCache) { conf.setInt("hbase.bucketcache.size", 400); conf.setStrings(HConstants.BUCKET_CACHE_IOENGINE_KEY, "offheap"); conf.setInt("hbase.bucketcache.writer.threads", 10); conf.setFloat("hfile.block.cache.size", 0.2f); conf.setFloat("hbase.regionserver.global.memstore.size", 0.1f); } tableName = TableName.valueOf(name.getMethodName()); CacheConfig.instantiateBlockCache(conf); }
@Before public void setup() throws IOException { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); FILESYSTEM = TEST_UTIL.getTestFileSystem(); CONF = TEST_UTIL.getConfiguration(); dir = TEST_UTIL.getDataTestDir("TestHRegion").toString(); method = name.getMethodName(); tableName = TableName.valueOf(method); CONF.set(CompactingMemStore.IN_MEMORY_FLUSH_THRESHOLD_FACTOR_KEY, String.valueOf(0.09)); }
@BeforeClass public static void setupBeforeClass() throws Exception { testUtil = HBaseTestingUtility.createLocalHTU(); testUtil.startMiniCluster(); conn = (ConnectionImplementation) testUtil.getConnection(); }
@Before public void setup() throws IOException { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); // Disable block cache. CONF.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f); dir = TEST_UTIL.getDataTestDir("TestHRegion").toString(); tableName = TableName.valueOf(name.getMethodName()); }
@BeforeClass public static void setup() throws Exception { final TableName tableName = TableName.valueOf("tableName"); TEST_UTIL = HBaseTestingUtility.createLocalHTU(); CONF = TEST_UTIL.getConfiguration(); THRESHOLD = CONF.getInt(RSRpcServices.BATCH_ROWS_THRESHOLD_NAME, RSRpcServices.BATCH_ROWS_THRESHOLD_DEFAULT); TEST_UTIL.startMiniCluster(); TEST_UTIL.createTable(tableName, TEST_FAM); RS = TEST_UTIL.getRSForFirstRegionInTable(tableName); }
@Before public void setup() throws Exception { testUtil = HBaseTestingUtility.createLocalHTU(); testDir = testUtil.getDataTestDir("TestStoreFileRefresherChore"); FSUtils.setRootDir(testUtil.getConfiguration(), testDir); }
@Before public void setup() throws Exception { TEST_UTIL = HBaseTestingUtility.createLocalHTU(); rootDir = TEST_UTIL.getDataTestDir(TABLE_NAME_STR); fs = TEST_UTIL.getTestFileSystem(); conf = TEST_UTIL.getConfiguration(); SnapshotTestingUtils.SnapshotMock snapshotMock = new SnapshotTestingUtils.SnapshotMock(conf, fs, rootDir); builder = snapshotMock.createSnapshotV2("snapshot", TABLE_NAME_STR, 0); snapshotDir = builder.commit(); snapshotDesc = builder.getSnapshotDescription(); }