hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject svn commit: r1527817 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
Date Mon, 30 Sep 2013 22:57:44 GMT
Author: mbertozzi
Date: Mon Sep 30 22:57:44 2013
New Revision: 1527817

URL: http://svn.apache.org/r1527817
Log:
HBASE-9663 PerformanceEvaluation does not properly honor specified table name parameter

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

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java?rev=1527817&r1=1527816&r2=1527817&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
Mon Sep 30 22:57:44 2013
@@ -139,7 +139,8 @@ public class PerformanceEvaluation exten
    * Regex to parse lines in input file passed to mapreduce task.
    */
   public static final Pattern LINE_PATTERN =
-    Pattern.compile("startRow=(\\d+),\\s+" +
+    Pattern.compile("tableName=(\\w+),\\s+" +
+        "startRow=(\\d+),\\s+" +
         "perClientRunRows=(\\d+),\\s+" +
         "totalRows=(\\d+),\\s+" +
         "clients=(\\d+),\\s+" +
@@ -216,6 +217,7 @@ public class PerformanceEvaluation exten
    *  the record value is the PeInputSplit itself.
    */
   public static class PeInputSplit extends InputSplit implements Writable {
+    private TableName tableName = TABLE_NAME;
     private int startRow = 0;
     private int rows = 0;
     private int totalRows = 0;
@@ -226,18 +228,11 @@ public class PerformanceEvaluation exten
     private int noOfTags = 0;
 
     public PeInputSplit() {
-      this.startRow = 0;
-      this.rows = 0;
-      this.totalRows = 0;
-      this.clients = 0;
-      this.flushCommits = false;
-      this.writeToWAL = true;
-      this.useTags = false;
-      this.noOfTags = 0;
     }
 
-    public PeInputSplit(int startRow, int rows, int totalRows, int clients,
+    public PeInputSplit(TableName tableName, int startRow, int rows, int totalRows, int clients,
         boolean flushCommits, boolean writeToWAL, boolean useTags, int noOfTags) {
+      this.tableName = tableName;
       this.startRow = startRow;
       this.rows = rows;
       this.totalRows = totalRows;
@@ -250,6 +245,11 @@ public class PerformanceEvaluation exten
 
     @Override
     public void readFields(DataInput in) throws IOException {
+      int tableNameLen = in.readInt();
+      byte[] name = new byte[tableNameLen];
+      in.readFully(name);
+      this.tableName = TableName.valueOf(name);
+
       this.startRow = in.readInt();
       this.rows = in.readInt();
       this.totalRows = in.readInt();
@@ -262,6 +262,9 @@ public class PerformanceEvaluation exten
 
     @Override
     public void write(DataOutput out) throws IOException {
+      byte[] name = this.tableName.toBytes();
+      out.writeInt(name.length);
+      out.write(name);
       out.writeInt(startRow);
       out.writeInt(rows);
       out.writeInt(totalRows);
@@ -282,6 +285,10 @@ public class PerformanceEvaluation exten
       return new String[0];
     }
 
+    public TableName getTableName() {
+      return tableName;
+    }
+
     public int getStartRow() {
       return startRow;
     }
@@ -343,27 +350,29 @@ public class PerformanceEvaluation exten
           }
           Matcher m = LINE_PATTERN.matcher(lineText.toString());
           if((m != null) && m.matches()) {
-            int startRow = Integer.parseInt(m.group(1));
-            int rows = Integer.parseInt(m.group(2));
-            int totalRows = Integer.parseInt(m.group(3));
-            int clients = Integer.parseInt(m.group(4));
-            boolean flushCommits = Boolean.parseBoolean(m.group(5));
-            boolean writeToWAL = Boolean.parseBoolean(m.group(6));
-            boolean useTags = Boolean.parseBoolean(m.group(7));
-            int noOfTags = Integer.parseInt(m.group(8));
-
-            LOG.debug("split["+ splitList.size() + "] " +
-                     " startRow=" + startRow +
-                     " rows=" + rows +
-                     " totalRows=" + totalRows +
-                     " clients=" + clients +
-                     " flushCommits=" + flushCommits +
-                     " writeToWAL=" + writeToWAL +
-                     " useTags=" + useTags +
-                     " noOfTags=" + noOfTags);
+            TableName tableName = TableName.valueOf(m.group(1));
+            int startRow = Integer.parseInt(m.group(2));
+            int rows = Integer.parseInt(m.group(3));
+            int totalRows = Integer.parseInt(m.group(4));
+            int clients = Integer.parseInt(m.group(5));
+            boolean flushCommits = Boolean.parseBoolean(m.group(6));
+            boolean writeToWAL = Boolean.parseBoolean(m.group(7));
+            boolean useTags = Boolean.parseBoolean(m.group(8));
+            int noOfTags = Integer.parseInt(m.group(9));
+
+            LOG.debug("tableName=" + tableName +
+                      " split["+ splitList.size() + "] " +
+                      " startRow=" + startRow +
+                      " rows=" + rows +
+                      " totalRows=" + totalRows +
+                      " clients=" + clients +
+                      " flushCommits=" + flushCommits +
+                      " writeToWAL=" + writeToWAL +
+                      " useTags=" + useTags +
+                      " noOfTags=" + noOfTags);
 
             PeInputSplit newSplit =
-              new PeInputSplit(startRow, rows, totalRows, clients,
+              new PeInputSplit(tableName, startRow, rows, totalRows, clients,
                 flushCommits, writeToWAL, useTags, noOfTags);
             splitList.add(newSplit);
           }
@@ -483,6 +492,7 @@ public class PerformanceEvaluation exten
       };
 
       // Evaluation task
+      pe.tableName = value.getTableName();
       long elapsedTime = this.pe.runOneClient(this.cmd, value.getStartRow(),
           value.getRows(), value.getTotalRows(),
           value.isFlushCommits(), value.isWriteToWAL(),
@@ -722,7 +732,8 @@ public class PerformanceEvaluation exten
     try {
       for (int i = 0; i < 10; i++) {
         for (int j = 0; j < N; j++) {
-          String s = "startRow=" + ((j * perClientRows) + (i * (perClientRows/10))) +
+          String s = "tableName=" + this.tableName +
+          ", startRow=" + ((j * perClientRows) + (i * (perClientRows/10))) +
           ", perClientRunRows=" + (perClientRows / 10) +
           ", totalRows=" + this.R +
           ", clients=" + this.N +
@@ -1391,6 +1402,12 @@ public class PerformanceEvaluation exten
     }
 
     try {
+      // MR-NOTE: if you are adding a property that is used to control an operation
+      // like put(), get(), scan(), ... you must also add it as part of the MR 
+      // input, take a look at writeInputFile().
+      // Then you must adapt the LINE_PATTERN input regex,
+      // and parse the argument, take a look at PEInputFormat.getSplits().
+      
       for (int i = 0; i < args.length; i++) {
         String cmd = args[i];
         if (cmd.equals("-h") || cmd.startsWith("--h")) {



Mime
View raw message