From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 04BAB469719 for ; Sat, 29 Feb 2020 18:43:35 +0300 (MSK) References: <20200226161308.73170-1-k.sosnin@tarantool.org> From: Vladislav Shpilevoy Message-ID: <83fa4b26-3f6d-ce5c-56eb-4c2034004576@tarantool.org> Date: Sat, 29 Feb 2020 16:43:33 +0100 MIME-Version: 1.0 In-Reply-To: <20200226161308.73170-1-k.sosnin@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chris Sosnin , tarantool-patches@dev.tarantool.org, Kirill Yukhin LGTM. On 26/02/2020 17:13, Chris Sosnin wrote: > This code is called from C, so it shouldn't throw. > > Closes #4753 > --- > branch: https://github.com/tarantool/tarantool/tree/ksosnin/gh-4753-sequence-cpp-exception > issue: https://github.com/tarantool/tarantool/issues/4753 > > src/box/schema.cc | 2 +- > test/box/sequence.result | 17 +++++++++++++++++ > test/box/sequence.test.lua | 8 ++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) > > diff --git a/src/box/schema.cc b/src/box/schema.cc > index fab7544f2..456eef429 100644 > --- a/src/box/schema.cc > +++ b/src/box/schema.cc > @@ -646,7 +646,7 @@ sequence_cache_find(uint32_t id) > { > struct sequence *seq = sequence_by_id(id); > if (seq == NULL) > - tnt_raise(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id)); > + diag_set(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id)); > return seq; > } > > diff --git a/test/box/sequence.result b/test/box/sequence.result > index 0a6cfee2c..32a094d6f 100644 > --- a/test/box/sequence.result > +++ b/test/box/sequence.result > @@ -2102,6 +2102,23 @@ s:drop() > --- > ... > -- > +-- gh-4753: accessing dropped sequence should yield correct error > +-- > +s = box.schema.sequence.create('s') > +--- > +... > +s:drop() > +--- > +... > +s:next() > +--- > +- error: Sequence '1' does not exist > +... > +s:reset() > +--- > +- error: Sequence '1' does not exist > +... > +-- > -- Check that altering parts of a primary index with a sequence > -- attached requires sequence update. Renaming fields does not. > -- > diff --git a/test/box/sequence.test.lua b/test/box/sequence.test.lua > index 8e00571e5..d8a212fab 100644 > --- a/test/box/sequence.test.lua > +++ b/test/box/sequence.test.lua > @@ -710,6 +710,14 @@ s.index.pk:alter{sequence = {field = 'x.a.b[1]'}} > s:replace{{a = {b = {box.NULL}}}} -- ok > s:drop() > > +-- > +-- gh-4753: accessing dropped sequence should yield correct error > +-- > +s = box.schema.sequence.create('s') > +s:drop() > +s:next() > +s:reset() > + > -- > -- Check that altering parts of a primary index with a sequence > -- attached requires sequence update. Renaming fields does not. >