From b200e4cb609c009478e87f0279ae0f575aa3adcc Mon Sep 17 00:00:00 2001 From: Ayelet Shani Date: Tue, 29 Aug 2023 14:42:52 +0300 Subject: [PATCH] 653:Remove deprecate use_seek_parallel_threshold_ parmeter in hash_spdb --- HISTORY.md | 1 + memtable/hash_spdb_rep.cc | 40 ++++++++++----------------------------- tools/db_bench_tool.cc | 4 +--- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index f5797d100d..e4ca29132e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,7 @@ Fix RepeatableThread to work properly with on thread start callback feature (htt ### Bug Fixes db_bench: fix SeekRandomWriteRandom valid check. Use key and value only after checking iterator is valid. +* spdb memtable: Remove deprecate use_seek_parallel_threshold parmeter (#653) ### Miscellaneous diff --git a/memtable/hash_spdb_rep.cc b/memtable/hash_spdb_rep.cc index d9025967a4..91965b1e2d 100644 --- a/memtable/hash_spdb_rep.cc +++ b/memtable/hash_spdb_rep.cc @@ -399,10 +399,10 @@ void SpdbVectorContainer::SortThread() { class HashSpdbRep : public MemTableRep { public: HashSpdbRep(const MemTableRep::KeyComparator& compare, Allocator* allocator, - size_t bucket_size, bool use_seek_parallel_threshold = false); + size_t bucket_size); + + HashSpdbRep(Allocator* allocator, size_t bucket_size); - HashSpdbRep(Allocator* allocator, size_t bucket_size, - bool use_seek_parallel_threshold = false); void PostCreate(const MemTableRep::KeyComparator& compare, Allocator* allocator); @@ -443,22 +443,17 @@ class HashSpdbRep : public MemTableRep { private: SpdbHashTable spdb_hash_table_; - bool use_seek_parallel_threshold_ = false; std::shared_ptr spdb_vectors_cont_ = nullptr; }; HashSpdbRep::HashSpdbRep(const MemTableRep::KeyComparator& compare, - Allocator* allocator, size_t bucket_size, - bool use_seek_parallel_threshold) - : HashSpdbRep(allocator, bucket_size, use_seek_parallel_threshold) { + Allocator* allocator, size_t bucket_size) + : HashSpdbRep(allocator, bucket_size) { spdb_vectors_cont_ = std::make_shared(compare); } -HashSpdbRep::HashSpdbRep(Allocator* allocator, size_t bucket_size, - bool use_seek_parallel_threshold) - : MemTableRep(allocator), - spdb_hash_table_(bucket_size), - use_seek_parallel_threshold_(use_seek_parallel_threshold) {} +HashSpdbRep::HashSpdbRep(Allocator* allocator, size_t bucket_size) + : MemTableRep(allocator), spdb_hash_table_(bucket_size) {} void HashSpdbRep::PostCreate(const MemTableRep::KeyComparator& compare, Allocator* allocator) { @@ -522,8 +517,7 @@ void HashSpdbRep::Get(const LookupKey& k, void* callback_args, MemTableRep::Iterator* HashSpdbRep::GetIterator(Arena* arena) { const bool empty_iter = - spdb_vectors_cont_->IsEmpty() || - (use_seek_parallel_threshold_ && !spdb_vectors_cont_->IsReadOnly()); + spdb_vectors_cont_->IsEmpty() || !spdb_vectors_cont_->IsReadOnly(); if (arena != nullptr) { void* mem; if (empty_iter) { @@ -543,7 +537,6 @@ MemTableRep::Iterator* HashSpdbRep::GetIterator(Arena* arena) { struct HashSpdbRepOptions { static const char* kName() { return "HashSpdbRepOptions"; } size_t hash_bucket_count; - bool use_seek_parallel_threshold; }; static std::unordered_map hash_spdb_factory_info = @@ -552,22 +545,12 @@ static std::unordered_map hash_spdb_factory_info = {offsetof(struct HashSpdbRepOptions, hash_bucket_count), OptionType::kSizeT, OptionVerificationType::kNormal, OptionTypeFlags::kNone}}, - {"use_seek_parallel_threshold", - {offsetof(struct HashSpdbRepOptions, use_seek_parallel_threshold), - OptionType::kBoolean, OptionVerificationType::kNormal, - OptionTypeFlags::kNone}}, }; class HashSpdbRepFactory : public MemTableRepFactory { public: explicit HashSpdbRepFactory(size_t hash_bucket_count = 1000000) { options_.hash_bucket_count = hash_bucket_count; - options_.use_seek_parallel_threshold = false; - - if (hash_bucket_count == 0) { - options_.use_seek_parallel_threshold = true; - options_.hash_bucket_count = 1000000; - } RegisterOptions(&options_, &hash_spdb_factory_info); } @@ -597,9 +580,7 @@ class HashSpdbRepFactory : public MemTableRepFactory { // HashSpdbRepFactory MemTableRep* HashSpdbRepFactory::PreCreateMemTableRep() { - MemTableRep* hash_spdb = - new HashSpdbRep(nullptr, options_.hash_bucket_count, - options_.use_seek_parallel_threshold); + MemTableRep* hash_spdb = new HashSpdbRep(nullptr, options_.hash_bucket_count); return hash_spdb; } @@ -613,8 +594,7 @@ void HashSpdbRepFactory::PostCreateMemTableRep( MemTableRep* HashSpdbRepFactory::CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, const SliceTransform* /*transform*/, Logger* /*logger*/) { - return new HashSpdbRep(compare, allocator, options_.hash_bucket_count, - options_.use_seek_parallel_threshold); + return new HashSpdbRep(compare, allocator, options_.hash_bucket_count); } MemTableRepFactory* NewHashSpdbRepFactory(size_t bucket_count) { diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 58c28921f2..789d68095b 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1863,8 +1863,6 @@ DEFINE_bool(multiread_batched, false, "Use the new MultiGet API"); DEFINE_string(memtablerep, "hash_spdb", ""); DEFINE_int64(hash_bucket_count, 1000000, "hash bucket count"); -DEFINE_bool(use_seek_parralel_threshold, true, - "if use seek parralel threshold ."); 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"); @@ -1969,7 +1967,7 @@ static Status CreateMemTableRepFactory( } else if (!strcasecmp(FLAGS_memtablerep.c_str(), "hash_linkedlist")) { factory->reset(NewHashLinkListRepFactory(FLAGS_hash_bucket_count)); } else if (!strcasecmp(FLAGS_memtablerep.c_str(), "hash_spdb")) { - factory->reset(NewHashSpdbRepFactory(0)); + factory->reset(NewHashSpdbRepFactory(FLAGS_hash_bucket_count)); } return s; }