HBASE-20523 PE tool should support configuring client side buffering sizes
(Ram)
This commit is contained in:
parent
23b9054089
commit
91f3de89ab
|
@ -57,6 +57,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
|||
import org.apache.hadoop.hbase.client.Admin;
|
||||
import org.apache.hadoop.hbase.client.Append;
|
||||
import org.apache.hadoop.hbase.client.BufferedMutator;
|
||||
import org.apache.hadoop.hbase.client.BufferedMutatorParams;
|
||||
import org.apache.hadoop.hbase.client.Connection;
|
||||
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||
import org.apache.hadoop.hbase.client.Consistency;
|
||||
|
@ -622,6 +623,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
int columns = 1;
|
||||
int caching = 30;
|
||||
boolean addColumns = true;
|
||||
long bufferSize = 2l * 1024l * 1024l;
|
||||
|
||||
public TestOptions() {}
|
||||
|
||||
|
@ -665,6 +667,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
this.addColumns = that.addColumns;
|
||||
this.columns = that.columns;
|
||||
this.caching = that.caching;
|
||||
this.bufferSize = that.bufferSize;
|
||||
}
|
||||
|
||||
public int getCaching() {
|
||||
|
@ -827,6 +830,14 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
this.valueSize = valueSize;
|
||||
}
|
||||
|
||||
public void setBufferSize(long bufferSize) {
|
||||
this.bufferSize = bufferSize;
|
||||
}
|
||||
|
||||
public long getBufferSize() {
|
||||
return this.bufferSize;
|
||||
}
|
||||
|
||||
public void setPeriod(int period) {
|
||||
this.period = period;
|
||||
}
|
||||
|
@ -1255,7 +1266,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
|
||||
@Override
|
||||
void onStartup() throws IOException {
|
||||
this.mutator = connection.getBufferedMutator(TableName.valueOf(opts.tableName));
|
||||
BufferedMutatorParams p = new BufferedMutatorParams(TableName.valueOf(opts.tableName));
|
||||
p.writeBufferSize(opts.bufferSize);
|
||||
this.mutator = connection.getBufferedMutator(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1964,6 +1977,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
System.err.println(" randomSleep Do a random sleep before each get between 0 and entered value. Defaults: 0");
|
||||
System.err.println(" columns Columns to write per row. Default: 1");
|
||||
System.err.println(" caching Scan caching to use. Default: 30");
|
||||
System.err.println(" bufferSize Set the value of client side buffering. Default: 2MB");
|
||||
System.err.println();
|
||||
System.err.println(" Note: -D properties will be applied to the conf used. ");
|
||||
System.err.println(" For example: ");
|
||||
|
@ -2199,6 +2213,12 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
|||
continue;
|
||||
}
|
||||
|
||||
final String bufferSize = "--bufferSize=";
|
||||
if (cmd.startsWith(bufferSize)) {
|
||||
opts.bufferSize = Long.parseLong(cmd.substring(bufferSize.length()));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isCommandClass(cmd)) {
|
||||
opts.cmdName = cmd;
|
||||
try {
|
||||
|
|
|
@ -87,4 +87,14 @@ public class TestPerformanceEvaluation {
|
|||
assertTrue(e.getCause() instanceof NoSuchElementException);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetBufferSizeOption() {
|
||||
PerformanceEvaluation.TestOptions opts = new PerformanceEvaluation.TestOptions();
|
||||
long bufferSize = opts.getBufferSize();
|
||||
assertEquals(bufferSize, 2l * 1024l * 1024l);
|
||||
opts.setBufferSize(64l * 1024l);
|
||||
bufferSize = opts.getBufferSize();
|
||||
assertEquals(bufferSize, 64l * 1024l);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue