From 2b2394cbbb5a147e26f652ac3de491e3d3d65bc4 Mon Sep 17 00:00:00 2001 From: fyrz Date: Sun, 22 Mar 2015 19:02:36 +0100 Subject: [PATCH] [RocksJava] DBBenchmark option for RocksMemEnv Extended DBBenchmark with option to enable RocksMemEnv. --- .../java/org/rocksdb/benchmark/DbBenchmark.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java b/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java index 4a8887377..698f62327 100644 --- a/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java +++ b/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java @@ -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_;