From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DF5F7469710 for ; Wed, 25 Nov 2020 15:53:51 +0300 (MSK) Received: by mail-lf1-f65.google.com with SMTP id s27so2976097lfp.5 for ; Wed, 25 Nov 2020 04:53:51 -0800 (PST) Date: Wed, 25 Nov 2020 15:53:48 +0300 From: Cyrill Gorcunov Message-ID: <20201125125348.GA1231860@grain> References: <20201124152405.1174898-1-gorcunov@gmail.com> <20201124152405.1174898-3-gorcunov@gmail.com> <248e1a42-c948-89ca-7894-251583c33246@tarantool.org> <20201125121256.GN875895@grain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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: Serge Petrenko Cc: tml , Vladislav Shpilevoy 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? --- 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; }