From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0E702469710 for ; Wed, 25 Nov 2020 16:49:29 +0300 (MSK) References: <20201124152405.1174898-1-gorcunov@gmail.com> <20201124152405.1174898-3-gorcunov@gmail.com> <248e1a42-c948-89ca-7894-251583c33246@tarantool.org> <20201125121256.GN875895@grain> <20201125125348.GA1231860@grain> From: Serge Petrenko Message-ID: Date: Wed, 25 Nov 2020 16:49:27 +0300 MIME-Version: 1.0 In-Reply-To: <20201125125348.GA1231860@grain> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH v2 2/3] cfg: support symbolic evaluation of replication_synchro_quorum List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tml , Vladislav Shpilevoy 25.11.2020 15:53, Cyrill Gorcunov пишет: > On Wed, Nov 25, 2020 at 03:46:04PM +0300, Serge Petrenko wrote: >> 25.11.2020 15:12, Cyrill Gorcunov пишет: >>> On Wed, Nov 25, 2020 at 03:04:07PM +0300, Serge Petrenko wrote: >>>> Just noticed. Looks like this diag_set and the one below are ignored: >>>> ``` >>>> tarantool> a=string.rep('n', 1000) >>>> --- >>>> ... >>>> >>>> tarantool> box.cfg{replication_synchro_quorum=a} >>>> --- >>>> - error: 'Incorrect value for option ''replication_synchro_quorum'': the >>>> value must >>>>     be greater than zero and less than maximal number of replicas' >>>> ... >>> Indeed. Actually if you remember I've been using errno for such errors. >>> Now we either should call diag_log() right after diag_set or return >>> errno handling? >> Why? Every time eval returns a value < 0 this means an error. >> Just add a check to check_replication_synchro_quorum. >> eval's return value is ignored here, and diag is rewritten with an unrelated >> error. > iow, you mean something like this? Yep. > --- > static int > box_check_replication_synchro_quorum(void) > { > int quorum = 0; > > if (!cfg_isnumber("replication_synchro_quorum")) { > int value = replicaset.registered_count; > quorum = box_eval_replication_synchro_quorum(value); > --> if (quorum < 0) > --> return -1; > } else { > quorum = cfg_geti("replication_synchro_quorum"); > } > > if (quorum <= 0 || quorum >= VCLOCK_MAX) { > diag_set(ClientError, ER_CFG, "replication_synchro_quorum", > "the value must be greater than zero and less than " > "maximal number of replicas"); > return -1; > } > return quorum; > } > -- Serge Petrenko