[Tarantool-patches] [PATCH] Check schema version after tarantool update
Sergey Ostanevich
sergos at tarantool.org
Tue Jan 14 15:11:45 MSK 2020
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
More information about the Tarantool-patches
mailing list