[Commits] 5494abc: MDEV-15611 Due to the failure of foreign key detection, Galera...
revision-id: 5494abcfb55e733a3fd4939d9d96b71e2a5dbc42 (mariadb-10.2.14-25-g5494abc) parent(s): bc2501453c3ab9a2cf3516bc3557de8665bc2776 author: Sachin Setiya committer: Sachin Setiya timestamp: 2018-04-08 22:25:37 +0530 message: MDEV-15611 Due to the failure of foreign key detection, Galera... 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. --- mysql-test/suite/galera/r/galera_mdev_15611.result | 16 ++++++++++++ mysql-test/suite/galera/t/galera_mdev_15611.cnf | 5 ++++ mysql-test/suite/galera/t/galera_mdev_15611.test | 30 ++++++++++++++++++++++ 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 0000000..9ea1684 --- /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 0000000..b6f601c --- /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 0000000..d32d7e7 --- /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 5009ac0..fd11638 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -466,17 +466,15 @@ wsrep_row_upd_check_foreign_constraints( @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 */
participants (1)
-
sachin