From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 21 Feb 2019 19:25:38 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v5 1/2] Journal transaction boundaries Message-ID: <20190221162538.abjxykyv3xszujb4@esperanza> References: <11df785115d046a43de09476e51302a00b1f3486.1550762885.git.georgy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11df785115d046a43de09476e51302a00b1f3486.1550762885.git.georgy@tarantool.org> To: Georgy Kirichenko Cc: tarantool-patches@freelists.org List-ID: On Thu, Feb 21, 2019 at 06:29:16PM +0300, Georgy Kirichenko wrote: > Append txn_id and is_commit to xrow_header structure, txn_id identifies > transaction id on replica where transaction was started. As transaction id > a lsn of the first row in the transaction is used. is_commit is set to true > for the last row in a transaction. > > As encoding/deconding rule assumed: > * txn_id encoded using transaction sequence number iproto field > as IPROTO_TSN = lsn - txn_id, > * is_commit packed into IPROTO_FLAGS field with a bit mask, > * txn_id and is_commit are encoded only for multi-row transactions. > So if we do not have txn_id after row decoding then this means that it > is a single row transaction. > > These rules provide compatibility with previous xlog format as well > as good compaction level. > > Needed for: 2798 > --- > src/box/iproto_constants.c | 8 +-- > src/box/iproto_constants.h | 7 +++ > src/box/lua/xlog.c | 10 +++ > src/box/wal.c | 5 ++ > src/box/xrow.c | 41 +++++++++++++ > src/box/xrow.h | 4 +- > test/unit/xrow.cc | 2 + > test/xlog/transaction.result | 108 +++++++++++++++++++++++++++++++++ > test/xlog/transaction.test.lua | 46 ++++++++++++++ > 9 files changed, 226 insertions(+), 5 deletions(-) > create mode 100644 test/xlog/transaction.result > create mode 100644 test/xlog/transaction.test.lua Pushed this one to 2.1.