[RocksJava] DBBenchmark option for RocksMemEnv

Extended DBBenchmark with option to enable RocksMemEnv.
This commit is contained in:
fyrz 2015-03-22 19:02:36 +01:00
parent fd8804f979
commit 2b2394cbbb

View File

@ -40,6 +40,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.rocksdb.*;
import org.rocksdb.RocksMemEnv;
import org.rocksdb.util.SizeUnit;
class Stats {
@ -445,6 +446,7 @@ public class DbBenchmark {
keysPerPrefix_ = (Integer) flags.get(Flag.keys_per_prefix);
hashBucketCount_ = (Long) flags.get(Flag.hash_bucket_count);
usePlainTable_ = (Boolean) flags.get(Flag.use_plain_table);
useMemenv_ = (Boolean) flags.get(Flag.use_mem_env);
flags_ = flags;
finishLock_ = new Object();
// options.setPrefixSize((Integer)flags_.get(Flag.prefix_size));
@ -486,6 +488,9 @@ public class DbBenchmark {
} else {
options.setCreateIfMissing(false);
}
if (useMemenv_) {
options.setEnv(new RocksMemEnv());
}
switch (memtable_) {
case "skip_list":
options.setMemTableConfig(new SkipListMemTableConfig());
@ -1482,6 +1487,12 @@ public class DbBenchmark {
@Override public Object parseValue(String value) {
return value;
}
},
use_mem_env(false, "Use RocksMemEnv instead of default filesystem based\n" +
"environment.") {
@Override public Object parseValue(String value) {
return parseBoolean(value);
}
};
private Flag(Object defaultValue, String desc) {
@ -1594,6 +1605,9 @@ public class DbBenchmark {
RandomGenerator gen_;
long startTime_;
// env
boolean useMemenv_;
// memtable related
final int maxWriteBufferNumber_;
final int prefixSize_;