Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ inode_vptrs
*.txt
__pycache__/
*.csv
debug.*

include/csv2/
debug.*
6 changes: 3 additions & 3 deletions include/rocksdb/filter_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class FilterBitsBuilder {
// Generate the filter using the keys that are added, and the specified hash
// function id. The return value of this function would be the filter bits, The
// ownership of actual data is set to buf (WaLSM+)
virtual Slice Finish(std::unique_ptr<const char[]>* buf, const int /* filter_id */) {
virtual Slice FinishWithId(std::unique_ptr<const char[]>* buf, const int /* filter_id */) {
buf->reset();
fprintf(stderr, "error call FilterBitsBuilder::Finish(buf, filter_id)\n");
exit(1);
Expand Down Expand Up @@ -105,14 +105,14 @@ class FilterBitsReader {

#ifdef ART_PLUS
// Check if the entry match the bits in filter using the specified hash function (WaLSM+)
virtual bool MayMatch(const Slice& /* entry */, const int /* hash_id */) {
virtual bool MayMatchWithId(const Slice& /* entry */, const int /* hash_id */) {
fprintf(stderr, "Error call FilterBitsReader::MayMatch(entry, hash_id)");
exit(1);
return true;
}

// Check if an array of entries match the bits in filter using the specified hash function (WaLSM+)
virtual void MayMatch(int /* num_keys */, Slice** /* keys */, bool* /* may_match */, const int /* hash_id */) {
virtual void MayMatchWithId(int /* num_keys */, Slice** /* keys */, bool* /* may_match */, const int /* hash_id */) {
fprintf(stderr, "Error call FilterBitsReader::MayMatch(num_keys, keys, may_match, hash_id)");
exit(1);
}
Expand Down
8 changes: 4 additions & 4 deletions table/block_based/filter_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class MultiLegacyBloomBitsBuilder : public FilterBitsBuilder {

virtual void AddKey(const Slice& key) override;
virtual Slice Finish(std::unique_ptr<const char[]>* buf) override;
virtual Slice Finish(std::unique_ptr<const char[]>* buf,
virtual Slice FinishWithId(std::unique_ptr<const char[]>* buf,
const int hash_id) override;

private:
Expand Down Expand Up @@ -612,7 +612,7 @@ Slice MultiLegacyBloomBitsBuilder::Finish(std::unique_ptr<const char[]>* buf) {
return Slice();
}

Slice MultiLegacyBloomBitsBuilder::Finish(std::unique_ptr<const char[]>* buf,
Slice MultiLegacyBloomBitsBuilder::FinishWithId(std::unique_ptr<const char[]>* buf,
int hash_id) {
return bits_builders_[hash_id]->Finish(buf);
}
Expand Down Expand Up @@ -673,7 +673,7 @@ class LegacyBloomBitsReader : public FilterBitsReader {
// passed to FilterBitsBuilder::AddKey. This method may return true or false
// if the key was not on the list, but it should aim to return false with a
// high probability. (WaLSM+)
bool MayMatch(const Slice& key, const int hash_id) override {
bool MayMatchWithId(const Slice& key, const int hash_id) override {
uint32_t hash = BloomHashId(key, hash_id);
uint32_t byte_offset;
LegacyBloomImpl::PrepareHashMayMatch(
Expand All @@ -683,7 +683,7 @@ class LegacyBloomBitsReader : public FilterBitsReader {
}

// check whether keys is in filter array (WaLSM+)
virtual void MayMatch(int num_keys, Slice** keys, bool* may_match, const int hash_id) override {
virtual void MayMatchWithId(int num_keys, Slice** keys, bool* may_match, const int hash_id) override {
std::array<uint32_t, MultiGetContext::MAX_BATCH_SIZE> hashes;
std::array<uint32_t, MultiGetContext::MAX_BATCH_SIZE> byte_offsets;
for (int i = 0; i < num_keys; ++i) {
Expand Down
4 changes: 2 additions & 2 deletions table/block_based/full_filter_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ bool FullFilterBlockReader::MayMatch(
filter_block.GetValue()->filter_bits_reader();

if (filter_bits_reader) {
if (filter_bits_reader->MayMatch(entry, hash_id)) {
if (filter_bits_reader->MayMatchWithId(entry, hash_id)) {
PERF_COUNTER_ADD(bloom_sst_hit_count, 1);
return true;
} else {
Expand Down Expand Up @@ -322,7 +322,7 @@ void FullFilterBlockReader::MayMatch(
}

#ifdef ART_PLUS
filter_bits_reader->MayMatch(num_keys, &keys[0], &may_match[0], hash_id);
filter_bits_reader->MayMatchWithId(num_keys, &keys[0], &may_match[0], hash_id);
#else
filter_bits_reader->MayMatch(num_keys, &keys[0], &may_match[0]);
#endif
Expand Down
4 changes: 2 additions & 2 deletions table/block_based/partitioned_filter_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void PartitionedFilterBlockBuilder::MaybeCutAFilterBlock(
#ifdef ART_PLUS
for (int i = 0; i < filter_count_; ++i) {
filter_gc[i].push_back(std::unique_ptr<const char[]>(nullptr));
Slice filter = filter_bits_builder_->Finish(&filter_gc[i].back(), i);
Slice filter = filter_bits_builder_->FinishWithId(&filter_gc[i].back(), i);
std::string& index_key = p_index_builder_->GetPartitionKey();
filters[i].push_back({index_key, filter, segment_id_base_.fetch_add(1, std::memory_order_relaxed)});
}
Expand Down Expand Up @@ -646,7 +646,7 @@ Slice generate_modified_internal_key(std::unique_ptr<const char[]>& buf, Slice o
EncodeFixed32R(modified_key_buf, filter_index);
std::memcpy(modified_key_buf + 4, original_user_key.data(), original_user_key.size());
EncodeFixed32R(modified_key_buf + 4 + original_user_key.size(), segment_id);
std::memcpy(modified_key_buf + 4 + original_user_key.size() + 4, original_user_key.data_, original_user_key.size());
std::memcpy(modified_key_buf + 4 + original_user_key.size() + 4, original_internal_bytes.data_, original_internal_bytes.size());
Slice modified_key = Slice(modified_key_buf, modified_key_buf_size);

buf.reset(modified_key_buf);
Expand Down