mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-28 20:27:03 +00:00
bloom_filter: fix index calculation to work on int, not uint
Java uses long, so we should use int64_t. Using uint64_t causes the wrong indexes to be calculated, and therefore, the filter to respond incorrectly to a given key. Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
committed by
Tomasz Grabiec
parent
601bb48fe7
commit
ba60176d4d
@@ -36,7 +36,7 @@ namespace utils {
|
||||
namespace filter {
|
||||
static thread_local auto reusable_indexes = std::vector<long>();
|
||||
|
||||
void bloom_filter::set_indexes(uint64_t base, uint64_t inc, int count, long max, std::vector<long>& results) {
|
||||
void bloom_filter::set_indexes(int64_t base, int64_t inc, int count, long max, std::vector<long>& results) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
results[i] = abs(base % max);
|
||||
base += inc;
|
||||
|
||||
@@ -43,7 +43,7 @@ private:
|
||||
bitmap _bitset;
|
||||
int _hash_count;
|
||||
|
||||
void set_indexes(uint64_t base, uint64_t inc, int count, long max, std::vector<long>& results);
|
||||
void set_indexes(int64_t base, int64_t inc, int count, long max, std::vector<long>& results);
|
||||
std::vector<long> get_hash_buckets(const bytes_view& key, int hash_count, long max);
|
||||
std::vector<long> indexes(const bytes_view& key);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user