@@ -31,6 +31,9 @@ DECLARE_uint32(write_buffer_mb);
3131DECLARE_uint32 (block_cache_shardbits);
3232DECLARE_bool (verify_compression);
3333
34+ DECLARE_uint32 (bloom_filter_bitset_size);
35+ DECLARE_uint32 (bloom_filter_hash_seed);
36+
3437namespace openmldb {
3538namespace storage {
3639
@@ -154,7 +157,7 @@ bool DiskTable::InitColumnFamilyDescriptor() {
154157 auto inner_indexs = table_index_.GetAllInnerIndex ();
155158 for (uint32_t i = 0 ; i < inner_indexs->size (); i++) {
156159 pk_cnt_vec_.push_back (std::make_shared<std::atomic<uint64_t >>(0 ));
157- bloom_filter_vec_.push_back (BloomFilter (1000 , 100 ));
160+ bloom_filter_vec_.push_back (BloomFilter ());
158161 }
159162 auto indexs = table_index_.GetAllIndex ();
160163 for (uint32_t i = 0 ; i < indexs.size (); i++) {
@@ -1359,15 +1362,15 @@ bool BloomFilter::getBit(uint32_t bit) {
13591362}
13601363
13611364void BloomFilter::Set (const char * str) {
1362- for (uint32_t i = 0 ; i < k_ ; ++i) {
1363- uint32_t p = hash (str, base_[i]) % bitset_size_ ;
1365+ for (uint32_t i = 0 ; i < FLAGS_bloom_filter_hash_seed ; ++i) {
1366+ uint32_t p = hash (str, base_[i]) % FLAGS_bloom_filter_bitset_size ;
13641367 setBit (p);
13651368 }
13661369}
13671370
13681371bool BloomFilter::Valid (const char * str) {
1369- for (uint32_t i = 0 ; i < k_ ; ++i) {
1370- uint32_t p = hash (str, base_[i]) % bitset_size_ ;
1372+ for (uint32_t i = 0 ; i < FLAGS_bloom_filter_hash_seed ; ++i) {
1373+ uint32_t p = hash (str, base_[i]) % FLAGS_bloom_filter_bitset_size ;
13711374 if (!getBit (p)) {
13721375 return false ;
13731376 }
0 commit comments