Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/2] box: fail in box_check_config() on bad sql cache size
Date: Fri, 20 Mar 2020 01:11:02 +0100	[thread overview]
Message-ID: <af89a1da-55d1-3e66-00a5-8eee48471a58@tarantool.org> (raw)
In-Reply-To: <20200319152752.GM6392@tarantool.org>

Thanks for the review!

On 19/03/2020 16:27, Igor Munkin wrote:
> Vlad,
> 
> Thanks for the patch, LGTM.
> 
> On 05.03.20, 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)
> 
> Side note: I'm just curious what are the rationale to use '!= 0' here
> and '< 0' nearby in the following patch.

box_check_sql_cache_size() returns 0/-1.

box_check_memory_quota() returns -1/size.

So for 0/-1 I used a more or less commonly used way of
checking for an error when a function returns these 2 values.

For box_check_memory_quota() I used < 0, because != 0
does not mean an error here.

> 
>> +		diag_raise();
>>  }
>>  
>>  /*
>> -- 
>> 2.21.1 (Apple Git-122.3)
>>
> 

  reply	other threads:[~2020-03-20  0:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  0:14 [Tarantool-patches] [PATCH 0/2] box.cfg() check memtx/vinyl_memory Vladislav Shpilevoy
2020-03-05  0:14 ` [Tarantool-patches] [PATCH 1/2] box: fail in box_check_config() on bad sql cache size Vladislav Shpilevoy
2020-03-05 11:35   ` Nikita Pettik
2020-03-05 20:53     ` Vladislav Shpilevoy
2020-03-05 21:00       ` Nikita Pettik
2020-03-05 21:17         ` Vladislav Shpilevoy
2020-03-19 15:27   ` Igor Munkin
2020-03-20  0:11     ` Vladislav Shpilevoy [this message]
2020-03-05  0:14 ` [Tarantool-patches] [PATCH 2/2] box: on cfg properly check memory quota Vladislav Shpilevoy
2020-03-05 11:41   ` Nikita Pettik
2020-03-20 13:56 ` [Tarantool-patches] [PATCH 0/2] box.cfg() check memtx/vinyl_memory Nikita Pettik

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=af89a1da-55d1-3e66-00a5-8eee48471a58@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] box: fail in box_check_config() on bad sql cache size' \
    /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