From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 6C7F445C305 for ; Tue, 8 Dec 2020 00:25:45 +0300 (MSK) References: <20201203140446.66312-1-gorcunov@gmail.com> <20201203140446.66312-3-gorcunov@gmail.com> From: Vladislav Shpilevoy Message-ID: <33204324-de84-c12d-f22a-51659f0b7d20@tarantool.org> Date: Mon, 7 Dec 2020 22:25:43 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v3 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 , tml Cc: Mons Anderson Hi! > 6. > tarantool> box.cfg{replication_synchro_quorum='"1"'} > 2020-12-05 00:49:02.251 [59985] main/103/interactive I> set 'replication_synchro_quorum' configuration option to "\"1\"" > --- > ... > > I gave string "1", but it is accepted. Can it be fixed? > > Why don't I see this log line "update replication_synchro_quorum", > which you use in the test in the next commit? You asked, how to check if the expression is not a number. This diff works on the example above - raises an error. ==================== @@ -577,7 +577,11 @@ eval_replication_synchro_quorum(int nr_replicas) "sqrt = math.sqrt," "fmod = math.fmod," "}})\n" - "return math.floor(f())\n"; + "local res = f()\n" + "if type(res) ~= 'number' then\n" + "error('Expression should return a number')\n" + "end\n" + "return math.floor(res)\n"; char buf[1024]; int value = -1;