Search in sources :

Example 1 with NonRepeatedEnvironmentEdge

use of org.apache.hadoop.hbase.util.NonRepeatedEnvironmentEdge 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());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) NonRepeatedEnvironmentEdge(org.apache.hadoop.hbase.util.NonRepeatedEnvironmentEdge) HBaseTestingUtil(org.apache.hadoop.hbase.HBaseTestingUtil) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)1 StartTestingClusterOption (org.apache.hadoop.hbase.StartTestingClusterOption)1 NonRepeatedEnvironmentEdge (org.apache.hadoop.hbase.util.NonRepeatedEnvironmentEdge)1