Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] txn_limbo: simplify owner migration condition
@ 2021-04-15 22:06 Cyrill Gorcunov via Tarantool-patches
  2021-04-15 23:12 ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov via Tarantool-patches @ 2021-04-15 22:06 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

When limbo owner is about to change the state
we should check is if there are some pending
transactions 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.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Guys, I don't want to create a separate branch for this
small patch neither I consider it anyhow significant. More
likely it is a cleanup dropping redundant code. Discovered
while trying to figure out details of qsync.

 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH] txn_limbo: simplify owner migration condition
  2021-04-15 22:06 [Tarantool-patches] [PATCH] txn_limbo: simplify owner migration condition Cyrill Gorcunov via Tarantool-patches
@ 2021-04-15 23:12 ` Vladislav Shpilevoy via Tarantool-patches
  2021-04-16  7:17   ` [Tarantool-patches] [PATCH v2] " Cyrill Gorcunov via Tarantool-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-04-15 23:12 UTC (permalink / raw)
  To: Cyrill Gorcunov, tml

Hi! Thanks for the patch!

On 16.04.2021 00:06, Cyrill Gorcunov wrote:
> When limbo owner is about to change the state
> we should check is if there are some pending

'is' is not needed.

> transactions are not yet processed, iow if

are -> which are.

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Tarantool-patches] [PATCH v2] txn_limbo: simplify owner migration condition
  2021-04-15 23:12 ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-04-16  7:17   ` Cyrill Gorcunov via Tarantool-patches
  2021-04-16 19:29     ` Vladislav Shpilevoy via Tarantool-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov via Tarantool-patches @ 2021-04-16  7:17 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tml

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.

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

Index: tarantool.git/src/box/txn_limbo.c
===================================================================
--- tarantool.git.orig/src/box/txn_limbo.c
+++ tarantool.git/src/box/txn_limbo.c
@@ -94,8 +94,7 @@ txn_limbo_append(struct txn_limbo *limbo
 		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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] txn_limbo: simplify owner migration condition
  2021-04-16  7:17   ` [Tarantool-patches] [PATCH v2] " Cyrill Gorcunov via Tarantool-patches
@ 2021-04-16 19:29     ` Vladislav Shpilevoy via Tarantool-patches
  2021-04-16 20:36       ` Cyrill Gorcunov via Tarantool-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-04-16 19:29 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml

Hi! Thanks for the patch!

LGTM. But I am afraid you still need to create a branch. We
don't commit patches from mail usually.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH v2] txn_limbo: simplify owner migration condition
  2021-04-16 19:29     ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-04-16 20:36       ` Cyrill Gorcunov via Tarantool-patches
  0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov via Tarantool-patches @ 2021-04-16 20:36 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tml

On Fri, Apr 16, 2021 at 09:29:10PM +0200, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
> 
> LGTM. But I am afraid you still need to create a branch. We
> don't commit patches from mail usually.

Thanks, Vlad! I'll collect a few more cleanups and send out on
te next week. This one simply with you Ack applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-16 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 22:06 [Tarantool-patches] [PATCH] txn_limbo: simplify owner migration condition Cyrill Gorcunov via Tarantool-patches
2021-04-15 23:12 ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16  7:17   ` [Tarantool-patches] [PATCH v2] " Cyrill Gorcunov via Tarantool-patches
2021-04-16 19:29     ` Vladislav Shpilevoy via Tarantool-patches
2021-04-16 20:36       ` Cyrill Gorcunov via Tarantool-patches

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