revision-id: aaa54f56428169a9a4398fd7b0ab28fe9406349e (mariadb-10.2.14-75-gaaa54f56428) parent(s): da3c5c3c9ad53eda04293e5f5ee6795197c70652 author: Sachin Setiya committer: Sachin Setiya timestamp: 2018-05-03 18:14:19 +0530 message: MDEV-14472 Assertion `is_current_stmt_binlog_format_row()' failed in... THD::binlog_write_table_map Initial patch , rpl test are failing because of this it really needs some changnes , but later patch will follow the same idea --- mysql-test/suite/binlog/r/mdev_14472.result | 12 ++++++++++++ mysql-test/suite/binlog/t/mdev_14472.test | 22 ++++++++++++++++++++++ sql/handler.cc | 4 +++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/binlog/r/mdev_14472.result b/mysql-test/suite/binlog/r/mdev_14472.result new file mode 100644 index 00000000000..0a2483678f1 --- /dev/null +++ b/mysql-test/suite/binlog/r/mdev_14472.result @@ -0,0 +1,12 @@ +CREATE TABLE t1 (f1 INT); +CREATE TABLE t2 (f2 INT); +CREATE TABLE t3 (f3 INT); +CREATE TABLE t4 (pk INT AUTO_INCREMENT PRIMARY KEY); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (); +CREATE TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (); +CREATE TRIGGER tr3 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t4 VALUES (); +LOCK TABLE t1 WRITE; +INSERT INTO t2 () VALUES (); +INSERT INTO t3 VALUES (); +UNLOCK TABLES; +DROP TABLE t1, t2, t3, t4; diff --git a/mysql-test/suite/binlog/t/mdev_14472.test b/mysql-test/suite/binlog/t/mdev_14472.test new file mode 100644 index 00000000000..fd892a44f5c --- /dev/null +++ b/mysql-test/suite/binlog/t/mdev_14472.test @@ -0,0 +1,22 @@ +--source include/have_log_bin.inc +--source include/have_binlog_format_mixed.inc + +# Reproducible with MyISAM, InnoDB, Aria + +CREATE TABLE t1 (f1 INT); +CREATE TABLE t2 (f2 INT); +CREATE TABLE t3 (f3 INT); +CREATE TABLE t4 (pk INT AUTO_INCREMENT PRIMARY KEY); + +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (); +CREATE TRIGGER tr2 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (); +CREATE TRIGGER tr3 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t4 VALUES (); + +LOCK TABLE t1 WRITE; +INSERT INTO t2 () VALUES (); +INSERT INTO t3 VALUES (); + +# Cleanup + +UNLOCK TABLES; +DROP TABLE t1, t2, t3, t4; diff --git a/sql/handler.cc b/sql/handler.cc index 06c407b572a..b5cdc72bc3c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -5650,7 +5650,9 @@ inline bool handler::check_table_binlog_row_based(bool binlog_row) { if (unlikely((table->in_use->variables.sql_log_bin_off))) return 0; /* Called by partitioning engine */ - if (unlikely((!check_table_binlog_row_based_done))) + /* Dont use cached result when current binlog format is stmt */ + if (unlikely(!table->in_use->is_current_stmt_binlog_format_row() && + (!check_table_binlog_row_based_done))) { check_table_binlog_row_based_done= 1; check_table_binlog_row_based_result=