You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2023/09/13 06:28:05 UTC

[GitHub] [kvrocks] PragmaTwice commented on a diff in pull request #1756: Add the support of the BF.MEXISTS and BF.CARD Command

PragmaTwice commented on code in PR #1756:
URL: https://github.com/apache/kvrocks/pull/1756#discussion_r1324029642


##########
src/types/redis_bloom_chain.cc:
##########
@@ -105,9 +106,14 @@ rocksdb::Status BloomChain::bloomCheck(const Slice &bf_key, const std::string &i
   BlockSplitBloomFilter block_split_bloom_filter;
   block_split_bloom_filter.Init(std::move(bf_data));
 
-  uint64_t h = BlockSplitBloomFilter::Hash(item.data(), item.size());
-  *exist = block_split_bloom_filter.FindHash(h);
-
+  for (size_t i = 0; i < items.size(); ++i) {
+    // this item exists in other bloomfilter already, and it's not necessary to check in this bloomfilter.
+    if (exists->at(i)) {

Review Comment:
   `at` will throw exceptions, so you'd better to use `operator[]` here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org