diff options
author | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2020-07-03 16:17:59 +0200 |
---|---|---|
committer | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2020-07-03 16:17:59 +0200 |
commit | 1bf863a91a8ad8cd6ba8e50db34b302120feaa29 (patch) | |
tree | 260fe6971349157414354ef4c4c1caacbf01fbac | |
parent | e6595a06d63fb40f81f6ec0313a37931cdf0e9c5 (diff) | |
parent | 2b8b7394a129ab27225a1284bab253a6714aaf03 (diff) | |
download | mariadb-git-1bf863a91a8ad8cd6ba8e50db34b302120feaa29.tar.gz |
Merge branch '10.4-MDEV-22222' of https://github.com/codership/mariadb-server into 10.4-MDEV-2222210.4-MDEV-22222
-rw-r--r-- | mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result | 12 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test | 21 | ||||
-rw-r--r-- | sql/sql_parse.cc | 6 |
3 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result new file mode 100644 index 00000000000..68691a4efd2 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result @@ -0,0 +1,12 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +LOCK TABLES t2 READ; +ERROR 42S02: Table 'test.t2' doesn't exist +START TRANSACTION; +INSERT INTO t1 VALUES (1); +LOCK TABLES t1 READ; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test b/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test new file mode 100644 index 00000000000..5cb7347639c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test @@ -0,0 +1,21 @@ +# +# Check `LOCK TABLES` command with or without existing table in database. +# Test case for MDEV-22222 / MDEV-22223 +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +--error ER_NO_SUCH_TABLE +LOCK TABLES t2 READ; + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +LOCK TABLES t1 READ; +UNLOCK TABLES; + +DROP TABLE t1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3e68bc1c25f..8fa7aa61386 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4990,6 +4990,12 @@ mysql_execute_command(THD *thd) if (res) goto error; +#ifdef WITH_WSREP + /* Clean up the previous transaction on implicit commit. */ + if (wsrep_on(thd) && !wsrep_not_committed(thd) && wsrep_after_statement(thd)) + goto error; +#endif + /* We can't have any kind of table locks while backup is active */ if (thd->current_backup_stage != BACKUP_FINISHED) { |