From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (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 95B33469719 for ; Thu, 19 Mar 2020 12:15:18 +0300 (MSK) From: Chris Sosnin Date: Thu, 19 Mar 2020 12:14:47 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/2] box: allow schema upgrades within a release List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, korablev@tarantool.org, tarantool-patches@dev.tarantool.org 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 @@ -982,8 +984,9 @@ local function get_version() local major = version[2] local minor = version[3] local patch = version[4] or 0 + local build = version[5] or 0 - return mkversion(major, minor, patch) + return mkversion(major, minor, patch, build) end local function upgrade(options) @@ -1025,7 +1028,8 @@ local function upgrade(options) box.space._schema:replace({'version', handler.version.major, handler.version.minor, - handler.version.patch}) + handler.version.patch, + handler.version.build}) ::continue:: end end -- 2.21.1 (Apple Git-122.3)