Skip to content

Commit

Permalink
mkversion: drop the module
Browse files Browse the repository at this point in the history
Since the issue tarantool#10521 introduced new public `version` module,
`internal.mkversion` is not needed anymore.

All functions, which are not inside the `version` module are exported to
the `box.internal` now. `mkversion` is replaced with `version`.

Follow-up tarantool#10521

NO_DOC=internal
NO_CHANGELOG=internal
  • Loading branch information
Serpentian authored and Totktonada committed Nov 25, 2024
1 parent 4667337 commit e72608f
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 170 deletions.
2 changes: 1 addition & 1 deletion src/box/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ lua_source(lua_sources lua/xlog.lua xlog_lua)
lua_source(lua_sources lua/key_def.lua key_def_lua)
lua_source(lua_sources lua/merger.lua merger_lua)
lua_source(lua_sources lua/iproto.lua iproto_lua)
lua_source(lua_sources lua/mkversion.lua mkversion_lua)
lua_source(lua_sources lua/version.lua internal_version_lua)

# {{{ config
lua_source(lua_sources lua/config/applier/app.lua config_applier_app_lua)
Expand Down
18 changes: 10 additions & 8 deletions src/box/lua/config/applier/box_cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local log = require('internal.config.utils.log')
local instance_config = require('internal.config.instance_config')
local snapshot = require('internal.config.utils.snapshot')
local schedule_task = fiber._internal.schedule_task
local mkversion = require('internal.mkversion')
local version = require('version')
local tarantool = require('tarantool')
local clock = require('clock')

Expand Down Expand Up @@ -399,9 +399,9 @@ local function names_schema_upgrade_on_replace(old, new)
return
end

local expected_version = mkversion(2, 11, 5)
local old_version = mkversion.from_tuple(old)
local new_version = mkversion.from_tuple(new)
local expected_version = version.new(2, 11, 5)
local old_version = box.internal.version_from_tuple(old)
local new_version = box.internal.version_from_tuple(new)
if old_version < expected_version and new_version >= expected_version then
-- We cannot do it inside on_replace trigger, as the version
-- is not considered set yet and we may try to set names, when
Expand Down Expand Up @@ -472,7 +472,8 @@ local function names_apply(config, missing_names, schema_version)
names_alert_missing(config, missing_names)
-- Don't wait for box.status to change, we may be already rw, set names
-- on reload, if it's possible and needed.
if schema_version and schema_version >= mkversion.get_latest() then
if schema_version and
schema_version >= box.internal.latest_dd_version() then
names_try_set_missing()
end

Expand All @@ -486,7 +487,7 @@ local function names_apply(config, missing_names, schema_version)

-- Wait for rw state and schema 2.11.5 to apply names. If schema version
-- is nil, bootstrap is going to be done.
if schema_version and schema_version < mkversion(2, 11, 5) then
if schema_version and schema_version < version.new(2, 11, 5) then
box.space._schema:on_replace(names_schema_upgrade_on_replace)
names_state.is_upgrade_wait = true
else
Expand All @@ -499,7 +500,8 @@ end
local function get_schema_version_before_cfg(config)
local snap_path = snapshot.get_path(config._configdata._iconfig_def)
if snap_path ~= nil then
return mkversion.from_tuple(snapshot.get_schema_version(snap_path))
local tuple = snapshot.get_schema_version(snap_path)
return box.internal.version_from_tuple(tuple)
end
-- Bootstrap, config not found
return nil
Expand Down Expand Up @@ -849,7 +851,7 @@ local function apply(config)
end)
else
-- Note, that we try to find new missing names on every reload.
names_apply(config, missing_names, mkversion.get())
names_apply(config, missing_names, box.internal.dd_version())
end
end

Expand Down
6 changes: 2 additions & 4 deletions src/box/lua/config/applier/box_status.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local mkversion = require('internal.mkversion')

local box_status_state = {
watcher = nil,
}
Expand Down Expand Up @@ -29,8 +27,8 @@ local function drop_schema_version_alert()
end

local function check_schema_version()
local current_version = mkversion.get()
local latest_version = mkversion.get_latest()
local current_version = box.internal.dd_version()
local latest_version = box.internal.latest_dd_version()
if current_version < latest_version then
set_schema_version_alert(current_version, latest_version)
else
Expand Down
14 changes: 7 additions & 7 deletions src/box/lua/config/applier/credentials.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local log = require('internal.config.utils.log')
local loaders = require('internal.loaders')
local digest = require('digest')
local fiber = require('fiber')
local mkversion = require('internal.mkversion')
local version = require('version')

-- Var is set with the first apply() call.
local config
Expand Down Expand Up @@ -669,9 +669,9 @@ local schema_is_upgraded = false
-- the current tarantool version.
local schema_is_upgraded_cond

local function update_schema_upgraded_status(version)
local schema_version = version or mkversion.get()
schema_is_upgraded = schema_version >= mkversion(2, 11, 1)
local function update_schema_upgraded_status(current_version)
local schema_version = current_version or box.internal.dd_version()
schema_is_upgraded = schema_version >= version.new(2, 11, 1)

if schema_is_upgraded then
assert(schema_is_upgraded_cond ~= nil)
Expand All @@ -685,9 +685,9 @@ local function on_schema_replace_trigger(old, new)
return
end

local expected_version = mkversion(2, 11, 1)
local old_version = mkversion.from_tuple(old)
local new_version = mkversion.from_tuple(new)
local expected_version = version.new(2, 11, 1)
local old_version = box.internal.version_from_tuple(old)
local new_version = box.internal.version_from_tuple(new)
if old_version < expected_version and new_version >= expected_version then
box.on_commit(function()
update_schema_upgraded_status(new_version)
Expand Down
4 changes: 2 additions & 2 deletions src/box/lua/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extern char session_lua[],
#endif
net_box_lua[],
net_replicaset_lua[],
mkversion_lua[],
internal_version_lua[],
upgrade_lua[],
console_lua[],
merger_lua[],
Expand Down Expand Up @@ -227,7 +227,7 @@ static const char *lua_sources[] = {
SECURITY_BOX_LUA_MODULES
INTEGRITY_BOX_LUA_MODULES
"box/xlog", "xlog", xlog_lua,
"box/mkversion", "internal.mkversion", mkversion_lua,
"box/version", NULL, internal_version_lua,
"box/upgrade", NULL, upgrade_lua,
"box/net_box", "net.box", net_box_lua,
"box/net_replicaset", "internal.net.replicaset", net_replicaset_lua,
Expand Down
4 changes: 2 additions & 2 deletions src/box/lua/load_cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ local math = require('math')
local fiber = require('fiber')
local fio = require('fio')
local compat = require('compat')
local mkversion = require('internal.mkversion')

local function nop() end

Expand Down Expand Up @@ -1212,7 +1211,8 @@ local function load_cfg(cfg)
local msg = string.format(
'Your schema version is %s while Tarantool %s requires a more'..
' recent schema version. Please, consider using box.'..
'schema.upgrade().', tostring(mkversion.get()), box.info.version)
'schema.upgrade().', tostring(box.internal.dd_version()),
box.info.version)
log.warn(msg)
end
end
Expand Down
80 changes: 0 additions & 80 deletions src/box/lua/mkversion.lua

This file was deleted.

Loading

0 comments on commit e72608f

Please sign in to comment.