Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tml <tarantool-patches@dev.tarantool.org>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [Tarantool-patches] [PATCH 2/6] txn: stop using txn_set_flag
Date: Fri, 22 Jan 2021 16:26:56 +0300	[thread overview]
Message-ID: <20210122132700.272816-3-gorcunov@gmail.com> (raw)
In-Reply-To: <20210122132700.272816-1-gorcunov@gmail.com>

Part-of #5128

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/applier.cc     |  4 ++--
 src/box/memtx_engine.c |  2 +-
 src/box/txn.c          | 13 ++++++-------
 src/box/txn.h          |  2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index 553db76fc..c7c85d329 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -237,7 +237,7 @@ apply_snapshot_row(struct xrow_header *row)
 	 * Do not wait for confirmation when fetching a snapshot.
 	 * Master only sends confirmed rows during join.
 	 */
-	txn_set_flag(txn, TXN_FORCE_ASYNC);
+	txn->flags |= TXN_FORCE_ASYNC;
 	if (txn_begin_stmt(txn, space) != 0)
 		goto rollback;
 	/* no access checks here - applier always works with admin privs */
@@ -308,7 +308,7 @@ apply_final_join_row(struct xrow_header *row)
 	 * Do not wait for confirmation while processing final
 	 * join rows. See apply_snapshot_row().
 	 */
-	txn_set_flag(txn, TXN_FORCE_ASYNC);
+	txn->flags |= TXN_FORCE_ASYNC;
 	if (apply_row(row) != 0) {
 		txn_rollback(txn);
 		fiber_gc();
diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c
index f79f14b4f..f0df3a07d 100644
--- a/src/box/memtx_engine.c
+++ b/src/box/memtx_engine.c
@@ -265,7 +265,7 @@ memtx_engine_recover_snapshot_row(struct memtx_engine *memtx,
 	 * Snapshot rows are confirmed by definition. They don't need to go to
 	 * the synchronous transactions limbo.
 	 */
-	txn_set_flag(txn, TXN_FORCE_ASYNC);
+	txn->flags |= TXN_FORCE_ASYNC;
 	rc = txn_commit(txn);
 	/*
 	 * Don't let gc pool grow too much. Yet to
diff --git a/src/box/txn.c b/src/box/txn.c
index a5edbfc60..32eca02c5 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -282,7 +282,7 @@ txn_begin(void)
 	 * It's a responsibility of an engine to disable yields
 	 * if they are not supported.
 	 */
-	txn_set_flag(txn, TXN_CAN_YIELD);
+	txn->flags |= TXN_CAN_YIELD;
 	return txn;
 }
 
@@ -516,7 +516,7 @@ txn_free_or_wakeup(struct txn *txn)
 	if (txn->fiber == NULL)
 		txn_free(txn);
 	else {
-		txn_set_flag(txn, TXN_IS_DONE);
+		txn->flags |= TXN_IS_DONE;
 		if (txn->fiber != fiber())
 			/* Wake a waiting fiber up. */
 			fiber_wakeup(txn->fiber);
@@ -642,8 +642,7 @@ txn_journal_entry_new(struct txn *txn)
 	 */
 	if (!txn_has_flag(txn, TXN_FORCE_ASYNC)) {
 		if (is_sync) {
-			txn_set_flag(txn, TXN_WAIT_SYNC);
-			txn_set_flag(txn, TXN_WAIT_ACK);
+			txn->flags |= TXN_WAIT_SYNC | TXN_WAIT_ACK;
 		} else if (!txn_limbo_is_empty(&txn_limbo)) {
 			/*
 			 * There some sync entries on the
@@ -652,7 +651,7 @@ txn_journal_entry_new(struct txn *txn)
 			 * doesn't touch sync space (each sync txn
 			 * should be considered as a barrier).
 			 */
-			txn_set_flag(txn, TXN_WAIT_SYNC);
+			txn->flags |= TXN_WAIT_SYNC;
 		}
 	}
 
@@ -994,7 +993,7 @@ txn_can_yield(struct txn *txn, bool set)
 	assert(txn == in_txn());
 	bool could = txn_has_flag(txn, TXN_CAN_YIELD);
 	if (set && !could) {
-		txn_set_flag(txn, TXN_CAN_YIELD);
+		txn->flags |= TXN_CAN_YIELD;
 		trigger_clear(&txn->fiber_on_yield);
 	} else if (!set && could) {
 		txn_clear_flag(txn, TXN_CAN_YIELD);
@@ -1229,6 +1228,6 @@ txn_on_yield(struct trigger *trigger, void *event)
 	assert(txn != NULL);
 	assert(!txn_has_flag(txn, TXN_CAN_YIELD));
 	txn_rollback_to_svp(txn, NULL);
-	txn_set_flag(txn, TXN_IS_ABORTED_BY_YIELD);
+	txn->flags |= TXN_IS_ABORTED_BY_YIELD;
 	return 0;
 }
diff --git a/src/box/txn.h b/src/box/txn.h
index b42249b17..201564000 100644
--- a/src/box/txn.h
+++ b/src/box/txn.h
@@ -491,7 +491,7 @@ txn_init_triggers(struct txn *txn)
 		rlist_create(&txn->on_commit);
 		rlist_create(&txn->on_rollback);
 		rlist_create(&txn->on_wal_write);
-		txn_set_flag(txn, TXN_HAS_TRIGGERS);
+		txn->flags |= TXN_HAS_TRIGGERS;
 	}
 }
 
-- 
2.29.2


  parent reply	other threads:[~2021-01-22 13:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22 13:26 [Tarantool-patches] [PATCH 0/6] txn: drop txn_X_flag helpers Cyrill Gorcunov via Tarantool-patches
2021-01-22 13:26 ` [Tarantool-patches] [PATCH 1/6] txn: convert flags to explicit bitfield Cyrill Gorcunov via Tarantool-patches
2021-01-22 13:26 ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-01-22 13:26 ` [Tarantool-patches] [PATCH 3/6] test/unit: snap_quorum_delay -- stop using txn_set_flag Cyrill Gorcunov via Tarantool-patches
2021-01-30 19:17   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-31 10:40     ` Cyrill Gorcunov via Tarantool-patches
2021-01-22 13:26 ` [Tarantool-patches] [PATCH 4/6] txn: stop using txn_clear_flag Cyrill Gorcunov via Tarantool-patches
2021-01-22 13:26 ` [Tarantool-patches] [PATCH 5/6] txn: stop using txn_has_flag Cyrill Gorcunov via Tarantool-patches
2021-01-30 19:17   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-31 22:13     ` Cyrill Gorcunov via Tarantool-patches
2021-02-03 19:47       ` Vladislav Shpilevoy via Tarantool-patches
2021-02-03 22:02         ` Cyrill Gorcunov via Tarantool-patches
2021-01-22 13:27 ` [Tarantool-patches] [PATCH 6/6] txn: drop unused txn_x_flag helpers Cyrill Gorcunov via Tarantool-patches
2021-01-27 12:08 ` [Tarantool-patches] [PATCH 0/6] txn: drop txn_X_flag helpers Serge Petrenko 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20210122132700.272816-3-gorcunov@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/6] txn: stop using txn_set_flag' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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