diff options
author | Sachin Setiya <sachinsetia1001@gmail.com> | 2018-04-08 22:25:37 +0530 |
---|---|---|
committer | Sachin Setiya <sachinsetia1001@gmail.com> | 2018-04-08 22:25:37 +0530 |
commit | 5494abcfb55e733a3fd4939d9d96b71e2a5dbc42 (patch) | |
tree | 0306be82db61cb788070ea7965e0b5f6fcaf569c | |
parent | bc2501453c3ab9a2cf3516bc3557de8665bc2776 (diff) | |
download | mariadb-git-bb-mdev-15611.tar.gz |
MDEV-15611 Due to the failure of foreign key detection, Galera...bb-mdev-15611
slave node killed himself.
Problem:- If we try to delete table with foreign key and table whom it is
referring with wsrep_slave_threads>1 then galera tries to execute both
Delete_rows_log-event in parallel, which should not happen.
Solution:- This is happening because we do not have foreign key info in
write set. Upto version 10.2.7 it used to work fine. Actually it happening
because of issue in commit 2f342c4. wsrep_must_process_fk has changed to
make it similar to original condition.
-rw-r--r-- | mysql-test/suite/galera/r/galera_mdev_15611.result | 16 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_mdev_15611.cnf | 5 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_mdev_15611.test | 30 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 18 |
4 files changed, 59 insertions, 10 deletions
diff --git a/mysql-test/suite/galera/r/galera_mdev_15611.result b/mysql-test/suite/galera/r/galera_mdev_15611.result new file mode 100644 index 00000000000..9ea1684494a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_mdev_15611.result @@ -0,0 +1,16 @@ +connection node_1; +CREATE TABLE t1 ( +id int primary key +); +CREATE TABLE t2 ( +id int primary key , +f_id int DEFAULT NULL, FOREIGN KEY(f_id) REFERENCES t1 (id) +); +insert into t1 select 1; +#Running 200 insert in t2 table +select count(*) from t2; +count(*) +200 +delete from t2; +delete from t1; +drop table t2,t1; diff --git a/mysql-test/suite/galera/t/galera_mdev_15611.cnf b/mysql-test/suite/galera/t/galera_mdev_15611.cnf new file mode 100644 index 00000000000..b6f601c56b1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_mdev_15611.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes.cnf +[mysqld.1] + +[mysqld.2] +wsrep_slave_threads=6 diff --git a/mysql-test/suite/galera/t/galera_mdev_15611.test b/mysql-test/suite/galera/t/galera_mdev_15611.test new file mode 100644 index 00000000000..d32d7e75262 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_mdev_15611.test @@ -0,0 +1,30 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 ( + id int primary key +); + +CREATE TABLE t2 ( + id int primary key , + f_id int DEFAULT NULL, FOREIGN KEY(f_id) REFERENCES t1 (id) +); + +insert into t1 select 1; + +--disable_query_log +--let $count=200 +--echo #Running 200 insert in t2 table +while($count) +{ + #Repeatedly execute the following SQL until you generate thousands of data + --eval insert into t2 values ($count, 1); + --dec $count +} +--enable_query_log + +select count(*) from t2; +delete from t2; +delete from t1; +drop table t2,t1; diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 5009ac02408..fd116384026 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -466,17 +466,15 @@ func_exit: @param[in] node query node @param[in] trx transaction @return whether the node cannot be ignored */ -inline -bool -wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx) -{ - if (que_node_get_type(node->common.parent) != QUE_NODE_UPDATE - || !wsrep_on_trx(trx)) { - return false; - } - return static_cast<upd_node_t*>(node->common.parent)->cascade_node - == node; +inline bool wsrep_must_process_fk(const upd_node_t* node, const trx_t* trx) +{ + if (!wsrep_on_trx(trx)) { + return false; + } + return que_node_get_type(node->common.parent) != QUE_NODE_UPDATE + || static_cast<upd_node_t*>(node->common.parent)->cascade_node + != node; } #endif /* WITH_WSREP */ |