From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5C87046970E for ; Tue, 14 Jan 2020 15:11:47 +0300 (MSK) Date: Tue, 14 Jan 2020 15:11:45 +0300 From: Sergey Ostanevich Message-ID: <20200114121145.GA547@tarantool.org> References: <20191211144858.18223-1-sergeiv@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191211144858.18223-1-sergeiv@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] Check schema version after tarantool update List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Voinov Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! > + > + --- Check if schema version matches Tarantool version > + --- and print warning if it's not (in case user forgot to call box.schema.upgrade()) > + local version = box.space._schema:get{'version'} > + if version ~= nil then > + local major = version[2] > + local minor = version[3] > + local patch = version[4] or 0 > + local schema_version = string.format("%s.%s.%s", major, minor, patch) > + local tarantool_version = box.info.version > + -- Versions are considered identical > + -- if Tarantool version starts with schema version substring > + local version_match = tarantool_version:sub(1, #schema_version) == schema_version This is apparently wrong, since according to the src/box/lua/upgrade.lua:973 Tarantool of version 1.10.5 (latest release) has no corresponding upgrade procedure beyond 1.10.2. Hence, the schema version will be inconsistent in your check. > + if not version_match then > + --- Print the warning > + local msg = string.format( > + "Schema version %s doesn't match Tarantool version %s " .. > + "(consider using box.schema.upgrade())", > + schema_version, tarantool_version) > + log.warn(msg) > + end > + end > end > box.cfg = locked(load_cfg) Regards, Sergos