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 12DD62F350 for ; Thu, 16 May 2019 07:24:22 -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 kQ4d8X9mgFNU for ; Thu, 16 May 2019 07:24:21 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 38CC82F033 for ; Thu, 16 May 2019 07:24:21 -0400 (EDT) From: Roman Khabibov Subject: [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Date: Thu, 16 May 2019 14:24:16 +0300 Message-Id: <5bf6f6461979b451d40925d29ff7692f979433dd.1558004869.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: kostja@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 -> 4439 bytes src/box/lua/space.cc | 2 + src/box/lua/upgrade.lua | 23 ++++++++ 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, 178 insertions(+), 13 deletions(-) diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap index 871a93f9856f97636ad55b7f5260e5c6957fef36..62bae6be8a6cbbb5fe354ee87e836e2cdb02dd99 100644 GIT binary patch literal 4439 zcmV-d5vcA{PC-x#FfK7O3RY!ub7^mGIv_GGGA=MJGC46VXD~Q9F=8<_Ic5q;ZgX^D zZewLSAU7~LH8^55WGyseVr4BfGdVUbIb}0sEj3|gHZ?IZI5{vhWeQe9Y;R+0Iv{&} z3JTS_3%bn^+yKs*=tEqk0000004TLD{Qyv%h5!ncR3SzXkk~l@3;+xOdU@HTEDz~p z+BX^(yPn0f4L~;l9QsnGq$X36ku4=DlgO!mdPKbrZ7z3Pr|t98HRhd0hgtuJWzDBV z0u=%W0`dVn4?u{r7#C&nu7eLSCgTCdV>-Y%<$%mNZZPH?HQ?YJ&r!?tdWRPNE1V15v~vjF?^kM(@60Fxy#hfzBds=j98{tBVC$B)i zO`K%uZnM%gMC1u*;{5O0dDOlfLpsYCP25_lAqg636tB+ zXNmVolz5NC$NM8mdN+ck_aaAnCt{>50VqMfGQcywbieidc7Zg%tee31xzUzr7x_1JK?(;m+efK>lpgb=R zly9O3<)J(iJnxri!h0o{@IHwpyhlO_?~h2rr$!(_tApo=S)DsZfI0MUI+(-n%f3z# zc(NzrPWD3-k$v_;5OIAFLtGDp5Z7P-LlD;60mAw^KUi9VFZ;qcJ;E>7nuoX$Icvnx4QT5>mUN?!6UE-g3Q@2oAJ z-#EY1Y3*Fr-dMW5ak<*Q!m8~ZaJ60AZLYo!JN%zRoBwgpq2G{0?>6Ajdkr^eHa2KY zLk(K5VMCTyG*qo2OR`jBg`#PyP%1SjiYCqfGf<^6pwU-p3^QyEgA7~05X076y8uHA zFU)ougWuHE3pX`%A zeeU09DDSh+W*;+$8uK>CJm!+yu--OImNsm|Px{1}JTZPc@rlQbv4}CgBgSbcVhmo4 zYavc8cy9=`dp~YGKboyUE3Yd&2KA|UE! z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O%>;ScArPIdS+TuDr-9~=+wPn|~z8F@!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..6ff87a8c2 100644 --- a/src/box/lua/upgrade.lua +++ b/src/box/lua/upgrade.lua @@ -737,6 +737,28 @@ 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("update 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 +790,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)