[RocksDB][Performance Branch] Make height and branching factor configurable for skiplist implementation

Summary: As title. Especially, HashSkipListRepFactory will be able to specify a relatively small height, to reduce the memory overhead of one skiplist per bucket.

Test Plan: make check and test it on leaf4

Reviewers: dhruba, sdong, kailiu

CC: reconnect.grayhat, leveldb

Differential Revision: https://reviews.facebook.net/D14307
This commit is contained in:
Haobo Xu
2013-11-22 13:31:00 -08:00
parent 8aac46d686
commit 4e6463ea44
4 changed files with 64 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ DEFINE_uint64(items_per_prefix, 10, "total number of values per prefix");
DEFINE_int64(write_buffer_size, 1000000000, "");
DEFINE_int64(max_write_buffer_number, 8, "");
DEFINE_int64(min_write_buffer_number_to_merge, 7, "");
DEFINE_int32(skiplist_height, 4, "");
// Path to the database on file system
const std::string kDbName = rocksdb::test::TmpDir() + "/prefix_test";
@@ -111,7 +112,8 @@ class PrefixTest {
options.prefix_extractor = prefix_extractor;
if (FLAGS_use_nolock_version) {
options.memtable_factory.reset(NewHashSkipListRepFactory(
prefix_extractor, FLAGS_bucket_count));
prefix_extractor, FLAGS_bucket_count,
FLAGS_skiplist_height));
} else {
options.memtable_factory =
std::make_shared<rocksdb::PrefixHashRepFactory>(
@@ -152,7 +154,7 @@ TEST(PrefixTest, DynamicPrefixIterator) {
TestKey test_key(prefix, sorted);
Slice key = TestKeyToSlice(test_key);
std::string value = "v" + std::to_string(sorted);
std::string value(40, 0);
ASSERT_OK(db->Put(write_options, key, value));
}