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

Cyrill Gorcunov gorcunov at gmail.com
Thu Feb 4 17:31:57 MSK 2021


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

	TXN_WAIT_ACK = 0x20 | TXN_WAIT_SYNC

if you and Vlad agrees.


More information about the Tarantool-patches mailing list