From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (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 26EDF469719 for ; Fri, 6 Mar 2020 00:17:20 +0300 (MSK) References: <4bfd55d1ec53a21acd83114ea6bef36c6345c038.1583366981.git.v.shpilevoy@tarantool.org> <20200305113518.GD9655@tarantool.org> <76fb8ee1-d34c-0060-6ef0-93b182feb688@tarantool.org> <20200305210029.GA12214@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Thu, 5 Mar 2020 22:17:17 +0100 MIME-Version: 1.0 In-Reply-To: <20200305210029.GA12214@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 1/2] box: fail in box_check_config() on bad sql cache size List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org On 05/03/2020 22:00, Nikita Pettik wrote: > On 05 Mar 21:53, Vladislav Shpilevoy wrote: >> Hi! Thanks for the review! >> >> On 05/03/2020 12:35, Nikita Pettik wrote: >>> On 05 Mar 01:14, Vladislav Shpilevoy wrote: >>>> It was calling box_check_sql_cache_size() assuming that it >>>> throws. But it returns 0/-1. >>>> --- >>>> src/box/box.cc | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/src/box/box.cc b/src/box/box.cc >>>> index 09dd67ab4..0212f34ad 100644 >>>> --- a/src/box/box.cc >>>> +++ b/src/box/box.cc >>>> @@ -669,7 +669,8 @@ box_check_config() >>>> box_check_memtx_memory(cfg_geti64("memtx_memory")); >>>> box_check_memtx_min_tuple_size(cfg_geti64("memtx_min_tuple_size")); >>>> box_check_vinyl_options(); >>>> - box_check_sql_cache_size(cfg_geti("sql_cache_size")); >>>> + if (box_check_sql_cache_size(cfg_geti("sql_cache_size")) != 0) >>>> + diag_raise(); >>>> } >>> >>> Is it possible to test this scenario: box.sql_cache_size is set to >>> incorrect value but box.internal:cfg_check() doesn't verify it? >>> I mean supply this patch with test case. If it turns out to be >>> too complicated, then nevermind. LGTM otherwise. >> >> It is not testable. Sql_cache_size is always set from >> box_set_prepared_stmt_cache_size(), on first and all >> next configurations, and is always checked for returned >> value. > > Ok, then mb it would be better to check rc in assertion > instead of diag_raise().. (since it can't fail here anyway)? > It can fail in box_check_config(). But the error won't be different from checking it later during set.