use of org.apache.hadoop.hbase.HBaseTestingUtility in project hadoop by apache.
the class TestHBaseStorageFlowActivity method setupBeforeClass.
@BeforeClass
public static void setupBeforeClass() throws Exception {
util = new HBaseTestingUtility();
Configuration conf = util.getConfiguration();
conf.setInt("hfile.format.version", 3);
util.startMiniCluster();
createSchema();
}
use of org.apache.hadoop.hbase.HBaseTestingUtility in project hadoop by apache.
the class TestHBaseTimelineStorageApps method setupBeforeClass.
@BeforeClass
public static void setupBeforeClass() throws Exception {
util = new HBaseTestingUtility();
util.startMiniCluster();
createSchema();
DataGeneratorForTest.loadApps(util);
}
use of org.apache.hadoop.hbase.HBaseTestingUtility in project hbase by apache.
the class CompactTableAction method perform.
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getAdmin();
boolean major = RandomUtils.nextInt(100) < majorRatio;
LOG.info("Performing action: Compact table " + tableName + ", major=" + major);
try {
if (major) {
admin.majorCompact(tableName);
} else {
admin.compact(tableName);
}
} catch (Exception ex) {
LOG.warn("Compaction failed, might be caused by other chaos: " + ex.getMessage());
}
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
}
use of org.apache.hadoop.hbase.HBaseTestingUtility in project hbase by apache.
the class DecreaseMaxHFileSizeAction method perform.
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getAdmin();
HTableDescriptor htd = admin.getTableDescriptor(tableName);
// Try and get the current value.
long currentValue = htd.getMaxFileSize();
// That's ok. We're trying to cause chaos.
if (currentValue <= 0) {
currentValue = context.getHBaseCluster().getConf().getLong(HConstants.HREGION_MAX_FILESIZE, HConstants.DEFAULT_MAX_FILE_SIZE);
}
// Decrease by 10% at a time.
long newValue = (long) (currentValue * 0.9);
// We don't want to go too far below 1gb.
// So go to about 1gb +/- 512 on each side.
newValue = Math.max(minFileSize, newValue) - (512 - random.nextInt(1024));
// Change the table descriptor.
htd.setMaxFileSize(newValue);
// Don't try the modify if we're stopping
if (context.isStopping()) {
return;
}
// modify the table.
admin.modifyTable(tableName, htd);
// Sleep some time.
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
}
use of org.apache.hadoop.hbase.HBaseTestingUtility in project hbase by apache.
the class FlushRandomRegionOfTableAction method perform.
@Override
public void perform() throws Exception {
HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
Admin admin = util.getAdmin();
LOG.info("Performing action: Flush random region of table " + tableName);
List<HRegionInfo> regions = admin.getTableRegions(tableName);
if (regions == null || regions.isEmpty()) {
LOG.info("Table " + tableName + " doesn't have regions to flush");
return;
}
HRegionInfo region = PolicyBasedChaosMonkey.selectRandomItem(regions.toArray(new HRegionInfo[regions.size()]));
LOG.debug("Flushing region " + region.getRegionNameAsString());
try {
admin.flushRegion(region.getRegionName());
} catch (Exception ex) {
LOG.warn("Flush failed, might be caused by other chaos: " + ex.getMessage());
}
if (sleepTime > 0) {
Thread.sleep(sleepTime);
}
}
Aggregations