From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 96B4C2FDA4 for ; Thu, 30 May 2019 08:36:07 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OHBev1LhY5Ey for ; Thu, 30 May 2019 08:36:07 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id CC69D2FD06 for ; Thu, 30 May 2019 08:36:06 -0400 (EDT) From: Roman Khabibov Subject: [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Date: Thu, 30 May 2019 15:36:02 +0300 Message-Id: <5eab44d0494d7622ef5fbb77c45229a09212d9bc.1559219194.git.roman.habibov@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org Add "_vcollation" sysview to read it from net.box. This sysview is always readable, exept when the user doesn't have "public" role. Needed for #3941 --- src/box/bootstrap.snap | Bin 4374 -> 4441 bytes src/box/lua/space.cc | 2 + src/box/lua/upgrade.lua | 25 ++++++++ src/box/schema_def.h | 2 + src/box/sysview.c | 13 ++++ test/app-tap/tarantoolctl.test.lua | 4 +- test/box-py/bootstrap.result | 13 +++- test/box/access_misc.result | 4 ++ test/box/access_sysview.result | 92 ++++++++++++++++++++++++++--- test/box/access_sysview.test.lua | 30 ++++++++++ test/box/alter.result | 6 +- test/wal_off/alter.result | 2 +- 12 files changed, 180 insertions(+), 13 deletions(-) diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap index 871a93f9856f97636ad55b7f5260e5c6957fef36..4e93a794a0608710a2bb93e96e9031451186bf01 100644 GIT binary patch literal 4441 zcmV-f5vJ}_PC-x#FfK7O3RY!ub7^mGIv_GGGA=MJGC49WXEkDGHfA<7HZclGZgX^D zZewLSAZ0UTWj8QoW-T}~Vl^!^G&40VVmLN4EjMOmV>UQqF=I6_VhUD6Y;R+0Iv{&} z3JTS_3%bn^-T=-7f4Q6pN z5R+@N@^vvz7$;E#lYuB=5JpTd0Hb$bFqrKuxIkwSxAXFa=GDc5EOPOZML5}OOP4Ha z;gZD)wq!AjX%;P_h@}Eiyplx}Q!7~huX5%8CM*A^OjT%hC}^61DYX6j`^Ijbe-3T` z-{-F#DilaC!M#(c+#7)e{4P!5S1AI1`GsKV-UpQKl>))NsRIwx{EjB2=65p(YCgo( z{4R+`vx797*=ZojsVT{+$xaj`nirG?W?l?LAvyS+AC@cM4ZBFrYj<;Oe&6+a0>y?4 zFkr)@CpNU9(E>IFj%>CBjBGXp6z~Tm;JpC|cwfK)7EEOZSTHRrz=Bs6Or6MRT|`B* zt|m^hbhlaQ8Y1!pH1U3bA@79<*g*sAEr8J80R-I|kN~Tq$A8WW(~ZOPB=ri97u z=Cj26BuczT;^Y01B)uC!(tD93y%RA~mH-qf%OOO{(xyTHpamHcZVq0*H3K3_<-wHf8HJ|9-y~{^P#=do43<#8}yat2g9e-e*>| zlKu4b#9&ip+KdU)^kqvGUA>!cESQz-rzZxR`cY$>XWuWHrKa}8U{hbU7v@jOmO3h# zPldtq_?)?FLy8toQ>+Aerz4cypc&Af`_c>m?^Dc*u zHhq|*%^u`vQ=45rSd)hytQn`vn%0EFL+86Vou_a*@BGcKGsCuYWoVSws*kQc5S!0`a10Je-3T_$3cgFLk_*$fJ5&!+@RUm zpfwFOXuXCFSz6IhwT3LoQjHagrl~@y)SxJuH2=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8F@!sl29ZUk&h5py3`~g77Zda z1QOgA!yx;p>o&eS`~6h6T)k*w@&IX<0$k&NG!f}8(^6{8R2&xNdgY1e8s|b zNi$Pj_RE`gLbnZT1O#4h{8+Tv;cFuo3uA zGVvPHZUT>4wu3BUnKI+ekUdK~lUH+%lx?#yukcP1>MahxY)gj5LoixFMkk)N0)%N~ zE-p-dAVAr&5G-T#-`cag8Ot5Re#*GG?>4dLFN=m729Yya7)h%h5u*T+C1OEsyl^RY z9=&k!gVhJ{3ZZ2o!oK=O4aNeNuuO7*e_Ra{TVoQZed}kR*8wQB#FB>4L%p!ia4=$e zYOuO=uXI%bH>&a%2UGEhi%6AqE-P;j9BOma-w;Ih`Yx@O3_ducSwe8ZIn+vQ2?-3= z%|9yMPJ!n;klelKR<4>U<6rW-U47{x7*d#zsvrw0JEj}b^1vXuaN4jv$A2^-Zc)qn^BoGAo*o-+n<;~iD;J7| zQLrKBBIVi0?L%RO#>v{Vv)k7d4KXYOEKzvjJjy0iFhW+J&3wO~^YE6AxO(yzw(ydk zxP5vTci75K+-tH!hy7wCv~j)#kA)dcT=i~!v)V9cG5(s%(U4@}&rtx^8Z@h$qsLi+ QJ>-q$w`eZc2h|X*?NOjQ=l}o! diff --git a/src/box/lua/space.cc b/src/box/lua/space.cc index 100da0a79..fbfc2a64d 100644 --- a/src/box/lua/space.cc +++ b/src/box/lua/space.cc @@ -525,6 +525,8 @@ box_lua_space_init(struct lua_State *L) lua_setfield(L, -2, "FUNC_ID"); lua_pushnumber(L, BOX_COLLATION_ID); lua_setfield(L, -2, "COLLATION_ID"); + lua_pushnumber(L, BOX_VCOLLATION_ID); + lua_setfield(L, -2, "VCOLLATION_ID"); lua_pushnumber(L, BOX_VFUNC_ID); lua_setfield(L, -2, "VFUNC_ID"); lua_pushnumber(L, BOX_PRIV_ID); diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua index 89d6e3d52..f2a1be639 100644 --- a/src/box/lua/upgrade.lua +++ b/src/box/lua/upgrade.lua @@ -737,6 +737,30 @@ local function upgrade_to_2_1_3() end end +local function create_vcollation_space() + local _collation = box.space._collation + local format = _collation:format() + create_sysview(box.schema.COLLATION_ID, box.schema.VCOLLATION_ID) + box.space[box.schema.VCOLLATION_ID]:format(format) +end + +local function upgrade_to_2_1_4() + local _collation = box.space._collation + local _index = box.space._index + + -- System space format usually is in order "id, owner, name...". + -- The fields "name", "owner" are swapped in "_collation" format, + -- due to the field "owner" was added after the "_collation" creation. + box.space._index:delete{276, 1} + log.info("update index name on _collation") + box.space._index:insert{_collation.id, 2, 'name', 'tree', {unique = true}, + {{1, 'string'}}} + log.info("create index owner on _collation") + box.space._index:insert{_collation.id, 1, 'owner', 'tree', {unique = false}, + {{2, 'unsigned'}}} + create_vcollation_space() +end + local function get_version() local version = box.space._schema:get{'version'} if version == nil then @@ -768,6 +792,7 @@ local function upgrade(options) {version = mkversion(2, 1, 1), func = upgrade_to_2_1_1, auto = true}, {version = mkversion(2, 1, 2), func = upgrade_to_2_1_2, auto = true}, {version = mkversion(2, 1, 3), func = upgrade_to_2_1_3, auto = true}, + {version = mkversion(2, 1, 4), func = upgrade_to_2_1_4, auto = true} } for _, handler in ipairs(handlers) do diff --git a/src/box/schema_def.h b/src/box/schema_def.h index eeeeb950b..77c004690 100644 --- a/src/box/schema_def.h +++ b/src/box/schema_def.h @@ -72,6 +72,8 @@ enum { BOX_SCHEMA_ID = 272, /** Space id of _collation. */ BOX_COLLATION_ID = 276, + /** Space id of _vcollation. */ + BOX_VCOLLATION_ID = 277, /** Space id of _space. */ BOX_SPACE_ID = 280, /** Space id of _vspace view. */ diff --git a/src/box/sysview.c b/src/box/sysview.c index 96c5e78ca..0d1259af0 100644 --- a/src/box/sysview.c +++ b/src/box/sysview.c @@ -402,6 +402,14 @@ vsequence_filter(struct space *source, struct tuple *tuple) ((PRIV_WRDA | PRIV_X) & effective); } +static bool + vcollation_filter(struct space *source, struct tuple *tuple) + { + (void) source; + (void) tuple; + return true; + } + static struct index * sysview_space_create_index(struct space *space, struct index_def *def) { @@ -448,6 +456,11 @@ sysview_space_create_index(struct space *space, struct index_def *def) source_index_id = def->iid; filter = vsequence_filter; break; + case BOX_VCOLLATION_ID: + source_space_id = BOX_COLLATION_ID; + source_index_id = def->iid; + filter = vcollation_filter; + break; default: diag_set(ClientError, ER_MODIFY_INDEX, def->name, space_name(space), diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua index c1e1490ca..ac1efa0ba 100755 --- a/test/app-tap/tarantoolctl.test.lua +++ b/test/app-tap/tarantoolctl.test.lua @@ -405,8 +405,8 @@ do check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1", "\n", 3) check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1 --replica 2", "\n", 3) check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 2", "\n", 0) - check_ctlcat_snap(test_i, dir, "--space=280", "---\n", 21) - check_ctlcat_snap(test_i, dir, "--space=288", "---\n", 47) + check_ctlcat_snap(test_i, dir, "--space=280", "---\n", 22) + check_ctlcat_snap(test_i, dir, "--space=288", "---\n", 51) end) end) diff --git a/test/box-py/bootstrap.result b/test/box-py/bootstrap.result index 379f6c51f..f37a28c80 100644 --- a/test/box-py/bootstrap.result +++ b/test/box-py/bootstrap.result @@ -4,7 +4,7 @@ box.internal.bootstrap() box.space._schema:select{} --- - - ['max_id', 511] - - ['version', 2, 1, 3] + - ['version', 2, 1, 4] ... box.space._cluster:select{} --- @@ -21,6 +21,10 @@ box.space._space:select{} 'name': 'name', 'type': 'string'}, {'name': 'owner', 'type': 'unsigned'}, {'name': 'type', 'type': 'string'}, {'name': 'locale', 'type': 'string'}, { 'name': 'opts', 'type': 'map'}]] + - [277, 1, '_vcollation', 'sysview', 0, {}, [{'name': 'id', 'type': 'unsigned'}, + {'name': 'name', 'type': 'string'}, {'name': 'owner', 'type': 'unsigned'}, { + 'name': 'type', 'type': 'string'}, {'name': 'locale', 'type': 'string'}, { + 'name': 'opts', 'type': 'map'}]] - [280, 1, '_space', 'memtx', 0, {}, [{'name': 'id', 'type': 'unsigned'}, {'name': 'owner', 'type': 'unsigned'}, {'name': 'name', 'type': 'string'}, {'name': 'engine', 'type': 'string'}, {'name': 'field_count', 'type': 'unsigned'}, {'name': 'flags', @@ -83,7 +87,11 @@ box.space._index:select{} --- - - [272, 0, 'primary', 'tree', {'unique': true}, [[0, 'string']]] - [276, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] - - [276, 1, 'name', 'tree', {'unique': true}, [[1, 'string']]] + - [276, 1, 'owner', 'tree', {'unique': false}, [[2, 'unsigned']]] + - [276, 2, 'name', 'tree', {'unique': true}, [[1, 'string']]] + - [277, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] + - [277, 1, 'owner', 'tree', {'unique': false}, [[2, 'unsigned']]] + - [277, 2, 'name', 'tree', {'unique': true}, [[1, 'string']]] - [280, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] - [280, 1, 'owner', 'tree', {'unique': false}, [[1, 'unsigned']]] - [280, 2, 'name', 'tree', {'unique': true}, [[2, 'string']]] @@ -150,6 +158,7 @@ box.space._priv:select{} - [1, 1, 'universe', 0, 4294967295] - [1, 2, 'function', 1, 4] - [1, 2, 'space', 276, 2] + - [1, 2, 'space', 277, 1] - [1, 2, 'space', 281, 1] - [1, 2, 'space', 286, 1] - [1, 2, 'space', 289, 1] diff --git a/test/box/access_misc.result b/test/box/access_misc.result index 36ebfae09..2b7ca4f97 100644 --- a/test/box/access_misc.result +++ b/test/box/access_misc.result @@ -761,6 +761,10 @@ box.space._space:select() 'name': 'name', 'type': 'string'}, {'name': 'owner', 'type': 'unsigned'}, {'name': 'type', 'type': 'string'}, {'name': 'locale', 'type': 'string'}, { 'name': 'opts', 'type': 'map'}]] + - [277, 1, '_vcollation', 'sysview', 0, {}, [{'name': 'id', 'type': 'unsigned'}, + {'name': 'name', 'type': 'string'}, {'name': 'owner', 'type': 'unsigned'}, { + 'name': 'type', 'type': 'string'}, {'name': 'locale', 'type': 'string'}, { + 'name': 'opts', 'type': 'map'}]] - [280, 1, '_space', 'memtx', 0, {}, [{'name': 'id', 'type': 'unsigned'}, {'name': 'owner', 'type': 'unsigned'}, {'name': 'name', 'type': 'string'}, {'name': 'engine', 'type': 'string'}, {'name': 'field_count', 'type': 'unsigned'}, {'name': 'flags', diff --git a/test/box/access_sysview.result b/test/box/access_sysview.result index c6a2b22ed..96976babb 100644 --- a/test/box/access_sysview.result +++ b/test/box/access_sysview.result @@ -74,6 +74,10 @@ session.su('guest') --- - true ... +#box.space._vspace.index[2]:select('_vcollation') ~= 0 +--- +- true +... #box.space._vindex:select(box.space._vspace.id) > 0 --- - true @@ -94,6 +98,10 @@ session.su('guest') --- - true ... +#box.space._vindex:select(box.space._vcollation.id) > 0 +--- +- true +... box.session.su('admin') --- ... @@ -127,6 +135,10 @@ box.session.su('guest') --- - error: Read access to space '_vsequence' is denied for user 'guest' ... +#box.space._vcollation:select{} +--- +- error: Read access to space '_vcollation' is denied for user 'guest' +... box.session.su('admin') --- ... @@ -138,11 +150,15 @@ box.session.su('guest') ... #box.space._vspace:select{} --- -- 8 +- 9 ... #box.space._vindex:select{} --- -- 20 +- 24 +... +#box.space._vcollation:select{} +--- +- 277 ... box.session.su('admin') --- @@ -230,11 +246,11 @@ box.session.su('guest') ... #box.space._vspace:select{} --- -- 22 +- 23 ... #box.space._vindex:select{} --- -- 48 +- 52 ... #box.space._vuser:select{} --- @@ -242,12 +258,16 @@ box.session.su('guest') ... #box.space._vpriv:select{} --- -- 15 +- 16 ... #box.space._vfunc:select{} --- - 1 ... +#box.space._vcollation:select{} +--- +- 277 +... box.session.su('admin') --- ... @@ -262,7 +282,7 @@ box.session.su('guest') ... #box.space._vindex:select{} --- -- 48 +- 52 ... #box.space._vuser:select{} --- @@ -270,7 +290,7 @@ box.session.su('guest') ... #box.space._vpriv:select{} --- -- 15 +- 16 ... #box.space._vfunc:select{} --- @@ -280,6 +300,10 @@ box.session.su('guest') --- - 0 ... +#box.space._vcollation:select{} +--- +- 277 +... box.session.su('admin') --- ... @@ -631,6 +655,60 @@ seq:drop() --- ... -- +-- _vcollation +-- +box.session.su('admin') +--- +... +box.internal.collation.create('test', 'ICU', 'ru-RU') +--- +... +-- Only admin can create collation. +coll_cnt = #box.space._collation:select{} +--- +... +box.schema.user.grant("guest", "read, write, alter, execute", "space", "_collation") +--- +... +box.session.su("guest") +--- +... +box.internal.collation.create('guest0', 'ICU', 'ru-RU') +--- +- error: Create access to collation 'guest0' is denied for user 'guest' +... +box.space._vcollation:select{0} +--- +- - [0, 'none', 1, 'BINARY', '', {}] +... +#box.space._vcollation:select{} == coll_cnt +--- +- true +... +box.session.su('admin') +--- +... +-- _vcollation is readable anyway. +box.schema.user.revoke("guest", "read", "space", "_collation") +--- +... +box.session.su("guest") +--- +... +#box.space._vcollation:select{} +--- +- 278 +... +session.su('admin') +--- +... +box.internal.collation.drop('test') +--- +... +box.internal.collation.drop('guest0') +--- +... +-- -- view:alter() tests -- box.space._vspace.index[1]:alter({parts = { 2, 'string' }}) diff --git a/test/box/access_sysview.test.lua b/test/box/access_sysview.test.lua index c62458407..031df28aa 100644 --- a/test/box/access_sysview.test.lua +++ b/test/box/access_sysview.test.lua @@ -31,12 +31,14 @@ session.su('guest') #box.space._vspace.index[2]:select('_vuser') ~= 0 #box.space._vspace.index[2]:select('_vfunc') ~= 0 #box.space._vspace.index[2]:select('_vpriv') ~= 0 +#box.space._vspace.index[2]:select('_vcollation') ~= 0 #box.space._vindex:select(box.space._vspace.id) > 0 #box.space._vindex:select(box.space._vindex.id) > 0 #box.space._vindex:select(box.space._vuser.id) > 0 #box.space._vindex:select(box.space._vfunc.id) > 0 #box.space._vindex:select(box.space._vpriv.id) > 0 +#box.space._vindex:select(box.space._vcollation.id) > 0 box.session.su('admin') box.schema.user.revoke('guest', 'public') @@ -48,6 +50,7 @@ box.session.su('guest') #box.space._vpriv:select{} #box.space._vfunc:select{} #box.space._vsequence:select{} +#box.space._vcollation:select{} box.session.su('admin') box.schema.user.grant('guest', 'public') @@ -55,6 +58,7 @@ box.session.su('guest') #box.space._vspace:select{} #box.space._vindex:select{} +#box.space._vcollation:select{} box.session.su('admin') s = box.schema.space.create('test') @@ -96,6 +100,7 @@ box.session.su('guest') #box.space._vuser:select{} #box.space._vpriv:select{} #box.space._vfunc:select{} +#box.space._vcollation:select{} box.session.su('admin') box.schema.user.revoke('guest', 'read', 'universe') @@ -107,6 +112,7 @@ box.session.su('guest') #box.space._vpriv:select{} #box.space._vfunc:select{} #box.space._vsequence:select{} +#box.space._vcollation:select{} box.session.su('admin') box.schema.user.revoke('guest', 'write', 'universe') @@ -264,6 +270,30 @@ box.session.su("guest") session.su('admin') seq:drop() +-- +-- _vcollation +-- + +box.session.su('admin') +box.internal.collation.create('test', 'ICU', 'ru-RU') + +-- Only admin can create collation. +coll_cnt = #box.space._collation:select{} +box.schema.user.grant("guest", "read, write, alter, execute", "space", "_collation") +box.session.su("guest") +box.internal.collation.create('guest0', 'ICU', 'ru-RU') +box.space._vcollation:select{0} +#box.space._vcollation:select{} == coll_cnt +box.session.su('admin') + +-- _vcollation is readable anyway. +box.schema.user.revoke("guest", "read", "space", "_collation") +box.session.su("guest") +#box.space._vcollation:select{} +session.su('admin') +box.internal.collation.drop('test') +box.internal.collation.drop('guest0') + -- -- view:alter() tests -- diff --git a/test/box/alter.result b/test/box/alter.result index c1b1de135..7fb09b4cd 100644 --- a/test/box/alter.result +++ b/test/box/alter.result @@ -183,7 +183,11 @@ _index:select{} --- - - [272, 0, 'primary', 'tree', {'unique': true}, [[0, 'string']]] - [276, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] - - [276, 1, 'name', 'tree', {'unique': true}, [[1, 'string']]] + - [276, 1, 'owner', 'tree', {'unique': false}, [[2, 'unsigned']]] + - [276, 2, 'name', 'tree', {'unique': true}, [[1, 'string']]] + - [277, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] + - [277, 1, 'owner', 'tree', {'unique': false}, [[2, 'unsigned']]] + - [277, 2, 'name', 'tree', {'unique': true}, [[1, 'string']]] - [280, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]] - [280, 1, 'owner', 'tree', {'unique': false}, [[1, 'unsigned']]] - [280, 2, 'name', 'tree', {'unique': true}, [[2, 'string']]] diff --git a/test/wal_off/alter.result b/test/wal_off/alter.result index ee280fcbb..8040efa1a 100644 --- a/test/wal_off/alter.result +++ b/test/wal_off/alter.result @@ -28,7 +28,7 @@ end; ... #spaces; --- -- 65505 +- 65504 ... -- cleanup for k, v in pairs(spaces) do -- 2.20.1 (Apple Git-117)