HBASE-17929 addendum add scan read type option
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/6e962d6f Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6e962d6f Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6e962d6f Branch: refs/heads/hbase-12439 Commit: 6e962d6f65eebaa8b41e58368aa171a7d4b2910b Parents: 66b616d Author: zhangduo <zhang...@apache.org> Authored: Wed Apr 19 11:57:44 2017 +0800 Committer: zhangduo <zhang...@apache.org> Committed: Wed Apr 19 11:58:44 2017 +0800 ---------------------------------------------------------------------- .../hadoop/hbase/PerformanceEvaluation.java | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/6e962d6f/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 96ee515..f58c025 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 @@ -638,6 +638,7 @@ public class PerformanceEvaluation extends Configured implements Tool { CompactingMemStore.COMPACTING_MEMSTORE_TYPE_DEFAULT); boolean asyncPrefetch = false; boolean cacheBlocks = true; + Scan.ReadType scanReadType = Scan.ReadType.DEFAULT; public TestOptions() {} @@ -1248,9 +1249,9 @@ public class PerformanceEvaluation extends Configured implements Tool { @Override void testRow(final int i) throws IOException { - Scan scan = - new Scan().withStartRow(getRandomRow(this.rand, opts.totalRows)).setCaching(opts.caching) - .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch); + Scan scan = new Scan().withStartRow(getRandomRow(this.rand, opts.totalRows)) + .setCaching(opts.caching).setCacheBlocks(opts.cacheBlocks) + .setAsyncPrefetch(opts.asyncPrefetch).setReadType(opts.scanReadType); FilterList list = new FilterList(); if (opts.addColumns) { scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); @@ -1287,7 +1288,8 @@ public class PerformanceEvaluation extends Configured implements Tool { Pair<byte[], byte[]> startAndStopRow = getStartAndStopRow(); Scan scan = new Scan().withStartRow(startAndStopRow.getFirst()) .withStopRow(startAndStopRow.getSecond()).setCaching(opts.caching) - .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch); + .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch) + .setReadType(opts.scanReadType); if (opts.filterAll) { scan.setFilter(new FilterAllFilter()); } @@ -1482,7 +1484,8 @@ public class PerformanceEvaluation extends Configured implements Tool { void testRow(final int i) throws IOException { if (this.testScanner == null) { Scan scan = new Scan().withStartRow(format(opts.startRow)).setCaching(opts.caching) - .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch); + .setCacheBlocks(opts.cacheBlocks).setAsyncPrefetch(opts.asyncPrefetch) + .setReadType(opts.scanReadType); if (opts.addColumns) { scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); } else { @@ -1692,7 +1695,7 @@ public class PerformanceEvaluation extends Configured implements Tool { list.addFilter(new FilterAllFilter()); } Scan scan = new Scan().setCaching(opts.caching).setCacheBlocks(opts.cacheBlocks) - .setAsyncPrefetch(opts.asyncPrefetch); + .setAsyncPrefetch(opts.asyncPrefetch).setReadType(opts.scanReadType); if (opts.addColumns) { scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); } else { @@ -2170,6 +2173,13 @@ public class PerformanceEvaluation extends Configured implements Tool { opts.cacheBlocks = Boolean.parseBoolean(cmd.substring(cacheBlocks.length())); continue; } + + final String scanReadType = "--scanReadType="; + if (cmd.startsWith(cacheBlocks)) { + opts.scanReadType = + Scan.ReadType.valueOf(cmd.substring(scanReadType.length()).toUpperCase()); + continue; + } if (isCommandClass(cmd)) { opts.cmdName = cmd; try {