From 62ddcb5a2267397b514144645306def530feb739 Mon Sep 17 00:00:00 2001 From: zncleon Date: Mon, 18 Sep 2023 15:57:39 +0800 Subject: [PATCH] Fix conflicts --- src/types/bloom_filter.cc | 6 +----- src/types/bloom_filter.h | 3 --- src/types/redis_bloom_chain.cc | 6 ++---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/types/bloom_filter.cc b/src/types/bloom_filter.cc index 263358fc2f0..94246161991 100644 --- a/src/types/bloom_filter.cc +++ b/src/types/bloom_filter.cc @@ -61,7 +61,7 @@ StatusOr CreateBlockSplitBloomFilter(std::string& bitset) bool BlockSplitBloomFilter::FindHash(uint64_t hash) const { const auto bucket_index = static_cast(((hash >> 32) * (data_.size() / kBytesPerFilterBlock)) >> 32); const auto key = static_cast(hash); - const auto* bitset32 = reinterpret_cast(data_view_.data()); + const auto* bitset32 = reinterpret_cast(data_.data()); for (int i = 0; i < kBitsSetPerBlock; ++i) { // Calculate mask for key in the given bitset. @@ -83,10 +83,6 @@ void BlockSplitBloomFilter::InsertHash(uint64_t hash) { const uint32_t mask = UINT32_C(0x1) << ((key * SALT[i]) >> 27); bitset32[bucket_index * kBitsSetPerBlock + i] |= mask; } - data_view_ = data_; } uint64_t BlockSplitBloomFilter::Hash(const char* data, size_t length) { return XXH64(data, length, /*seed=*/0); } - -BlockSplitBloomFilter::BlockSplitBloomFilter(const std::string& bitset) - : data_view_(bitset), num_bytes_(bitset.size()) {} diff --git a/src/types/bloom_filter.h b/src/types/bloom_filter.h index be28ac79870..18c97251417 100644 --- a/src/types/bloom_filter.h +++ b/src/types/bloom_filter.h @@ -171,9 +171,6 @@ class BlockSplitBloomFilter { static uint64_t Hash(const char* data, size_t length); private: - // The private constructor of BlockSplitBloomFilter. It's only used for CreateReadOnlyBloomFilter - explicit BlockSplitBloomFilter(const std::string& bitset); - // Bytes in a tiny Bloom filter block. static constexpr int kBytesPerFilterBlock = 32; diff --git a/src/types/redis_bloom_chain.cc b/src/types/redis_bloom_chain.cc index 05aa48e5b72..05e43bbfc05 100644 --- a/src/types/redis_bloom_chain.cc +++ b/src/types/redis_bloom_chain.cc @@ -108,13 +108,11 @@ void BloomChain::bloomAdd(const Slice &item, std::string *bf_data) { block_split_bloom_filter.InsertHash(h); } - bool BloomChain::bloomCheck(const Slice &item, std::string &bf_data) { - std::unique_ptr bloom_filter_read_only = - BlockSplitBloomFilter::CreateReadOnlyBloomFilter(bf_data); + BlockSplitBloomFilter block_split_bloom_filter(bf_data); uint64_t h = BlockSplitBloomFilter::Hash(item.data(), item.size()); - return bloom_filter_read_only->FindHash(h); + return block_split_bloom_filter.FindHash(h); } rocksdb::Status BloomChain::Reserve(const Slice &user_key, uint32_t capacity, double error_rate, uint16_t expansion) {