summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormkaruza <mario.karuza@galeracluster.com>2020-03-31 18:43:10 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2020-04-08 16:42:18 +0300
commitedc3899d9781e98b4328931884527913ebffb11f (patch)
tree8363049da5c95323a8027e667cd999f3b583ff38
parent476966b3fb05ce8c061a4b77a0ab0b722bb0d192 (diff)
downloadmariadb-git-edc3899d9781e98b4328931884527913ebffb11f.tar.gz
MDEV-22051: Protocol::end_statement(): Assertion `0' failed on Galera node upon DDL attempt with conflicting lockbb-10.4-MDEV-22051
If FTWRL is issued, DDL statements should report error back to user before TOI is started.
-rw-r--r--mysql-test/suite/galera/r/MDEV-22051.result20
-rw-r--r--mysql-test/suite/galera/t/MDEV-22051.test33
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/wsrep_mysqld.cc6
m---------wsrep-lib0
5 files changed, 57 insertions, 4 deletions
diff --git a/mysql-test/suite/galera/r/MDEV-22051.result b/mysql-test/suite/galera/r/MDEV-22051.result
new file mode 100644
index 00000000000..9f5394637c2
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22051.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+FLUSH TABLES WITH READ LOCK;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Global Read-Lock (FTWRL) in place.
+SET wsrep_OSU_method=RSU;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Global Read-Lock (FTWRL) in place.
+SET wsrep_OSU_method=TOI;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Global Read-Lock (FTWRL) in place.
+connection node_1;
+UNLOCK TABLES;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 VALUES (1);
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MDEV-22051.test b/mysql-test/suite/galera/t/MDEV-22051.test
new file mode 100644
index 00000000000..b7332c47d69
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-22051.test
@@ -0,0 +1,33 @@
+#
+# If FTWRL is issued on node, DDL statement should report error back to
+# user.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+FLUSH TABLES WITH READ LOCK;
+
+--error ER_UNKNOWN_COM_ERROR
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+SET wsrep_OSU_method=RSU;
+--error ER_UNKNOWN_COM_ERROR
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+SET wsrep_OSU_method=TOI;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--error ER_UNKNOWN_COM_ERROR
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+--connection node_1
+UNLOCK TABLES;
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+FLUSH TABLES WITH READ LOCK;
+--error ER_CANT_UPDATE_WITH_READLOCK
+INSERT INTO t1 VALUES (1);
+UNLOCK TABLES;
+
+DROP TABLE t1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e5b9f74c5f3..bd74c91dd99 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3527,7 +3527,7 @@ mysql_execute_command(THD *thd)
* and dirty reads (if configured)
*/
if (!(thd->wsrep_applier) &&
- !(wsrep_ready_get() && wsrep_reject_queries == WSREP_REJECT_NONE) &&
+ !(wsrep_ready_get() && wsrep_reject_queries == WSREP_REJECT_NONE) &&
!(thd->variables.wsrep_dirty_reads &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) &&
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 6692e8c4ef0..7665c5f1c6b 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2028,10 +2028,10 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_,
DBUG_ASSERT(wsrep_thd_is_local(thd));
DBUG_ASSERT(thd->wsrep_trx().ws_meta().seqno().is_undefined());
- if (thd->global_read_lock.is_acquired())
+ if (Wsrep_server_state::instance().desynced_on_pause())
{
- WSREP_DEBUG("Aborting TOI: Global Read-Lock (FTWRL) in place: %s %llu",
- WSREP_QUERY(thd), thd->thread_id);
+ my_message(ER_UNKNOWN_COM_ERROR,
+ "Aborting TOI: Global Read-Lock (FTWRL) in place.", MYF(0));
return -1;
}
diff --git a/wsrep-lib b/wsrep-lib
-Subproject a17b65a25f5e608ffa8e6e051930bf47ed95019
+Subproject d0255569b0154e23c5461ed13928f9b0a18008e