[PATCH v2 2/5] bloom: rename bloom_possible_has to bloom_maybe_has

Vladimir Davydov vdavydov.dev at gmail.com
Wed Mar 28 22:04:58 MSK 2018


Suggested by @kostja
---
 src/box/vy_run.c      |  2 +-
 src/lib/salad/bloom.h |  4 ++--
 test/unit/bloom.cc    | 12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/box/vy_run.c b/src/box/vy_run.c
index 7f792c13..c62962bc 100644
--- a/src/box/vy_run.c
+++ b/src/box/vy_run.c
@@ -1263,7 +1263,7 @@ vy_run_iterator_do_seek(struct vy_run_iterator *itr,
 		} else {
 			hash = tuple_hash(key, key_def);
 		}
-		if (!bloom_possible_has(&run->info.bloom, hash)) {
+		if (!bloom_maybe_has(&run->info.bloom, hash)) {
 			itr->search_ended = true;
 			itr->stat->bloom_hit++;
 			return 0;
diff --git a/src/lib/salad/bloom.h b/src/lib/salad/bloom.h
index e28ca5f3..1e3221f8 100644
--- a/src/lib/salad/bloom.h
+++ b/src/lib/salad/bloom.h
@@ -123,7 +123,7 @@ bloom_add(struct bloom *bloom, bloom_hash_t hash);
  *
  */
 static bool
-bloom_possible_has(const struct bloom *bloom, bloom_hash_t hash);
+bloom_maybe_has(const struct bloom *bloom, bloom_hash_t hash);
 
 /**
  * Calculate size of a buffer that is needed for storing bloom table
@@ -233,7 +233,7 @@ bloom_add(struct bloom *bloom, bloom_hash_t hash)
 }
 
 static inline bool
-bloom_possible_has(const struct bloom *bloom, bloom_hash_t hash)
+bloom_maybe_has(const struct bloom *bloom, bloom_hash_t hash)
 {
 	/* Using lower part of the has for finding a block */
 	bloom_hash_t pos = hash % bloom->table_size;
diff --git a/test/unit/bloom.cc b/test/unit/bloom.cc
index e78ab73e..ac5796ac 100644
--- a/test/unit/bloom.cc
+++ b/test/unit/bloom.cc
@@ -34,7 +34,7 @@ simple_test()
 			for (uint32_t i = 0; i < count * 10; i++) {
 				bool has = check.find(i) != check.end();
 				bool bloom_possible =
-					bloom_possible_has(&bloom, h(i));
+					bloom_maybe_has(&bloom, h(i));
 				tests++;
 				if (has && !bloom_possible)
 					error_count++;
@@ -83,7 +83,7 @@ store_load_test()
 			for (uint32_t i = 0; i < count * 10; i++) {
 				bool has = check.find(i) != check.end();
 				bool bloom_possible =
-					bloom_possible_has(&test, h(i));
+					bloom_maybe_has(&test, h(i));
 				tests++;
 				if (has && !bloom_possible)
 					error_count++;
@@ -124,11 +124,11 @@ spectrum_test()
 	uint64_t false_positive = 0;
 	uint64_t error_count = 0;
 	for (uint32_t i = 0; i < count; i++) {
-		if (!bloom_possible_has(&bloom, h(i)))
+		if (!bloom_maybe_has(&bloom, h(i)))
 			error_count++;
 	}
 	for (uint32_t i = count; i < 2 * count; i++) {
-		if (bloom_possible_has(&bloom, h(i)))
+		if (bloom_maybe_has(&bloom, h(i)))
 			false_positive++;
 	}
 	bool fpr_rate_is_good = false_positive < 1.5 * p * count;
@@ -148,11 +148,11 @@ spectrum_test()
 	false_positive = 0;
 	error_count = 0;
 	for (uint32_t i = 0; i < count; i++) {
-		if (!bloom_possible_has(&bloom, h(i)))
+		if (!bloom_maybe_has(&bloom, h(i)))
 			error_count++;
 	}
 	for (uint32_t i = count; i < 2 * count; i++) {
-		if (bloom_possible_has(&bloom, h(i)))
+		if (bloom_maybe_has(&bloom, h(i)))
 			false_positive++;
 	}
 	fpr_rate_is_good = false_positive < 1.5 * p * count;
-- 
2.11.0




More information about the Tarantool-patches mailing list