From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp62.i.mail.ru (smtp62.i.mail.ru [217.69.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 73357445320 for ; Wed, 15 Jul 2020 19:42:49 +0300 (MSK) Date: Wed, 15 Jul 2020 16:42:48 +0000 From: Nikita Pettik Message-ID: <20200715164248.GG26087@tarantool.org> References: <1594821336-14468-1-git-send-email-alyapunov@tarantool.org> <1594821336-14468-7-git-send-email-alyapunov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1594821336-14468-7-git-send-email-alyapunov@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 06/13] txm: add TX status List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aleksandr Lyapunov Cc: tarantool-patches@dev.tarantool.org 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.