From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 28 Jan 2019 16:00:53 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] [PATCH v2 1/2] Journal transaction boundaries Message-ID: <20190128130053.ss7bytgv72l3aeca@esperanza> References: <7b72afb3f1a3479f1239fcbed936cc151b55f23c.1548153546.git.georgy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7b72afb3f1a3479f1239fcbed936cc151b55f23c.1548153546.git.georgy@tarantool.org> To: Georgy Kirichenko Cc: tarantool-patches@freelists.org List-ID: On Tue, Jan 22, 2019 at 01:57:36PM +0300, Georgy Kirichenko wrote: > Append txn_id, txn_replica_id and txn_last to xrow_header structure. > txn_replica_id identifies replica where transaction was started and > txn_id identifies transaction id on that replica. As transaction id > a lsn of the first row in this transaction is used. > txn_last set to true if it is the last row in a transaction, so we > could commit transaction with last row or use additional NOP requests > with txn_last = true ans valid txn_id and txn_replica_id. > For replication all local changes moved to xrows array tail to form > a separate transaction (like autonomous transaction) because it is not > possible to replicate such transaction back to it's creator. > > As encoding/deconding rules assumed: > 1. txn_replica_id is encoded only if it is not equal with replica > id. This might have point because of replication trigger > 2. txn_id and txn_last are encoded only for multi-row transaction. > So if we do not have txn_id in a xstream then this means that it > is a single row transaction. > This rules provides compatibility with previous xlog handling. > > Needed for: 2798 > --- > src/box/iproto_constants.h | 3 ++ > src/box/wal.c | 36 +++++++++++++++- > src/box/xrow.c | 38 +++++++++++++++++ > src/box/xrow.h | 5 ++- > test/unit/xrow.cc | 3 ++ > test/vinyl/errinj_stat.result | 8 ++-- > test/vinyl/layout.result | 24 +++++------ > test/vinyl/stat.result | 78 +++++++++++++++++------------------ Also, forgot to say that this patch lacks a test case. We should probably check that transaction boundaries are written using the xlog reader module.