Tarantool development patches archive
 help / color / mirror / Atom feed
From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: Ilya Kosarev <i.kosarev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] rtree: add comments on ignored rtree_search() return value
Date: Thu, 3 Sep 2020 10:19:03 +0300	[thread overview]
Message-ID: <c2aabdf6-bf84-4b45-5143-13b3338913f2@tarantool.org> (raw)
In-Reply-To: <20200901162751.23037-1-i.kosarev@tarantool.org>

Hi, thanks for the patch, LGTM

On 01.09.2020 19:27, Ilya Kosarev wrote:
> rtree_search() has return value and it is ignored in some cases.
> Although it is totally fine it seems to be reasonable to comment those
> cases as far as such usage might be questionable.
>
> Closes #2052
> ---
> Branch: https://github.com/tarantool/tarantool/tree/i.kosarev/gh-2052-rtree_search()-result-ignored
> Issue: https://github.com/tarantool/tarantool/issues/2052
>
>   src/box/memtx_rtree.c       | 7 +++++++
>   test/unit/rtree_iterator.cc | 7 +++++++
>   2 files changed, 14 insertions(+)
>
> diff --git a/src/box/memtx_rtree.c b/src/box/memtx_rtree.c
> index 612fcb2a9f..6b8b0a2e17 100644
> --- a/src/box/memtx_rtree.c
> +++ b/src/box/memtx_rtree.c
> @@ -322,6 +322,13 @@ memtx_rtree_index_create_iterator(struct index *base,  enum iterator_type type,
>   	it->base.next = index_rtree_iterator_next;
>   	it->base.free = index_rtree_iterator_free;
>   	rtree_iterator_init(&it->impl);
> +	/*
> +	 * We don't care if rtree_search() does or does not find anything
> +	 * as far as we are fine anyway: iterator is initialized correctly
> +	 * and the case where nothing is found and rtree_iterator_next()
> +	 * returns NULL should be processed in the correct way on the
> +	 * caller's side.
> +	 */
>   	rtree_search(&index->tree, &rect, op, &it->impl);
>   	return (struct iterator *)it;
>   }
> diff --git a/test/unit/rtree_iterator.cc b/test/unit/rtree_iterator.cc
> index b3c8695e9d..641b659177 100644
> --- a/test/unit/rtree_iterator.cc
> +++ b/test/unit/rtree_iterator.cc
> @@ -274,6 +274,13 @@ iterator_invalidate_check()
>   			rtree_insert(&tree, &rect, record_t(i+1));
>   		}
>   		rtree_set2d(&rect, 0, 0, test_size, test_size);
> +		/*
> +		 * We don't care if rtree_search() does or does not find
> +		 * anything as far as we are fine anyway: iterator is
> +		 * initialized correctly and the case where nothing is found
> +		 * and rtree_iterator_next() returns NULL will be processed
> +		 * correctly as fail case in check #19.
> +		 */
>   		rtree_search(&tree, &rect, SOP_BELONGS, &iterators[0]);
>   		if (!rtree_iterator_next(&iterators[0])) {
>   			fail("Integrity check failed (19)", "false");

  reply	other threads:[~2020-09-03  7:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 16:27 Ilya Kosarev
2020-09-03  7:19 ` Aleksandr Lyapunov [this message]
2020-09-08 14:49 ` Kirill Yukhin

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=c2aabdf6-bf84-4b45-5143-13b3338913f2@tarantool.org \
    --to=alyapunov@tarantool.org \
    --cc=i.kosarev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] rtree: add comments on ignored rtree_search() return value' \
    /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