From: Cyrill Gorcunov <gorcunov@gmail.com> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: Mons Anderson <v.perepelitsa@corp.mail.ru>, tml <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v4 2/3] cfg: support symbolic evaluation of replication_synchro_quorum Date: Mon, 21 Dec 2020 23:12:20 +0300 [thread overview] Message-ID: <20201221201220.GC81750@grain> (raw) In-Reply-To: <20201221200226.GB81750@grain> On Mon, Dec 21, 2020 at 11:02:26PM +0300, Cyrill Gorcunov wrote: > On Mon, Dec 21, 2020 at 06:48:04PM +0100, Vladislav Shpilevoy wrote: > > > + > > > + if (lua_isnumber(tarantool_L, -1)) > > > + quorum = (int)lua_tonumber(tarantool_L, -1); > > > > 1. There is a small issue: > > > > tarantool> box.cfg{replication_synchro_quorum='4294967297'} > > 2020-12-21 18:33:16.015 [47366] main/103/interactive I> set 'replication_synchro_quorum' configuration option to "4294967297" > > Actually nope. When we pass this value it is treated > as a plain number and cfg_geti trims it :( > > Here is a master branch output > > | tarantool> box.cfg{replication_synchro_quorum=4294967297} > | ... > | 2020-12-21 22:59:00.614 [176552] main/103/interactive I> set 'replication_synchro_quorum' configuration option to 4294967297 > > Note that on master branch I have to pass real numebr not string, > but issue is the same... > > Need to think how to deal with it. I think we might need something like below, but I'm not sure if this won't break backward compatibility... --- [cyrill@grain tarantool.git] git diff diff --git a/src/cfg.c b/src/cfg.c index 46cff1999..f896c6974 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -49,10 +49,18 @@ cfg_geti(const char *param) { cfg_get(param); int val; - if (lua_isboolean(tarantool_L, -1)) + if (lua_isboolean(tarantool_L, -1)) { val = lua_toboolean(tarantool_L, -1); - else - val = lua_tointeger(tarantool_L, -1); + } else { + double dv = lua_tointeger(tarantool_L, -1); + errno = 0; + long long lv = llrint(dv); + if (errno != 0) + panic("cfg_geti('%s') round failed", param); + if (lv > INT_MAX || lv < INT_MIN) + panic("cfg_geti('%s') out of bounds", param); + val = (int)lv; + } lua_pop(tarantool_L, 1); return val; } --- [cyrill@grain tarantool.git] ./src/tarantool Tarantool 2.7.0-112-g4c558a4ba type 'help' for interactive help tarantool> box.cfg{replication_synchro_quorum=4294967297} cfg_geti('replication_synchro_quorum') out of bounds
next prev parent reply other threads:[~2020-12-21 20:12 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-14 11:39 [Tarantool-patches] [PATCH v4 0/3] qsync: evaluate replication_synchro_quorum dynamically Cyrill Gorcunov 2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 1/3] cfg: add cfg_isnumber helper Cyrill Gorcunov 2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 2/3] cfg: support symbolic evaluation of replication_synchro_quorum Cyrill Gorcunov 2020-12-16 13:21 ` Serge Petrenko 2020-12-16 13:35 ` Cyrill Gorcunov 2020-12-17 23:17 ` Vladislav Shpilevoy 2020-12-18 7:25 ` Cyrill Gorcunov 2020-12-20 17:01 ` Vladislav Shpilevoy 2020-12-20 18:28 ` Cyrill Gorcunov 2020-12-21 17:48 ` Vladislav Shpilevoy 2020-12-21 17:49 ` Vladislav Shpilevoy 2020-12-21 20:02 ` Cyrill Gorcunov 2020-12-21 20:12 ` Cyrill Gorcunov [this message] 2020-12-14 11:39 ` [Tarantool-patches] [PATCH v4 3/3] test: add replication/gh-5446-qsync-eval-quorum.test.lua Cyrill Gorcunov 2020-12-16 13:25 ` Serge Petrenko 2020-12-17 23:18 ` Vladislav Shpilevoy 2020-12-18 8:14 ` Cyrill Gorcunov 2020-12-20 17:01 ` Vladislav Shpilevoy 2020-12-20 18:27 ` Cyrill Gorcunov 2020-12-21 16:05 ` Cyrill Gorcunov
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=20201221201220.GC81750@grain \ --to=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.perepelitsa@corp.mail.ru \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v4 2/3] cfg: support symbolic evaluation of replication_synchro_quorum' \ /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