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 B168D25935 for ; Fri, 12 Jul 2019 05:55:53 -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 bBkhLMGqLzPt for ; Fri, 12 Jul 2019 05:55:53 -0400 (EDT) Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (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 089EB20ED5 for ; Fri, 12 Jul 2019 05:55:52 -0400 (EDT) Date: Fri, 12 Jul 2019 12:55:49 +0300 From: Kirill Yukhin Subject: [tarantool-patches] Re: [PATCH] net.box: ignore absence of _vcollation Message-ID: <20190712095549.ac4hhaxhxzgaik5i@tarantool.org> References: <20190708121338.76309-1-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190708121338.76309-1-roman.habibov@tarantool.org> 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: alexander.turenko@tarantool.org Hello, On 08 Jul 15:13, Roman Khabibov wrote: > Ignore error about absence of _vcollation, when a client connects > to a server of old Tarantool versions, where this space does not > exist. > > Closes #4307 > --- > Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-4307-vcoll > Issue: https://github.com/tarantool/tarantool/issues/4307 Add a regression test please. > > src/box/lua/net_box.lua | 33 +++++++++++++++++++++++++-------- > 1 file changed, 25 insertions(+), 8 deletions(-) > > diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua > index 2892bb3d3..723e63045 100644 > --- a/src/box/lua/net_box.lua > +++ b/src/box/lua/net_box.lua > @@ -761,6 +761,11 @@ local function create_transport(host, port, user, password, callback, > if status ~= 0 then > local body > body, body_end = decode(body_rpos) > + local err_msg = 'Space \'277\' does not exist' Space 277? Seriously? This code handles not only collations request. Should be more generic, IMHO. > @@ -1270,16 +1275,28 @@ function remote_methods:_install_schema(schema_version, spaces, indices, > 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 > + if pkcollationid ~= nil and collations ~= nil then > pkcollation = collations[pkcollationid + 1][2] > end > > - local pk = { > - type = pktype, > - fieldno = pkfield + 1, > - collation = pkcollation, > - is_nullable = pknullable > - } > + local pk > + if collations ~= nil then > + pk = { > + type = pktype, > + fieldno = pkfield + 1, > + collation = pkcollation, > + is_nullable = pknullable > + } > + else > + pk = { > + type = pktype, > + fieldno = pkfield + 1, > + collation_id = pkcollationid, > + is_nullable = pknullable > + } > + end IMHO, it'd be better to not duplicate code and put actual difference under if-then-else hammock. -- Regards, Kirill Yukhin