Skip to content
Snippets Groups Projects
Commit 06edcbe1 authored by Alexander Turenko's avatar Alexander Turenko Committed by Kirill Yukhin
Browse files

net.box: fix fetching of schema of an old version

After 2.2.0-633-gaa0964ae1 ('net.box: fix schema fetching from 1.10/2.1
servers') net.box expects that _vcollation system view exists on a
tarantool server of 2.2.1+ version. This is however not always so: a
server may be run on a new version of tarantool, but work on a schema of
an old version.

The situation with non last schema is usual for replication cluster in
process of upgrading: all instances run on the new version of tarantool
first (no auto-upgrade is performed by tarantools in a cluster). Then
box.schema.upgrade() should be called, but the instances should be
operable even before the call.

Before the commit net.box was unable to connect a server if it is run on
a schema without _vcollation system view (say, 2.1.3), but the server
executable is of 2.2.1 version or newer.

Note: I trim tests from the commit to polish them a bit more, but
include the fix itself to 2.4.1 release.

Follows up #4307
Fixes #4691
parent 335f80a0
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,7 @@ local E_UNKNOWN = box.error.UNKNOWN
local E_NO_CONNECTION = box.error.NO_CONNECTION
local E_TIMEOUT = box.error.TIMEOUT
local E_PROC_LUA = box.error.PROC_LUA
local E_NO_SUCH_SPACE = box.error.NO_SUCH_SPACE
-- utility tables
local is_final_state = {closed = 1, error = 1}
......@@ -803,6 +804,13 @@ local function create_transport(host, port, user, password, callback,
local status = hdr[IPROTO_STATUS_KEY]
local response_schema_version = hdr[IPROTO_SCHEMA_VERSION_KEY]
if status ~= 0 then
-- No _vcollation space (server has an old
-- schema version).
local errno = band(status, IPROTO_ERRNO_MASK)
if id == select3_id and errno == E_NO_SUCH_SPACE then
peer_has_vcollation = false
goto continue
end
local body
body, body_end = decode(body_rpos)
return error_sm(E_NO_CONNECTION, body[IPROTO_ERROR_KEY])
......@@ -817,6 +825,7 @@ local function create_transport(host, port, user, password, callback,
body, body_end = decode(body_rpos)
response[id] = body[IPROTO_DATA_KEY]
end
::continue::
until response[select1_id] and response[select2_id] and
(not peer_has_vcollation or response[select3_id])
-- trick: response[select3_id] is nil when the key is nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment