From: Sergey Ostanevich <sergos@tarantool.org> To: Sergey Voinov <sergeiv@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH] Check schema version after tarantool update Date: Tue, 14 Jan 2020 15:11:45 +0300 [thread overview] Message-ID: <20200114121145.GA547@tarantool.org> (raw) In-Reply-To: <20191211144858.18223-1-sergeiv@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
prev parent reply other threads:[~2020-01-14 12:11 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-11 14:48 Sergey Voinov 2020-01-14 12:11 ` Sergey Ostanevich [this message]
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=20200114121145.GA547@tarantool.org \ --to=sergos@tarantool.org \ --cc=sergeiv@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] Check schema version after tarantool update' \ /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