Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v2 2/5] bloom: rename bloom_possible_has to bloom_maybe_has
Date: Wed, 28 Mar 2018 22:04:58 +0300	[thread overview]
Message-ID: <3ab74d58d5adb5256b6e89853a67982cecc63ae9.1522262496.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1522262496.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1522262496.git.vdavydov.dev@gmail.com>

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

  parent reply	other threads:[~2018-03-28 19:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 19:04 [PATCH v2 0/5] vinyl: multi-part bloom filter Vladimir Davydov
2018-03-28 19:04 ` [PATCH v2 1/5] bloom: use malloc for bitmap allocations Vladimir Davydov
2018-03-28 19:04 ` Vladimir Davydov [this message]
2018-03-28 19:04 ` [PATCH v2 3/5] vinyl: introduce bloom filters for partial key lookups Vladimir Davydov
2018-03-28 19:05 ` [PATCH v2 4/5] bloom: optimize tuple bloom filter size Vladimir Davydov
2018-03-28 19:05 ` [PATCH v2 5/5] bloom: drop spectrum Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ab74d58d5adb5256b6e89853a67982cecc63ae9.1522262496.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 2/5] bloom: rename bloom_possible_has to bloom_maybe_has' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox