* [tarantool-patches] [PATCH 0/2] Add "_vcollation" sysview and fetch it in net.box
@ 2019-05-16 11:24 Roman Khabibov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
0 siblings, 2 replies; 11+ messages in thread
From: Roman Khabibov @ 2019-05-16 11:24 UTC (permalink / raw)
To: tarantool-patches; +Cc: kostja
As I understood "readable for all" means that the filter for
"_vcollation" must always return "true", because the condition
"User has read access to according system space" is always
met.
Roman Khabibov (2):
schema: add "_vcollation" sysview
net.box: fetch '_vcollation' sysview into the module
src/box/bootstrap.snap | Bin 4374 -> 4439 bytes
src/box/lua/net_box.lua | 19 ++++--
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/box/net.box.result | 2 +-
test/box/stat_net.result | 4 +-
test/wal_off/alter.result | 2 +-
15 files changed, 195 insertions(+), 21 deletions(-)
--
Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3941-net-vcoll
Issue: https://github.com/tarantool/tarantool/issues/3941
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview
2019-05-16 11:24 [tarantool-patches] [PATCH 0/2] Add "_vcollation" sysview and fetch it in net.box Roman Khabibov
@ 2019-05-16 11:24 ` Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
2019-05-30 11:57 ` Konstantin Osipov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
1 sibling, 2 replies; 11+ messages in thread
From: Roman Khabibov @ 2019-05-16 11:24 UTC (permalink / raw)
To: tarantool-patches; +Cc: kostja
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!?<v^Y*0%;IDq
zCf8);>tdWRPNE1V15v~vjF?^kM(@60Fxy#hfzBds=j98{tBVC$<l-fZaI)8yE?LyV
zC5sho$zm4MELubnO9i5MC5tGgR<QhE<;wp}R{l?!s?h9E&@=&4X#4l~jom!|9NPZB
z&tE%KD3D-+dn2H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
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)<K
zP@MU2;Kleeq#R$<iXQ?{@G39C0{$kmg+I+mNCY}1jz*t=_EuMcmc#XDGvBU41sMlx
z&(6N*l}yPX=uUz4e|kXz)Y#m?IJ~=~7!7Fp3|R~51m>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)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-16 11:24 [tarantool-patches] [PATCH 0/2] Add "_vcollation" sysview and fetch it in net.box Roman Khabibov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
@ 2019-05-16 11:24 ` Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
2019-05-30 11:58 ` Konstantin Osipov
1 sibling, 2 replies; 11+ messages in thread
From: Roman Khabibov @ 2019-05-16 11:24 UTC (permalink / raw)
To: tarantool-patches; +Cc: kostja
Fetch "_vcollation" sysview to show collation name instead collation id.
Closes #3941
---
src/box/lua/net_box.lua | 19 ++++++++++++++-----
test/box/net.box.result | 2 +-
test/box/stat_net.result | 4 ++--
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 0cfb5075d..86650a4cb 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -31,6 +31,7 @@ local decode_greeting = internal.decode_greeting
local TIMEOUT_INFINITY = 500 * 365 * 86400
local VSPACE_ID = 281
local VINDEX_ID = 289
+local VCOLLATION_ID = 277
local DEFAULT_CONNECT_TIMEOUT = 10
local IPROTO_STATUS_KEY = 0x00
@@ -735,11 +736,15 @@ local function create_transport(host, port, user, password, callback,
end
local select1_id = new_request_id()
local select2_id = new_request_id()
+ local select3_id = new_request_id()
local response = {}
-- fetch everything from space _vspace, 2 = ITER_ALL
encode_select(send_buf, select1_id, VSPACE_ID, 0, 2, 0, 0xFFFFFFFF, nil)
-- fetch everything from space _vindex, 2 = ITER_ALL
encode_select(send_buf, select2_id, VINDEX_ID, 0, 2, 0, 0xFFFFFFFF, nil)
+ -- fetch everything from space _vcollation, 2 = ITER_ALL
+ encode_select(send_buf, select3_id, VCOLLATION_ID, 0, 2, 0, 0xFFFFFFFF, nil)
+
schema_version = nil -- any schema_version will do provided that
-- it is consistent across responses
repeat
@@ -747,7 +752,7 @@ local function create_transport(host, port, user, password, callback,
if err then return error_sm(err, hdr) end
dispatch_response_iproto(hdr, body_rpos, body_end)
local id = hdr[IPROTO_SYNC_KEY]
- if id == select1_id or id == select2_id then
+ if id == select1_id or id == select2_id or id == select3_id then
-- response to a schema query we've submitted
local status = hdr[IPROTO_STATUS_KEY]
local response_schema_version = hdr[IPROTO_SCHEMA_VERSION_KEY]
@@ -766,9 +771,9 @@ local function create_transport(host, port, user, password, callback,
body, body_end = decode(body_rpos)
response[id] = body[IPROTO_DATA_KEY]
end
- until response[select1_id] and response[select2_id]
+ until response[select1_id] and response[select2_id] and response[select3_id]
callback('did_fetch_schema', schema_version,
- response[select1_id], response[select2_id])
+ response[select1_id], response[select2_id], response[select3_id])
set_state('active')
return iproto_sm(schema_version)
end
@@ -1190,7 +1195,7 @@ function remote_methods:timeout(timeout)
return self
end
-function remote_methods:_install_schema(schema_version, spaces, indices)
+function remote_methods:_install_schema(schema_version, spaces, indices, collations)
local sl, space_mt, index_mt = {}, self._space_mt, self._index_mt
for _, space in pairs(spaces) do
local name = space[3]
@@ -1258,11 +1263,15 @@ function remote_methods:_install_schema(schema_version, spaces, indices)
local pkcollationid = index[PARTS][k].collation
local pktype = index[PARTS][k][2] or index[PARTS][k].type
local pkfield = index[PARTS][k][1] or index[PARTS][k].field
+ local pkcollation = nil
+ if pkcollationid ~= nil then
+ pkcollation = collations[pkcollationid + 1][2]
+ end
local pk = {
type = pktype,
fieldno = pkfield + 1,
- collation_id = pkcollationid,
+ collation = pkcollation,
is_nullable = pknullable
}
idx.parts[k] = pk
diff --git a/test/box/net.box.result b/test/box/net.box.result
index d02fed7a3..474297af3 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2910,7 +2910,7 @@ c.space.test.index.sk.parts
---
- - type: string
is_nullable: false
- collation_id: 277
+ collation: test
fieldno: 1
...
c:close()
diff --git a/test/box/stat_net.result b/test/box/stat_net.result
index 92f6d581f..9eeada7ec 100644
--- a/test/box/stat_net.result
+++ b/test/box/stat_net.result
@@ -85,7 +85,7 @@ box.stat.net.CONNECTIONS.total
...
box.stat.net.REQUESTS.total
---
-- 13
+- 17
...
box.stat.net.CONNECTIONS.current
---
@@ -151,7 +151,7 @@ test_run:wait_cond(function() return box.stat.net.REQUESTS.current == 0 end, WAI
...
box.stat.net.REQUESTS.total
---
-- 15
+- 19
...
-- reset
box.stat.reset()
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 1/2] schema: add "_vcollation" sysview
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
@ 2019-05-16 12:43 ` Konstantin Osipov
2019-05-28 15:50 ` Roman Khabibov
2019-05-30 11:57 ` Konstantin Osipov
1 sibling, 1 reply; 11+ messages in thread
From: Konstantin Osipov @ 2019-05-16 12:43 UTC (permalink / raw)
To: Roman Khabibov; +Cc: tarantool-patches
* Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
> + -- 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'}}}
use :replace, not delete + insert
> + log.info("update index owner on _collation")
> + box.space._index:insert{_collation.id, 1, 'owner', 'tree', {unique = false}, {{2, 'unsigned'}}}
Not update, but create.
create index 'owner' on space '_collation'
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-16 11:24 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
@ 2019-05-16 12:43 ` Konstantin Osipov
2019-05-30 11:58 ` Konstantin Osipov
1 sibling, 0 replies; 11+ messages in thread
From: Konstantin Osipov @ 2019-05-16 12:43 UTC (permalink / raw)
To: Roman Khabibov; +Cc: tarantool-patches
* Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
> Fetch "_vcollation" sysview to show collation name instead collation id.
this one is lgtm.
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 1/2] schema: add "_vcollation" sysview
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-28 15:50 ` Roman Khabibov
0 siblings, 0 replies; 11+ messages in thread
From: Roman Khabibov @ 2019-05-28 15:50 UTC (permalink / raw)
To: tarantool-patches; +Cc: Konstantin Osipov
Hi! Thanks for the review.
> On May 16, 2019, at 3:43 PM, Konstantin Osipov <kostja@tarantool.org> wrote:
>
> * Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
>> + -- 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'}}}
>
> use :replace, not delete + insert
I think, I can’t, because I change primary key.
> Not update, but create.
>
> create index 'owner' on space ‘_collation’
+ log.info("create index owner on _collation")
+ box.space._index:insert{_collation.id, 1, 'owner', 'tree', {unique = false},
+ {{2, 'unsigned'}}}
diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap
index 871a93f98..4e93a794a 100644
Binary files a/src/box/bootstrap.snap and b/src/box/bootstrap.snap differ
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 1/2] schema: add "_vcollation" sysview
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-30 11:57 ` Konstantin Osipov
1 sibling, 0 replies; 11+ messages in thread
From: Konstantin Osipov @ 2019-05-30 11:57 UTC (permalink / raw)
To: Roman Khabibov; +Cc: tarantool-patches
* Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
> +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}
why do you delete the index entry just to rename it? Can't you
update the existing record?
> +static bool
> + vcollation_filter(struct space *source, struct tuple *tuple)
> + {
> + (void) source;
> + (void) tuple;
> + return true;
> + }
> +
The return value and function should have the same indent, please
re-indent.
I don't see where 'PUBLIC' role is granted access to the new
space. How does this work?
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-16 11:24 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
@ 2019-05-30 11:58 ` Konstantin Osipov
2019-05-30 12:05 ` Vladislav Shpilevoy
1 sibling, 1 reply; 11+ messages in thread
From: Konstantin Osipov @ 2019-05-30 11:58 UTC (permalink / raw)
To: Roman Khabibov; +Cc: tarantool-patches
* Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
> Fetch "_vcollation" sysview to show collation name instead collation id.
@gerold107 could you review this?
--
Konstantin Osipov, Moscow, Russia
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] Re: [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-30 11:58 ` Konstantin Osipov
@ 2019-05-30 12:05 ` Vladislav Shpilevoy
0 siblings, 0 replies; 11+ messages in thread
From: Vladislav Shpilevoy @ 2019-05-30 12:05 UTC (permalink / raw)
To: tarantool-patches, Konstantin Osipov, Roman Khabibov
On 30/05/2019 14:58, Konstantin Osipov wrote:
> * Roman Khabibov <roman.habibov@tarantool.org> [19/05/16 14:27]:
>> Fetch "_vcollation" sysview to show collation name instead collation id.
>
> @gerold107 could you review this?
>
I am not 107, but 103. Ok, I will. Roman, please,
send a bumped version in a new thread.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-30 12:36 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
@ 2019-06-04 16:36 ` Vladimir Davydov
0 siblings, 0 replies; 11+ messages in thread
From: Vladimir Davydov @ 2019-06-04 16:36 UTC (permalink / raw)
To: Roman Khabibov; +Cc: tarantool-patches, v.shpilevoy
On Thu, May 30, 2019 at 03:36:03PM +0300, Roman Khabibov wrote:
> Fetch "_vcollation" sysview to show collation name instead collation id.
>
> Closes #3941
> ---
> src/box/lua/net_box.lua | 24 ++++++++++++++++++------
> test/box/net.box.result | 2 +-
> test/box/stat_net.result | 4 ++--
> 3 files changed, 21 insertions(+), 9 deletions(-)
This one looks good to me, but you probably need to write a doc bot
request.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module
2019-05-30 12:36 [tarantool-patches] [PATCH 0/2] Add _vcollation and fetch in net.box Roman Khabibov
@ 2019-05-30 12:36 ` Roman Khabibov
2019-06-04 16:36 ` Vladimir Davydov
0 siblings, 1 reply; 11+ messages in thread
From: Roman Khabibov @ 2019-05-30 12:36 UTC (permalink / raw)
To: tarantool-patches; +Cc: v.shpilevoy
Fetch "_vcollation" sysview to show collation name instead collation id.
Closes #3941
---
src/box/lua/net_box.lua | 24 ++++++++++++++++++------
test/box/net.box.result | 2 +-
test/box/stat_net.result | 4 ++--
3 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 0cfb5075d..251ad407a 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -31,6 +31,7 @@ local decode_greeting = internal.decode_greeting
local TIMEOUT_INFINITY = 500 * 365 * 86400
local VSPACE_ID = 281
local VINDEX_ID = 289
+local VCOLLATION_ID = 277
local DEFAULT_CONNECT_TIMEOUT = 10
local IPROTO_STATUS_KEY = 0x00
@@ -735,11 +736,16 @@ local function create_transport(host, port, user, password, callback,
end
local select1_id = new_request_id()
local select2_id = new_request_id()
+ local select3_id = new_request_id()
local response = {}
-- fetch everything from space _vspace, 2 = ITER_ALL
encode_select(send_buf, select1_id, VSPACE_ID, 0, 2, 0, 0xFFFFFFFF, nil)
-- fetch everything from space _vindex, 2 = ITER_ALL
encode_select(send_buf, select2_id, VINDEX_ID, 0, 2, 0, 0xFFFFFFFF, nil)
+ -- fetch everything from space _vcollation, 2 = ITER_ALL
+ encode_select(send_buf, select3_id, VCOLLATION_ID, 0, 2, 0, 0xFFFFFFFF,
+ nil)
+
schema_version = nil -- any schema_version will do provided that
-- it is consistent across responses
repeat
@@ -747,7 +753,7 @@ local function create_transport(host, port, user, password, callback,
if err then return error_sm(err, hdr) end
dispatch_response_iproto(hdr, body_rpos, body_end)
local id = hdr[IPROTO_SYNC_KEY]
- if id == select1_id or id == select2_id then
+ if id == select1_id or id == select2_id or id == select3_id then
-- response to a schema query we've submitted
local status = hdr[IPROTO_STATUS_KEY]
local response_schema_version = hdr[IPROTO_SCHEMA_VERSION_KEY]
@@ -766,9 +772,10 @@ local function create_transport(host, port, user, password, callback,
body, body_end = decode(body_rpos)
response[id] = body[IPROTO_DATA_KEY]
end
- until response[select1_id] and response[select2_id]
- callback('did_fetch_schema', schema_version,
- response[select1_id], response[select2_id])
+ until response[select1_id] and response[select2_id] and
+ response[select3_id]
+ callback('did_fetch_schema', schema_version, response[select1_id],
+ response[select2_id],response[select3_id])
set_state('active')
return iproto_sm(schema_version)
end
@@ -1190,7 +1197,8 @@ function remote_methods:timeout(timeout)
return self
end
-function remote_methods:_install_schema(schema_version, spaces, indices)
+function remote_methods:_install_schema(schema_version, spaces, indices,
+ collations)
local sl, space_mt, index_mt = {}, self._space_mt, self._index_mt
for _, space in pairs(spaces) do
local name = space[3]
@@ -1258,11 +1266,15 @@ function remote_methods:_install_schema(schema_version, spaces, indices)
local pkcollationid = index[PARTS][k].collation
local pktype = index[PARTS][k][2] or index[PARTS][k].type
local pkfield = index[PARTS][k][1] or index[PARTS][k].field
+ local pkcollation = nil
+ if pkcollationid ~= nil then
+ pkcollation = collations[pkcollationid + 1][2]
+ end
local pk = {
type = pktype,
fieldno = pkfield + 1,
- collation_id = pkcollationid,
+ collation = pkcollation,
is_nullable = pknullable
}
idx.parts[k] = pk
diff --git a/test/box/net.box.result b/test/box/net.box.result
index d02fed7a3..474297af3 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2910,7 +2910,7 @@ c.space.test.index.sk.parts
---
- - type: string
is_nullable: false
- collation_id: 277
+ collation: test
fieldno: 1
...
c:close()
diff --git a/test/box/stat_net.result b/test/box/stat_net.result
index 92f6d581f..9eeada7ec 100644
--- a/test/box/stat_net.result
+++ b/test/box/stat_net.result
@@ -85,7 +85,7 @@ box.stat.net.CONNECTIONS.total
...
box.stat.net.REQUESTS.total
---
-- 13
+- 17
...
box.stat.net.CONNECTIONS.current
---
@@ -151,7 +151,7 @@ test_run:wait_cond(function() return box.stat.net.REQUESTS.current == 0 end, WAI
...
box.stat.net.REQUESTS.total
---
-- 15
+- 19
...
-- reset
box.stat.reset()
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-06-04 16:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 11:24 [tarantool-patches] [PATCH 0/2] Add "_vcollation" sysview and fetch it in net.box Roman Khabibov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 1/2] schema: add "_vcollation" sysview Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
2019-05-28 15:50 ` Roman Khabibov
2019-05-30 11:57 ` Konstantin Osipov
2019-05-16 11:24 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
2019-05-16 12:43 ` [tarantool-patches] " Konstantin Osipov
2019-05-30 11:58 ` Konstantin Osipov
2019-05-30 12:05 ` Vladislav Shpilevoy
2019-05-30 12:36 [tarantool-patches] [PATCH 0/2] Add _vcollation and fetch in net.box Roman Khabibov
2019-05-30 12:36 ` [tarantool-patches] [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module Roman Khabibov
2019-06-04 16:36 ` Vladimir Davydov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox