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/3] txn_limbo: simplify owner migration condition
Date: Mon, 19 Apr 2021 11:37:18 +0300	[thread overview]
Message-ID: <20210419083719.29689-3-gorcunov@gmail.com> (raw)
In-Reply-To: <20210419083719.29689-1-gorcunov@gmail.com>

When limbo owner is about to change the state we should check
if there are some pending transactions which are not yet processed,
iow if queue is empty. No need to test if current limbo owner
is zero. The owner is set to zero once -- when limbo is created
during initialization.

After all I think even if owner would ever zero and we're about
to change it the queue simply must be empty, that is the only
safe state.

Acked-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/txn_limbo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index addcb0f97..2a10bd0ae 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -94,8 +94,7 @@ txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn)
 		id = instance_id;
 	bool make_ro = false;
 	if (limbo->owner_id != id) {
-		if (limbo->owner_id == REPLICA_ID_NIL ||
-		    rlist_empty(&limbo->queue)) {
+		if (rlist_empty(&limbo->queue)) {
 			limbo->owner_id = id;
 			limbo->confirmed_lsn = 0;
 			if (id != instance_id)
-- 
2.30.2


  parent reply	other threads:[~2021-04-19  8:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19  8:37 [Tarantool-patches] [PATCH 0/3] wal,txn_limbo: a few cleanups Cyrill Gorcunov via Tarantool-patches
2021-04-19  8:37 ` [Tarantool-patches] [PATCH 1/3] wal: sanitize wal_mode Cyrill Gorcunov via Tarantool-patches
2021-04-23 20:57   ` Vladislav Shpilevoy via Tarantool-patches
2021-04-23 21:17     ` Cyrill Gorcunov via Tarantool-patches
2021-04-25  8:08       ` Serge Petrenko via Tarantool-patches
2021-04-25 13:26         ` Cyrill Gorcunov via Tarantool-patches
2021-04-26  9:40           ` Serge Petrenko via Tarantool-patches
2021-04-26  9:58             ` Cyrill Gorcunov via Tarantool-patches
2021-04-19  8:37 ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-04-25  8:09   ` [Tarantool-patches] [PATCH 2/3] txn_limbo: simplify owner migration condition Serge Petrenko via Tarantool-patches
2021-04-19  8:37 ` [Tarantool-patches] [PATCH 3/3] txn_limbo: simplify txn_limbo_ack Cyrill Gorcunov via Tarantool-patches
2021-04-25  8:11   ` Serge Petrenko via Tarantool-patches
2021-04-22 11:34 ` [Tarantool-patches] [PATCH 4/4] txn_limbo: simplify txn_limbo_on_parameters_change Cyrill Gorcunov via Tarantool-patches
2021-04-25  8:13   ` Serge Petrenko via Tarantool-patches
2021-04-25 13:18 ` [Tarantool-patches] [PATCH 0/3] wal,txn_limbo: a few cleanups Vladislav Shpilevoy via Tarantool-patches
2021-04-26 15:40 ` Kirill Yukhin 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=20210419083719.29689-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/3] txn_limbo: simplify owner migration condition' \
    /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