[Tarantool-patches] [PATCH v2 4/9] box: make clear_synchro_queue() write a PROMOTE entry instead of CONFIRM + ROLLBACK

Serge Petrenko sergepetrenko at tarantool.org
Wed Apr 14 11:23:23 MSK 2021



13.04.2021 17:33, Cyrill Gorcunov пишет:
> On Mon, Apr 12, 2021 at 10:40:17PM +0300, Serge Petrenko wrote:
>>   		} else {
>> -			txn_limbo_force_empty(&txn_limbo, wait_lsn);
>> +			/*
>> +			 * Term parameter is unused now, We'll pass
>> +			 * box_raft()->term there later.
>> +			 */
>> +			txn_limbo_write_promote(&txn_limbo, wait_lsn, 0);
>> +			struct synchro_request req = {
>> +				.type = 0, /* unused */
>> +				.replica_id = 0, /* unused */
>> +				.origin_id = instance_id,
>> +				.lsn = wait_lsn,
>> +				.term = 0, /* unused */
>> +			};
> Is there some particular meaning of zeroifying designated assignments?
> I mean why not simply
>
> 			struct synchro_request req = {
> 				.origin_id	= instance_id,
> 				.lsn		= wait_lsn,
> 			};
>
> or you wanted to pay attention that the left of the fields are
> unused? Just curious, I'm fine with current code.

I went for your option at first, and it's the one I'd prefer.
But with it I got failed builds in some CI jobs.

It said something like "sorry, not yet implemented: struct partial
initialization"

Maybe the error was there because I initialize not the first
struct members. It's strange, because we use such "partial initializations"
in some other places IIRC.

Anyway, zeroifying unused fields explicitly helped.

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list