You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2017/04/18 01:53:16 UTC

hbase git commit: HBASE-17929 Add more options for PE tool

Repository: hbase
Updated Branches:
  refs/heads/master ecdfb8232 -> 3c32032f5


HBASE-17929 Add more options for PE tool


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/3c32032f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/3c32032f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/3c32032f

Branch: refs/heads/master
Commit: 3c32032f5ce935eedd2b6d471f20b030c857acbc
Parents: ecdfb82
Author: zhangduo <zh...@apache.org>
Authored: Mon Apr 17 16:20:45 2017 +0800
Committer: zhangduo <zh...@apache.org>
Committed: Tue Apr 18 09:52:34 2017 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/PerformanceEvaluation.java     | 37 ++++++++++++++------
 1 file changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/3c32032f/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
index 40e50cf..96ee515 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java
@@ -636,6 +636,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
     MemoryCompactionPolicy inMemoryCompaction =
         MemoryCompactionPolicy.valueOf(
             CompactingMemStore.COMPACTING_MEMSTORE_TYPE_DEFAULT);
+    boolean asyncPrefetch = false;
+    boolean cacheBlocks = true;
 
     public TestOptions() {}
 
@@ -1246,8 +1248,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
 
     @Override
     void testRow(final int i) throws IOException {
-      Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows));
-      scan.setCaching(opts.caching);
+      Scan scan =
+          new Scan().withStartRow(getRandomRow(this.rand, opts.totalRows)).setCaching(opts.caching)
+              .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch);
       FilterList list = new FilterList();
       if (opts.addColumns) {
         scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
@@ -1282,8 +1285,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
     @Override
     void testRow(final int i) throws IOException {
       Pair<byte[], byte[]> startAndStopRow = getStartAndStopRow();
-      Scan scan = new Scan(startAndStopRow.getFirst(), startAndStopRow.getSecond());
-      scan.setCaching(opts.caching);
+      Scan scan = new Scan().withStartRow(startAndStopRow.getFirst())
+          .withStopRow(startAndStopRow.getSecond()).setCaching(opts.caching)
+          .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch);
       if (opts.filterAll) {
         scan.setFilter(new FilterAllFilter());
       }
@@ -1477,8 +1481,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
     @Override
     void testRow(final int i) throws IOException {
       if (this.testScanner == null) {
-        Scan scan = new Scan(format(opts.startRow));
-        scan.setCaching(opts.caching);
+        Scan scan = new Scan().withStartRow(format(opts.startRow)).setCaching(opts.caching)
+            .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch);
         if (opts.addColumns) {
           scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
         } else {
@@ -1487,7 +1491,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
         if (opts.filterAll) {
           scan.setFilter(new FilterAllFilter());
         }
-       this.testScanner = table.getScanner(scan);
+        this.testScanner = table.getScanner(scan);
       }
       Result r = testScanner.next();
       updateValueSize(r);
@@ -1687,8 +1691,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
       if(opts.filterAll) {
         list.addFilter(new FilterAllFilter());
       }
-      Scan scan = new Scan();
-      scan.setCaching(opts.caching);
+      Scan scan = new Scan().setCaching(opts.caching).setCacheBlocks(opts.cacheBlocks)
+          .setAsyncPrefetch(opts.asyncPrefetch);
       if (opts.addColumns) {
         scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
       } else {
@@ -2138,8 +2142,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
 
       final String inMemoryCompaction = "--inmemoryCompaction=";
       if (cmd.startsWith(inMemoryCompaction)) {
-        opts.inMemoryCompaction = opts.inMemoryCompaction.valueOf(cmd.substring
-            (inMemoryCompaction.length()));
+        opts.inMemoryCompaction =
+            MemoryCompactionPolicy.valueOf(cmd.substring(inMemoryCompaction.length()));
         continue;
       }
 
@@ -2155,6 +2159,17 @@ public class PerformanceEvaluation extends Configured implements Tool {
         continue;
       }
 
+      final String asyncPrefetch = "--asyncPrefetch";
+      if (cmd.startsWith(asyncPrefetch)) {
+        opts.asyncPrefetch = true;
+        continue;
+      }
+
+      final String cacheBlocks = "--cacheBlocks=";
+      if (cmd.startsWith(cacheBlocks)) {
+        opts.cacheBlocks = Boolean.parseBoolean(cmd.substring(cacheBlocks.length()));
+        continue;
+      }
       if (isCommandClass(cmd)) {
         opts.cmdName = cmd;
         try {