[Tarantool-patches] [PATCH v3 06/13] txm: add TX status

Nikita Pettik korablev at tarantool.org
Wed Jul 15 19:42:48 MSK 2020


On 15 Jul 16:55, Aleksandr Lyapunov wrote:
> Transaction engine (see further commits) needs to distinguish and
> maniputate transactions by their status. The status describe the
> lifetime point of a transaction (inprogress, prepared, committed)
> and its abilities (conflicted, read view).
> 
> Part of #4897
> Part of #5108
> ---
> diff --git a/src/box/txn.h b/src/box/txn.h
> index 36b1a03..e261852 100644
> --- a/src/box/txn.h
> +++ b/src/box/txn.h
> @@ -121,6 +121,40 @@ enum {
>  };
>  
>  /**
> + * Status of a transaction.
> + */
> +enum txn_status {
> +	/**
> +	 * Initial state of TX. The only state of a TX that allowed to do
> +	 * read or write actions.
> +	 */
> +	TXN_INPROGRESS,
> +	/**
> +	 * The TX have passed conflict checks and is ready to be committed.
> +	 */
> +	TXN_PREPARED,
> +	/**
> +	 * The TX was aborted when other TX was committed due to conflict.
> +	 */
> +	TXN_CONFLICTED,
> +	/**
> +	 * The TX was read_only, has a conflict and was sent to read view.
> +	 * Read-only and does not participate in conflict resolution ever more.
> +	 * This transaction can onlu see state of the database at some fixed

Nit: onlu -> only

> +	 * point in the past.
> +	 */
> +	TXN_IN_READ_VIEW,
> +	/**
> +	 * The TX was committed.
> +	 */
> +	TXN_COMMITTED,
> +	/**
> +	 * The TX was aborted by user.
> +	 */

I guess not only by user. If commit stage fails, tx also features this flag.

> +	TXN_ABORTED,
> +};
> +
> +/**
>   * A single statement of a multi-statement
>   * transaction: undo and redo info.
>   */

The rest I guess is OK.



More information about the Tarantool-patches mailing list