From: Alex Khatskevich <avkhatskevich@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH][vshard] Reload reloadable fiber Date: Tue, 26 Jun 2018 15:43:59 +0300 [thread overview] Message-ID: <0c6f7167-d61d-010e-9ba5-5c08244a5bb9@tarantool.org> (raw) In-Reply-To: <45c2c224-6bfa-c54d-7654-36961a9d1c66@tarantool.org> >> Fixed a problem: >> The `reloadable_fiber_f` was running an infinite where loop and > > 1. What is a 'where loop'? where -> while >> -while test_run:grep_log('router_1', 'Failover has been reloaded') == >> nil do fiber.sleep(0.1) end >> +while test_run:grep_log('router_1', 'Failover has been started') == >> nil do fiber.sleep(0.1) end > > 2. Why? Please, leave the old message. Router already writes that > failover is started in router_cfg. In other places the same. Discussed verbally. After this commit, it is the reloadable fiber's responsibility to write "started" message, it looks like 'Worker_name has been started'. Reloaded message looks like 'Worker_name is reloaded, restarting' >> + -- >> + -- The module is loaded for the first time. >> + -- >> + M = { >> + -- Latest versions of functions. >> + reloadable_fiber_f = nil, >> + errinj = { >> + RELOADABLE_STACK_MAX = nil, > > 3. What is the point of this error injection? It > tests Lua, not VShard, as I think. And it takes > too many lines in the reloadable fiber function > complicating its understanding. So lets remove. deleted >> +-- @param module Module which can be reloaded. >> +-- @param func_name Name of a function to be executed in the >> +-- module. >> +-- @param worker_name Name of the reloadable background subsystem. >> +-- For example: "Garbage Collector", "Recovery", "Discovery", >> +-- "Rebalancer". Used only for an activity logging. >> -- >> -local function reloadable_fiber_f(M, func_name, worker_name) >> - while true do >> - local ok, err = pcall(M[func_name], M.module_version) >> - if not ok then >> - log.error('%s has been failed: %s', worker_name, err) >> - fiber.yield() >> - else >> - log.info('%s has been reloaded', worker_name) >> - fiber.yield() >> +local function reloadable_fiber_f(module, func_name, worker_name) >> + log.info('%s has been started', worker_name) >> + local func = module[func_name] >> + local ok, err = pcall(func, module.module_version) >> + if not ok then >> + log.error('%s has been failed: %s', worker_name, err) >> + if func ~= module[func_name] then >> + log.warn('%s reloadable function %s has changed', >> + worker_name, func_name) >> end >> end >> + fiber.yield() >> + log.info('%s is reloading', worker_name) >> + if M.errinj.RELOADABLE_EXIT then >> + return > > 4. How is this error possible? There are no lines in reloadable_fiber_f > that can terminate the fiber. deleted > > 5. Now on any reload I see two messages: > > started > reloading > started > reloading > > But actually the fiber is started once. Please, return the old > messages. > discussed verbally >> +++ b/test/unit/util.result >> @@ -0,0 +1,107 @@ >> +test_run = require('test_run').new() >> +--- >> +... >> +util = require('vshard.util') >> +--- >> +... >> +test_util = require('util') > > 6. Unused variable? deleted
next prev parent reply other threads:[~2018-06-26 12:44 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-14 11:42 [tarantool-patches] " AKhatskevich 2018-06-14 11:58 ` AKhatskevich 2018-06-21 12:04 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-26 12:43 ` Alex Khatskevich [this message] 2018-06-26 12:50 ` Alex Khatskevich 2018-06-27 9:54 ` Vladislav Shpilevoy 2018-06-27 10:44 ` Alex Khatskevich 2018-06-27 11:34 ` Vladislav Shpilevoy 2018-06-27 11:45 ` Alex Khatskevich 2018-06-27 11:53 ` Vladislav Shpilevoy 2018-06-27 13:11 ` Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=0c6f7167-d61d-010e-9ba5-5c08244a5bb9@tarantool.org \ --to=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH][vshard] Reload reloadable fiber' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox