[Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms

Serge Petrenko sergepetrenko at tarantool.org
Mon Aug 23 14:32:27 MSK 2021



06.08.2021 02:29, Vladislav Shpilevoy via Tarantool-patches пишет:
> Thanks for the patch!
>
>> diff --git a/src/box/applier.cc b/src/box/applier.cc
>> index f621fa657..9db286ae2 100644
>> --- a/src/box/applier.cc
>> +++ b/src/box/applier.cc
>> @@ -856,7 +856,7 @@ apply_synchro_row_cb(struct journal_entry *entry)
>>   		applier_rollback_by_wal_io(entry->res);
>>   	} else {
>>   		replica_txn_wal_write_cb(synchro_entry->rcb);
>> -		txn_limbo_process(&txn_limbo, synchro_entry->req);
>> +		txn_limbo_process_locked(&txn_limbo, synchro_entry->req);
>>   		trigger_run(&replicaset.applier.on_wal_write, NULL);
>>   	}
>>   	fiber_wakeup(synchro_entry->owner);
>> @@ -867,11 +867,13 @@ static int
>>   apply_synchro_row(uint32_t replica_id, struct xrow_header *row)
>>   {
>>   	assert(iproto_type_is_synchro_request(row->type));
>> +	int rc = 0;
>>   
>>   	struct synchro_request req;
>>   	if (xrow_decode_synchro(row, &req) != 0)
>>   		goto err;
>>   
>> +	txn_limbo_term_lock(&txn_limbo);
> Maybe you should hide the lock from the API. Instead, do similar to
> what transactions do:
>
> 	int txn_limbo_process_begin(limbo *);
> 	void txn_limbo_process_commit(limbo *, request *);
> 	void txn_limbo_process_rollback(limbo *);
>
> begin would take the lock, commit would do the request and
> unlock, rollback would only unlock. Commit and rollback you
> call from apply_synchro_row_cb depend in on the WAL write
> result.
>
> Then the locks would disappear from the API, right?
>
> In the next patch you would make txn_limbo_process_begin()
> also take the request to validate it. Then the 'filtering'
> would become internal to the limbo.

I agree with Vlad here.

txn_limbo_process_begin()/commit()/rollback

looks more clean than calling lock()/unlock() manually.

Let's stick with Vlad's proposal then.

>
>>   	struct replica_cb_data rcb_data;
>>   	struct synchro_entry entry;

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list