Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Subject: Re: [PATCH v4 4/4] box: introduce functional indexes
Date: Wed, 24 Jul 2019 23:44:59 +0300	[thread overview]
Message-ID: <20190724204459.GA11089@atlas> (raw)
In-Reply-To: <e244e92d21226c8a869d9d87987ccc9cf21af803.1563953154.git.kshcherbatov@tarantool.org>

* Kirill Shcherbatov <kshcherbatov@tarantool.org> [19/07/24 10:38]:
> index f98a77a51..c36b6643e 100644
> --- a/src/box/alter.cc
> +++ b/src/box/alter.cc
> @@ -45,6 +45,7 @@
>  #include "fiber.h" /* for gc_pool */
>  #include "scoped_guard.h"
>  #include "third_party/base64.h"
> +#include "memtx_engine.h"
>  #include <new> /* for placement new */
>  #include <stdio.h> /* snprintf() */
>  #include <ctype.h>
> @@ -195,7 +196,7 @@ err:
>   */
>  static void
>  index_opts_decode(struct index_opts *opts, const char *map,
> -		  struct region *region)
> +		  struct space *space, struct region *region)
>  {
>  	index_opts_create(opts);
>  	if (opts_decode(opts, index_opts_reg, &map, ER_WRONG_INDEX_OPTIONS,
> @@ -229,6 +230,22 @@ index_opts_decode(struct index_opts *opts, const char *map,
>  			  "bloom_fpr must be greater than 0 and "
>  			  "less than or equal to 1");
>  	}
> +	/**
> +	 * Can't verify functional index function
> +	 * reference on load because the function object
> +	 * had not been registered in Tarantool yet.
> +	 */
> +	struct memtx_engine *engine = (struct memtx_engine *)space->engine;
> +	if (engine->state == MEMTX_OK && opts->functional_fid > 0) {
> +		struct func *func = func_cache_find(opts->functional_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 constraints");
> +		}
> +	}

this part is obviously incorrect. alter should not depend on
memtx_engine. And you don't need it at all. Please verify 
key parts inside the trigger on _func_index space, then you don't
need to check for recovery state.


-- 
Konstantin Osipov, Moscow, Russia

  parent reply	other threads:[~2019-07-24 20:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24  7:36 [PATCH v4 0/4] box: " Kirill Shcherbatov
2019-07-24  7:36 ` [PATCH v4 1/4] box: introduce tuple_chunk infrastructure Kirill Shcherbatov
2019-07-24  7:36 ` [PATCH v4 2/4] box: generalize memtx_multikey_tree methods Kirill Shcherbatov
2019-07-24 19:24   ` Konstantin Osipov
2019-07-24  7:36 ` [PATCH v4 3/4] box: refactor memtx_tree_delete_identical Kirill Shcherbatov
2019-07-24 19:24   ` Konstantin Osipov
2019-07-24  7:36 ` [PATCH v4 4/4] box: introduce functional indexes Kirill Shcherbatov
2019-07-24 12:24   ` [tarantool-patches] " Kirill Shcherbatov
2019-07-24 19:41   ` Konstantin Osipov
2019-07-24 20:04   ` Konstantin Osipov
2019-07-24 20:22   ` Konstantin Osipov
2019-07-25 11:20     ` [tarantool-patches] " Kirill Shcherbatov
2019-07-24 20:44   ` Konstantin Osipov [this message]
2019-07-25 11:22     ` Kirill Shcherbatov
2019-07-24 21:07   ` Konstantin Osipov
2019-07-25  8:27     ` [tarantool-patches] " Kirill Shcherbatov
2019-07-25  8:40       ` Konstantin Osipov
2019-07-25 11:18         ` Kirill Shcherbatov
2019-07-24 21:17   ` Konstantin Osipov
2019-07-24 21:56   ` Konstantin Osipov
2019-07-25  8:33     ` [tarantool-patches] " Kirill Shcherbatov
2019-07-24 12:25 ` [tarantool-patches] [PATCH v4 4/5] box: fix memtx_tree_index_build_array_deduplicate Kirill Shcherbatov

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=20190724204459.GA11089@atlas \
    --to=kostja@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v4 4/4] box: introduce functional indexes' \
    /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