From 3cda2dfcad46e72b8d37351f2891165224a3a6ca Mon Sep 17 00:00:00 2001 From: ramkrishna Date: Wed, 8 Apr 2015 10:26:16 +0530 Subject: [PATCH] HBASE-13370 - PE tool could give option for using Explicit Column Tracker which leads to seeks(Ram) --- .../hadoop/hbase/PerformanceEvaluation.java | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) 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 e195c098b05..755372cbb78 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 @@ -597,6 +597,7 @@ public class PerformanceEvaluation extends Configured implements Tool { boolean valueZipf = false; int valueSize = DEFAULT_VALUE_LENGTH; int period = (this.perClientRunRows / 10) == 0? perClientRunRows: perClientRunRows / 10; + boolean addColumns = true; public TestOptions() {} @@ -636,6 +637,7 @@ public class PerformanceEvaluation extends Configured implements Tool { this.valueSize = that.valueSize; this.period = that.period; this.randomSleep = that.randomSleep; + this.addColumns = that.addColumns; } public boolean isValueZipf() { @@ -885,6 +887,14 @@ public class PerformanceEvaluation extends Configured implements Tool { public boolean isOneCon() { return oneCon; } + + public boolean getAddColumns() { + return addColumns; + } + + public void setAddColumns(boolean addColumns) { + this.addColumns = addColumns; + } } /* @@ -1144,7 +1154,9 @@ public class PerformanceEvaluation extends Configured implements Tool { void testRow(final int i) throws IOException { Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows)); FilterList list = new FilterList(); - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } if (opts.filterAll) { list.addFilter(new FilterAllFilter()); } @@ -1177,7 +1189,9 @@ public class PerformanceEvaluation extends Configured implements Tool { if (opts.filterAll) { scan.setFilter(new FilterAllFilter()); } - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } Result r = null; int count = 0; ResultScanner s = this.table.getScanner(scan); @@ -1273,7 +1287,9 @@ public class PerformanceEvaluation extends Configured implements Tool { Thread.sleep(rd.nextInt(opts.randomSleep)); } Get get = new Get(getRandomRow(this.rand, opts.totalRows)); - get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } if (opts.filterAll) { get.setFilter(new FilterAllFilter()); } @@ -1358,7 +1374,9 @@ public class PerformanceEvaluation extends Configured implements Tool { if (this.testScanner == null) { Scan scan = new Scan(format(opts.startRow)); scan.setCaching(30); - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } if (opts.filterAll) { scan.setFilter(new FilterAllFilter()); } @@ -1378,7 +1396,9 @@ public class PerformanceEvaluation extends Configured implements Tool { @Override void testRow(final int i) throws IOException { Get get = new Get(format(i)); - get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + get.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } if (opts.filterAll) { get.setFilter(new FilterAllFilter()); } @@ -1449,7 +1469,9 @@ public class PerformanceEvaluation extends Configured implements Tool { list.addFilter(new FilterAllFilter()); } Scan scan = new Scan(); - scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + if (opts.addColumns) { + scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); + } scan.setFilter(list); return scan; } @@ -1632,6 +1654,7 @@ public class PerformanceEvaluation extends Configured implements Tool { "Default: opts.perClientRunRows / 10"); System.err.println(" multiGet Batch gets together into groups of N. Only supported " + "by randomRead. Default: disabled"); + System.err.println(" addColumns Adds columns to scans/gets explicitly. Default: true"); System.err.println(" replicas Enable region replica testing. Defaults: 1."); System.err.println(" splitPolicy Specify a custom RegionSplitPolicy for the table."); System.err.println(" randomSleep Do a random sleep before each get between 0 and entered value. Defaults: 0"); @@ -1847,6 +1870,12 @@ public class PerformanceEvaluation extends Configured implements Tool { continue; } + final String addColumns = "--addColumns="; + if (cmd.startsWith(addColumns)) { + opts.addColumns = Boolean.parseBoolean(cmd.substring(addColumns.length())); + continue; + } + if (isCommandClass(cmd)) { opts.cmdName = cmd; opts.numClientThreads = Integer.parseInt(args.remove());