You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2016/11/01 19:48:08 UTC

[30/50] hbase git commit: HBASE-16562 ITBLL should fail to start if misconfigured

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/66a82af9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/66a82af9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/66a82af9

Branch: refs/heads/0.98
Commit: 66a82af9f47230b1972a32bea50beb785fb7997a
Parents: daf5783
Author: chenheng <ch...@apache.org>
Authored: Tue Sep 6 11:02:18 2016 +0800
Committer: chenheng <ch...@apache.org>
Committed: Wed Sep 7 16:33:32 2016 +0800

----------------------------------------------------------------------
 .../test/IntegrationTestBigLinkedList.java      | 34 ++++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/66a82af9/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 d0df043..8f7539b 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
@@ -218,6 +218,11 @@ public class IntegrationTestBigLinkedList extends IntegrationTestBase {
 
     private static final Log LOG = LogFactory.getLog(Generator.class);
 
+    public static final String USAGE =  "Usage : " + Generator.class.getSimpleName() +
+            " <num mappers> <num nodes per map> <tmp output dir> [<width> <wrap multiplier> \n" +
+            "where <num nodes per map> should be a multiple of width*wrap multiplier, " +
+            "25M by default \n";
+
     static class GeneratorInputFormat extends InputFormat<BytesWritable,NullWritable> {
       static class GeneratorInputSplit extends InputSplit implements Writable {
         @Override
@@ -434,21 +439,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() +
-            " <num mappers> <num nodes per map> <tmp output dir> [<width> <wrap multiplier>]");
-        System.out.println("   where <num nodes per map> 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();
       HBaseAdmin admin = new HBaseAdmin(conf);
@@ -549,12 +553,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);
     }
   }