[Tarantool-patches] [PATCH 2/3] txn_limbo: simplify owner migration condition

Serge Petrenko sergepetrenko at tarantool.org
Sun Apr 25 11:09:23 MSK 2021



19.04.2021 11:37, Cyrill Gorcunov пишет:
> 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 at tarantool.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov at 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)
Thanks for the patch! LGTM.

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list