[Tarantool-patches] [PATCH 3/4] feedback_daemon: send feedback on server start
Serge Petrenko
sergepetrenko at tarantool.org
Fri Apr 2 17:58:02 MSK 2021
Send the first report as soon as instance's initial configuration
finishes.
Closes #5750
---
src/box/lua/feedback_daemon.lua | 2 +-
src/box/lua/load_cfg.lua | 34 ++++++++++++++++++++++-----------
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index d00eedf39..2ce768642 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -345,7 +345,7 @@ local function guard_loop(self)
while true do
if get_fiber_id(self.fiber) == 0 then
- self.fiber = fiber.create(feedback_loop, self)
+ self.fiber = fiber.new(feedback_loop, self)
log.verbose("%s restarted", PREFIX)
end
local st = pcall(fiber.sleep, self.interval)
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 44bb95ed1..885a0cac1 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -626,6 +626,27 @@ setmetatable(box, {
end
})
+-- A trigger on initial box.cfg{} call. Used to perform some checks and
+-- send feedback report once instance is fully configured.
+local function on_initial_config()
+ -- Check if schema version matches Tarantool version and print
+ -- warning if it's not (in case user forgot to call
+ -- box.schema.upgrade()).
+ local needs, schema_version_str = private.schema_needs_upgrade()
+ if needs then
+ local msg = string.format(
+ 'Your schema version is %s while Tarantool %s requires a more'..
+ ' recent schema version. Please, consider using box.'..
+ 'schema.upgrade().', schema_version_str, box.info.version)
+ log.warn(msg)
+ end
+
+ -- Send feedback as soon as instance is configured.
+ if private.feedback_daemon ~= nil then
+ private.feedback_daemon.send()
+ end
+end
+
-- Whether box is loaded.
--
-- `false` when box is not configured or when the initialization
@@ -716,17 +737,8 @@ local function load_cfg(cfg)
box_is_configured = true
- -- Check if schema version matches Tarantool version and print
- -- warning if it's not (in case user forgot to call
- -- box.schema.upgrade()).
- local needs, schema_version_str = private.schema_needs_upgrade()
- if needs then
- local msg = string.format(
- 'Your schema version is %s while Tarantool %s requires a more'..
- ' recent schema version. Please, consider using box.'..
- 'schema.upgrade().', schema_version_str, box.info.version)
- log.warn(msg)
- end
+ on_initial_config()
+
end
box.cfg = locked(load_cfg)
--
2.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list