From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 92EA36EC40; Tue, 17 Aug 2021 15:32:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 92EA36EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629203524; bh=bcqEqnDgDrcx/xreAnr12BMs3jJVR8AKfin5zoiQ3ng=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=sUYU5jeCEDxIhPiJLANhnCdnXyAb0SntAxebdhlqeNymb5Gk8QjnvZlbJIgtWncpH 3IonvqUJz4rbAK6fJ8lWoHlh0E7r2sdBnBoYQ2iZ7VBwggFkhBIGHWN/SS9Ti6HMUV ZtmjsNiaboGaab6I+r0DeXe8x5BuLdMqVCUgUEnw= Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109]) (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 304996EC40 for ; Tue, 17 Aug 2021 15:32:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 304996EC40 Received: by smtp49.i.mail.ru with esmtpa (envelope-from ) id 1mFyGA-0001ne-GT; Tue, 17 Aug 2021 15:32:02 +0300 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: Date: Tue, 17 Aug 2021 15:32:02 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD972FF4A7D76DB5E242D14FEF1BD8BF4AC182A05F538085040C9D1A5B749374FF9A00A2A3E45319BF3EE43F0589F3EF227D1F30058F04838F2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE702C8878A98595F58EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373745FD4183B699148638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D835B564049EE617F927616A1BB13ABA2B117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18E5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B60A9A04DE7321024275ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5F7F6D5EA7A57927D65D6A6874126E6C8ECA7DF61EFA14BA8D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7567C209D01CC1E34B410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346BEB6F73FB9D1E4A524FECF126CE6B713559EAE2936243D11E9AB36B1E3F2B5673C928EE437714411D7E09C32AA3244C78BD53F452B0F332EB71B840430C7E54F165894D92D62706729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojuRQ/H5n28tqbIT4YIleAnw== X-Mailru-Sender: 3B9A0136629DC9125D61937A2360A446FFAC22A7B5FFE864CFDCC1E2289D94A5BC1F0997A9148D22424AE0EB1F3D1D21E2978F233C3FAE6EE63DB1732555E4A8EE80603BA4A5B0BC112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 1/1] schema: remove assert on wrong insert into _priv X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 16.08.2021 19:13, imeevma@tarantool.org пишет: > Prior to this patch, an assertion was throwed if a tuple with an > incorrect id was inserted into the _priv system space. This bug > appeared only in the debug build. > > Closes #6295 > --- > https://github.com/tarantool/tarantool/issues/6295 > https://github.com/tarantool/tarantool/tree/imeevma/gh-6295-assert-on-insert-with-wrong-id > > src/box/schema.cc | 1 - > .../gh-6295-assert-on-wrong-id.test.lua | 34 +++++++++++++++++++ > test/box-tap/suite.ini | 2 +- > 3 files changed, 35 insertions(+), 2 deletions(-) > create mode 100755 test/box-tap/gh-6295-assert-on-wrong-id.test.lua > > diff --git a/src/box/schema.cc b/src/box/schema.cc > index 1970871cc..ac19a2b1e 100644 > --- a/src/box/schema.cc > +++ b/src/box/schema.cc > @@ -730,7 +730,6 @@ schema_find_name(enum schema_object_type type, uint32_t object_id) > default: > break; > } > - assert(false); > return "(nil)"; > } Thanks for the patch! I think it's better to return NULL in this case. And set the diagnostics accordingly. And check for schema_find_name results in alter.cc schema_find_name is the place where we already know there's no such space, or function, and so on. So priv_def_check should fail right at schema_find_name, not later. > diff --git a/test/box-tap/gh-6295-assert-on-wrong-id.test.lua b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua > new file mode 100755 > index 000000000..e4822f395 > --- /dev/null > +++ b/test/box-tap/gh-6295-assert-on-wrong-id.test.lua > @@ -0,0 +1,34 @@ > +#!/usr/bin/env tarantool > + > +local tap = require('tap') > +local test = tap.test('gh-6295-assert-on-wrong-id') > + > +test:plan(5) > + > +local ok, res > + > +box.cfg{} > + > +-- Should be an error, not an assertion. > +local _priv = box.space._priv > +local errmsg = "Function '1000000' does not exist" > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'function', 1000000, box.priv.A}) > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Function exists") > + > +errmsg = "Sequence '1000000' does not exist" > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'sequence', 1000000, box.priv.A}) > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Sequence exists") > + > +errmsg = "Space '1000000' does not exist" > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'space', 1000000, box.priv.A}) > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Space exists") > + > +errmsg = "User '1000000' is not found" > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'user', 1000000, box.priv.A}) > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "User exists") > + > +errmsg = "Role '1000000' is not found" > +ok, res = pcall(_priv.replace, _priv, {1, 2, 'role', 1000000, box.priv.A}) > +test:is_deeply({ok, tostring(res)}, {false, errmsg}, "Role exists") > + > +os.exit(test:check() and 0 or 1) > diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini > index b09d7db4f..fd55d5d24 100644 > --- a/test/box-tap/suite.ini > +++ b/test/box-tap/suite.ini > @@ -3,7 +3,7 @@ core = app > description = Database tests with #! using TAP > is_parallel = True > use_unix_sockets_iproto = True > -release_disabled = errinj_set_with_enviroment_vars.test.lua > +release_disabled = errinj_set_with_enviroment_vars.test.lua, gh-6295-assert-on-wrong-id.test.lua > config = suite.cfg > fragile = { > "retries": 10, -- Serge Petrenko