From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 5 Mar 2019 13:28:56 +0300 From: Vladimir Davydov Subject: Re: [tarantool-patches] Re: [PATCH 3/3] Transaction support for applier Message-ID: <20190305102856.3isddnlhd3vzvwtb@esperanza> References: <20190305091135.GY21955@chai> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190305091135.GY21955@chai> To: Konstantin Osipov Cc: tarantool-patches@freelists.org, Georgy Kirichenko List-ID: On Tue, Mar 05, 2019 at 12:11:35PM +0300, Konstantin Osipov wrote: > * Georgy Kirichenko [19/03/03 23:30]: > > Applier fetch incoming rows to form a transaction and then apply it. > > In case of replication all local changes moved to an journal entry > > tail to form a separate transaction (like autonomous transaction) > > to be able to replicate changes back so applier assumes that transactions > > could not be mixed in a replication stream. > > > > Closes: #2798 > > Needed for: #980 > > --- > > src/box/applier.cc | 243 ++++++++++++++++++++------ > > src/box/txn.c | 21 ++- > > src/box/txn.h | 4 + > > test/replication/transaction.result | 240 +++++++++++++++++++++++++ > > test/replication/transaction.test.lua | 86 +++++++++ > > 5 files changed, 534 insertions(+), 60 deletions(-) > > create mode 100644 test/replication/transaction.result > > create mode 100644 test/replication/transaction.test.lua > > > > diff --git a/src/box/applier.cc b/src/box/applier.cc > > index 3222b041d..dfabbe5ab 100644 > > --- a/src/box/applier.cc > > +++ b/src/box/applier.cc > > @@ -48,6 +48,12 @@ > > #include "session.h" > > #include "cfg.h" > > #include "box.h" > > +#include "txn.h" > > I thought we agreed to use box API, not txn API? I don't think it's a good idea to use any public box API functions, such as box_txn_begin and box_txn_commit, in internals, because they might have some fool-proof checks we don't need. > > +static int > > +applier_apply_tx(struct xrow_header *first_row, struct xrow_header *last_row) > > +{ > > + int res = 0; > > + struct txn *txn = NULL; > > + struct xrow_header *row = first_row; > > + if (first_row != last_row) > > + txn = txn_begin(false); > > Shouldn't it be box_txn_begin()?