[Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Jun 26 01:14:16 MSK 2020


> diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
> index a715a136e..c55f5bda1 100644
> --- a/src/box/txn_limbo.c
> +++ b/src/box/txn_limbo.c
> @@ -191,6 +244,38 @@ txn_limbo_read_confirm(struct txn_limbo *limbo, int64_t lsn)
> +void
> +txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn)
> +{
> +	assert(limbo->instance_id != REPLICA_ID_NIL &&
> +	       limbo->instance_id != instance_id);
> +	struct txn_limbo_entry *e, *tmp;
> +	rlist_foreach_entry_safe_reverse(e, &limbo->queue, in_queue, tmp) {
> +		if (e->lsn < lsn)
> +			break;

Shouldn't this be 'continue' instead of 'break'? As I understand rollback,
we need to find entry, *from* which all the entries will be rolled back.
Here it seems that if the oldest entry in the limbo (with the smallest LSN)
is smaller than rollback lsn, we just won't rollback anything.

> +		assert(e->txn->fiber == NULL);
> +		e->is_rollback = true;
> +		txn_limbo_pop(limbo, e);
> +		txn_clear_flag(e->txn, TXN_WAIT_ACK);
> +
> +		/* Rollback the transaction. */
> +		e->txn->signature = -1;
> +		txn_complete(e->txn);
> +	}
> +}


More information about the Tarantool-patches mailing list