Skip to content

Commit

Permalink
570: fix HashSpdRepFactory options compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
ayulas committed Jul 10, 2023
1 parent fccd441 commit 96f85a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
40 changes: 20 additions & 20 deletions plugin/speedb/memtable/hash_spd_rep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,35 +543,35 @@ 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",
{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*/}},
};
} // 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(
"insert name here",
/*should replace with stuct like HashSkipListRepOptions*/ &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 @@ -585,8 +585,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

0 comments on commit 96f85a9

Please sign in to comment.