[patches] [PATCH] Don't try to lock a ddl latch in a multistatement tx
Georgy Kirichenko
georgy at tarantool.org
Fri Mar 2 08:44:46 MSK 2018
On Thursday, March 1, 2018 5:43:11 PM MSK Konstantin Osipov wrote:
> * Georgy Kirichenko <georgy at tarantool.org> [18/03/01 17:15]:
> > Any ddl is prohibited in a multistatement transaction, there is no
> > reason to try to lock a ddl latch in tis case. Locking for already
> > locked latch will cause an yield and a silent transaction rollback, and
> > this will crash or assert tarantool server.
> >
> > Fixes #2783
> > ---
> > https://github.com/tarantool/tarantool/tree/gh-2783-check-multistatement-t
> > x-for-ddl-lock
> >
> > src/box/alter.cc | 7 +++++++
> >
> > test/box/ddl.result | 42
> > ++++++++++++++++++++++++++++++++++++++++++
> > test/box/ddl.test.lua | 23 +++++++++++++++++++++++
> > test/box/on_replace.result | 2 +-
> > test/box/transaction.result | 2 +-
> > test/engine/truncate.result | 2 +-
> > 6 files changed, 75 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/box/alter.cc b/src/box/alter.cc
> > index 5749740d2..b94cf710b 100644
> > --- a/src/box/alter.cc
> > +++ b/src/box/alter.cc
> > @@ -3133,6 +3133,13 @@ lock_before_dd(struct trigger *trigger, void
> > *event)
> >
> > if (fiber() == latch_owner(&schema_lock))
> >
> > return;
> >
> > struct txn *txn = (struct txn *)event;
> >
> > + /*
> > + * The trigger is executed before any check and may yield but
> > + * an yield in a non-autocommit memtx transaction will rollback it.
> > + * So we shouldn't to try to lock a latch if there is a multistatement
> > + * transaction.
> > + */
> > + txn_check_singlestatement_xc(txn, "DDL");
>
> Don't you want to remove the extra check for
> txn_check_singlestatement from the places in which it now has
> become redundant, e.g. on_replace_dd_space?
I thought this may be meaningfull but you are right.
A next version will be pushed soon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20180302/7fe0f732/attachment.sig>
More information about the Tarantool-patches
mailing list