@@ -31,9 +31,6 @@ 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-
3734namespace openmldb {
3835namespace storage {
3936
@@ -392,13 +389,13 @@ bool DiskTable::Get(uint32_t idx, const std::string& pk, uint64_t ts, std::strin
392389bool DiskTable::Get (const std::string& pk, uint64_t ts, std::string& value) { return Get (0 , pk, ts, value); }
393390
394391void DiskTable::SchedGc () {
395- ClearRecord ();
392+ ResetRecordCnt ();
396393 GcHead ();
397394 GcTTL ();
398395 UpdateTTL ();
399396}
400397
401- void DiskTable::ClearRecord () {
398+ void DiskTable::ResetRecordCnt () {
402399 auto indexs = table_index_.GetAllIndex ();
403400 for (const auto & index : indexs) {
404401 idx_cnt_vec_[index->GetId ()]->store (0 , std::memory_order_relaxed);
@@ -426,7 +423,7 @@ void DiskTable::GcHead() {
426423 if (indexs.size () > 1 ) {
427424 std::map<uint32_t , uint64_t > ttl_map;
428425 std::map<uint32_t , uint32_t > idx_map;
429- std::set<uint32_t > other_TTL_set ;
426+ std::set<uint32_t > other_ttl_set ;
430427 for (const auto & index : indexs) {
431428 auto ts_col = index->GetTsColumn ();
432429 if (ts_col) {
@@ -436,7 +433,7 @@ void DiskTable::GcHead() {
436433 }
437434 auto TTL_type = index->GetTTLType ();
438435 if (TTL_type != openmldb::storage::TTLType::kLatestTime ) {
439- other_TTL_set .insert (ts_col->GetId ());
436+ other_ttl_set .insert (ts_col->GetId ());
440437 }
441438 idx_map.emplace (ts_col->GetId (), index->GetId ());
442439 }
@@ -449,7 +446,7 @@ void DiskTable::GcHead() {
449446 uint64_t ts = 0 ;
450447 uint32_t ts_idx = 0 ;
451448 ParseKeyAndTs (true , it->key (), cur_pk, ts, ts_idx);
452- if (other_TTL_set .find (ts_idx) != other_TTL_set .end ()) {
449+ if (other_ttl_set .find (ts_idx) != other_ttl_set .end ()) {
453450 it->Next ();
454451 continue ;
455452 }
@@ -1335,7 +1332,7 @@ int DiskTable::GetCount(uint32_t index, const std::string& pk, uint64_t& count)
13351332 return 0 ;
13361333}
13371334
1338- uint32_t BloomFilter::hash (const char * str, uint32_t seed) {
1335+ uint32_t BloomFilter::Hash (const char * str, uint32_t seed) {
13391336 uint a = 63689 ;
13401337 uint hash = 0 ;
13411338
@@ -1347,31 +1344,31 @@ uint32_t BloomFilter::hash(const char* str, uint32_t seed) {
13471344 return (hash & 0x7FFFFFFF );
13481345}
13491346
1350- void BloomFilter::setBit (uint32_t bit) {
1347+ void BloomFilter::SetBit (uint32_t bit) {
13511348 uint32_t bits_num = bit / 64 ;
13521349 uint32_t bits_left = bit % 64 ;
13531350
13541351 bits_[bits_num]->fetch_or ((uint64_t )1 << bits_left, std::memory_order_relaxed);
13551352}
13561353
1357- bool BloomFilter::getBit (uint32_t bit) {
1354+ bool BloomFilter::GetBit (uint32_t bit) {
13581355 uint32_t bits_num = bit / 64 ;
13591356 uint32_t bits_left = bit % 64 ;
13601357
13611358 return (bits_[bits_num]->load (std::memory_order_relaxed) >> bits_left) & 1 ;
13621359}
13631360
13641361void BloomFilter::Set (const char * str) {
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 ;
1367- setBit (p);
1362+ for (uint32_t i = 0 ; i < FLAGS_disk_stat_bloom_filter_hash_seed ; ++i) {
1363+ uint32_t p = Hash (str, base_[i]) % FLAGS_disk_stat_bloom_filter_bitset_size ;
1364+ SetBit (p);
13681365 }
13691366}
13701367
13711368bool BloomFilter::Valid (const char * str) {
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 ;
1374- if (!getBit (p)) {
1369+ for (uint32_t i = 0 ; i < FLAGS_disk_stat_bloom_filter_hash_seed ; ++i) {
1370+ uint32_t p = Hash (str, base_[i]) % FLAGS_disk_stat_bloom_filter_bitset_size ;
1371+ if (!GetBit (p)) {
13751372 return false ;
13761373 }
13771374 }
0 commit comments