Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH v1 1/1] box: make functional index creation transactional
Date: Tue, 6 Aug 2019 16:19:52 +0300	[thread overview]
Message-ID: <20190806131952.GB4242@esperanza> (raw)
In-Reply-To: <103f6c68-bf55-8459-bcc1-8ec6ccc2d475@tarantool.org>

The patch is good, just a nit pick below.

On Mon, Aug 05, 2019 at 06:38:51PM +0300, Kirill Shcherbatov wrote:
> diff --git a/src/box/alter.cc b/src/box/alter.cc
> index 92f1d5b22..de778eefd 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -4725,12 +4763,11 @@ on_replace_dd_func_index(struct trigger *trigger, void *event)
>  		space = space_cache_find_xc(space_id);
>  		index = index_find_xc(space, index_id);
>  		func = func_cache_find(fid);
> -		if (func->def->language != FUNC_LANGUAGE_LUA ||
> -		    func->def->body == NULL || !func->def->is_deterministic ||
> -		    !func->def->is_sandboxed) {
> -			tnt_raise(ClientError, ER_WRONG_INDEX_OPTIONS, 0,
> -				  "referenced function doesn't satisfy "
> -				  "functional index function constraints");
> +		func_index_check_func(func);
> +		if (index->def->opts.func_id != func->def->fid) {
> +			tnt_raise(ClientError, ER_FUNC_INDEX_PARTS,
> +				  "functional index function id doesn't match "
> +				  "the fid defined in index");

Why ER_FUNC_INDEX_PARTS? Why not ER_WRONG_INDEX_OPTIONS like in
the error right above? BTW passing 0 to ER_WRONG_INDEX_OPTIONS looks
confusing.

Also, using "function id" and "fid" in the same error message looks ugly.
Please rephrase it. Something like this maybe:

  "Function ids defined in _index and _func_index don't match"

Also, please add a test case covering this particular error.

  reply	other threads:[~2019-08-06 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02 13:05 Kirill Shcherbatov
2019-08-05 10:20 ` Vladimir Davydov
2019-08-05 15:38   ` [tarantool-patches] " Kirill Shcherbatov
2019-08-06 13:19     ` Vladimir Davydov [this message]
2019-08-06 14:21       ` Kirill Shcherbatov
2019-08-06 14:42         ` 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=20190806131952.GB4242@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH v1 1/1] box: make functional index creation transactional' \
    /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