Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH] txn: convert flags to explicit bitfield
Date: Thu, 18 Feb 2021 00:45:56 +0300	[thread overview]
Message-ID: <YC2OlDido/bCoQTS@grain> (raw)
In-Reply-To: <21a79be2-2af3-9eab-588f-c110aecfd0b6@tarantool.org>

On Wed, Feb 17, 2021 at 10:15:30PM +0100, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
> > @@ -535,7 +535,7 @@ txn_complete_fail(struct txn *txn)
> >  		txn_rollback_one_stmt(txn, stmt);
> >  	if (txn->engine != NULL)
> >  		engine_rollback(txn->engine, txn);
> > -	if (txn_has_flag(txn, TXN_HAS_TRIGGERS))
> > +	if (txn->flags & TXN_HAS_TRIGGERS)
> 1. Did you do a self-review before sending this? Can you
> tell yourself what is wrong here?

Yes I did, and I don't get what's wrong with this line? Previously
we have `if (txn_has_flag(txn, TXN_HAS_TRIGGERS))` where txn_has_flag
get expanded to

	return (txn->flags & TXN_HAS_TRIGGERS) != 0;

so where is an error?

> 2. What was wrong with the idea of having the helpers
> but operating on bitfields? And having has_flags() instead
> of has_flag() to check presense of all specified flags +
> clear_flags() to remove all specified flags.
> I don't understand. I think we discussed it already 2 or 3
> times and all seemed to agree?

The initial idea was to operate with flags directly, you pointed
that lines of code as if (!(txn->flags & mask)) violates our
code style. Then we thought of renaming the helpers to txn_x_flags
to operate with multiple flags, which lead us to a vague moment --
it is unclear how exactly txn_has_flag should operate: exact
matching or any matching?

Finlly I simply moved back to direct access to the fields
with explicit `!= 0` or `== 0` form.

  reply	other threads:[~2021-02-17 21:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 14:01 Cyrill Gorcunov via Tarantool-patches
2021-02-17 21:15 ` Vladislav Shpilevoy via Tarantool-patches
2021-02-17 21:45   ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-02-18  8:32     ` Cyrill Gorcunov via Tarantool-patches
2021-02-23 21:37       ` Vladislav Shpilevoy via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YC2OlDido/bCoQTS@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] txn: convert flags to explicit bitfield' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox