HBASE-13370 - PE tool could give option for using Explicit Column Tracker

which leads to seeks (Ram)
This commit is contained in:
unknown 2015-04-02 16:11:23 +05:30
parent 2392a3e437
commit f210c2ebba
1 changed files with 35 additions and 6 deletions

View File

@ -610,6 +610,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
int valueSize = DEFAULT_VALUE_LENGTH; int valueSize = DEFAULT_VALUE_LENGTH;
int period = (this.perClientRunRows / 10) == 0? perClientRunRows: perClientRunRows / 10; int period = (this.perClientRunRows / 10) == 0? perClientRunRows: perClientRunRows / 10;
int cycles = 1; int cycles = 1;
boolean addColumns = true;
public TestOptions() {} public TestOptions() {}
@ -651,6 +652,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
this.period = that.period; this.period = that.period;
this.randomSleep = that.randomSleep; this.randomSleep = that.randomSleep;
this.measureAfter = that.measureAfter; this.measureAfter = that.measureAfter;
this.addColumns = that.addColumns;
} }
public int getCycles() { public int getCycles() {
@ -916,6 +918,14 @@ public class PerformanceEvaluation extends Configured implements Tool {
public void setMeasureAfter(int measureAfter) { public void setMeasureAfter(int measureAfter) {
this.measureAfter = measureAfter; this.measureAfter = measureAfter;
} }
public boolean getAddColumns() {
return addColumns;
}
public void setAddColumns(boolean addColumns) {
this.addColumns = addColumns;
}
} }
/* /*
@ -1181,7 +1191,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
void testRow(final int i) throws IOException { void testRow(final int i) throws IOException {
Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows)); Scan scan = new Scan(getRandomRow(this.rand, opts.totalRows));
FilterList list = new FilterList(); FilterList list = new FilterList();
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.addColumns) {
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
}
if (opts.filterAll) { if (opts.filterAll) {
list.addFilter(new FilterAllFilter()); list.addFilter(new FilterAllFilter());
} }
@ -1214,7 +1226,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
if (opts.filterAll) { if (opts.filterAll) {
scan.setFilter(new FilterAllFilter()); scan.setFilter(new FilterAllFilter());
} }
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.addColumns) {
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
}
Result r = null; Result r = null;
int count = 0; int count = 0;
ResultScanner s = this.table.getScanner(scan); ResultScanner s = this.table.getScanner(scan);
@ -1310,7 +1324,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
Thread.sleep(rd.nextInt(opts.randomSleep)); Thread.sleep(rd.nextInt(opts.randomSleep));
} }
Get get = new Get(getRandomRow(this.rand, opts.totalRows)); 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) { if (opts.filterAll) {
get.setFilter(new FilterAllFilter()); get.setFilter(new FilterAllFilter());
} }
@ -1395,7 +1411,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
if (this.testScanner == null) { if (this.testScanner == null) {
Scan scan = new Scan(format(opts.startRow)); Scan scan = new Scan(format(opts.startRow));
scan.setCaching(30); scan.setCaching(30);
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.addColumns) {
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
}
if (opts.filterAll) { if (opts.filterAll) {
scan.setFilter(new FilterAllFilter()); scan.setFilter(new FilterAllFilter());
} }
@ -1415,7 +1433,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
@Override @Override
void testRow(final int i) throws IOException { void testRow(final int i) throws IOException {
Get get = new Get(format(i)); Get get = new Get(format(i));
get.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.addColumns) {
get.addColumn(FAMILY_NAME, QUALIFIER_NAME);
}
if (opts.filterAll) { if (opts.filterAll) {
get.setFilter(new FilterAllFilter()); get.setFilter(new FilterAllFilter());
} }
@ -1486,7 +1506,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
list.addFilter(new FilterAllFilter()); list.addFilter(new FilterAllFilter());
} }
Scan scan = new Scan(); Scan scan = new Scan();
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME); if (opts.addColumns) {
scan.addColumn(FAMILY_NAME, QUALIFIER_NAME);
}
scan.setFilter(list); scan.setFilter(list);
return scan; return scan;
} }
@ -1677,6 +1699,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
"Default: opts.perClientRunRows / 10"); "Default: opts.perClientRunRows / 10");
System.err.println(" multiGet Batch gets together into groups of N. Only supported " + System.err.println(" multiGet Batch gets together into groups of N. Only supported " +
"by randomRead. Default: disabled"); "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(" replicas Enable region replica testing. Defaults: 1.");
System.err.println(" cycles How many times to cycle the test. Defaults: 1."); System.err.println(" cycles How many times to cycle the test. Defaults: 1.");
System.err.println(" splitPolicy Specify a custom RegionSplitPolicy for the table."); System.err.println(" splitPolicy Specify a custom RegionSplitPolicy for the table.");
@ -1906,6 +1929,12 @@ public class PerformanceEvaluation extends Configured implements Tool {
continue; continue;
} }
final String addColumns = "--addColumns=";
if (cmd.startsWith(addColumns)) {
opts.addColumns = Boolean.parseBoolean(cmd.substring(addColumns.length()));
continue;
}
if (isCommandClass(cmd)) { if (isCommandClass(cmd)) {
opts.cmdName = cmd; opts.cmdName = cmd;
opts.numClientThreads = Integer.parseInt(args.remove()); opts.numClientThreads = Integer.parseInt(args.remove());