[patches] [PATCH] Don't try to lock a ddl latch in a multistatement tx

Konstantin Osipov kostja at tarantool.org
Thu Mar 1 17:43:11 MSK 2018


* 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-tx-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?

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list