[Tarantool-patches] [PATCH v2 06/10] raft: introduce box.cfg.raft_* options

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Sep 8 01:55:05 MSK 2020


Thanks for the review!

>> diff --git a/src/box/box.cc b/src/box/box.cc
>> index 281917af2..5f04a1a78 100644
>> --- a/src/box/box.cc
>> +++ b/src/box/box.cc
>> @@ -472,6 +472,40 @@ box_check_uri(const char *source, const char *option_name)
>>       }
>>   }
>>   +static int
>> +box_check_raft_is_enabled(void)
>> +{
>> +    int b = cfg_getb("raft_is_enabled");
>> +    if (b < 0) {
>> +        diag_set(ClientError, ER_CFG, "raft_is_enabled",
>> +             "the value must be a boolean");
>> +    }
>> +    return b;
>> +}
>> +
>> +static int
>> +box_check_raft_is_candidate(void)
>> +{
>> +    int b = cfg_getb("raft_is_candidate");
>> +    if (b < 0) {
>> +        diag_set(ClientError, ER_CFG, "raft_is_candidate",
>> +             "the value must be a boolean");
>> +    }
>> +    return b;
>> +}
>> +
>> +static double
>> +box_check_raft_election_timeout(void)
>> +{
>> +    double d = cfg_getd("raft_election_timeout");
>> +    if (d == 0) {
> 
> Should be "d <= 0" here?
> 
> Otherwise you end up with a diag_raise without appropriate diag_set
> when raft_election_timeout is negative.

Yes, this is a typo:

====================
diff --git a/src/box/box.cc b/src/box/box.cc
index 5f04a1a78..5c87d86d7 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -498,7 +498,7 @@ static double
 box_check_raft_election_timeout(void)
 {
 	double d = cfg_getd("raft_election_timeout");
-	if (d == 0) {
+	if (d <= 0) {
 		diag_set(ClientError, ER_CFG, "raft_election_timeout",
 			 "the value must be a positive number");
 		return -1;


More information about the Tarantool-patches mailing list