[Tarantool-patches] [PATCH 1/2] box: allow schema upgrades within a release
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sun Mar 22 22:43:37 MSK 2020
Thanks for the patch!
On 19/03/2020 10:14, Chris Sosnin wrote:
> To avoid cases when a user has an incorrectly upgraded schema, we
> introduce new versioning, which can be used to perform upgrades
> within a single release.
>
> Closes #4804
> Needed for #4666
> ---
> src/box/lua/upgrade.lua | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
> index 075cc236e..92c3b460e 100644
> --- a/src/box/lua/upgrade.lua
> +++ b/src/box/lua/upgrade.lua
> @@ -27,12 +27,14 @@ local mkversion = {}
> mkversion.__index = mkversion
> setmetatable(mkversion, {__call = function(c, ...) return c.new(...) end})
>
> -function mkversion.new(major, minor, patch)
> +function mkversion.new(major, minor, patch, build)
> local self = setmetatable({}, mkversion)
> self.major = major
> self.minor = minor
> self.patch = patch
> + self.build = build or 0
> self.id = bit.bor(bit.lshift(bit.bor(bit.lshift(major, 8), minor), 8), patch)
> + self.id = bit.bor(bit.lshift(self.id, 8), self.build)
> return self
> end
Since we don't update mkversion.__tostring(), user during upgrade
will see his logs as
> set schema version to 2.3.1
> set schema version to 2.3.1
> set schema version to 2.3.1
... depending on how many schema versions we have within
release.
Perhaps, it is worth adding the build version to __tostring()
method. So as not to confuse the user, and simplify debug so
as user could tell between which builds the upgrade failed.
It does not affect version visibility - box.info.version() is
reported differently.
More information about the Tarantool-patches
mailing list