Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Cc: v.shpilevoy@tarantool.org
Subject: [Tarantool-patches] [PATCH] vinyl: fix comment to vy_read_iterator_cmp_stmt()
Date: Tue, 19 May 2020 04:38:10 +0300	[thread overview]
Message-ID: <874510a4f0283272fa4d090a381ec8379d98b3ee.1589852208.git.korablev@tarantool.org> (raw)

vy_read_iterator_cmp_stmt() uses tuple_compare_with_key() under the hood
which follows next convention:
(a) it returns 0 if key_fields of tuple equal to given key;
(b) < 0 if key_fields less than given key;
(c) > 0 otherwise.
However, comment to vy_read_iterator_cmp_stmt() says that:
(a) it returns -1 if first statement precedes second one;
(b) 0 if they at the same position;
(c) +1 if first statement supersedes second one.
so, since there's no "normalization" of return code from
tuple_compare_with_key() it would be correct to say that
vy_read_iterator_cmp_stmt() returns:
(a) it returns arbitrary integer value < 0 if first statement precedes
second one;
(b) 0 if they at the same position;
(c) arbitrary integer value > 0 if first statement supersedes second one.
---
 src/box/vy_read_iterator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/box/vy_read_iterator.c b/src/box/vy_read_iterator.c
index 9ea07709e..dcc9a0873 100644
--- a/src/box/vy_read_iterator.c
+++ b/src/box/vy_read_iterator.c
@@ -168,9 +168,9 @@ vy_read_iterator_range_is_done(struct vy_read_iterator *itr,
  * Compare two tuples from the read iterator perspective.
  *
  * Returns:
- *  -1 if statement @a precedes statement @b in the iterator output
- *   0 if statements @a and @b are at the same position
- *   1 if statement @a supersedes statement @b
+ *  < 0 if statement @a precedes statement @b in the iterator output
+ * == 0 if statements @a and @b are at the same position
+ *  > 0 if statement @a supersedes statement @b
  *
  * NULL denotes the statement following the last one.
  */
-- 
2.17.1

             reply	other threads:[~2020-05-19  1:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  1:38 Nikita Pettik [this message]
2020-05-19 23:38 ` Vladislav Shpilevoy
2020-05-20 20:40   ` Nikita Pettik

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=874510a4f0283272fa4d090a381ec8379d98b3ee.1589852208.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] vinyl: fix comment to vy_read_iterator_cmp_stmt()' \
    /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