[Tarantool-patches] [PATCH v3] txn: convert flags to explicit bitfield

Serge Petrenko sergepetrenko at tarantool.org
Fri Feb 5 10:53:32 MSK 2021



04.02.2021 17:31, Cyrill Gorcunov пишет:
> On Thu, Feb 04, 2021 at 05:01:07PM +0300, Serge Petrenko wrote:
> ...
>>>    	/**
>>>    	 * Synchronous transaction touched sync spaces, or an
>>>    	 * asynchronous transaction blocked by a sync one until it
>>>    	 * is confirmed.
>>>    	 */
>>> -	TXN_WAIT_SYNC,
>>> +	TXN_WAIT_SYNC = 0x10,
>>>    	/**
>>>    	 * Synchronous transaction 'waiting for ACKs' state before
>>>    	 * commit. In this state it waits until it is replicated
>>> @@ -82,14 +82,14 @@ enum txn_flag {
>>>    	 * commit and returns success to a user.
>>>    	 * TXN_WAIT_SYNC is always set, if TXN_WAIT_ACK is set.
>>>    	 */
>>> -	TXN_WAIT_ACK,
>>> +	TXN_WAIT_ACK = 0x20,
>> Since setting `TXN_WAIT_ACK` always implies setting `TXN_WAIT_SYNC`, and
>> when TXN_WAIT_ACK is cleared, TXN_WAIT_SYNC is also cleared, you may
>> define TXN_WAIT_ACK = 0x30 for simplicity.
>> Then setting TXN_WAIT_ACK will set TXN_WAIT_SYNC implicitly. And same for
>> clearing TXN_WAIT_ACK.
> Yes, but this won't get exact match for txn_has_flag, which tests
> for a single bit now. Surely I can setup

Ok, I see. Why not make txn_has_flag check for entire flag then?

>
> 	TXN_WAIT_ACK = 0x20 | TXN_WAIT_SYNC
>
> if you and Vlad agrees.
Let's wait for what Vlad has to say

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list