HBASE-3982. Improvements to TestHFileSeek.
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1135709 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d8f5be74d7
commit
93038d06aa
|
@ -260,6 +260,7 @@ Release 0.91.0 - Unreleased
|
|||
(Jolly Chen)
|
||||
HBASE-3961 Add Delete.setWriteToWAL functionality (Bruno Dumon)
|
||||
HBASE-3928 Some potential performance improvements to Bytes/KeyValue
|
||||
HBASE-3982 Improvements to TestHFileSeek
|
||||
|
||||
TASKS
|
||||
HBASE-3559 Move report of split to master OFF the heartbeat channel
|
||||
|
|
|
@ -37,10 +37,12 @@ import org.apache.hadoop.fs.FSDataInputStream;
|
|||
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.RawLocalFileSystem;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.io.hfile.HFile.Reader;
|
||||
import org.apache.hadoop.hbase.io.hfile.HFile.Writer;
|
||||
import org.apache.hadoop.io.BytesWritable;
|
||||
import org.mortbay.log.Log;
|
||||
|
||||
/**
|
||||
* test the performance for seek.
|
||||
|
@ -51,6 +53,7 @@ import org.apache.hadoop.io.BytesWritable;
|
|||
* instead.</p>
|
||||
*/
|
||||
public class TestHFileSeek extends TestCase {
|
||||
private static final boolean USE_PREAD = true;
|
||||
private MyOptions options;
|
||||
private Configuration conf;
|
||||
private Path path;
|
||||
|
@ -67,6 +70,11 @@ public class TestHFileSeek extends TestCase {
|
|||
}
|
||||
|
||||
conf = new Configuration();
|
||||
|
||||
if (options.useRawFs) {
|
||||
conf.setClass("fs.file.impl", RawLocalFileSystem.class, FileSystem.class);
|
||||
}
|
||||
|
||||
conf.setInt("tfile.fs.input.buffer.size", options.fsInputBufferSize);
|
||||
conf.setInt("tfile.fs.output.buffer.size", options.fsOutputBufferSize);
|
||||
path = new Path(new Path(options.rootDir), options.file);
|
||||
|
@ -161,7 +169,7 @@ public class TestHFileSeek extends TestCase {
|
|||
KeySampler kSampler =
|
||||
new KeySampler(rng, reader.getFirstKey(), reader.getLastKey(),
|
||||
keyLenGen);
|
||||
HFileScanner scanner = reader.getScanner(false, false);
|
||||
HFileScanner scanner = reader.getScanner(false, USE_PREAD);
|
||||
BytesWritable key = new BytesWritable();
|
||||
timer.reset();
|
||||
timer.start();
|
||||
|
@ -250,7 +258,9 @@ public class TestHFileSeek extends TestCase {
|
|||
// Default writing 10MB.
|
||||
long fileSize = 10 * 1024 * 1024;
|
||||
long seekCount = 1000;
|
||||
long trialCount = 1;
|
||||
long seed;
|
||||
boolean useRawFs = false;
|
||||
|
||||
static final int OP_CREATE = 1;
|
||||
static final int OP_READ = 2;
|
||||
|
@ -349,14 +359,30 @@ public class TestHFileSeek extends TestCase {
|
|||
"specify how many seek operations we perform (requires -x r or -x rw.")
|
||||
.create('n');
|
||||
|
||||
Option trialCount =
|
||||
OptionBuilder
|
||||
.withLongOpt("trials")
|
||||
.withArgName("n")
|
||||
.hasArg()
|
||||
.withDescription(
|
||||
"specify how many times to run the whole benchmark")
|
||||
.create('t');
|
||||
|
||||
Option useRawFs =
|
||||
OptionBuilder
|
||||
.withLongOpt("rawfs")
|
||||
.withDescription("use raw instead of checksummed file system")
|
||||
.create();
|
||||
|
||||
Option help =
|
||||
OptionBuilder.withLongOpt("help").hasArg(false).withDescription(
|
||||
"show this screen").create("h");
|
||||
|
||||
return new Options().addOption(compress).addOption(fileSize).addOption(
|
||||
fsInputBufferSz).addOption(fsOutputBufferSize).addOption(keyLen)
|
||||
.addOption(blockSz).addOption(rootDir).addOption(valueLen).addOption(
|
||||
operation).addOption(seekCount).addOption(file).addOption(help);
|
||||
.addOption(blockSz).addOption(rootDir).addOption(valueLen)
|
||||
.addOption(operation).addOption(seekCount).addOption(file)
|
||||
.addOption(trialCount).addOption(useRawFs).addOption(help);
|
||||
|
||||
}
|
||||
|
||||
|
@ -397,6 +423,10 @@ public class TestHFileSeek extends TestCase {
|
|||
seekCount = Integer.parseInt(line.getOptionValue('n'));
|
||||
}
|
||||
|
||||
if (line.hasOption('t')) {
|
||||
trialCount = Integer.parseInt(line.getOptionValue('t'));
|
||||
}
|
||||
|
||||
if (line.hasOption('k')) {
|
||||
IntegerRange ir = IntegerRange.parse(line.getOptionValue('k'));
|
||||
minKeyLen = ir.from();
|
||||
|
@ -441,6 +471,8 @@ public class TestHFileSeek extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
useRawFs = line.hasOption("rawfs");
|
||||
|
||||
proceed = true;
|
||||
}
|
||||
|
||||
|
@ -489,8 +521,11 @@ public class TestHFileSeek extends TestCase {
|
|||
}
|
||||
|
||||
testCase.options = options;
|
||||
testCase.setUp();
|
||||
testCase.testSeeks();
|
||||
testCase.tearDown();
|
||||
for (int i = 0; i < options.trialCount; i++) {
|
||||
Log.info("Beginning trial " + (i+1));
|
||||
testCase.setUp();
|
||||
testCase.testSeeks();
|
||||
testCase.tearDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue