hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1527067 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
Date Fri, 27 Sep 2013 20:38:58 GMT
Author: enis
Date: Fri Sep 27 20:38:57 2013
New Revision: 1527067

URL: http://svn.apache.org/r1527067
Log:
HBASE-9672 LoadTestTool NPE's when -num_tables is given, but -tn is not

Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java?rev=1527067&r1=1527066&r2=1527067&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/util/LoadTestTool.java
Fri Sep 27 20:38:57 2013
@@ -98,7 +98,7 @@ public class LoadTestTool extends Abstra
   public static final String OPT_ENCODE_IN_CACHE_ONLY_USAGE =
       "If this is specified, data blocks will only be encoded in block " +
       "cache but not on disk";
-  
+
   public static final String OPT_INMEMORY = "in_memory";
   public static final String OPT_USAGE_IN_MEMORY = "Tries to keep the HFiles of the CF "
+
   		"inmemory as far as possible.  Not guaranteed that reads are always served from inmemory";
@@ -107,7 +107,7 @@ public class LoadTestTool extends Abstra
   		" only if the HFileV3 version is used";
 
   public static final String OPT_NUM_TAGS = "num_tags";
-  public static final String OPT_USAGE_NUM_TAGS = "Specifies the minimum and number of tags
to be" 
+  public static final String OPT_USAGE_NUM_TAGS = "Specifies the minimum and number of tags
to be"
       +      " added per KV";
 
   protected static final String OPT_KEY_WINDOW = "key_window";
@@ -163,7 +163,7 @@ public class LoadTestTool extends Abstra
   private int keyWindow = MultiThreadedReader.DEFAULT_KEY_WINDOW;
   private int maxReadErrors = MultiThreadedReader.DEFAULT_MAX_ERRORS;
   private int verifyPercent;
- 
+
   private int numTables = 1;
 
   // TODO: refactor LoadTestToolImpl somewhere to make the usage from tests less bad,
@@ -261,7 +261,7 @@ public class LoadTestTool extends Abstra
         DEFAULT_START_KEY + ".");
     addOptNoArg(OPT_SKIP_INIT, "Skip the initialization; assume test table "
         + "already exists");
-    
+
     addOptWithArg(NUM_TABLES,
       "A positive integer number. When a number n is speicfied, load test "
           + "tool  will load n table parallely. -tn parameter value becomes "
@@ -367,7 +367,7 @@ public class LoadTestTool extends Abstra
       System.out.println("Percent of keys to verify: " + verifyPercent);
       System.out.println("Reader threads: " + numReaderThreads);
     }
-    
+
     numTables = 1;
     if(cmd.hasOption(NUM_TABLES)) {
       numTables = parseInt(cmd.getOptionValue(NUM_TABLES), 1, Short.MAX_VALUE);
@@ -390,7 +390,7 @@ public class LoadTestTool extends Abstra
     String bloomStr = cmd.getOptionValue(OPT_BLOOM);
     bloomType = bloomStr == null ? null :
         BloomType.valueOf(bloomStr);
-    
+
     inMemoryCF = cmd.hasOption(OPT_INMEMORY);
     useTags = cmd.hasOption(OPT_USETAGS);
     if (useTags) {
@@ -405,7 +405,7 @@ public class LoadTestTool extends Abstra
       System.out.println("Using tags, number of tags per KV: min=" + minNumTags + ", max="
           + maxNumTags);
     }
-    
+
   }
 
   public void initTestTable() throws IOException {
@@ -539,14 +539,14 @@ public class LoadTestTool extends Abstra
   }
 
   /**
-   * When NUM_TABLES is specified, the function starts multiple worker threads 
-   * which individually start a LoadTestTool instance to load a table. Each 
+   * When NUM_TABLES is specified, the function starts multiple worker threads
+   * which individually start a LoadTestTool instance to load a table. Each
    * table name is in format <tn>_<index>. For example, "-tn test -num_tables
2"
    * , table names will be "test_1", "test_2"
-   * 
+   *
    * @throws IOException
    */
-  private int parallelLoadTables() 
+  private int parallelLoadTables()
       throws IOException {
     // create new command args
     String tableName = cmd.getOptionValue(OPT_TABLE_NAME, DEFAULT_TABLE_NAME);
@@ -554,6 +554,7 @@ public class LoadTestTool extends Abstra
     if (!cmd.hasOption(LoadTestTool.OPT_TABLE_NAME)) {
       newArgs = new String[cmdLineArgs.length + 2];
       newArgs[0] = "-" + LoadTestTool.OPT_TABLE_NAME;
+      newArgs[1] = LoadTestTool.DEFAULT_TABLE_NAME;
       for (int i = 0; i < cmdLineArgs.length; i++) {
         newArgs[i + 2] = cmdLineArgs[i];
       }
@@ -567,7 +568,7 @@ public class LoadTestTool extends Abstra
         tableNameValueIndex = j + 1;
       } else if (newArgs[j].endsWith(NUM_TABLES)) {
         // change NUM_TABLES to 1 so that each worker loads one table
-        newArgs[j + 1] = "1"; 
+        newArgs[j + 1] = "1";
       }
     }
 
@@ -594,7 +595,7 @@ public class LoadTestTool extends Abstra
       }
       checkForErrors();
     }
-    
+
     return EXIT_SUCCESS;
   }
 
@@ -627,6 +628,7 @@ public class LoadTestTool extends Abstra
       workerArgs = args;
     }
 
+    @Override
     public void run() {
       try {
         int ret = ToolRunner.run(HBaseConfiguration.create(), new LoadTestTool(), workerArgs);



Mime
View raw message