summaryrefslogtreecommitdiff
path: root/mysql-test/extra
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2009-11-03 19:02:56 +0000
committerAlfranio Correia <alfranio.correia@sun.com>2009-11-03 19:02:56 +0000
commit19c380aaff1f1f3c0d21ac0c18904c21d7bdce76 (patch)
tree0e262b0d25432c224e2d4c8e1a1d608f78444771 /mysql-test/extra
parent97565b8d1ab24b6f861300c75a4f4f3c7d711be6 (diff)
downloadmariadb-git-19c380aaff1f1f3c0d21ac0c18904c21d7bdce76.tar.gz
WL#2687 WL#5072 BUG#40278 BUG#47175
Non-transactional updates that take place inside a transaction present problems for logging because they are visible to other clients before the transaction is committed, and they are not rolled back even if the transaction is rolled back. It is not always possible to log correctly in statement format when both transactional and non-transactional tables are used in the same transaction. In the current patch, we ensure that such scenario is completely safe under the ROW and MIXED modes.
Diffstat (limited to 'mysql-test/extra')
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test24
-rw-r--r--mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test423
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test45
-rw-r--r--mysql-test/extra/rpl_tests/rpl_flsh_tbls.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test375
-rw-r--r--mysql-test/extra/rpl_tests/rpl_innodb.test123
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_ignore.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_mixing_engines.inc503
-rw-r--r--mysql-test/extra/rpl_tests/rpl_mixing_engines.test1804
-rw-r--r--mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_start_stop_slave.test127
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stop_middle_group.test147
15 files changed, 3122 insertions, 483 deletions
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index da0b77fbc23..4abf21a9930 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -8,6 +8,7 @@
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
--disable_warnings
drop table if exists t1, t2;
@@ -323,23 +324,24 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# and does not make slave to stop)
if (`select @@binlog_format = 'ROW'`)
{
- --exec $MYSQL_BINLOG --start-position=525 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --echo This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
+ --echo were previously flushed upon committing/rolling back each statement.
}
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
--exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
-}
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select
-(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
-is not null;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval select
-@a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
-@a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
-@a not like "%#%error_code=%error_code=%";
+ --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+ eval select
+ (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
+ is not null;
+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+ eval select
+ @a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
+ @a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
+ @a not like "%#%error_code=%error_code=%";
+}
drop table t1, t2;
#
diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
new file mode 100644
index 00000000000..55dc7ca6514
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
@@ -0,0 +1,423 @@
+########################################################################################
+# This test verifies if the binlog is not corrupted when the cache buffer is not
+# big enough to accommodate the changes and is divided in five steps:
+#
+# 1 - Single Statements:
+# 1.1 - Single statement on transactional table.
+# 1.2 - Single statement on non-transactional table.
+# 1.3 - Single statement on both transactional and non-transactional tables.
+# In both 1.2 and 1.3, an incident event is logged to notify the user that the
+# master and slave are diverging.
+#
+# 2 - Transactions ended by an implicit commit.
+#
+# 3 - Transactions ended by a COMMIT.
+#
+# 4 - Transactions ended by a ROLLBACK.
+#
+# 5 - Transactions with a failing statement that updates a non-transactional
+# table. In this case, a failure means that the statement does not get into
+# the cache and an incident event is logged to notify the user that the master
+# and slave are diverging.
+#
+########################################################################################
+
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
+
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
+CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
+CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
+
+let $data = `select concat('"', repeat('a',2000), '"')`;
+
+--echo ########################################################################################
+--echo # 1 - SINGLE STATEMENT
+--echo ########################################################################################
+
+connection master;
+
+--echo *** Single statement on transactional table ***
+--disable_query_log
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+eval INSERT INTO t1 (a, data) VALUES (1,
+ CONCAT($data, $data, $data, $data, $data));
+--enable_query_log
+
+--echo *** Single statement on non-transactional table ***
+--disable_query_log
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+eval INSERT INTO t2 (a, data) VALUES (2,
+ CONCAT($data, $data, $data, $data, $data, $data));
+--enable_query_log
+
+connection slave;
+--source include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+START SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_start.inc
+
+connection master;
+
+--disable_query_log
+eval INSERT INTO t1 (a, data) VALUES (3, $data);
+eval INSERT INTO t1 (a, data) VALUES (4, $data);
+eval INSERT INTO t1 (a, data) VALUES (5, $data);
+eval INSERT INTO t2 (a, data) VALUES (3, $data);
+eval INSERT INTO t2 (a, data) VALUES (4, $data);
+eval INSERT INTO t2 (a, data) VALUES (5, $data);
+--enable_query_log
+
+--echo *** Single statement on both transactional and non-transactional tables. ***
+--disable_query_log
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
+ t1.data = CONCAT($data, $data, $data, $data);
+--enable_query_log
+
+connection slave;
+--source include/wait_for_slave_sql_to_stop.inc
+
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+}
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+{
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
+}
+START SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_start.inc
+connection master;
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (1, $data);
+--eval INSERT INTO t1 (a, data) VALUES (2, $data);
+--eval INSERT INTO t1 (a, data) VALUES (3, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (4, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (5, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (6, $data);
+--eval INSERT INTO t1 (a, data) VALUES (7, 's');
+--eval INSERT INTO t2 (a, data) VALUES (8, 's');
+--eval INSERT INTO t1 (a, data) VALUES (9, 's');
+--enable_query_log
+
+--disable_query_log
+ALTER TABLE t3 ADD COLUMN d int;
+--enable_query_log
+
+--disable_query_log
+--eval INSERT INTO t2 (a, data) VALUES (10, $data);
+--eval INSERT INTO t2 (a, data) VALUES (11, $data);
+--eval INSERT INTO t2 (a, data) VALUES (12, $data);
+--eval INSERT INTO t2 (a, data) VALUES (13, $data);
+--enable_query_log
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (14, $data);
+--eval INSERT INTO t1 (a, data) VALUES (15, $data);
+--eval INSERT INTO t1 (a, data) VALUES (16, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (17, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (18, $data);
+--eval INSERT INTO t1 (a, data) VALUES (19, 's');
+--eval INSERT INTO t2 (a, data) VALUES (20, 's');
+--eval INSERT INTO t1 (a, data) VALUES (21, 's');
+--enable_query_log
+
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ --disable_query_log
+ CREATE TABLE t4 SELECT * FROM t1;
+ --enable_query_log
+}
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+{
+ --disable_query_log
+ --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+ CREATE TABLE t4 SELECT * FROM t1;
+ --enable_query_log
+}
+
+--disable_query_log
+--eval INSERT INTO t2 (a, data) VALUES (15, $data);
+--enable_query_log
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (22, $data);
+--eval INSERT INTO t1 (a, data) VALUES (23, $data);
+--eval INSERT INTO t1 (a, data) VALUES (24, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (25, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (26, $data);
+--eval INSERT INTO t1 (a, data) VALUES (27, 's');
+--eval INSERT INTO t2 (a, data) VALUES (28, 's');
+--eval INSERT INTO t1 (a, data) VALUES (29, 's');
+--enable_query_log
+
+--disable_query_log
+CREATE TABLE t5 (a int);
+--enable_query_log
+
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'` )
+{
+ connection slave;
+ --source include/wait_for_slave_sql_to_stop.inc
+
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+ START SLAVE SQL_THREAD;
+ --source include/wait_for_slave_sql_to_start.inc
+ connection master;
+}
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 3 - BEGIN - COMMIT
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (1, $data);
+--eval INSERT INTO t1 (a, data) VALUES (2, $data);
+--eval INSERT INTO t1 (a, data) VALUES (3, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (4, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (5, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (6, $data);
+--eval INSERT INTO t1 (a, data) VALUES (7, 's');
+--eval INSERT INTO t2 (a, data) VALUES (8, 's');
+--eval INSERT INTO t1 (a, data) VALUES (9, 's');
+--enable_query_log
+COMMIT;
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 4 - BEGIN - ROLLBACK
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (1, $data);
+--eval INSERT INTO t1 (a, data) VALUES (2, $data);
+--eval INSERT INTO t1 (a, data) VALUES (3, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (4, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (5, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (6, $data);
+--eval INSERT INTO t1 (a, data) VALUES (7, 's');
+--eval INSERT INTO t2 (a, data) VALUES (8, 's');
+--eval INSERT INTO t1 (a, data) VALUES (9, 's');
+--enable_query_log
+ROLLBACK;
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 5 - PROCEDURE
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+DELIMITER //;
+
+CREATE PROCEDURE p1(pd VARCHAR(30000))
+BEGIN
+ INSERT INTO t1 (a, data) VALUES (1, pd);
+ INSERT INTO t1 (a, data) VALUES (2, pd);
+ INSERT INTO t1 (a, data) VALUES (3, pd);
+ INSERT INTO t1 (a, data) VALUES (4, pd);
+ INSERT INTO t1 (a, data) VALUES (5, 's');
+END//
+
+DELIMITER ;//
+
+TRUNCATE TABLE t1;
+
+--disable_query_log
+eval CALL p1($data);
+--enable_query_log
+
+TRUNCATE TABLE t1;
+
+BEGIN;
+--disable_query_log
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+eval CALL p1($data);
+--enable_query_log
+COMMIT;
+
+TRUNCATE TABLE t1;
+
+BEGIN;
+--disable_query_log
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+eval CALL p1($data);
+--enable_query_log
+ROLLBACK;
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 6 - XID
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (1, $data);
+--eval INSERT INTO t1 (a, data) VALUES (2, $data);
+--eval INSERT INTO t1 (a, data) VALUES (3, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (4, $data);
+SAVEPOINT sv;
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (5, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (6, $data);
+--eval INSERT INTO t1 (a, data) VALUES (7, 's');
+--eval INSERT INTO t2 (a, data) VALUES (8, 's');
+--eval INSERT INTO t1 (a, data) VALUES (9, 's');
+--enable_query_log
+ROLLBACK TO sv;
+COMMIT;
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # 7 - NON-TRANS TABLE
+--echo ########################################################################################
+
+connection master;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (1, $data);
+--eval INSERT INTO t1 (a, data) VALUES (2, $data);
+--eval INSERT INTO t2 (a, data) VALUES (3, $data);
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+ --eval INSERT INTO t1 (a, data) VALUES (4, $data);
+}
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+{
+ --eval INSERT INTO t1 (a, data) VALUES (4, $data);
+}
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (5, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (6, $data);
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (7, $data);
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+ --eval UPDATE t2 SET data= CONCAT($data, $data);
+}
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+{
+ --eval UPDATE t2 SET data= CONCAT($data, $data);
+}
+--eval INSERT INTO t1 (a, data) VALUES (8, 's');
+--eval INSERT INTO t1 (a, data) VALUES (9, 's');
+--eval INSERT INTO t2 (a, data) VALUES (10, 's');
+--eval INSERT INTO t1 (a, data) VALUES (11, 's');
+--enable_query_log
+COMMIT;
+
+BEGIN;
+--disable_query_log
+--eval INSERT INTO t1 (a, data) VALUES (15, $data);
+--eval INSERT INTO t1 (a, data) VALUES (16, $data);
+--eval INSERT INTO t2 (a, data) VALUES (17, $data);
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+ --eval INSERT INTO t1 (a, data) VALUES (18, $data);
+}
+if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+{
+ --eval INSERT INTO t1 (a, data) VALUES (18, $data);
+}
+--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--eval INSERT INTO t1 (a, data) VALUES (19, $data);
+--enable_query_log
+COMMIT;
+
+if (`SELECT @@binlog_format = 'STATEMENT'`)
+{
+ connection slave;
+ --source include/wait_for_slave_sql_to_stop.inc
+
+ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+ START SLAVE SQL_THREAD;
+ --source include/wait_for_slave_sql_to_start.inc
+ connection master;
+}
+
+let $diff_statement= SELECT * FROM t1;
+--source include/diff_master_slave.inc
+
+--echo ########################################################################################
+--echo # CLEAN
+--echo ########################################################################################
+
+connection master;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE IF EXISTS t4;
+DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
+DROP PROCEDURE p1;
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
index 46168d6b97a..377f75b91db 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -97,9 +97,8 @@ SELECT * FROM t2 ORDER BY a;
connection slave;
START SLAVE;
source include/wait_for_slave_sql_to_stop.inc;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
STOP SLAVE;
RESET SLAVE;
SELECT * FROM t2 ORDER BY a;
@@ -150,9 +149,8 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -195,9 +193,8 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -240,9 +237,8 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -286,9 +282,8 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
#START SLAVE;
@@ -495,9 +490,8 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -539,9 +533,8 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -811,9 +804,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
@@ -922,9 +914,8 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
--echo ********************************************
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
---query_vertical SHOW SLAVE STATUS
+--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
+--echo Slave failed with Error $errno
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index 0baf49c9fac..6de4a538e72 100644
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -20,19 +20,15 @@ rename table t1 to t5, t2 to t1;
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
flush no_write_to_binlog tables;
# Check that it's not in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+let $binlog_start= $rename_event_pos;
+source include/show_binlog_events.inc;
# Check that the master is not confused.
select * from t3;
# This FLUSH should go into the binlog to not confuse the slave.
flush tables;
# Check that it's in the binlog.
---replace_result $SERVER_VERSION SERVER_VERSION
---replace_column 2 # 5 #
---replace_regex /table_id: [0-9]+/table_id: #/
-eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
+let $binlog_start= $rename_event_pos;
+source include/show_binlog_events.inc;
sync_slave_with_master;
# Check that the slave is not confused.
diff --git a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
new file mode 100644
index 00000000000..39190611983
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
@@ -0,0 +1,375 @@
+################################################################################
+# In this test case, we verify if some DDL statements implicitly commit a
+# transaction and are written directly to the binary log without going
+# through either the Statement- or Transactional-Cache.
+#
+# As any statement that goes through a cache is written to the binary log
+# wrapped in a BEGIN...COMMIT, we proceed as follows:
+#
+# - create a transaction and insert some values into a transactional table.
+# - execute a DDL statement that is supposed to implicitly commit the previous
+# transaction.
+# - Check in the binary log for a COMMIT mark which is supposed to be written
+# before the DDL statement.
+# - Check in the binary log if the DDL is not wrapped by a BEGIN..COMMIT.
+#
+# For further details, please, read WL#2687 and WL#5072.
+################################################################################
+
+--echo #########################################################################
+--echo # CONFIGURATION
+--echo #########################################################################
+#Re-enable this after fixing BUG#46572
+#connection master;
+
+CREATE TABLE tt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = Innodb;
+CREATE TABLE tt_2 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = Innodb;
+
+INSERT INTO tt_1(ddl_case) VALUES(0);
+INSERT INTO tt_2(ddl_case) VALUES(0);
+
+--echo #########################################################################
+--echo # CHECK IMPLICT COMMIT
+--echo #########################################################################
+SET AUTOCOMMIT= 0;
+let $ddl_cases= 41;
+while (`SELECT $ddl_cases >= 1`)
+{
+ --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
+ let $in_temporary= "no";
+ #
+ # In SBR and MIXED modes, the commit event is usually the third event in the
+ # binary log:
+ #
+ # 1: BEGIN
+ # 2: INSERT
+ # 3: COMMIT
+ # 4: DDL EVENT which triggered the previous commmit.
+ #
+ if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
+ {
+ let $commit_event_row_number= 3;
+ }
+ #
+ # In RBR mode, the commit event is usually the fourth event in the binary log:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ # 4: COMMIT
+ # 5: DDL EVENT which triggered the previous commmit.
+ #
+ if (`select @@binlog_format = 'ROW'`)
+ {
+ let $commit_event_row_number= 4;
+ }
+ let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1);
+ --enable_query_log
+ eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases);
+ if (`SELECT $ddl_cases = 41`)
+ {
+ let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES;
+ }
+ if (`SELECT $ddl_cases = 40`)
+ {
+ let $cmd= LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+ }
+ if (`SELECT $ddl_cases = 39`)
+ {
+ let $cmd= ANALYZE TABLE nt_1;
+ }
+ if (`SELECT $ddl_cases = 38`)
+ {
+ let $cmd= CHECK TABLE nt_1;
+ }
+ if (`SELECT $ddl_cases = 37`)
+ {
+ let $cmd= OPTIMIZE TABLE nt_1;
+ }
+ if (`SELECT $ddl_cases = 36`)
+ {
+ let $cmd= REPAIR TABLE nt_1;
+ }
+ if (`SELECT $ddl_cases = 35`)
+ {
+ let $cmd= LOCK TABLES tt_1 WRITE;
+ }
+ if (`SELECT $ddl_cases = 34`)
+ {
+ let $cmd= UNLOCK TABLES;
+ }
+ if (`SELECT $ddl_cases = 33`)
+ {
+ let $cmd= CREATE USER 'user'@'localhost';
+ }
+ if (`SELECT $ddl_cases = 32`)
+ {
+ let $cmd= GRANT ALL ON *.* TO 'user'@'localhost';
+ }
+ if (`SELECT $ddl_cases = 31`)
+ {
+ let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass');
+ }
+ if (`SELECT $ddl_cases = 30`)
+ {
+ let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
+ }
+ if (`SELECT $ddl_cases = 29`)
+ {
+ let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost';
+ }
+ if (`SELECT $ddl_cases = 28`)
+ {
+ let $cmd= DROP USER 'user_new'@'localhost';
+ }
+ if (`SELECT $ddl_cases = 27`)
+ {
+ let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
+ }
+ if (`SELECT $ddl_cases = 26`)
+ {
+ let $cmd= ALTER EVENT evt COMMENT 'evt';
+ }
+ if (`SELECT $ddl_cases = 25`)
+ {
+ let $cmd= DROP EVENT evt;
+ }
+ if (`SELECT $ddl_cases = 24`)
+ {
+ let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
+ }
+ if (`SELECT $ddl_cases = 23`)
+ {
+ let $cmd= DROP TRIGGER tr;
+ #
+ # In RBR mode, due to the trigger the tt_2 is also updated:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: TABLE MAP EVENT
+ # 4: ROW EVENT
+ # 5: COMMIT
+ # 6: DDL EVENT which triggered the previous commmit.
+ #
+ if (`select @@binlog_format = 'ROW'`)
+ {
+ let $commit_event_row_number= 5;
+ }
+ }
+ if (`SELECT $ddl_cases = 22`)
+ {
+ let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
+ }
+ if (`SELECT $ddl_cases = 21`)
+ {
+ let $cmd= ALTER FUNCTION fc COMMENT 'fc';
+ }
+ if (`SELECT $ddl_cases = 20`)
+ {
+ let $cmd= DROP FUNCTION fc;
+ }
+ if (`SELECT $ddl_cases = 19`)
+ {
+ let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
+ }
+ if (`SELECT $ddl_cases = 18`)
+ {
+ let $cmd= ALTER PROCEDURE pc COMMENT 'pc';
+ }
+ if (`SELECT $ddl_cases = 17`)
+ {
+ let $cmd= DROP PROCEDURE pc;
+ }
+ if (`SELECT $ddl_cases = 16`)
+ {
+ let $cmd= CREATE VIEW v AS SELECT * FROM tt_1;
+ }
+ if (`SELECT $ddl_cases = 15`)
+ {
+ let $cmd= ALTER VIEW v AS SELECT * FROM tt_1;
+ }
+ if (`SELECT $ddl_cases = 14`)
+ {
+ let $cmd= DROP VIEW v;
+ }
+ if (`SELECT $ddl_cases = 13`)
+ {
+ let $cmd= CREATE INDEX ix ON tt_1(ddl_case);
+ }
+ if (`SELECT $ddl_cases = 12`)
+ {
+ let $cmd= DROP INDEX ix ON tt_1;
+ }
+ if (`SELECT $ddl_cases = 11`)
+ {
+ let $cmd= CREATE TEMPORARY TABLE tt_xx (a int);
+ let $in_temporary= "yes";
+ # In SBR and MIXED modes, the DDL statement is written to the binary log but
+ # does not commit the current transaction.
+ #
+ # 1: BEGIN
+ # 2: INSERT
+ # 3: CREATE TEMPORARY
+ #
+ # In RBR the transaction is not committed either and the statement is not
+ # written to the binary log:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ #
+ if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
+ {
+ let $commit_event_row_number= 4;
+ }
+ }
+ if (`SELECT $ddl_cases = 10`)
+ {
+ let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
+ #
+ # In MIXED mode, the changes are logged as rows and we have what follows:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ # 4: COMMIT
+ # 5: DDL EVENT which triggered the previous commmit.
+ #
+ if (`select @@binlog_format = 'MIXED'`)
+ {
+ let $commit_event_row_number= 4;
+ }
+ }
+ if (`SELECT $ddl_cases = 9`)
+ {
+ let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx;
+ #
+ # In MIXED mode, the changes are logged as rows and we have what follows:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ # 4: COMMIT
+ # 5: DDL EVENT which triggered the previous commmit.
+ #
+ if (`select @@binlog_format = 'MIXED'`)
+ {
+ let $commit_event_row_number= 4;
+ }
+ }
+ if (`SELECT $ddl_cases = 8`)
+ {
+ let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
+ let $in_temporary= "yes";
+ #
+ # In SBR and MIXED modes, the DDL statement is written to the binary log
+ # but does not commit the current transaction:
+ #
+ # 1: BEGIN
+ # 2: INSERT
+ # 3: DROP TEMPORARY
+ #
+ # In RBR the transaction is not committed either and the statement is not
+ # written to the binary log:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ #
+ if (`select @@binlog_format = 'STATEMENT'`)
+ {
+ let $commit_event_row_number= 4;
+ }
+ # In MIXED mode, the changes are logged as rows and we have what follows:
+ #
+ # 1: BEGIN
+ # 2: TABLE MAP EVENT
+ # 3: ROW EVENT
+ # 4: DROP TEMPORARY table IF EXISTS
+ #
+ if (`select @@binlog_format = 'MIXED'`)
+ {
+ let $commit_event_row_number= 5;
+ }
+ }
+ if (`SELECT $ddl_cases = 7`)
+ {
+ let $cmd= CREATE TABLE tt_xx (a int);
+ }
+ if (`SELECT $ddl_cases = 6`)
+ {
+ let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
+ }
+ if (`SELECT $ddl_cases = 5`)
+ {
+ let $cmd= RENAME TABLE tt_xx TO new_tt_xx;
+ }
+ if (`SELECT $ddl_cases = 4`)
+ {
+ let $cmd= TRUNCATE TABLE new_tt_xx;
+ }
+ if (`SELECT $ddl_cases = 3`)
+ {
+ let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx;
+ }
+ if (`SELECT $ddl_cases = 2`)
+ {
+ let $cmd= CREATE DATABASE db;
+ }
+ if (`SELECT $ddl_cases = 1`)
+ {
+ let $cmd= DROP DATABASE IF EXISTS db;
+ }
+ --eval $cmd
+ --disable_query_log
+ #
+ # When a temporary table is either created or dropped, there is no implicit
+ # commit. The flag in_temporary is used to avoid aborting the test in such
+ # cases. Thus we force the commit.
+ #
+ if (`SELECT $in_temporary = "yes"`)
+ {
+ --eval COMMIT
+ }
+ let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number);
+ if (`SELECT SUBSTRING("$event_commit",1,6) != "COMMIT"`)
+ {
+ --echo it *does not* commit the current transaction.
+ --echo $cmd
+ --echo $event_commit
+ SHOW BINLOG EVENTS;
+ exit;
+ }
+ --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
+ let $binlog_start= $first_binlog_position;
+ --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
+ --source include/show_binlog_events.inc
+ --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
+ --echo
+ dec $ddl_cases;
+}
+SET AUTOCOMMIT= 1;
+
+--echo ###################################################################################
+--echo # CHECK CONSISTENCY
+--echo ###################################################################################
+# Re-enable this after fixing BUG#46572
+# #--sync_slave_with_master
+#
+# #--let $diff_table_1= master:test.tt_1
+# #--let $diff_table_2= slave:test.tt_1
+# #--source include/diff_tables.inc
+#
+
+--echo ###################################################################################
+--echo # CLEAN
+--echo ###################################################################################
+#Re-enable this after fixing BUG#46572
+#connection master;
+
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+
+
+#Re-enable this after fixing BUG#46572
+#sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test
new file mode 100644
index 00000000000..c866b68466d
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_innodb.test
@@ -0,0 +1,123 @@
+#
+# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
+#
+connection master;
+CREATE TABLE t4 (
+ id INT(5) unsigned NOT NULL auto_increment,
+ name varchar(15) NOT NULL default '',
+ number varchar(35) NOT NULL default 'default',
+ PRIMARY KEY (id),
+ UNIQUE KEY unique_rec (name,number)
+) ENGINE=InnoDB;
+
+--disable_warnings
+LOAD DATA
+ INFILE '../../std_data/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_warnings
+LOAD DATA
+ INFILE '../../std_data/loaddata_pair.dat'
+ REPLACE INTO TABLE t4
+ (name,number);
+--enable_warnings
+SELECT * FROM t4;
+
+sync_slave_with_master;
+SELECT * FROM t4;
+
+connection master;
+--disable_query_log
+DROP TABLE t4;
+--enable_query_log
+sync_slave_with_master;
+connection master;
+
+# End of 4.1 tests
+
+#
+# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
+# on master
+#
+#Note Matthias: to be merged to rpl_ddl.test
+
+--source include/not_ndb_default.inc
+
+FLUSH LOGS;
+sync_slave_with_master;
+FLUSH LOGS;
+connection master;
+let $engine_type= "InnoDB";
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
+eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
+SET AUTOCOMMIT = 0;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+
+# We want to verify that the following transactions are written to the
+# binlog, despite the transaction is rolled back. (They should be
+# written to the binlog since they contain non-transactional DROP
+# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which
+# is transactional (InnoDB) on master and MyISAM on slave. t1 should
+# be transactional on master so that the insert into t1 does not cause
+# the transaction to be logged. Since t1 is non-transactional on
+# slave, the change will not be rolled back, so the inserted rows will
+# stay in t1 and we can verify that the transaction was replicated.
+#
+# Note, however, that the previous explanation is not true for ROW and
+# MIXED modes as rollback on a transactional table is not written to
+# the binary log.
+ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
+SHOW CREATE TABLE mysqltest1.t1;
+
+--echo -------- switch to master --------
+connection master;
+INSERT INTO mysqltest1.t1 SET f1= 1;
+DROP TEMPORARY TABLE mysqltest1.tmp;
+ROLLBACK;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+# Must return no rows here
+SELECT COUNT(*) FROM mysqltest1.t1;
+
+INSERT INTO mysqltest1.t1 SET f1= 2;
+CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
+ROLLBACK;
+SHOW CREATE TABLE mysqltest1.tmp2;
+# Must return no rows here
+SELECT COUNT(*) FROM mysqltest1.t1;
+
+sync_slave_with_master;
+--echo -------- switch to slave --------
+connection slave;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp;
+--error ER_NO_SUCH_TABLE
+SHOW CREATE TABLE mysqltest1.tmp2;
+# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
+SELECT COUNT(*) FROM mysqltest1.t1;
+FLUSH LOGS;
+
+--echo -------- switch to master --------
+connection master;
+FLUSH LOGS;
+
+DROP DATABASE mysqltest1;
+-- source include/master-slave-end.inc
+
+--echo End of 5.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index 78f0bebd89d..a6bf2b294d1 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -38,6 +38,7 @@ connection master;
truncate table t1;
# first scenario: duplicate on first row
insert delayed into t1 values(10, "my name");
+flush table t1;
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
{
# statement below will be converted to non-delayed INSERT and so
@@ -49,7 +50,7 @@ if (`SELECT @@global.binlog_format != 'STATEMENT'`)
{
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
}
-flush table t1; # to wait for INSERT DELAYED to be done
+flush table t1;
select * from t1;
sync_slave_with_master;
# when bug existed in statement-based binlogging, t1 on slave had
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
index 43d45ef6c60..ee09c316354 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
@@ -55,7 +55,9 @@ INSERT INTO t1 VALUES (2, 2);
INSERT INTO t1 VALUES (3, 3);
INSERT INTO t1 VALUES (4, 4);
+--disable_warnings
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+--enable_warnings
SELECT * FROM t1 ORDER BY a;
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index 129a39ac509..a933a7b2372 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -1,6 +1,3 @@
-# Requires statement logging
--- source include/have_binlog_format_mixed_or_statement.inc
-
# See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
@@ -71,7 +68,7 @@ set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--query_vertical show slave status;
# Trigger error again to test CHANGE MASTER
@@ -93,7 +90,7 @@ stop slave;
change master to master_user='test';
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--query_vertical show slave status;
# Trigger error again to test RESET SLAVE
@@ -115,7 +112,7 @@ connection slave;
stop slave;
reset slave;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 16 # 22 # 23 # 33 #
--query_vertical show slave status;
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 0517fea1be3..7efcb67b033 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -43,7 +43,7 @@ show binlog events from 107 limit 1;
show binlog events from 107 limit 2;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
-show binlog events from 107 limit 2,1;
+show binlog events from 107 limit 1,4;
flush logs;
# We need an extra update before doing save_master_pos.
@@ -104,7 +104,7 @@ show binlog events in 'slave-bin.000001' from 4;
--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'slave-bin.000002' from 4;
-source include/show_slave_status.inc;
+source include/show_slave_status2.inc;
# Need to recode the following
diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
new file mode 100644
index 00000000000..68e67208f4a
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
@@ -0,0 +1,503 @@
+################################################################################
+# This is an auxiliary file used by rpl_mixing_engines.test, and that it
+# executes SQL statements according to a format string, as specified in
+# rpl_mixing_engines.test. In addition, it accepts the special format
+# strings 'configure' and 'clean', used before and after everything else.
+################################################################################
+
+if (`SELECT HEX(@commands) = HEX('configure')`)
+{
+ connection master;
+
+ SET SQL_LOG_BIN=0;
+ eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval SET SQL_LOG_BIN=1;
+
+ connection slave;
+
+ SET SQL_LOG_BIN=0;
+ eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+ eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
+ SET SQL_LOG_BIN=1;
+
+ connection master;
+
+ INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
+
+ INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
+ INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
+
+ DELIMITER |;
+
+ CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+ INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+ END|
+
+ CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+ END|
+
+ CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+ INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+ RETURN "fc_i_tt_5_suc";
+ END|
+
+ CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+ INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+ RETURN "fc_i_nt_5_suc";
+ END|
+
+ CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+ INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+ END|
+
+ CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+ INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+ END|
+
+ CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
+ INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+ INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+ END|
+
+ CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
+ BEGIN
+ DECLARE in_stmt_id INTEGER;
+ SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
+ SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+ INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+ INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+ END|
+
+ DELIMITER ;|
+
+ let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+
+ let $trans_id= 7;
+ let $stmt_id= 1;
+ let $commands= '';
+
+ SET @commands= '';
+}
+
+if (`SELECT HEX(@commands) = HEX('clean')`)
+{
+ connection master;
+
+ DROP TABLE tt_1;
+ DROP TABLE tt_2;
+ DROP TABLE tt_3;
+ DROP TABLE tt_4;
+ DROP TABLE tt_5;
+ DROP TABLE tt_6;
+
+ DROP TABLE nt_1;
+ DROP TABLE nt_2;
+ DROP TABLE nt_3;
+ DROP TABLE nt_4;
+ DROP TABLE nt_5;
+ DROP TABLE nt_6;
+
+ DROP PROCEDURE pc_i_tt_5_suc;
+ DROP PROCEDURE pc_i_nt_5_suc;
+ DROP FUNCTION fc_i_tt_5_suc;
+ DROP FUNCTION fc_i_nt_5_suc;
+
+ sync_slave_with_master;
+
+ SET @commands= '';
+}
+
+if (`SELECT HEX(@commands) != HEX('')`)
+{
+ --disable_query_log
+ SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
+ let $command= `SELECT @command`;
+ --eval SET @check_commands= '$commands'
+ if (`SELECT HEX(@check_commands) = HEX('''')`)
+ {
+ let $commands= `SELECT @commands`;
+ }
+ --echo -b-b-b-b-b-b-b-b-b-b-b- >> $command << -b-b-b-b-b-b-b-b-b-b-b-
+ let $pos_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+ --enable_query_log
+ if (`SELECT HEX(@command) = HEX('B')`)
+ {
+ eval BEGIN;
+ }
+ if (`SELECT HEX(@command) = HEX('T')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('T-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('T-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval SELECT fc_i_tt_5_suc ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('T-proc')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval CALL pc_i_tt_5_suc ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('eT')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Te')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Te-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_5`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Te-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('N')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('N-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('N-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval SELECT fc_i_nt_5_suc ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('N-proc')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval CALL pc_i_nt_5_suc ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('eN')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Ne')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Ne-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_5`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('Ne-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('tN')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('tNe')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM tt_1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('nT')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('nTe')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_1`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM nt_1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('NT')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval UPDATE nt_3, tt_3 SET nt_3.info= "new text $trans_id --> $stmt_id", tt_3.info= "new text $trans_id --> $stmt_id" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('NT-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('NT-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_tt_5_suc($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('NeT-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_4`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_4 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('NeT-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from nt_5`;
+ let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('TN')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval UPDATE tt_4, nt_4 SET tt_4.info= "new text $trans_id --> $stmt_id", nt_4.info= "new text $trans_id --> $stmt_id" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('TN-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('TN-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_nt_5_suc($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('TeN-trig')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_3`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_3 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('TeN-func')`)
+ {
+ #--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
+ let $old_trans_id= `SELECT max(trans_id) from tt_5`;
+ let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
+ inc $stmt_id;
+ }
+ if (`SELECT HEX(@command) = HEX('CS-T->T')`)
+ {
+ --eval CREATE TABLE tt_xx_$trans_id engine=$engine_type SELECT * FROM tt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CS-N->N')`)
+ {
+ --eval CREATE TABLE nt_xx_$trans_id engine=MyIsam SELECT * FROM nt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CS-T->N')`)
+ {
+ --eval CREATE TABLE tt_xx_$trans_id engine=$engine_type SELECT * FROM nt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CS-N->T')`)
+ {
+ --eval CREATE TABLE nt_xx_$trans_id engine=MyIsam SELECT * FROM tt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CSe-T->T')`)
+ {
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ --eval CREATE TABLE tt_xx_$trans_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM tt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CSe-N->N')`)
+ {
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ --eval CREATE TABLE nt_xx_$trans_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM nt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CSe-T->N')`)
+ {
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ --eval CREATE TABLE tt_xx_$trans_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM nt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CSe-N->T')`)
+ {
+ --error ER_DUP_ENTRY, ER_DUP_KEY
+ --eval CREATE TABLE nt_xx_$trans_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM tt_1;
+ }
+ if (`SELECT HEX(@command) = HEX('CT')`)
+ {
+ --eval CREATE TEMPORARY TABLE tt_xx_$trans_id (a int) engine=$engine_type;
+ }
+ if (`SELECT HEX(@command) = HEX('drop-CS')`)
+ {
+ --disable_warnings
+ eval DROP TABLE IF EXISTS tt_xx_$trans_id, nt_xx_$trans_id;
+ --enable_warnings
+ }
+ if (`SELECT HEX(@command) = HEX('drop-CT')`)
+ {
+ --disable_warnings
+ eval DROP TEMPORARY TABLE IF EXISTS tt_xx_$trans_id;
+ --enable_warnings
+ }
+ if (`SELECT HEX(@command) = HEX('C')`)
+ {
+ eval COMMIT;
+ }
+ if (`SELECT HEX(@command) = HEX('R')`)
+ {
+ eval ROLLBACK;
+ }
+ if (`SELECT HEX(@command) = HEX('S1')`)
+ {
+ eval SAVEPOINT s1;
+ }
+ if (`SELECT HEX(@command) = HEX('R1')`)
+ {
+ eval ROLLBACK TO s1;
+ }
+ --disable_query_log
+ SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
+ inc $stmt_id;
+
+ let $binlog_start= $pos_command;
+ --source include/show_binlog_events.inc
+ --echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e-
+ if (`SELECT HEX(@commands) = HEX('')`)
+ {
+ let $binlog_start= $pos_trans_command;
+ --echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b-
+ --source include/show_binlog_events.inc
+ --echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
+ --echo
+ let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+ let $stmt_id= 1;
+ inc $trans_id;
+ let $commands= '';
+ }
+
+ --source extra/rpl_tests/rpl_mixing_engines.inc
+}
diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test
index cbda85527f1..ea36a241664 100644
--- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test
+++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test
@@ -1,710 +1,1662 @@
-###################################################################################
-# This test checks if transactions that mixes transactional and non-transactional
-# tables are correctly handled in statement mode. In an nutshell, we have what
-# follows:
+################################################################################
+# - Introduction
+# This checks if transactions that mixes transactional and non-transactional
+# are correctly handled. There are several types of statements that require
+# attention because of their special behavior in transactions:
#
-# 1) "B T T C" generates in binlog the "B T T C" entries.
+# * Non-transactional updates that take place inside a transaction present
+# problems for logging because (1) they are visible to other clients before
+# the transaction is committed, and (2) they are not rolled back even if the
+# transaction is rolled back. It is not always possible to log correctly in
+# statement format when both transactional and non-transactional tables are
+# used in the same transaction.
#
-# 2) "B T T R" generates in binlog an "empty" entry.
+# * Statements that do an implicit commit (i.e., most but not all DDL, and
+# some utility commands) are logged specially due to unspecified requirements by
+# NDB.
+#
+# * Statements that update temporary tables need special treatment since they
+# are not logged in row format.
#
-# 3) "B T N C" generates in binlog the "B T N C" entries.
+# - Definitions
#
-# 4) "B T N R" generates in binlog the "B T N R" entries.
+# To reason about logging different table types, we make some preliminary
+# definitions.
#
-# 5) "T" generates in binlog the "B T C" entry.
+# * A table that has a transactional engine is called a T-table.
#
-# 6) "N" generates in binlog the "N" entry.
+# * A table that has a non-transactional engine is called an N-table.
#
-# 7) "M" generates in binglog the "B M C" entries.
+# * A statement makes an N-write if it makes any type of change to the server
+# state that will not be changed by a ROLLBACK.
#
-# 8) "B N N T C" generates in binglog the "N N B T C" entries.
+# * Events are either appended to the Transaction Cache (TC) or to the
+# Statement Cache (SC) or written directly to the binlog.
#
-# 9) "B N N T R" generates in binlog the "N N B T R" entries.
+# - Preliminary Rules
#
-# 10) "B N N C" generates in binglog the "N N" entries.
+# The following preliminary rules are actually consequences of the principle
+# that statements shall be correctly logged when binlog_format=MIXED or ROW.
+# They also apply when binlog_format=STATEMENT: this makes statement format
+# work in many practical cases.
#
-# 11) "B N N R" generates in binlog the "N N" entries.
+# * (Causality) If statement A is executed before statement B, and B is logged
+# in statement format, and B reads tables that A may modifies, then B shall be
+# logged after A.
#
-# 12) "B M T C" generates in the binlog the "B M T C" entries.
+# * (Durability) Events shall be written to the binary log at the moment they
+# take effect. In particular, changes to N-tables shall be written to the
+# binary log when they have been executed, and changes to T-tables shall be
+# written to the binary log on commit. If --sync-binlog has been specified,
+# then it suffices that events are be written to the binary log at the next
+# synchronization point.
#
-# 13) "B M T R" generates in the binlog the "B M T R" entries.
-###################################################################################
-
---echo ###################################################################################
---echo # CONFIGURATION
---echo ###################################################################################
-connection master;
+# * (causality-precedence) If causality and durability cannot both be
+# fulfilled, then casuality is considered more important.
+#
+# - Rules for non-committing statements, except CREATE TEMPORARY TABLE...SELECT
+#
+# The preliminary rules above, together with the principles for logging format
+# , have been used to construct the following rules.
+#
+# CALL statements are unrolled, so that each statement executed by the stored
+# procedure is logged separately. (If a stored procedure A invokes a stored
+# procedure B, then B is unrolled recursively). In the following, we assume
+# that unrolling has already been done, and the word "statement" refers to a
+# non-CALL top-level statement or a non-CALL sub-statement.
+#
+# Let S be a logged statement that does not have an implicit commit, except
+# CREATE TEMPORARY TABLE...SELECT (This includes all "pure DML": INSERT,
+# UPDATE, DELETE, REPLACE, TRUNCATE, SELECT, DO, CALL, EXECUTE, LOAD DATA
+# INFILE, and BINLOG. It also includes CREATE TEMPORARY TABLE without SELECT,
+# and DROP TEMPORARY TABLE. CREATE TEMPORARY TABLE...SELECT is handled in the
+# next subsection).
+#
+# Before executing S, determine unsafeness:
+#
+# * If S either makes N-writes or reads from an N-table, and either S or a
+# previous statement in the same transaction reads or writes to a T-table,
+# then S is marked as unsafe.
+#
+# When logging S, determine where to log it by applying the following rules in
+# order:
+#
+# * If S is to be logged in statement format (i.e., if one of the following
+# holds: (1) STATEMENT; (2) MIXED and S is safe; (3) S is of DDL type, i.e.,
+# CREATE TEMPORARY TABLE):
+# 1. If S produces an error and does not do any N-write, do not log.
+# 2. Otherwise, if either S or any previous statement in the same
+# transaction reads or writes in any T-tables, log to TC.
+# 3. Otherwise, log to SC.
+#
+# * If S is to be logged in row format (i.e., if S is DML and one of the
+# following holds: (1) ROW; (2) MIXED and S is unsafe):
+# 1. Do not log row events that write to temporary tables.
+# 2. Log row events that write to non-temporary N-tables to SC.
+# 3. Log row events that write to non-temporary T-tables to TC, except
+# rows that are rolled back due to an error. (Note: if there is an error,
+# rows written to a T-table are kept if there are subsequent rows written
+# to an N-table.)
+#
+# * At the end of S, write BEGIN + SC + COMMIT to the binlog and clear the
+# SC.
+#
+# At end of transaction:
+#
+# * At COMMIT or implicit commit, where all XA tables in the transaction
+# succeed in the "prepare" phase:
+# 1. If the TC is non-empty, write BEGIN + TC + COMMIT to the binlog.
+# 2. If the TC is empty, do nothing.
+#
+# * At ROLLBACK; or at COMMIT or implicit commit where some XA table fails
+# in the "prepare" phase:
+# 1. If the TC contains any N-write, write BEGIN + TC + ROLLBACK to the
+# binlog.
+# 2. If the TC does not contain any N-write, do nothing.
+#
+# * At ROLLBACK TO SAVEPOINT:
+# 1. If the TC contains any N-write after the savepoint, write ROLLBACK TO
+# SAVEPOINT to the TC.
+# 2. Otherwise, clear the part of the TC that starts at the savepoint and
+# extends to the end of the TC. (Bug#47327 breaks this rule)
+#
+# * Clear the TC at the end of the transaction.
+#
+# - Rules for CREATE [TEMPORARY] TABLE...SELECT
+#
+# First, unsafeness is determined as above (R-unsafe-transaction). Then the
+# logging format is decided. Then the following rules apply.
+#
+# * If logging in statement format (i.e., one of the following holds: (1)
+# STATEMENT; (2) MIXED and statement is safe):
+# 1. If there is an error, do not write anything.
+# 2. If there is no error and the TEMPORARY keyword is used, write the
+# entire CREATE...SELECT statement to the TC.
+# 3. If there is no error and the TEMPORARY keyword is not used, write the
+# entire CREATE...SELECT directly to the binlog.
+#
+# * If logging in row format (i.e., one of the following holds: (1) ROW; (2)
+# MIXED and statement is unsafe):
+# 1. If the TEMPORARY keyword is used, do not write anything.
+# 2. If the TEMPORARY keyword is not used, write CREATE TABLE (without
+# select) + BEGIN + row events + COMMIT to the TC. If there is an error,
+# clear the TC; otherwise flush the TC to the binlog at the end of the
+# statement and then clear the TC. (Note: currently Bug#47899 breaks this
+# rule)
+#
+# - Rules for committing statements, except CREATE [TEMPORARY] TABLE...SELECT
+#
+# * All other statements that have a pre-commit are written directly to the
+# binlog. (Note: this is semantically equivalent to writing it to the SC and
+# flushing the SC. However, due to requirements by NDB (which have not been
+# clarified), we write directly to the binlog.)
+#
+# We use the include file rpl_mixing_engines.inc to generate sql commands from a
+# format string. The format string consists of a sequence of 'codes' separated
+# by spaces. The following codes exist:
+#
+# - Define the scope of a transaction:
+# B - Begin.
+# C - Commit.
+# R - Rollback.
+# S1 - Savepoint.
+# R1 - Rollback to S1.
+#
+# - Change only T-Tables:
+# T - Updates a T-Table.
+# T-trig - Updates T-Tables through a trigger.
+# T-func - Updates T-Tables through a function.
+# T-proc - Updates T-Tables through a procedure.
+# eT - Fails while updating the first tuple in a T-Table.
+# Te - Fails while updating an n-tuple (n > 1) in a T-Table.
+# Te-trig - Fails while updating an n-tuple (n > 1) in a T-Table.
+# Te-func - Fails while updating an n-tuple (n > 1) in a T-Table.
+#
+# - Change only N-Tables
+# N - Updates a N-Table.
+# N-trig - Updates N-Tables through a trigger.
+# N-func - Updates N-Tables through a function.
+# N-proc - Updates N-Tables through a procedure.
+# eN - Fails while updating the first tuple in a N-Table.
+# Ne - Fails while updating an n-tuple (n > 1) in a N-Table.
+# Ne-trig - Fails while updating an n-tuple (n > 1) in a N-Table.
+# Ne-func - Fails while updating an n-tuple (n > 1) in a N-Table.
+#
+# - Read T-table and write N-table:
+# tN - Updates a N-Table
+# tNe - Fails while updating an n-tuple (n > 1) in a N-Table.
+#
+# - Read N-table and write T-table:
+# nT - Updates a T-Table.
+# nTe - Fails while updating an n-tuple (n > 1) in a T-Table.
+#
+# - Update both types of tables. First a N-Table and the a T-Table:
+# NT - Upates both types of tables through an update statement.
+# NT-trig - Updates both types of tables through a trigger.
+# NT-func - Updates both types of tables through a procedure.
+# NeT-trig - Fails while updating an n-tuple (n > 1) in a T-Table.
+# NeT-func - Fails while updating an n-tuple (n > 1) in a T-Table.
+#
+# - Update both types of tables. First a T-Table and the a N-Table:
+# TN - Upates both types of tables through an update statement.
+# TN-trig - Updates both types of tables through a trigger.
+# TN-func - Updates both types of tables through a procedure.
+# TeN-trig - Fails while updating an n-tuple (n > 1) in a N-Table.
+# TeN-func - Fails while updating an n-tuple (n > 1) in a N-Table.
+#
+# - This is CREATE...SELECT:
+# CS-T->T - Creates a T-table selecting from a T-table.
+# CS-N->N - Creates a N-table selecting from a N-table.
+# CS-T->N - Creates a T-table selecting form a N-table.
+# CS-N->T - Creates a N-table selecting from a T-table.
+# CSe-T->T - Fails while creating a T-table selecting from a T-table.
+# CSe-N->N - Fails while creating a N-table selecting from a N-table.
+# CSe-T->N - Fails while creating a T-table selecting from a a N-table.
+# CSe-N->T - Fails while creating a N-table selecting from a T-table.
+# drop-CS - Drops any of the tables previously created.
+# CT - Creates a temporary T-table.
+# drop-CT - Drops a temporary T-table.
+#
+# The format of the entries in the binlog depends on the mode and on the type
+# statements: S - statement and R - row. And when it is clear from the context
+# which statement is referred to, we sometimes use "M" to denote a "Mixed"
+# statement, i.e., one that accesses both a T-table and an N-table.
+#
+# For further details, please, read WL#2687 and WL#5072.
+################################################################################
+--echo #########################################################################
+--echo # CONFIGURATION
+--echo #########################################################################
+
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
-SET SQL_LOG_BIN=0;
-CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-SET SQL_LOG_BIN=1;
-
-connection slave;
-
-SET SQL_LOG_BIN=0;
-CREATE TABLE nt_1 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_2 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_3 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE nt_4 (a text, b int PRIMARY KEY, c text) ENGINE = MyISAM;
-CREATE TABLE tt_1 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_2 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_3 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-CREATE TABLE tt_4 (a text, b int PRIMARY KEY, c text) ENGINE = Innodb;
-SET SQL_LOG_BIN=1;
+SET @commands= 'configure';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+--echo #########################################################################
+--echo # 1 - MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
+--echo #########################################################################
connection master;
-DELIMITER |;
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo # --> STMT "B T C" entries, format S.
+--echo # --> ROW "B T C" entries, format R.
+--echo # --> MIXED "B T C" entries, format S.
+--echo #
+SET @commands= 'T';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-CREATE FUNCTION f1 () RETURNS VARCHAR(64)
-BEGIN
- RETURN "Testing...";
-END|
+SET @commands= 'T-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-CREATE FUNCTION f2 () RETURNS VARCHAR(64)
-BEGIN
- RETURN f1();
-END|
+SET @commands= 'T-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-CREATE PROCEDURE pc_i_tt_3 (IN x INT, IN y VARCHAR(64))
-BEGIN
- INSERT INTO tt_3 VALUES (y,x,x);
-END|
+SET @commands= 'T-proc';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-CREATE TRIGGER tr_i_tt_3_to_nt_3 BEFORE INSERT ON tt_3 FOR EACH ROW
-BEGIN
- INSERT INTO nt_3 VALUES (NEW.a, NEW.b, NEW.c);
-END|
-CREATE TRIGGER tr_i_nt_4_to_tt_4 BEFORE INSERT ON nt_4 FOR EACH ROW
-BEGIN
- INSERT INTO tt_4 VALUES (NEW.a, NEW.b, NEW.c);
-END|
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #1.e) Generates in the binlog what follows:
+--echo # --> STMT empty.
+--echo # --> ROW empty.
+--echo # --> MIXED empty.
+--echo #
+SET @commands= 'eT';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-DELIMITER ;|
+SET @commands= 'Te';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---echo ###################################################################################
---echo # MIXING TRANSACTIONAL and NON-TRANSACTIONAL TABLES
---echo ###################################################################################
-connection master;
+SET @commands= 'Te-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
+SET @commands= 'Te-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+--echo
+--echo
+--echo
+--echo
--echo #
---echo #1) "B T T C" generates in binlog the "B T T C" entries.
+--echo #2) Generates in the binlog what follows:
+--echo # --> STMT "B N C" entry, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format S.
--echo #
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text 4", 4, "new text 4");
-INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4");
-COMMIT;
+SET @commands= 'N';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'N-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'N-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'N-proc';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #1.e) "B T T C" with error in T generates in binlog the "B T T C" entries.
+--echo #2.e) Generates in the binlog what follows if a N-table is changed:
+--echo # --> STMT "B N C" entry, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format S.
--echo #
-INSERT INTO tt_1 VALUES ("new text -2", -2, "new text -2");
-BEGIN;
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -2", -2, "new text -2");
-INSERT INTO tt_2 VALUES ("new text -3", -3, "new text -3");
-COMMIT;
+SET @commands= 'eN';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'Ne';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_2 VALUES ("new text -5", -5, "new text -5");
---error ER_DUP_ENTRY
-INSERT INTO tt_2 VALUES ("new text -4", -4, "new text -4"), ("new text -5", -5, "new text -5");
-COMMIT;
+SET @commands= 'Ne-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
+SET @commands= 'Ne-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #2) "B T T R" generates in binlog an "empty" entry.
+--echo #3) Generates in the binlog what follows:
+--echo # --> STMT "B M C" entry if only N-Table is changed, format S.
+--echo # --> STMT "B M C" entries, format S.
+--echo # --> ROW "B N T B T C" entries, format R.
+--echo # --> MIXED "B N T B T C" entries, format R.
--echo #
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text 5", 5, "new text 5");
-INSERT INTO tt_2 VALUES ("new text 5", 5, "new text 5");
-ROLLBACK;
+SET @commands= 'tN';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'nT';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'NT';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'NT-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'NT-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'TN';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'TN-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'TN-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #2.e) "B T T R" with error in T generates in binlog an "empty" entry.
+--echo #3.e) Generates in the binlog what follows:
+--echo # --> STMT "B M C" entry if only N-Table is changed, format S.
+--echo # --> STMT "B M R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
+SET @commands= 'tNe';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'nTe';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'NeT-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'NeT-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'TeN-trig';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'TeN-func';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+--echo
+--echo
+--echo
+--echo
--echo #
-INSERT INTO tt_1 VALUES ("new text -7", -7, "new text -7");
-BEGIN;
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -6", -6, "new text -6"), ("new text -7", -7, "new text -7");
-INSERT INTO tt_2 VALUES ("new text -8", -8, "new text -8");
-ROLLBACK;
+--echo #4) Generates in the binlog what follows:
+--echo # --> STMT "B T T C" entries, format S.
+--echo # --> ROW "B T T C" entries, format R.
+--echo # --> MIXED "B T T C" entries, format S
+--echo #
+SET @commands= 'B T T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_2 VALUES ("new text -10", -10, "new text -10");
---error ER_DUP_ENTRY
-INSERT INTO tt_2 VALUES ("new text -9", -9, "new text -9"), ("new text -10", -10, "new text -10");
-ROLLBACK;
+SET @commands= 'B T-trig T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #3) "B T N C" generates in binlog the "B T N C" entries.
+--echo #4.e) Generates in the binlog what follows:
+--echo # --> STMT "B T C" entries, format S.
+--echo # --> ROW "B T C" entries, format R.
+--echo # --> MIXED "B T C" entries, format S.
--echo #
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text 6", 6, "new text 6");
-INSERT INTO nt_1 VALUES ("new text 6", 6, "new text 6");
-COMMIT;
+SET @commands= 'B T eT C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B eT T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #5) Generates in the binlog what follows:
+--echo # --> STMT empty.
+--echo # --> ROW empty.
+--echo # --> MIXED empty.
+--echo #
+SET @commands= 'B T T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #5.e) Generates in the binlog what follows:
+--echo # --> STMT empty.
+--echo # --> ROW empty.
+--echo # --> MIXED empty.
+--echo #
+SET @commands= 'B T eT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Te-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B eT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #6) Generates in the binlog what follows:
+--echo # --> STMT "B N C B N C" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S.
+--echo #
+SET @commands= 'B N N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #3.e) "B T N C" with error in either T or N generates in binlog the "B T N C" entries.
+--echo #6.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B N C" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S.
--echo #
-INSERT INTO tt_1 VALUES ("new text -12", -12, "new text -12");
-BEGIN;
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -11", -11, "new text -11"), ("new text -12", -12, "new text -12");
-INSERT INTO nt_1 VALUES ("new text -13", -13, "new text -13");
-COMMIT;
+SET @commands= 'B N eN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B eN N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #7) Generates in the binlog what follows:
+--echo # --> STMT "B N C B N C" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S.
+--echo #
+SET @commands= 'B N N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text -14", -14, "new text -14");
-INSERT INTO nt_1 VALUES ("new text -16", -16, "new text -16");
---error ER_DUP_ENTRY
-INSERT INTO nt_1 VALUES ("new text -15", -15, "new text -15"), ("new text -16", -16, "new text -16");
-COMMIT;
+SET @commands= 'B N-func N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #4) "B T N R" generates in binlog the "B T N R" entries.
+--echo #7.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B N C" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S.
--echo #
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text 7", 7, "new text 7");
-INSERT INTO nt_1 VALUES ("new text 7", 7, "new text 7");
-ROLLBACK;
+SET @commands= 'B N eN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N Ne-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B eN N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Ne-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #4.e) "B T N R" with error in either T or N generates in binlog the "B T N R" entries.
+--echo #8) Generates in the binlog what follows:
+--echo # --> STMT "B T N C" entries, format S.
+--echo # --> ROW "B N C B T C" entries, format R.
+--echo # --> MIXED "B N C B T C" entries, format R in N and S in T.
--echo #
-INSERT INTO tt_1 VALUES ("new text -17", -17, "new text -17");
-BEGIN;
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -16", -16, "new text -16"), ("new text -17", -17, "new text -17");
-INSERT INTO nt_1 VALUES ("new text -18", -18, "new text -18");
-ROLLBACK;
+SET @commands= 'B T N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_1 VALUES ("new text -19", -19, "new text -19");
-INSERT INTO nt_1 VALUES ("new text -21", -21, "new text -21");
---error ER_DUP_ENTRY
-INSERT INTO nt_1 VALUES ("new text -20", -20, "new text -20"), ("new text -21", -21, "new text -21");
-ROLLBACK;
+SET @commands= 'B T-func N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #5) "T" generates in binlog the "B T C" entry.
+--echo #8.e) Generates in the binlog what follows if T-* fails:
+--echo # --> STMT "B N C" entry, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
+--echo # Otherwise, what follows if N-* fails and a N-Table is changed:
+--echo # --> STMT "B T N C" entries, format S.
+--echo # --> ROW "B N C B T C" entries, format R.
+--echo # --> MIXED "B N C B T C" entries, format R in N and S in T.
--echo #
-INSERT INTO tt_1 VALUES ("new text 8", 8, "new text 8");
+SET @commands= 'B eT N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T eN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Ne C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #5.e) "T" with error in T generates in binlog an "empty" entry.
+--echo #9) Generates in the binlog what follows:
+--echo # --> STMT "B T N R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
--echo #
-INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1");
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -1", -1, "new text -1"), ("new text -22", -22, "new text -22");
---error ER_DUP_ENTRY
-INSERT INTO tt_1 VALUES ("new text -23", -23, "new text -23"), ("new text -1", -1, "new text -1");
+SET @commands= 'B T N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-trig N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-func N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T-proc N-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #6) "N" generates in binlog the "N" entry.
+--echo #9.e) Generates in the binlog what follows if T* fails:
+--echo # --> STMT "B N C" entry, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
+--echo # Otherwise, what follows if N* fails and a N-Table is changed:
+--echo # --> STMT "B T N R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
--echo #
-INSERT INTO nt_1 VALUES ("new text 9", 9, "new text 9");
+SET @commands= 'B eT N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B Te N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T eN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T Ne R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #6.e) "N" with error in N generates in binlog an empty entry if the error
---echo # happens in the first tuple. Otherwise, generates the "N" entry and
---echo # the error is appended.
+--echo #10) Generates in the binlog:
+--echo # --> STMT "B N C B T C" entries, format S.
+--echo # --> ROW "B N C B T C" entries, format R.
+--echo # --> MIXED "B N C B T C" entries, format S.
--echo #
-INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
---error ER_DUP_ENTRY
-INSERT INTO nt_1 VALUES ("new text -1", -1, "new text -1");
---error ER_DUP_ENTRY
-INSERT INTO nt_1 VALUES ("new text -24", -24, "new text -24"), ("new text -1", -1, "new text -1");
+SET @commands= 'B N T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-trig T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-func T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc T-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc T-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N-proc T-proc C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #7) "M" generates in binglog the "B M C" entries.
+--echo #11) Generates in the binlog what follows:
+--echo # --> STMT "B N C" entries, format S.
+--echo # --> ROW "B N C" entries, format R.
+--echo # --> MIXED "B N C" entries, format S.
--echo #
-DELETE FROM nt_1;
+SET @commands= 'B N T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_1 SELECT * FROM tt_1;
+SET @commands= 'B N T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-DELETE FROM tt_1;
+SET @commands= 'B N T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO tt_1 SELECT * FROM nt_1;
+SET @commands= 'B N T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO tt_3 VALUES ("new text 000", 000, '');
+SET @commands= 'B N-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO tt_3 VALUES("new text 100", 100, f1());
+SET @commands= 'B N-trig T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_4 VALUES("new text 100", 100, f1());
+SET @commands= 'B N-trig T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO tt_3 VALUES("new text 200", 200, f2());
+SET @commands= 'B N-trig T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_4 VALUES ("new text 300", 300, '');
+SET @commands= 'B N-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_4 VALUES ("new text 400", 400, f1());
+SET @commands= 'B N-func T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_4 VALUES ("new text 500", 500, f2());
+SET @commands= 'B N-func T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-CALL pc_i_tt_3(600, "Testing...");
+SET @commands= 'B N-func T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 1", nt_4.a= "new text 1", tt_3.a= "new text 1", tt_4.a= "new text 1" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
+SET @commands= 'B N-proc T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 2", tt_4.a= "new text 2", nt_3.a= "new text 2", nt_4.a = "new text 2" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
+SET @commands= 'B N-proc T-proc R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 3", nt_3.a= "new text 3", nt_4.a= "new text 3", tt_4.a = "new text 3" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
+SET @commands= 'B N-proc T-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 4", nt_3.a= "new text 4", nt_4.a= "new text 4", tt_4.a = "new text 4" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
+SET @commands= 'B N-proc T-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #7.e) "M" with error in M generates in binglog the "B M R" entries.
+--echo #12) Generates in the binlog what follows:
+--echo # --> STMT "B M C B T C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M T C" entries, format S.
+--echo # --> ROW "B N C B T T C" entries, format R.
+--echo # --> MIXED "B N C B T T C" entries, format R in N/T and format S in T.
--echo #
+SET @commands= 'B tN T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nT T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO nt_3 VALUES ("new text -26", -26, '');
-SELECT * FROM tt_3;
---error ER_DUP_ENTRY
-INSERT INTO tt_3 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
-SELECT * FROM tt_3;
+SET @commands= 'B TN-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-INSERT INTO tt_4 VALUES ("new text -26", -26, '');
-SELECT * FROM nt_4;
---error ER_DUP_ENTRY
-INSERT INTO nt_4 VALUES ("new text -25", -25, ''), ("new text -26", -26, '');
-SELECT * FROM nt_4;
+SET @commands= 'B TN-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #8) "B N N T C" generates in binglog the "N N B T C" entries.
+--echo #12.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B T C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M T C" entries, format S.
+--echo # --> ROW "B N C B T T C" entries, format R.
+--echo # --> MIXED "B N C B T T C" entries, format R in N/T and format S in T.
+ --echo #
+SET @commands= 'B tNe T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nTe T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-trig T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-func T C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+
+--echo
+--echo
+--echo
+--echo
--echo #
-BEGIN;
-INSERT INTO nt_1 VALUES ("new text 10", 10, "new text 10");
-INSERT INTO nt_2 VALUES ("new text 10", 10, "new text 10");
-INSERT INTO tt_1 VALUES ("new text 10", 10, "new text 10");
-COMMIT;
+--echo #13) "B M T R" generates in the binlog:
+--echo # --> STMT "B M C B T R" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M T R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
+--echo #
+SET @commands= 'B tN T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
---echo #8.e) "B N N T R" See 6.e and 9.e.
+--echo #13.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B T R" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M T R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
--echo #
+SET @commands= 'B tNe T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nTe T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-trig T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-func T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #9) "B N N T R" generates in binlog the "N N B T R" entries.
+--echo #14) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B T M C" entries, format S.
+--echo # --> ROW "B N C B T T C" entries, format R.
+--echo # --> MIXED "B N C B T T C" entries, format R in N/T and format S in T.
--echo #
-BEGIN;
-INSERT INTO nt_1 VALUES ("new text 11", 11, "new text 11");
-INSERT INTO nt_2 VALUES ("new text 11", 11, "new text 11");
-INSERT INTO tt_1 VALUES ("new text 11", 11, "new text 11");
-ROLLBACK;
+SET @commands= 'B T tN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T nT C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #9.e) "B N N T R" with error in N generates in binlog the "N N B T R" entries.
+--echo #14.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B T M C" entries, format S.
+--echo # --> ROW "B N C B T C" entry, format R.
+--echo # --> MIXED "B N C B T C" entry, format R.
--echo #
-BEGIN;
-INSERT INTO nt_1 VALUES ("new text -25", -25, "new text -25");
-INSERT INTO nt_2 VALUES ("new text -25", -25, "new text -25");
---error ER_DUP_ENTRY
-INSERT INTO nt_2 VALUES ("new text -26", -26, "new text -26"), ("new text -25", -25, "new text -25");
-INSERT INTO tt_1 VALUES ("new text -27", -27, "new text -27");
-ROLLBACK;
+SET @commands= 'B T tNe C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T nTe C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NeT-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
+SET @commands= 'B T NeT-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TeN-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TeN-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #10) "B N N C" generates in binglog the "N N" entries.
+--echo #15) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B T M R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
--echo #
-BEGIN;
-INSERT INTO nt_1 VALUES ("new text 12", 12, "new text 12");
-INSERT INTO nt_2 VALUES ("new text 12", 12, "new text 12");
-COMMIT;
+SET @commands= 'B T tN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T nT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NT-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TN-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
---echo #10.e) "B N N C" See 6.e and 9.e.
+--echo #15.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B T M R" entries, format S.
+--echo # --> ROW "B N C" entry, format R.
+--echo # --> MIXED "B N C" entry, format R.
--echo #
+SET @commands= 'B T tNe R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T nTe R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NeT-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T NeT-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TeN-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T TeN-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #11) "B N N R" generates in binlog the "N N" entries.
+--echo #16) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M N C" entries, format S.
+--echo # --> ROW "B N C B N C B T C" entries, format R.
+--echo # --> MIXED "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> MIXED "B N C B N C B T C" entries, format R.
--echo #
-BEGIN;
-INSERT INTO nt_1 VALUES ("new text 13", 13, "new text 13");
-INSERT INTO nt_2 VALUES ("new text 13", 13, "new text 13");
-ROLLBACK;
+SET @commands= 'B tN N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nT N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NT-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TN-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
--echo #
---echo #11.e) "B N N R" See 6.e and 9.e.
+--echo #16.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M N C" entries, format S.
+--echo # --> ROW "B N C B N C B T C" entries, format R.
+--echo # --> MIXED "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> MIXED "B N C B N C B T C" entries, format R.
--echo #
+SET @commands= 'B tNe N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nTe N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B NeT-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-trig N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B TeN-func N C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #12) "B M T C" generates in the binlog the "B M T C" entries.
+--echo #17) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M N R" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> MIXED "B N C B N C" entries, format R.
--echo #
-DELETE FROM nt_1;
-BEGIN;
-INSERT INTO nt_1 SELECT * FROM tt_1;
-INSERT INTO tt_2 VALUES ("new text 14", 14, "new text 14");
-COMMIT;
+SET @commands= 'B tN N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nT N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-DELETE FROM tt_1;
-BEGIN;
-INSERT INTO tt_1 SELECT * FROM nt_1;
-INSERT INTO tt_2 VALUES ("new text 15", 15, "new text 15");
-COMMIT;
+SET @commands= 'B NT N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES ("new text 700", 700, '');
-INSERT INTO tt_1 VALUES ("new text 800", 800, '');
-COMMIT;
+SET @commands= 'B NT-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES("new text 900", 900, f1());
-INSERT INTO tt_1 VALUES ("new text 1000", 1000, '');
-COMMIT;
+SET @commands= 'B NT-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES(1100, 1100, f2());
-INSERT INTO tt_1 VALUES ("new text 1200", 1200, '');
-COMMIT;
+SET @commands= 'B TN N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_4 VALUES ("new text 1300", 1300, '');
-INSERT INTO tt_1 VALUES ("new text 1400", 1400, '');
-COMMIT;
+SET @commands= 'B TN-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_4 VALUES("new text 1500", 1500, f1());
-INSERT INTO tt_1 VALUES ("new text 1600", 1600, '');
-COMMIT;
+SET @commands= 'B TN-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_4 VALUES("new text 1700", 1700, f2());
-INSERT INTO tt_1 VALUES ("new text 1800", 1800, '');
-COMMIT;
-BEGIN;
-CALL pc_i_tt_3(1900, "Testing...");
-INSERT INTO tt_1 VALUES ("new text 2000", 2000, '');
-COMMIT;
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #17.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B M N R" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B M C B N C" entries if in M only N-Table is changed, format S.
+--echo # --> MIXED "B N C B N C" entries, format R.
+--echo #
+SET @commands= 'B tNe N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B nTe N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 5", nt_4.a= "new text 5", tt_3.a= "new text 5", tt_4.a= "new text 5" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 2100", 2100, '');
-COMMIT;
+SET @commands= 'B NeT-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 6", tt_4.a= "new text 6", nt_3.a= "new text 6", nt_4.a = "new text 6" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 2200", 2200, '');
-COMMIT;
+SET @commands= 'B NeT-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 7", nt_3.a= "new text 7", nt_4.a= "new text 7", tt_4.a = "new text 7" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 2300", 2300, '');
-COMMIT;
+SET @commands= 'B TeN-trig N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 8", nt_3.a= "new text 8", nt_4.a= "new text 8", tt_4.a = "new text 8" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 2400", 2400, '');
-COMMIT;
+SET @commands= 'B TeN-func N R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #12.e) "B M T C" with error in M generates in the binlog the "B M T C" entries.
---echo #
+--echo #18) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B M C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B N C B M C" entries, format S.
+--echo # --> ROW "B N C B N C B T C" entries, format R.
+--echo # --> MIXED "B N C B N C B T C" entries, format S in first N and format R in the other.
+--echo #
+
+SET @commands= 'B N tN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N nT C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N NT C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---echo # There is a bug in the slave that needs to be fixed before enabling
---echo # this part of the test. A bug report will be filed referencing this
---echo # test case.
+SET @commands= 'B N NT-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_3 VALUES ("new text -28", -28, '');
---error ER_DUP_ENTRY
-INSERT INTO tt_3 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
-INSERT INTO tt_1 VALUES ("new text -27", -27, '');
-COMMIT;
+SET @commands= 'B N NT-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N TN C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N TN-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N TN-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_4 VALUES ("new text -28", -28, '');
---error ER_DUP_ENTRY
-INSERT INTO nt_4 VALUES ("new text -27", -27, ''), ("new text -28", -28, '');
-INSERT INTO tt_1 VALUES ("new text -28", -28, '');
-COMMIT;
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #13) "B M T R" generates in the binlog the "B M T R" entries
+--echo #18.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B M C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B N C B M C" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S in first N and format R in the other.
--echo #
+SET @commands= 'B N tNe C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-DELETE FROM nt_1;
-BEGIN;
-INSERT INTO nt_1 SELECT * FROM tt_1;
-INSERT INTO tt_2 VALUES ("new text 17", 17, "new text 17");
-ROLLBACK;
+SET @commands= 'B N nTe C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-DELETE FROM tt_1;
-BEGIN;
-INSERT INTO tt_1 SELECT * FROM nt_1;
-INSERT INTO tt_2 VALUES ("new text 18", 18, "new text 18");
-ROLLBACK;
-INSERT INTO tt_1 SELECT * FROM nt_1;
+SET @commands= 'B N NeT-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES ("new text 2500", 2500, '');
-INSERT INTO tt_1 VALUES ("new text 2600", 2600, '');
-ROLLBACK;
+SET @commands= 'B N NeT-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES("new text 2700", 2700, f1());
-INSERT INTO tt_1 VALUES ("new text 2800", 2800, '');
-ROLLBACK;
+SET @commands= 'B N TeN-trig C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_3 VALUES(2900, 2900, f2());
-INSERT INTO tt_1 VALUES ("new text 3000", 3000, '');
-ROLLBACK;
+SET @commands= 'B N TeN-func C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_4 VALUES ("new text 3100", 3100, '');
-INSERT INTO tt_1 VALUES ("new text 3200", 3200, '');
-ROLLBACK;
-BEGIN;
-INSERT INTO nt_4 VALUES("new text 3300", 3300, f1());
-INSERT INTO tt_1 VALUES ("new text 3400", 3400, '');
-ROLLBACK;
+--echo
+--echo
+--echo
+--echo
+--echo #
+--echo #19) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B M C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B N C B M R" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S in first N and format R in the other.
+--echo #
-BEGIN;
-INSERT INTO nt_4 VALUES("new text 3500", 3500, f2());
-INSERT INTO tt_1 VALUES ("new text 3600", 3600, '');
-ROLLBACK;
+SET @commands= 'B N tN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-CALL pc_i_tt_3(3700, "Testing...");
-INSERT INTO tt_1 VALUES ("new text 3700", 3700, '');
-ROLLBACK;
+SET @commands= 'B N nT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE nt_3, nt_4, tt_3, tt_4 SET nt_3.a= "new text 9", nt_4.a= "new text 9", tt_3.a= "new text 9", tt_4.a= "new text 9" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 3800", 3800, '');
-ROLLBACK;
+SET @commands= 'B N NT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, tt_4, nt_3, nt_4 SET tt_3.a= "new text 10", tt_4.a= "new text 10", nt_3.a= "new text 10", nt_4.a = "new text 10" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 3900", 3900, '');
-ROLLBACK;
+SET @commands= 'B N NT-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 11", nt_3.a= "new text 11", nt_4.a= "new text 11", tt_4.a = "new text 11" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 4000", 4000, '');
-ROLLBACK;
+SET @commands= 'B N NT-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-UPDATE tt_3, nt_3, nt_4, tt_4 SET tt_3.a= "new text 12", nt_3.a= "new text 12", nt_4.a= "new text 12", tt_4.a = "new text 12" where nt_3.b = nt_4.b and nt_4.b = tt_3.b and tt_3.b = tt_4.b and tt_4.b = 100;
-INSERT INTO tt_1 VALUES ("new text 4100", 4100, '');
-ROLLBACK;
+SET @commands= 'B N TN R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N TN-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N TN-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
--echo
--echo
--echo
--echo
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
--echo #
---echo #13.e) "B M T R" with error in M generates in the binlog the "B M T R" entries.
+--echo #19.e) Generates in the binlog what follows if a N-Table is changed:
+--echo # --> STMT "B N C B M C" entries if in M only N-Table is changed, format S.
+--echo # --> STMT "B N C B M R" entries, format S.
+--echo # --> ROW "B N C B N C" entries, format R.
+--echo # --> MIXED "B N C B N C" entries, format S in first N and format R in the other.
--echo #
+SET @commands= 'B N tNe R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO nt_3 VALUES ("new text -30", -30, '');
---error ER_DUP_ENTRY
-INSERT INTO tt_3 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
-INSERT INTO tt_1 VALUES ("new text -30", -30, '');
-ROLLBACK;
+SET @commands= 'B N nTe R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-BEGIN;
-INSERT INTO tt_4 VALUES ("new text -30", -30, '');
---error ER_DUP_ENTRY
-INSERT INTO nt_4 VALUES ("new text -29", -29, ''), ("new text -30", -30, '');
-INSERT INTO tt_1 VALUES ("new text -31", -31, '');
-ROLLBACK;
+SET @commands= 'B N NeT-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---source include/show_binlog_events.inc
+SET @commands= 'B N NeT-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-connection master;
-sync_slave_with_master;
+SET @commands= 'B N TeN-trig R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-slave.sql
---diff_files $MYSQLTEST_VARDIR/tmp/test-master.sql $MYSQLTEST_VARDIR/tmp/test-slave.sql
+SET @commands= 'B N TeN-func R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
--echo ###################################################################################
---echo # CLEAN
+--echo # 2 - SAVEPOINT
--echo ###################################################################################
+SET @commands= 'B T S1 T R1 C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
-connection master;
-DROP TABLE tt_1;
-DROP TABLE tt_2;
-DROP TABLE tt_3;
-DROP TABLE tt_4;
-DROP TABLE nt_1;
-DROP TABLE nt_2;
-DROP TABLE nt_3;
-DROP TABLE nt_4;
-DROP PROCEDURE pc_i_tt_3;
-DROP FUNCTION f1;
-DROP FUNCTION f2;
+SET @commands= 'B N T S1 T R1 C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T N S1 T R1 C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T S1 N T R1 C';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+--echo ###################################################################################
+--echo # 3 - CREATE TABLE...SELECT
+--echo ###################################################################################
+SET @commands= 'CSe-T->T CS-T->T drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'CSe-N->N CS-N->N drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'CSe-T->N CS-T->N drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'CSe-N->T CS-N->T drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'CSe-N->T CS-N->T drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'CSe-N->T CS-N->T drop-CS';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+--echo ###################################################################################
+--echo # 4 - ROLLBACK TEMPORARY TABLE
+--echo ###################################################################################
+SET @commands= 'B T CT R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T S1 T CT R1 R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B T CT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B tN CT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B CT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+SET @commands= 'B N CT T R';
+--source extra/rpl_tests/rpl_mixing_engines.inc
+
+--echo ###################################################################################
+--echo # CHECK CONSISTENCY
+--echo ###################################################################################
+connection master;
sync_slave_with_master;
+
+--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
+--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
+
+--echo ###################################################################################
+--echo # CLEAN
+--echo ###################################################################################
+SET @commands= 'clean';
+--source extra/rpl_tests/rpl_mixing_engines.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
index 50036e564a7..cf68ba53caf 100644
--- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
@@ -23,7 +23,7 @@ let $binary_log_limit_row= 3;
-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
let $binary_log_file= ;
-let $binary_log_limit_row= 3;
+let $binary_log_limit_row= 4;
let $binary_log_limit_offset= 1;
-- source include/show_binlog_events.inc
@@ -49,7 +49,7 @@ let $binary_log_limit_row= 3;
-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
let $binary_log_file= ;
-let $binary_log_limit_row= 3;
+let $binary_log_limit_row= 4;
let $binary_log_limit_offset= 1;
-- source include/show_binlog_events.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
new file mode 100644
index 00000000000..4029a628e04
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
@@ -0,0 +1,127 @@
+#
+# Bug#6148 ()
+#
+# Let the master do lots of insertions
+
+connection master;
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
+
+connection slave;
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
+
+connection master;
+create table t1(n int);
+sync_slave_with_master;
+stop slave;
+connection master;
+let $1=5000;
+disable_query_log;
+while ($1)
+{
+ eval insert into t1 values($1);
+ dec $1;
+}
+enable_query_log;
+save_master_pos;
+
+connection slave;
+start slave;
+let $wait_condition= SELECT COUNT(*) > 0 FROM t1;
+source include/wait_condition.inc;
+stop slave io_thread;
+start slave io_thread;
+source include/wait_for_slave_to_start.inc;
+sync_with_master;
+
+connection master;
+drop table t1;
+save_master_pos;
+
+connection slave;
+sync_with_master;
+
+
+#
+# Bug#38205 Row-based Replication (RBR) causes inconsistencies...
+# Bug#319 if while a non-transactional slave is replicating a transaction...
+#
+# Verifying that STOP SLAVE does not interrupt excution of a group
+# execution of events if the group can not roll back.
+# Killing the sql thread continues to provide a "hard" stop (the
+# part II, moved to the bugs suite as it's hard to make it
+# deterministic with KILL).
+#
+
+#
+# Part I. The being stopped sql thread finishes first the current group of
+# events if the group contains an event on a non-transaction table.
+
+connection master;
+create table t1i(n int primary key) engine=innodb;
+create table t2m(n int primary key) engine=myisam;
+begin;
+insert into t1i values (1);
+insert into t1i values (2);
+insert into t1i values (3);
+commit;
+
+sync_slave_with_master;
+connection slave;
+begin;
+insert into t1i values (5);
+
+connection master;
+let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+begin;
+insert into t1i values (4);
+insert into t2m values (1); # non-ta update to process
+insert into t1i values (5); # to block at. to be played with stopped
+commit;
+
+connection slave;
+# slave sql thread must be locked out by the conn `slave' explicit lock
+let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval select $pos0_master - $pos0_slave as zero;
+--enable_query_log
+
+connection slave1;
+let $count= 1;
+let $table= t2m;
+source include/wait_until_rows_count.inc;
+send stop slave;
+
+connection slave;
+rollback; # release the sql thread
+
+connection slave1;
+reap;
+source include/wait_for_slave_to_stop.inc;
+let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
+--echo *** sql thread is *not* running: $sql_status ***
+
+
+connection master;
+let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+connection slave;
+
+let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
+
+--echo *** the prove: the stopped slave has finished the current transaction ***
+
+--disable_query_log
+select count(*) as five from t1i;
+eval select $pos1_master - $pos1_slave as zero;
+eval select $pos1_slave > $pos0_slave as one;
+--enable_query_log
+
+source include/start_slave.inc;
+
+# clean-up
+connection master;
+drop table t1i, t2m;
+
+sync_slave_with_master;
+
+# End of tests
diff --git a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
new file mode 100644
index 00000000000..96ae314bee5
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
@@ -0,0 +1,147 @@
+# Proving that stopping in the middle of applying a group of events
+# does not have immediate effect if a non-transaction table has been changed.
+# The slave sql thread has to try to finish applying first.
+# The tests rely on simulation of the killed status.
+# The matter of testing correlates to some of `rpl_start_stop_slave' that does
+# not require `have_debug'.
+
+connection master;
+
+call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
+
+create table tm (a int auto_increment primary key) engine=myisam;
+create table ti (a int auto_increment primary key) engine=innodb;
+
+sync_slave_with_master;
+set @@global.debug="+d,stop_slave_middle_group";
+
+connection master;
+
+begin;
+insert into ti set a=null;
+insert into tm set a=null; # to simulate killed status on the slave
+commit;
+
+connection slave;
+
+# slave will catch the killed status but won't shut down immediately
+# only after the whole group has done (commit)
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: no error and the group is finished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read = $exec into @check;
+--enable_query_log
+eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
+select count(*) as one from tm;
+select count(*) as one from ti;
+
+set @@global.debug="-d";
+
+#
+# bug#45940 issues around rli->last_event_start_time
+# Testing of slave stopped after it had waited (in vain) for
+# the group be finished.
+# It could not be finished because of simulation of failure to
+# receive the terminal part
+# The test relay on simulation of the incomplete group in the relay log
+
+# Two cases are verified: a mixed transacton and a mixed multi-table update.
+#
+# The mixed transacton.
+#
+source include/start_slave.inc;
+
+connection master;
+
+truncate table tm; # cleanup of former tests
+truncate table ti;
+
+#connection slave;
+sync_slave_with_master;
+
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+
+connection master;
+
+begin;
+insert into ti set a=null;
+insert into tm set a=null;
+commit;
+
+connection slave;
+
+# slave will catch the killed status, won't shut down immediately
+# but does it eventually having the whole group unfinished (not committed)
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: the error and group unfinished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read - $exec > 0 into @check;
+--enable_query_log
+eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
+select count(*) as one from tm;
+select count(*) as zero from ti;
+
+set @@global.debug="-d";
+
+#
+# The mixed multi-table update
+#
+stop slave;
+truncate table tm;
+source include/start_slave.inc;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+set @@global.debug="+d,stop_slave_middle_group";
+set @@global.debug="+d,incomplete_group_in_relay_log";
+
+connection master;
+update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
+
+connection slave;
+
+# slave will catch the killed status, won't shut down immediately
+# but does it eventually having the whole group unfinished (not committed)
+#
+
+source include/wait_for_slave_sql_to_stop.inc;
+
+# checking: the error and group unfinished
+
+let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
+let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
+--disable_query_log
+eval SELECT $read - $exec > 0 into @check;
+--enable_query_log
+eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
+select max(a) as two from tm;
+select max(a) as one from ti;
+
+set @@global.debug="-d";
+
+#
+# clean-up
+#
+
+connection master;
+drop table tm, ti;
+
+connection slave; # slave SQL thread is stopped
+source include/stop_slave.inc;
+drop table tm, ti;