Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

570 spdb memtable use seek parralel threshold mishandled #603

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Also switch to waiting a sec on the CV each time. This is required since a bg er
* db_bench: Create a WBM once for all db-s regardless of their use in different groups (#550)
* Tompstone unit test faiure (#560)
* build: Remove unused variables in unit tests (#581)
* Spdb memtable use seek parralel threshold option parameter mishandled (#570)

### Miscellaneous
* disable failing unit tests and paired bloom filter stress testing
Expand Down
38 changes: 21 additions & 17 deletions plugin/speedb/memtable/hash_spd_rep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,32 +543,36 @@ MemTableRep::Iterator* HashSpdRep::GetIterator(Arena* arena) {
}
}

static std::unordered_map<std::string, OptionTypeInfo> hash_spd_factory_info = {

{"hash_bucket_count",
{0, OptionType::kSizeT, OptionVerificationType::kNormal,
OptionTypeFlags::kDontSerialize /*Since it is part of the ID*/}},
{"use_seek_parralel_threshold",
{0, OptionType::kBoolean, OptionVerificationType::kNormal,
OptionTypeFlags::kDontSerialize /*Since it is part of the ID*/}},
static std::unordered_map<std::string, OptionTypeInfo> hash_spdb_factory_info =
{
{"hash_bucket_count",
{offsetof(struct HashSpdbRepOptions, hash_bucket_count),
OptionType::kSizeT, OptionVerificationType::kNormal,
OptionTypeFlags::kNone}},
{"use_seek_parralel_threshold",
Yuval-Ariel marked this conversation as resolved.
Show resolved Hide resolved
{offsetof(struct HashSpdbRepOptions, use_seek_parralel_threshold),
OptionType::kBoolean, OptionVerificationType::kNormal,
OptionTypeFlags::kNone}},
};
} // namespace

// HashSpdRepFactory

HashSpdRepFactory::HashSpdRepFactory(size_t hash_bucket_count)
: bucket_count_(hash_bucket_count), use_seek_parralel_threshold_(false) {
HashSpdRepFactory::HashSpdRepFactory(size_t hash_bucket_count) {
options_.hash_bucket_count = hash_bucket_count;
options_.use_seek_parralel_threshold = false;

if (hash_bucket_count == 0) {
use_seek_parralel_threshold_ = true;
bucket_count_ = 1000000;
options_.use_seek_parralel_threshold = true;
options_.hash_bucket_count = 1000000;
}
RegisterOptions("", &bucket_count_, &hash_spd_factory_info);
RegisterOptions(&options_, &hash_spdb_factory_info);
Init();
}

MemTableRep* HashSpdRepFactory::PreCreateMemTableRep() {
MemTableRep* hash_spd =
new HashSpdRep(nullptr, bucket_count_, use_seek_parralel_threshold_);
MemTableRep* hash_spd = new HashSpdRep(nullptr, options_.hash_bucket_count,
options_.use_seek_parralel_threshold);
return hash_spd;
}

Expand All @@ -582,8 +586,8 @@ void HashSpdRepFactory::PostCreateMemTableRep(
MemTableRep* HashSpdRepFactory::CreateMemTableRep(
const MemTableRep::KeyComparator& compare, Allocator* allocator,
const SliceTransform* /*transform*/, Logger* /*logger*/) {
return new HashSpdRep(compare, allocator, bucket_count_,
use_seek_parralel_threshold_);
return new HashSpdRep(compare, allocator, options_.hash_bucket_count,
options_.use_seek_parralel_threshold);
}

} // namespace ROCKSDB_NAMESPACE
11 changes: 8 additions & 3 deletions plugin/speedb/memtable/hash_spd_rep.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@

namespace ROCKSDB_NAMESPACE {

struct HashSpdbRepOptions {
static const char* kName() { return "HashSpdbRepOptions"; }
size_t hash_bucket_count;
bool use_seek_parralel_threshold;
};

class HashSpdRepFactory : public MemTableRepFactory {
public:
explicit HashSpdRepFactory(size_t bucket_count = 1000000);
explicit HashSpdRepFactory(size_t hash_bucket_count = 1000000);

using MemTableRepFactory::CreateMemTableRep;
MemTableRep* CreateMemTableRep(const MemTableRep::KeyComparator& compare,
Expand All @@ -44,8 +50,7 @@ class HashSpdRepFactory : public MemTableRepFactory {
const char* Name() const override { return kClassName(); }

private:
size_t bucket_count_;
bool use_seek_parralel_threshold_ = false;
HashSpdbRepOptions options_;
};

} // namespace ROCKSDB_NAMESPACE