[patches] [PATCH] Don't try to lock a ddl latch in a multistatement tx
Vladimir Davydov
vdavydov.dev at gmail.com
Thu Mar 1 17:53:26 MSK 2018
On Thu, Mar 01, 2018 at 05:12:40PM +0300, Georgy Kirichenko wrote:
> 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
> 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");
This check will raise even if the transaction has no statements at all
so the following code will fail:
box.begin()
box.schema.space.create('test')
box.commit()
AFAIK this will break our SQL implementation.
More information about the Tarantool-patches
mailing list