From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@dev.tarantool.org, alexander.turenko@tarantool.org, korablev@tarantool.org Subject: [Tarantool-patches] [PATCH 2/3] box: forbid to update/replace _space_sequence Date: Mon, 17 Feb 2020 21:57:21 +0100 [thread overview] Message-ID: <79a6254a868ee44517921a0c89af29d44dd2c4b8.1581972845.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1581972845.git.v.shpilevoy@tarantool.org> Anyway this does not work for generated sequences. A proper support of update would complicate the code and won't give anything useful. Part of #4771 --- src/box/alter.cc | 8 ++++++-- test/box/sequence.result | 19 +++++++++++++++++++ test/box/sequence.test.lua | 9 +++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/box/alter.cc b/src/box/alter.cc index 64af71c61..50121c79c 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -4713,9 +4713,13 @@ on_replace_dd_space_sequence(struct trigger * /* trigger */, void *event) return -1; } + if ((stmt->new_tuple != NULL) == (stmt->old_tuple != NULL)) { + diag_set(ClientError, ER_UNSUPPORTED, + "space \"_space_sequence\"", "update"); + return -1; + } + enum priv_type priv_type = stmt->new_tuple ? PRIV_C : PRIV_D; - if (stmt->new_tuple && stmt->old_tuple) - priv_type = PRIV_A; /* Check we have the correct access type on the sequence. * */ if (is_generated || !stmt->new_tuple) { diff --git a/test/box/sequence.result b/test/box/sequence.result index 917952909..0a6cfee2c 100644 --- a/test/box/sequence.result +++ b/test/box/sequence.result @@ -2270,3 +2270,22 @@ sq:next() -- 2 sq:drop() --- ... +-- +-- Update on _space_sequence is forbidden. +-- +s = box.schema.create_space('test') +--- +... +pk = s:create_index('pk', {sequence = true}) +--- +... +t = box.space._space_sequence:get({s.id}) +--- +... +box.space._space_sequence:update({s.id}, {{'=', 2, t[2]}}) +--- +- error: space "_space_sequence" does not support update +... +s:drop() +--- +... diff --git a/test/box/sequence.test.lua b/test/box/sequence.test.lua index b0ec020ed..8e00571e5 100644 --- a/test/box/sequence.test.lua +++ b/test/box/sequence.test.lua @@ -771,3 +771,12 @@ sq:next() -- 1 box.begin() box.space._sequence_data:delete{sq.id} box.rollback() sq:next() -- 2 sq:drop() + +-- +-- Update on _space_sequence is forbidden. +-- +s = box.schema.create_space('test') +pk = s:create_index('pk', {sequence = true}) +t = box.space._space_sequence:get({s.id}) +box.space._space_sequence:update({s.id}, {{'=', 2, t[2]}}) +s:drop() -- 2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-02-17 20:57 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-17 20:57 [Tarantool-patches] [PATCH 0/3] Fix upgrade from 2.1 sequence Vladislav Shpilevoy 2020-02-17 20:57 ` [Tarantool-patches] [PATCH 1/3] upgrade: add missing sys triggers off and erasure Vladislav Shpilevoy 2020-02-21 15:20 ` Nikita Pettik 2020-02-22 16:17 ` Vladislav Shpilevoy 2020-02-17 20:57 ` Vladislav Shpilevoy [this message] 2020-02-21 15:29 ` [Tarantool-patches] [PATCH 2/3] box: forbid to update/replace _space_sequence Nikita Pettik 2020-02-22 16:16 ` Vladislav Shpilevoy 2020-02-17 20:57 ` [Tarantool-patches] [PATCH 3/3] upgrade: fix generated sequence upgrade from 2.1 Vladislav Shpilevoy 2020-02-21 15:42 ` Nikita Pettik 2020-02-22 16:16 ` Vladislav Shpilevoy 2020-02-24 19:48 ` [Tarantool-patches] [PATCH 0/3] Fix upgrade from 2.1 sequence 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=79a6254a868ee44517921a0c89af29d44dd2c4b8.1581972845.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/3] box: forbid to update/replace _space_sequence' \ /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