From 1dc704701a29c07847fcec8bf050c41b68919d47 Mon Sep 17 00:00:00 2001 From: chenheng Date: Tue, 6 Sep 2016 11:02:18 +0800 Subject: [PATCH] HBASE-16562 ITBLL should fail to start if misconfigured --- .../hbase/test/IntegrationTestBigLinkedList.java | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java index 7f0f732..da00faa 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java @@ -257,6 +257,12 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase { public static final String MULTIPLE_UNEVEN_COLUMNFAMILIES_KEY = "generator.multiple.columnfamilies"; + public static final String USAGE = "Usage : " + Generator.class.getSimpleName() + + " [ " + + " ] \n" + + "where should be a multiple of width*wrap multiplier, 25M by default \n" + + "walkers will verify random flushed loop during Generation."; + static class GeneratorInputFormat extends InputFormat { static class GeneratorInputSplit extends InputSplit implements Writable { @Override @@ -498,21 +504,31 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase { @Override public int run(String[] args) throws Exception { if (args.length < 3) { - System.out.println("Usage : " + Generator.class.getSimpleName() + - " [ ]"); - System.out.println(" where should be a multiple of " + - " width*wrap multiplier, 25M by default"); - return 0; + System.err.println(USAGE); + return 1; } int numMappers = Integer.parseInt(args[0]); long numNodes = Long.parseLong(args[1]); Path tmpOutput = new Path(args[2]); Integer width = (args.length < 4) ? null : Integer.parseInt(args[3]); - Integer wrapMuplitplier = (args.length < 5) ? null : Integer.parseInt(args[4]); - return run(numMappers, numNodes, tmpOutput, width, wrapMuplitplier); + Integer wrapMultiplier = (args.length < 5) ? null : Integer.parseInt(args[4]); + + long wrap = (long)width*wrapMultiplier; + if (wrap < numNodes && numNodes % wrap != 0) { + /** + * numNodes should be a multiple of width*wrapMultiplier. + * If numNodes less than wrap, wrap will be set to be equal with numNodes, + * See {@link GeneratorMapper#setup(Mapper.Context)} + * */ + System.err.println(USAGE); + return 1; + } + return run(numMappers, numNodes, tmpOutput, width, wrapMultiplier); } + + protected void createSchema() throws IOException { Configuration conf = getConf(); TableName tableName = getTableName(conf); -- 2.9.3