From 36e759d19969e89912f35135018723229acc6755 Mon Sep 17 00:00:00 2001 From: Radheshyam Balasundaram Date: Mon, 18 Aug 2014 11:59:38 -0700 Subject: [PATCH] Adding Cuckoo Table SST option to db_bench Summary: Adding flags to use cuckoo table SST in db_bench.cc Test Plan: Ran benchmark with fillseq and readrandom Reviewers: sdong, ljin Reviewed By: ljin Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D21729 --- db/db_bench.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/db_bench.cc b/db/db_bench.cc index 8c1d28835..f208b8181 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -543,6 +543,8 @@ DEFINE_string(memtablerep, "skip_list", ""); DEFINE_int64(hash_bucket_count, 1024 * 1024, "hash bucket count"); DEFINE_bool(use_plain_table, false, "if use plain table " "instead of block-based table format"); +DEFINE_bool(use_cuckoo_table, false, "if use cuckoo table format"); +DEFINE_double(cuckoo_hash_ratio, 0.9, "Hash ratio for Cuckoo SST table."); DEFINE_bool(use_hash_search, false, "if use kHashSearch " "instead of kBinarySearch. " "This is valid if only we use BlockTable"); @@ -1705,6 +1707,13 @@ class Benchmark { plain_table_options.hash_table_ratio = 0.75; options.table_factory = std::shared_ptr( NewPlainTableFactory(plain_table_options)); + } else if (FLAGS_use_cuckoo_table) { + if (FLAGS_cuckoo_hash_ratio > 1 || FLAGS_cuckoo_hash_ratio < 0) { + fprintf(stderr, "Invalid cuckoo_hash_ratio\n"); + exit(1); + } + options.table_factory = std::shared_ptr( + NewCuckooTableFactory(FLAGS_cuckoo_hash_ratio)); } else { BlockBasedTableOptions block_based_options; if (FLAGS_use_hash_search) {