[Tarantool-patches] [PATCH 1/2] box: fail in box_check_config() on bad sql cache size

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Mar 20 03:11:02 MSK 2020


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)
>>
> 


More information about the Tarantool-patches mailing list