[Tarantool-patches] [PATCH v2 10/19] txn_limbo: add ROLLBACK processing

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Jul 5 18:29:43 MSK 2020


> diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
> index ac57fd1bd..680e81d3d 100644
> --- a/src/box/txn_limbo.c
> +++ b/src/box/txn_limbo.c
> @@ -127,33 +141,64 @@ txn_limbo_wait_complete(struct txn_limbo *limbo, struct txn_limbo_entry *entry)
> -/**
> - * Write a confirmation entry to WAL. After it's written all the
> - * transactions waiting for confirmation may be finished.
> - */
>  static int
> -txn_limbo_write_confirm(struct txn_limbo *limbo, struct txn_limbo_entry *entry)
> +txn_limbo_write_confirm_rollback(struct txn_limbo *limbo,
> +				 struct txn_limbo_entry *entry,
> +				 bool is_confirm)
>  {
>  	struct xrow_header row;
>  	struct request request = {
>  		.header = &row,
>  	};
>  
> -	if (xrow_encode_confirm(&row, limbo->instance_id, entry->lsn) < 0)
> +	int res = 0;
> +	if (is_confirm) {
> +		res = xrow_encode_confirm(&row, limbo->instance_id, entry->lsn);
> +	} else {
> +		/*
> +		 * This entry is the first to be rolled back, so
> +		 * the last "safe" lsn is entry->lsn - 1.
> +		 */
> +		res = xrow_encode_rollback(&row, limbo->instance_id,
> +					   entry->lsn - 1);

Why can't you write the exact lsn + change the check in txn_limbo_read_rollback()
from

    if (e->lsn <= lsn)
        break;

to

    if (e->lsn < lsn)
        break;

Currently the rollback entry contains LSN which counter-intuitively shouldn't be
rolled back.


More information about the Tarantool-patches mailing list