[Tarantool-patches] [PATCH v4 09/16] box: split promote() into reasonable parts

Sergey Petrenko sergepetrenko at tarantool.org
Thu Jul 29 23:46:45 MSK 2021


27.07.2021 02:44, Vladislav Shpilevoy пишет:
> Thanks for the fixes!
>
>> diff --git a/src/box/box.cc b/src/box/box.cc
>> index 85fac08bb..d83c30918 100644
>> --- a/src/box/box.cc
>> +++ b/src/box/box.cc
>> @@ -1527,6 +1527,140 @@ box_wait_quorum(uint32_t lead_id, int64_t target_lsn, int quorum,
> <...>
>
>> +
>> +/**
>> + * A helper to wait until all limbo entries are ready to be confirmed, i.e.
>> + * written to WAL and have gathered a quorum of ACKs from replicas.
>> + * Return lsn of the last limbo entry on success, -1 on error.
>> + */
>> +static int64_t
>> +box_wait_limbo_acked(void)
>> +{
>> +	if (txn_limbo_is_empty(&txn_limbo))
>> +		return txn_limbo.confirmed_lsn;
>> +
>> +	uint64_t promote_term = txn_limbo.promote_greatest_term;
>> +	int quorum = replication_synchro_quorum;
>> +	struct txn_limbo_entry *last_entry;
>> +	last_entry = txn_limbo_last_synchro_entry(&txn_limbo);
>> +	/* Wait for the last entries WAL write. */
>> +	if (last_entry->lsn < 0) {
>> +		int64_t tid = last_entry->txn->id;
>> +
>> +		if (wal_sync(NULL) < 0)
> Could you please make it `!= 0`? To be consistent with the
> other places and to emphasize the result is binary - either an
> error or success.

Sure, fixed. I didn't touch it at first because it had "< 0"
even before my patchset.





More information about the Tarantool-patches mailing list