From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [tarantool-patches] Re: [PATCH 2/2] net.box: fetch '_vcollation' sysview into the module From: Roman Khabibov In-Reply-To: <20190605172850.rrapakadshzxjnjo@esperanza> Date: Thu, 6 Jun 2019 19:00:59 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <9919CF9F-7E29-4192-9A3B-A775546D346C@tarantool.org> References: <8580960460ba5013b81e3a327fc94df2377c06da.1559219194.git.roman.habibov@tarantool.org> <20190604163603.ukdr3qogig5leksl@esperanza> <2F4F2E2A-9C27-42B2-94D8-98513D1398A9@tarantool.org> <20190605172850.rrapakadshzxjnjo@esperanza> To: tarantool-patches@freelists.org Cc: Vladimir Davydov List-ID: > On Jun 5, 2019, at 8:28 PM, Vladimir Davydov = wrote: >=20 > On Wed, Jun 05, 2019 at 08:08:39PM +0300, Roman Khabibov wrote: >>=20 >>> On Jun 4, 2019, at 7:36 PM, Vladimir Davydov = wrote: >>>=20 >>> On Thu, May 30, 2019 at 03:36:03PM +0300, Roman Khabibov wrote: >>>> Fetch "_vcollation" sysview to show collation name instead = collation id. >>>>=20 >>>> 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(-) >>>=20 >>> This one looks good to me, but you probably need to write a doc bot >>> request. >>>=20 >> What should I write in this request? I understood, that you meant >> info about _vcollation existance. >=20 > Yep, something like this I suppose: >=20 > = https://www.tarantool.io/en/doc/2.1/book/box/box_space/#box-space-vspace >=20 > BTW we miss _vsequence documentation. Should be added as well. commit 2faf236c6b45b308ad86fd60f4250fc7af33996d Author: Roman Khabibov Date: Thu May 16 13:15:25 2019 +0300 net.box: fetch '_vcollation' sysview into the module =20 Fetch "_vcollation" sysview to show collation name instead collation = id. =20 Closes #3941 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 =3D internal.decode_greeting local TIMEOUT_INFINITY =3D 500 * 365 * 86400 local VSPACE_ID =3D 281 local VINDEX_ID =3D 289 +local VCOLLATION_ID =3D 277 local DEFAULT_CONNECT_TIMEOUT =3D 10 =20 local IPROTO_STATUS_KEY =3D 0x00 @@ -735,11 +736,16 @@ local function create_transport(host, port, user, = password, callback, end local select1_id =3D new_request_id() local select2_id =3D new_request_id() + local select3_id =3D new_request_id() local response =3D {} -- fetch everything from space _vspace, 2 =3D ITER_ALL encode_select(send_buf, select1_id, VSPACE_ID, 0, 2, 0, = 0xFFFFFFFF, nil) -- fetch everything from space _vindex, 2 =3D ITER_ALL encode_select(send_buf, select2_id, VINDEX_ID, 0, 2, 0, = 0xFFFFFFFF, nil) + -- fetch everything from space _vcollation, 2 =3D ITER_ALL + encode_select(send_buf, select3_id, VCOLLATION_ID, 0, 2, 0, = 0xFFFFFFFF, + nil) + schema_version =3D 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 =3D hdr[IPROTO_SYNC_KEY] - if id =3D=3D select1_id or id =3D=3D select2_id then + if id =3D=3D select1_id or id =3D=3D select2_id or id =3D=3D = select3_id then -- response to a schema query we've submitted local status =3D hdr[IPROTO_STATUS_KEY] local response_schema_version =3D = hdr[IPROTO_SCHEMA_VERSION_KEY] @@ -766,9 +772,10 @@ local function create_transport(host, port, user, = password, callback, body, body_end =3D decode(body_rpos) response[id] =3D 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 =20 -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 =3D {}, self._space_mt, self._index_mt for _, space in pairs(spaces) do local name =3D space[3] @@ -1258,11 +1266,15 @@ function = remote_methods:_install_schema(schema_version, spaces, indices) local pkcollationid =3D index[PARTS][k].collation local pktype =3D index[PARTS][k][2] or = index[PARTS][k].type local pkfield =3D index[PARTS][k][1] or = index[PARTS][k].field + local pkcollation =3D nil + if pkcollationid ~=3D nil then + pkcollation =3D collations[pkcollationid + 1][2] + end =20 local pk =3D { type =3D pktype, fieldno =3D pkfield + 1, - collation_id =3D pkcollationid, + collation =3D pkcollation, is_nullable =3D pknullable } idx.parts[k] =3D pk diff --git a/test/box/net.box.result b/test/box/net.box.result index d02fed7a3..9c516fff5 100644 --- a/test/box/net.box.result +++ b/test/box/net.box.result @@ -2339,14 +2339,14 @@ connected_cnt ... disconnected_cnt --- -- 1 +- 2 ... conn:close() --- ... disconnected_cnt --- -- 2 +- 3 ... test_run:cmd('stop server connecter') --- @@ -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 =3D=3D 0 end, WAI ... box.stat.net.REQUESTS.total --- -- 15 +- 19 ... -- reset box.stat.reset()