@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<String>(Arrays.asList(args)); // LoadTestDataGeneratorWithTags:minNumTags:maxNumTags:minTagLength:maxTagLength tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithTags.class.getName()); sb.append(COLON); sb.append(minTagsPerKey); sb.append(COLON); sb.append(maxTagsPerKey); sb.append(COLON); sb.append(minTagLength); sb.append(COLON); sb.append(maxTagLength); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<String>(Arrays.asList(args)); tmp.add(HYPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithACL.class.getName()); sb.append(COLON); if (User.isHBaseSecurityEnabled(getConf())) { sb.append(authnFileName); sb.append(COLON); } sb.append(superUser); sb.append(COLON); sb.append(userNames); sb.append(COLON); sb.append(Integer.toString(SPECIAL_PERM_CELL_INSERTION_FACTOR)); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override public void setConf(Configuration conf) { conf.setIfUnset( String.format("%s.%s", TEST_NAME, LoadTestTool.OPT_REGION_REPLICATION), String.valueOf(DEFAULT_REGION_REPLICATION)); conf.setIfUnset( String.format("%s.%s", TEST_NAME, LoadTestTool.OPT_COLUMN_FAMILIES), StringUtils.join(",", DEFAULT_COLUMN_FAMILIES)); conf.setBoolean("hbase.table.sanity.checks", true); // enable async wal replication to region replicas for unit tests conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true); conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, 1024L * 1024 * 4); // flush every 4 MB conf.setInt("hbase.hstore.blockingStoreFiles", 100); super.setConf(conf); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<>(Arrays.asList(args)); // LoadTestDataGeneratorWithTags:minNumTags:maxNumTags:minTagLength:maxTagLength tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithTags.class.getName()); sb.append(COLON); sb.append(minTagsPerKey); sb.append(COLON); sb.append(maxTagsPerKey); sb.append(COLON); sb.append(minTagLength); sb.append(COLON); sb.append(maxTagLength); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<>(Arrays.asList(args)); tmp.add(HYPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithACL.class.getName()); sb.append(COLON); if (User.isHBaseSecurityEnabled(getConf())) { sb.append(authnFileName); sb.append(COLON); } sb.append(superUser); sb.append(COLON); sb.append(userNames); sb.append(COLON); sb.append(Integer.toString(SPECIAL_PERM_CELL_INSERTION_FACTOR)); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override public void setConf(Configuration conf) { conf.setIfUnset( String.format("%s.%s", TEST_NAME, LoadTestTool.OPT_REGION_REPLICATION), String.valueOf(DEFAULT_REGION_REPLICATION)); conf.setIfUnset( String.format("%s.%s", TEST_NAME, LoadTestTool.OPT_COLUMN_FAMILIES), StringUtils.join(",", DEFAULT_COLUMN_FAMILIES)); conf.setBoolean("hbase.table.sanity.checks", true); // enable async wal replication to region replicas for unit tests conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, 1024L * 1024 * 4); // flush every 4 MB conf.setInt("hbase.hstore.blockingStoreFiles", 100); super.setConf(conf); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<>(Arrays.asList(args)); // LoadTestDataGeneratorMOB:mobColumnFamily:minMobDataSize:maxMobDataSize tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithMOB.class.getName()); sb.append(COLON); sb.append(Bytes.toString(mobColumnFamily)); sb.append(COLON); sb.append(minMobDataSize); sb.append(COLON); sb.append(maxMobDataSize); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<String>(Arrays.asList(args)); tmp.add(HYPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithACL.class.getName()); sb.append(COLON); if (LoadTestTool.isSecure(getConf())) { sb.append(authnFileName); sb.append(COLON); } sb.append(superUser); sb.append(COLON); sb.append(userNames); sb.append(COLON); sb.append(Integer.toString(SPECIAL_PERM_CELL_INSERTION_FACTOR)); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override protected void processOptions(CommandLine cmd) { super.processOptions(cmd); if (cmd.hasOption(OPT_SUPERUSER)) { superUser = cmd.getOptionValue(OPT_SUPERUSER); } if (cmd.hasOption(OPT_USERS)) { userNames = cmd.getOptionValue(OPT_USERS); } if (LoadTestTool.isSecure(getConf())) { boolean authFileNotFound = false; if (cmd.hasOption(OPT_AUTHN)) { authnFileName = cmd.getOptionValue(OPT_AUTHN); if (StringUtils.isEmpty(authnFileName)) { authFileNotFound = true; } } else { authFileNotFound = true; } if (authFileNotFound) { super.printUsage(); System.exit(EXIT_FAILURE); } } }
@Override protected void initTable() throws IOException { // Do the same as the LoadTestTool does, but with different table configuration. HTableDescriptor htd = new HTableDescriptor(getTablename()); htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName()); htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "100"); HColumnDescriptor hcd = new HColumnDescriptor(LoadTestTool.DEFAULT_COLUMN_FAMILY); HBaseTestingUtility.createPreSplitLoadTestTable(util.getConfiguration(), htd, hcd); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<String>(Arrays.asList(args)); tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithVisibilityLabels.class.getName()); sb.append(COLON); sb.append(asCommaSeperatedString(VISIBILITY_EXPS)); sb.append(COLON); String authorizationsStr = AUTHS.toString(); sb.append(authorizationsStr.substring(1, authorizationsStr.length() - 1)); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override public void setUpCluster() throws Exception { util = getTestingUtil(getConf()); LOG.debug("Initializing/checking cluster has " + SERVER_COUNT + " servers"); util.initializeCluster(getMinServerCount()); LOG.debug("Done initializing/checking cluster"); cluster = util.getHBaseClusterInterface(); deleteTableIfNecessary(); loadTool = new LoadTestTool(); loadTool.setConf(util.getConfiguration()); // Initialize load test tool before we start breaking things; // LoadTestTool init, even when it is a no-op, is very fragile. initTable(); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { List<String> args = Lists.newArrayList(super.getArgsForLoadTestTool( mode, modeSpecificArg, startKey, numKeys)); String clazz = this.getClass().getSimpleName(); args.add("-" + LoadTestTool.OPT_MULTIGET); args.add(conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_MULTIGET), "100")); args.add("-" + LoadTestTool.OPT_NUM_REGIONS_PER_SERVER); args.add(conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_NUM_REGIONS_PER_SERVER), Integer.toString(LoadTestTool.DEFAULT_NUM_REGIONS_PER_SERVER))); return args.toArray(new String[args.size()]); }
@Override public void setConf(Configuration conf) { super.setConf(conf); // default replication for this test is 3 String clazz = this.getClass().getSimpleName(); conf.setIfUnset(String.format("%s.%s", clazz, LoadTestTool.OPT_REGION_REPLICATION), Integer.toString(DEFAULT_REGION_REPLICATION)); }
protected void setUp(int numSlavesBase) throws Exception { tableName = this.getClass().getSimpleName(); util = new IntegrationTestingUtility(); LOG.info("Initializing cluster with " + numSlavesBase + " servers"); util.initializeCluster(numSlavesBase); LOG.info("Done initializing cluster"); cluster = util.getHBaseClusterInterface(); deleteTableIfNecessary(); loadTool = new LoadTestTool(); loadTool.setConf(util.getConfiguration()); // Initialize load test tool before we start breaking things; // LoadTestTool init, even when it is a no-op, is very fragile. int ret = loadTool.run(new String[] { "-tn", tableName, "-init_only" }); Assert.assertEquals("Failed to initialize LoadTestTool", 0, ret); }
@Override protected void initTable() throws IOException { // Do the same as the LoadTestTool does, but with different table configuration. HTableDescriptor htd = new HTableDescriptor(getTablename()); htd.setConfiguration(StoreEngine.STORE_ENGINE_CLASS_KEY, StripeStoreEngine.class.getName()); htd.setConfiguration(HStore.BLOCKING_STOREFILES_KEY, "100"); HColumnDescriptor hcd = new HColumnDescriptor(LoadTestTool.COLUMN_FAMILY); HBaseTestingUtility.createPreSplitLoadTestTable(util.getConfiguration(), htd, hcd); }
@Override public void setUpCluster() throws Exception { util = getTestingUtil(null); LOG.debug("Initializing/checking cluster has " + SERVER_COUNT + " servers"); util.initializeCluster(SERVER_COUNT); LOG.debug("Done initializing/checking cluster"); cluster = util.getHBaseClusterInterface(); deleteTableIfNecessary(); loadTool = new LoadTestTool(); loadTool.setConf(util.getConfiguration()); // Initialize load test tool before we start breaking things; // LoadTestTool init, even when it is a no-op, is very fragile. initTable(); }
@Override protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey, long numKeys) { String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys); List<String> tmp = new ArrayList<>(Arrays.asList(args)); tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR); StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithVisibilityLabels.class.getName()); sb.append(COLON); sb.append(asCommaSeperatedString(VISIBILITY_EXPS)); sb.append(COLON); String authorizationsStr = AUTHS.toString(); sb.append(authorizationsStr.substring(1, authorizationsStr.length() - 1)); tmp.add(sb.toString()); return tmp.toArray(new String[tmp.size()]); }
@Override public TableName getTablename() { String clazz = this.getClass().getSimpleName(); return TableName.valueOf( conf.get(String.format("%s.%s", clazz, LoadTestTool.OPT_TABLE_NAME), clazz)); }
@Override protected Set<String> getColumnFamilies() { return Sets.newHashSet(Bytes.toString(LoadTestTool.COLUMN_FAMILY)); }