use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.
the class TestFSUtils method setUp.
@Before
public void setUp() throws IOException {
htu = new HBaseTestingUtil();
fs = htu.getTestFileSystem();
conf = htu.getConfiguration();
}
use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.
the class TestMajorCompactor method setUp.
@Before
public void setUp() throws Exception {
utility = new HBaseTestingUtil();
utility.getConfiguration().setInt("hbase.hfile.compaction.discharger.interval", 10);
utility.startMiniCluster();
}
use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.
the class FromClientSideBase method initialize.
protected static final void initialize(Class<?> registryImpl, int numHedgedReqs, Class<?>... cps) throws Exception {
// at the end of every parameterized run.
if (isSameParameterizedCluster(registryImpl, numHedgedReqs)) {
return;
}
// Uncomment the following lines if more verbosity is needed for
// debugging (see HBASE-12285 for details).
// ((Log4JLogger)RpcServer.LOG).getLogger().setLevel(Level.ALL);
// ((Log4JLogger)RpcClient.LOG).getLogger().setLevel(Level.ALL);
// ((Log4JLogger)ScannerCallable.LOG).getLogger().setLevel(Level.ALL);
// make sure that we do not get the same ts twice, see HBASE-19731 for more details.
EnvironmentEdgeManager.injectEdge(new NonRepeatedEnvironmentEdge());
if (TEST_UTIL != null) {
// We reached end of a parameterized run, clean up.
TEST_UTIL.shutdownMiniCluster();
}
TEST_UTIL = new HBaseTestingUtil();
Configuration conf = TEST_UTIL.getConfiguration();
conf.setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, Arrays.stream(cps).map(Class::getName).toArray(String[]::new));
// enable for below tests
conf.setBoolean(TableDescriptorChecker.TABLE_SANITY_CHECKS, true);
conf.setClass(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, registryImpl, ConnectionRegistry.class);
Preconditions.checkArgument(numHedgedReqs > 0);
conf.setInt(MasterRegistry.MASTER_REGISTRY_HEDGED_REQS_FANOUT_KEY, numHedgedReqs);
StartTestingClusterOption.Builder builder = StartTestingClusterOption.builder();
// Multiple masters needed only when hedged reads for master registry are enabled.
builder.numMasters(numHedgedReqs > 1 ? 3 : 1).numRegionServers(SLAVES);
TEST_UTIL.startMiniCluster(builder.build());
}
use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.
the class RegionReplicaTestHelper method moveRegion.
/**
* Return the new location.
*/
static ServerName moveRegion(HBaseTestingUtil util, HRegionLocation currentLoc) throws Exception {
ServerName serverName = currentLoc.getServerName();
RegionInfo regionInfo = currentLoc.getRegion();
TableName tableName = regionInfo.getTable();
int replicaId = regionInfo.getReplicaId();
ServerName newServerName = util.getHBaseCluster().getRegionServerThreads().stream().map(t -> t.getRegionServer().getServerName()).filter(sn -> !sn.equals(serverName)).findAny().get();
util.getAdmin().move(regionInfo.getEncodedNameAsBytes(), newServerName);
util.waitFor(30000, new ExplainingPredicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
Optional<ServerName> newServerName = getRSCarryingReplica(util, tableName, replicaId);
return newServerName.isPresent() && !newServerName.get().equals(serverName);
}
@Override
public String explainFailure() throws Exception {
return regionInfo.getRegionNameAsString() + " is still on " + serverName;
}
});
return newServerName;
}
use of org.apache.hadoop.hbase.HBaseTestingUtil in project hbase by apache.
the class TestClientOperationInterrupt method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = HBaseConfiguration.create();
conf.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, TestCoprocessor.class.getName());
util = new HBaseTestingUtil(conf);
util.startMiniCluster();
Admin admin = util.getAdmin();
if (admin.tableExists(tableName)) {
if (admin.isTableEnabled(tableName)) {
admin.disableTable(tableName);
}
admin.deleteTable(tableName);
}
Table ht = util.createTable(tableName, new byte[][] { dummy, test });
Put p = new Put(row1);
p.addColumn(dummy, dummy, dummy);
ht.put(p);
}
Aggregations