[Tarantool-patches] [PATCH v2 2/8] txn_limbo: fix promote term filtering

Serge Petrenko sergepetrenko at tarantool.org
Fri Jun 18 11:55:54 MSK 2021



18.06.2021 01:05, Cyrill Gorcunov пишет:
> On Fri, Jun 18, 2021 at 12:07:36AM +0300, Serge Petrenko wrote:
>> txn_limbo_process() used to filter out promote requests whose term was
>> equal to the greatest term seen. This wasn't correct for PROMOTE entries
>> with term 1.
> ...
>> +	if (term > limbo->promote_greatest_term) {
>> +		limbo->promote_greatest_term = term;
>> +	} else if (req->type == IPROTO_PROMOTE &&
>> +		   limbo->promote_greatest_term > 1) {
>> +		/* PROMOTE for outdated term. Ignore. */
>> +		say_info("RAFT: ignoring PROMOTE request from instance "
>> +			 "id %"PRIu32" for term %"PRIu64". Greatest term seen "
>> +			 "before (%"PRIu64") is bigger.", origin, term,
>> +			 limbo->promote_greatest_term);
>> +		return;
>>   	}
> Serge, please don't use PRIx helper, they are completely unreadable.
> As far as I remember we agreed to use %llu with explicit long long
> conversion. Ie
>
> 	say_info("RAFT: ignoring PROMOTE request from instance "
> 		 "id %u for term %lld . Greatest term seen "
> 		 "before (%llu) is bigger.", origin, (long long)term,
> 		 (long long)limbo->promote_greatest_term);
>
> surely we can fix it on top of the series.

Ok, sure. I thought this was fine. Let's change.

================================

diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index a5d1df00c..e91782b40 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -674,9 +674,9 @@ txn_limbo_process(struct txn_limbo *limbo, const 
struct synchro_request *req)
                    limbo->promote_greatest_term > 1) {
                 /* PROMOTE for outdated term. Ignore. */
                 say_info("RAFT: ignoring PROMOTE request from instance "
-                        "id %"PRIu32" for term %"PRIu64". Greatest term 
seen "
-                        "before (%"PRIu64") is bigger.", origin, term,
-                        limbo->promote_greatest_term);
+                        "id %u for term %llu. Greatest term seen "
+                        "before (%llu) is bigger.", origin, (long 
long)term,
+                        (long long)limbo->promote_greatest_term);
                 return;
         }



================================

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list