From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Alex Khatskevich <avkhatskevich@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 1/3] Update only vshard part of a cfg on reload Date: Mon, 6 Aug 2018 20:03:22 +0300 [thread overview] Message-ID: <1457a321-3ed1-ed05-74c2-e4f8508a0156@tarantool.org> (raw) In-Reply-To: <55486f60-a630-1d19-69e0-5cf99c01f319@tarantool.org> Thanks for the patch! See 3 comments below. > diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua > index 102b942..40216ea 100644 > --- a/vshard/storage/init.lua > +++ b/vshard/storage/init.lua > @@ -1553,18 +1553,19 @@ local function storage_cfg(cfg, this_replica_uuid) > -- > -- If a master role of the replica is not changed, then > -- 'read_only' can be set right here. > - cfg.listen = cfg.listen or this_replica.uri > - if cfg.replication == nil and this_replicaset.master and not is_master then > - cfg.replication = {this_replicaset.master.uri} > + box_cfg.listen = box_cfg.listen or this_replica.uri > + if box_cfg.replication == nil and this_replicaset.master > + and not is_master then > + box_cfg.replication = {this_replicaset.master.uri} > else > - cfg.replication = {} > + box_cfg.replication = {} > end > if was_master == is_master then > - cfg.read_only = not is_master > + box_cfg.read_only = not is_master > end > if type(box.cfg) == 'function' then > - cfg.instance_uuid = this_replica.uuid > - cfg.replicaset_uuid = this_replicaset.uuid > + box_cfg.instance_uuid = this_replica.uuid > + box_cfg.replicaset_uuid = this_replicaset.uuid 1. All these box_cfg manipulations should be done under 'if not is_reload' I think. > else > local info = box.info > if this_replica_uuid ~= info.uuid then > @@ -1607,27 +1610,27 @@ local function storage_cfg(cfg, this_replica_uuid) > local_on_master_enable_prepare() > end > > - local box_cfg = table.copy(cfg) > - lcfg.remove_non_box_options(box_cfg) > - local ok, err = pcall(box.cfg, box_cfg) > - while M.errinj.ERRINJ_CFG_DELAY do > - lfiber.sleep(0.01) > - end > - if not ok then > - M.sync_timeout = old_sync_timeout > - if was_master and not is_master then > - local_on_master_disable_abort() > + if not is_reload then > + local ok, err = true, nil > + ok, err = pcall(box.cfg, box_cfg) 2. Why do you need to announce 'local ok, err' before their usage on the next line? > + while M.errinj.ERRINJ_CFG_DELAY do > + lfiber.sleep(0.01) > end > - if not was_master and is_master then > - local_on_master_enable_abort() > + if not ok then > + M.sync_timeout = old_sync_timeout > + if was_master and not is_master then > + local_on_master_disable_abort() > + end > + if not was_master and is_master then > + local_on_master_enable_abort() > + end > + error(err) > end > - error(err) > + log.info("Box has been configured") > + local uri = luri.parse(this_replica.uri) > + box.once("vshard:storage:1", storage_schema_v1, uri.login, uri.password) > end > > - log.info("Box has been configured") > - local uri = luri.parse(this_replica.uri) > - box.once("vshard:storage:1", storage_schema_v1, uri.login, uri.password) > - > lreplicaset.rebind_replicasets(new_replicasets, M.replicasets) > lreplicaset.outdate_replicasets(M.replicasets) > M.replicasets = new_replicasets > @@ -1874,7 +1877,7 @@ if not rawget(_G, MODULE_INTERNALS) then > rawset(_G, MODULE_INTERNALS, M) > else > reload_evolution.upgrade(M) > - storage_cfg(M.current_cfg, M.this_replica.uuid) > + storage_cfg(M.current_cfg, M.this_replica.uuid, true) 3. I see that you have stored vshard_cfg in M.current_cfg. Not a full config. So it does not have any box options. And it causes a question - why do you need to separate reload from non-reload, if reload anyway in such implementation is like 'box.cfg{}' call with no parameters? And if you do not store box_cfg options how are you going to compare configs when we will implement atomic cfg over cluster? > M.module_version = M.module_version + 1 > end >
next prev parent reply other threads:[~2018-08-06 17:03 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-31 16:25 [tarantool-patches] [PATCH 0/3] multiple routers AKhatskevich 2018-07-31 16:25 ` [tarantool-patches] [PATCH 1/3] Update only vshard part of a cfg on reload AKhatskevich 2018-08-01 18:43 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-03 20:03 ` Alex Khatskevich 2018-08-06 17:03 ` Vladislav Shpilevoy [this message] 2018-08-07 13:19 ` Alex Khatskevich 2018-08-08 11:17 ` Vladislav Shpilevoy 2018-07-31 16:25 ` [tarantool-patches] [PATCH 2/3] Move lua gc to a dedicated module AKhatskevich 2018-08-01 18:43 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-03 20:04 ` Alex Khatskevich 2018-08-06 17:03 ` Vladislav Shpilevoy 2018-08-08 11:17 ` Vladislav Shpilevoy 2018-07-31 16:25 ` [tarantool-patches] [PATCH 3/3] Introduce multiple routers feature AKhatskevich 2018-08-01 18:43 ` [tarantool-patches] " Vladislav Shpilevoy 2018-08-03 20:05 ` Alex Khatskevich 2018-08-06 17:03 ` Vladislav Shpilevoy 2018-08-07 13:18 ` Alex Khatskevich 2018-08-08 12:28 ` Vladislav Shpilevoy 2018-08-08 14:04 ` Alex Khatskevich 2018-08-08 15:37 ` Vladislav Shpilevoy 2018-08-01 14:30 ` [tarantool-patches] [PATCH] Check self arg passed for router objects AKhatskevich 2018-08-03 20:07 ` [tarantool-patches] [PATCH] Refactor config templates AKhatskevich 2018-08-06 15:49 ` [tarantool-patches] " 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=1457a321-3ed1-ed05-74c2-e4f8508a0156@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 1/3] Update only vshard part of a cfg on reload' \ /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