[tarantool-patches] Re: [PATCH 3/3] Transaction support for applier

Vladimir Davydov vdavydov.dev at gmail.com
Tue Mar 5 13:28:56 MSK 2019


On Tue, Mar 05, 2019 at 12:11:35PM +0300, Konstantin Osipov wrote:
> * Georgy Kirichenko <georgy at tarantool.org> [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()?



More information about the Tarantool-patches mailing list