Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: alexander.turenko@tarantool.org
Subject: [tarantool-patches] [PATCH] net.box: ignore absence of _vcollation
Date: Mon,  8 Jul 2019 15:13:38 +0300	[thread overview]
Message-ID: <20190708121338.76309-1-roman.habibov@tarantool.org> (raw)

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

 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'
+                    if id == select3_id and string.find(body[IPROTO_ERROR_KEY],
+                                                        err_msg) ~= nil then
+                        break
+                    end
                     return error_sm(E_NO_CONNECTION, body[IPROTO_ERROR_KEY])
                 end
                 if schema_version == nil then
@@ -776,7 +781,7 @@ local function create_transport(host, port, user, password, callback,
         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])
+                 response[select2_id], response[select3_id])
         set_state('active')
         return iproto_sm(schema_version)
     end
@@ -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
+
+
                 idx.parts[k] = pk
             end
             idx.unique = not not index[OPTS].unique
-- 
2.20.1 (Apple Git-117)

             reply	other threads:[~2019-07-08 12:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-08 12:13 Roman Khabibov [this message]
2019-07-12  9:55 ` [tarantool-patches] " Kirill Yukhin
2019-07-19 12:16   ` Roman Khabibov
2019-07-20 19:07   ` Alexander Turenko
2019-07-24 21:27     ` Alexander Turenko
2019-07-24 22:43       ` Vladislav Shpilevoy
2019-07-30 10:58         ` Alexander Turenko
2019-07-30 12:08           ` Konstantin Osipov
2019-07-30 20:18           ` Vladislav Shpilevoy
2019-07-30 22:35             ` Alexander Turenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708121338.76309-1-roman.habibov@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] net.box: ignore absence of _vcollation' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox