Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4D50C200B79 for ; Wed, 7 Sep 2016 09:58:42 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4BF0D160AC1; Wed, 7 Sep 2016 07:58:42 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 90B52160AB1 for ; Wed, 7 Sep 2016 09:58:41 +0200 (CEST) Received: (qmail 48829 invoked by uid 500); 7 Sep 2016 07:58:40 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 48820 invoked by uid 99); 7 Sep 2016 07:58:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2016 07:58:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9C215E040F; Wed, 7 Sep 2016 07:58:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chenheng@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-16562 ITBLL should fail to start if misconfigured Date: Wed, 7 Sep 2016 07:58:40 +0000 (UTC) archived-at: Wed, 07 Sep 2016 07:58:42 -0000 Repository: hbase Updated Branches: refs/heads/branch-1.1 6f747178f -> 6e076d940 HBASE-16562 ITBLL should fail to start if misconfigured Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6e076d94 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6e076d94 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6e076d94 Branch: refs/heads/branch-1.1 Commit: 6e076d940f8882d6ac096f6bb2ebdf05feeb4218 Parents: 6f74717 Author: chenheng Authored: Tue Sep 6 11:02:18 2016 +0800 Committer: chenheng Committed: Wed Sep 7 15:56:30 2016 +0800 ---------------------------------------------------------------------- .../test/IntegrationTestBigLinkedList.java | 35 ++++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/6e076d94/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestBigLinkedList.java ---------------------------------------------------------------------- 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 f3d8360..a06e91d 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 @@ -116,6 +116,7 @@ import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; +import org.jruby.RubyProcess; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -257,6 +258,11 @@ 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"; + static class GeneratorInputFormat extends InputFormat { static class GeneratorInputSplit extends InputSplit implements Writable { @Override @@ -499,21 +505,20 @@ 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]); + return run(numMappers, numNodes, tmpOutput, width, wrapMultiplier); } + + protected void createSchema() throws IOException { Configuration conf = getConf(); TableName tableName = getTableName(conf); @@ -619,12 +624,22 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase { } public int run(int numMappers, long numNodes, Path tmpOutput, - Integer width, Integer wrapMuplitplier) throws Exception { - int ret = runRandomInputGenerator(numMappers, numNodes, tmpOutput, width, wrapMuplitplier); + Integer width, Integer wrapMultiplier) throws Exception { + 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; + } + int ret = runRandomInputGenerator(numMappers, numNodes, tmpOutput, width, wrapMultiplier); if (ret > 0) { return ret; } - return runGenerator(numMappers, numNodes, tmpOutput, width, wrapMuplitplier); + return runGenerator(numMappers, numNodes, tmpOutput, width, wrapMultiplier); } }