diff options
Diffstat (limited to 'mysql-test/extra')
59 files changed, 6754 insertions, 1010 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index a5011a1231d..3bbc693ceda 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -248,15 +248,17 @@ reset master; drop table if exists t3; --enable_warnings create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -source include/show_master_status.inc; +--let $binlog_file1= query_get_value(SHOW MASTER STATUS, File, 1) +--echo File $binlog_file1 let $it=4; while ($it) { insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); dec $it; } -# must show new binlog index after rotating; -source include/show_master_status.inc; +--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1) +--echo *** show new binlog index after rotating *** +--echo File $binlog_file2 drop table t3; --echo # diff --git a/mysql-test/extra/binlog_tests/binlog_cache_stat.test b/mysql-test/extra/binlog_tests/binlog_cache_stat.test new file mode 100644 index 00000000000..a602b098201 --- /dev/null +++ b/mysql-test/extra/binlog_tests/binlog_cache_stat.test @@ -0,0 +1,251 @@ +# Embedded server doesn't support binlog +-- source include/not_embedded.inc +-- source include/have_innodb.inc + +# Creating tables +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; + +# +# This test checks binlog_cache_use and binlog_cache_disk_use when +# transactions are committed and after when they are aborted. +# + +# +# Checking commit. +# +--echo **** Preparing the enviroment to check commit and its effect on status variables. +--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +let $exp_cache= 0; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 0; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Transactional changes which are long enough so they will be flushed to disk... +--echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +let $1=2000; +disable_query_log; +begin; +while ($1) +{ + eval insert into t1 values( $1 ); + dec $1; +} +commit; +enable_query_log; +let $exp_cache= 1; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Transactional changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +commit; +let $exp_cache= 2; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Non-Transactional changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +commit; +let $exp_cache= 2; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 1; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Mixed changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +commit; +let $exp_cache= 3; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 2; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +# +# Checking abort. +# +--echo **** Preparing the enviroment to check abort and its effect on the status variables. +--echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +let $exp_cache= 0; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 0; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Transactional changes which are long enough so they will be flushed to disk... +--echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +let $1=2000; +disable_query_log; +begin; +while ($1) +{ + eval insert into t1 values( $1 ); + dec $1; +} +rollback; +enable_query_log; +let $exp_cache= 1; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Transactional changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +rollback; +let $exp_cache= 2; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 0; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Non-Transactional changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +rollback; +let $exp_cache= 2; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 1; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} + +--echo **** Mixed changes which should not be flushed to disk and so should not +--echo **** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +rollback; +let $exp_cache= 3; +let $got_cache= query_get_value(show status like "binlog_cache_use", Value, 1); +let $exp_disk= 1; +let $got_disk= query_get_value(show status like "binlog_cache_disk_use", Value, 1); +let $exp_stmt_cache= 2; +let $got_stmt_cache= query_get_value(show status like "binlog_stmt_cache_use", Value, 1); +let $exp_stmt_disk= 0; +let $got_stmt_disk= query_get_value(show status like "binlog_stmt_cache_disk_use", Value, 1); +if (`SELECT $got_cache <> $exp_cache || $got_disk <> $exp_disk || $got_stmt_cache <> $exp_stmt_cache || $got_stmt_disk <> $exp_stmt_disk`) +{ + -- echo "Expected: binlog_cache_use = $exp_cache, binlog_cache_disk_use = $exp_disk but got binlog_cache_use = $got_cache, binlog_cache_disk_use = $got_disk" + -- echo "Expected: binlog_stmt_cache_use = $exp_stmt_cache, binlog_stmt_cache_disk_use = $exp_stmt_disk but got binlog_stmt_cache_use = $got_stmt_cache, binlog_stmt_cache_disk_use = $got_stmt_disk" + -- die +} +drop table t1, t2; diff --git a/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test b/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test deleted file mode 100644 index d537e29c1a8..00000000000 --- a/mysql-test/extra/binlog_tests/binlog_failure_mixing_engines.test +++ /dev/null @@ -1,301 +0,0 @@ -################################################################################ -# Let -# - B be begin, C commit and R rollback. -# - T a statement that accesses and changes only transactional tables, i.e. -# T-tables -# - N a statement that accesses and changes only non-transactional tables, -# i.e, N-tables. -# - M be a mixed statement, i.e. a statement that updates both T- and -# N-tables. -# - M* be a mixed statement that fails while updating either a T -# or N-table. -# - N* be a statement that fails while updating a N-table. -# -# In this test case, when changes are logged as rows either in the RBR or MIXED -# modes, we check if a M* statement that happens early in a transaction is -# written to the binary log outside the boundaries of the transaction and -# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with -# the master as the rollback will keep the changes on N-tables and undo them on -# T-tables. In particular, we expect the following behavior: -# -# 1. B M* T C would generate in the binlog B M* R B T C. -# 2. B M M* C would generate in the binlog B M M* C. -# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C. -# -# SBR is not considered in this test because a failing statement is written to -# the binary along with the error code such that a slave executes and rolls it -# back, thus undoing the effects on T-tables. -# -# Note that, in the first case, we are not preserving history from the master as -# we are introducing a rollback that never happened. However, this seems to be -# more acceptable than making the slave diverge. In the second case, the slave -# will diverge as the changes on T-tables that originated from the M statement -# are rolled back on the master but not on the slave. Unfortunately, we cannot -# simply roll the transaction back as this would undo any uncommitted changes -# on T-tables. -# -# We check two more cases. First, INSERT...SELECT* which produces the following -# results: -# -# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in -# the binlog the following entries: "Nothing". -# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in -# the binlog the following entries: B INSERT M...SELECT* R. -# -# Finally, we also check if any N statement that happens early in a transaction -# (i.e. before any T or M statement) is written to the binary log outside the -# boundaries of the transaction. In particular, we expect the following -# behavior: -# -# 1. B N N T C would generate in the binlog B N C B N C B T C. -# 2. B N N T R would generate in the binlog B N C B N C B T R. -# 3. B N* N* T C would generate in the binlog B N R B N R B T C. -# 4. B N* N* T R would generate in the binlog B N R B N R B T R. -# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C. -# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R. -# -# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be -# pushed after the WL#2687. -# -# Please, remove this test case after pushing WL#2687. -################################################################################ - -RESET MASTER; - ---echo ################################################################################### ---echo # CONFIGURATION ---echo ################################################################################### -CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM; -CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM; -CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb; -CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb; - -DELIMITER |; - -CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW -BEGIN - INSERT INTO nt_1 VALUES (NEW.a, NEW.b); -END| - -CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW -BEGIN - INSERT INTO tt_2 VALUES (NEW.a, NEW.b); -END| - -DELIMITER ;| - ---echo ################################################################################### ---echo # CHECK HISTORY IN BINLOG ---echo ################################################################################### ---echo ---echo ---echo ---echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO nt_1 VALUES ("new text 1", 1); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1); -INSERT INTO tt_2 VALUES ("new text 3", 3); -COMMIT; ---source include/show_binlog_events.inc - ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO tt_2 VALUES ("new text 4", 4); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4); -INSERT INTO tt_2 VALUES ("new text 6", 6); -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO nt_1 VALUES ("new text 10", 10); -BEGIN; -INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8); ---error ER_DUP_ENTRY -INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10); -INSERT INTO tt_2 VALUES ("new text 11", 11); -COMMIT; ---source include/show_binlog_events.inc - ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO tt_2 VALUES ("new text 15", 15); -BEGIN; -INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13); ---error ER_DUP_ENTRY -INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15); -INSERT INTO tt_2 VALUES ("new text 16", 16); -COMMIT; ---source include/show_binlog_events.inc - - ---echo ---echo ---echo ---echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO nt_1 VALUES ("new text 18", 18); -INSERT INTO nt_1 VALUES ("new text 20", 20); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18); ---error ER_DUP_ENTRY -INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20); -INSERT INTO tt_2 VALUES ("new text 21", 21); -COMMIT; ---source include/show_binlog_events.inc - ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -INSERT INTO tt_2 VALUES ("new text 23", 23); -INSERT INTO tt_2 VALUES ("new text 25", 25); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23); ---error ER_DUP_ENTRY -INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25); -INSERT INTO tt_2 VALUES ("new text 26", 26); -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates ---echo *** in the binlog the following entries: "Nothing". ---echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details. ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -TRUNCATE TABLE nt_2; -TRUNCATE TABLE tt_2; -INSERT INTO tt_2 VALUES ("new text 7", 7); -BEGIN; -INSERT INTO tt_2 VALUES ("new text 27", 27); ---error ER_DUP_ENTRY -INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1; -INSERT INTO tt_2 VALUES ("new text 28", 28); -ROLLBACK; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates ---echo *** in the binlog the following entries: "B INSERT M..SELECT* R". ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -TRUNCATE TABLE nt_2; -TRUNCATE TABLE tt_2; -INSERT INTO tt_2 VALUES ("new text 7", 7); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1; -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -TRUNCATE TABLE nt_1; -TRUNCATE TABLE tt_2; -BEGIN; -INSERT INTO nt_1 VALUES (USER(), 1); -INSERT INTO nt_1 VALUES (USER(), 2); -INSERT INTO tt_2 VALUES (USER(), 3); -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -INSERT INTO nt_1 VALUES (USER(), 4); -INSERT INTO nt_1 VALUES (USER(), 5); -INSERT INTO tt_2 VALUES (USER(), 6); -ROLLBACK; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1); ---error ER_DUP_ENTRY -INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1); -INSERT INTO tt_2 VALUES (USER(), 9); -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; ---error ER_DUP_ENTRY -INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1); ---error ER_DUP_ENTRY -INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1); -INSERT INTO tt_2 VALUES (USER(), 12); -ROLLBACK; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -INSERT INTO nt_1 VALUES (USER(), 13); -INSERT INTO nt_1 VALUES (USER(), 14); -INSERT INTO tt_2 VALUES (USER(), 15); -INSERT INTO nt_1 VALUES (USER(), 16); -INSERT INTO tt_2 VALUES (USER(), 17); -COMMIT; ---source include/show_binlog_events.inc - ---echo ---echo ---echo ---echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries ---echo -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); -BEGIN; -INSERT INTO nt_1 VALUES (USER(), 18); -INSERT INTO nt_1 VALUES (USER(), 19); -INSERT INTO tt_2 VALUES (USER(), 20); -INSERT INTO nt_1 VALUES (USER(), 21); -INSERT INTO tt_2 VALUES (USER(), 22); -ROLLBACK; ---source include/show_binlog_events.inc - ---echo ################################################################################### ---echo # CLEAN ---echo ################################################################################### - -DROP TABLE tt_1; -DROP TABLE tt_2; -DROP TABLE nt_1; -DROP TABLE nt_2; diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test index c99d0b86be3..7b31a3ebf17 100644 --- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test +++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test @@ -34,11 +34,11 @@ create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; let $table=t1; let $count=0; -insert delayed into t1 values (207); +insert /* before delayed */ delayed /* after delayed */ into t1 values (207); inc $count; --source include/wait_until_rows_count.inc -insert delayed into t1 values (null); +insert /*! delayed */ into t1 values (null); inc $count; --source include/wait_until_rows_count.inc @@ -52,13 +52,19 @@ inc $count; FLUSH TABLES; source include/show_binlog_events.inc; -insert delayed into t1 values (null),(null),(null),(null); +RESET MASTER; +insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc -insert delayed into t1 values (null),(null),(400),(null); +insert /*! delayed */ into t1 values (null),(null),(400),(null); inc $count; inc $count; inc $count; inc $count; --source include/wait_until_rows_count.inc +if (`SELECT @@SESSION.BINLOG_FORMAT = 'STATEMENT'`) { + FLUSH TABLES; + source include/show_binlog_events.inc; +} + select * from t1; drop table t1; diff --git a/mysql-test/extra/binlog_tests/binlog_truncate.test b/mysql-test/extra/binlog_tests/binlog_truncate.test index dce33b3cef0..d434f792db0 100644 --- a/mysql-test/extra/binlog_tests/binlog_truncate.test +++ b/mysql-test/extra/binlog_tests/binlog_truncate.test @@ -12,16 +12,57 @@ eval CREATE TABLE t1 (a INT) ENGINE=$engine; eval CREATE TABLE t2 (a INT) ENGINE=$engine; INSERT INTO t2 VALUES (1),(2),(3); let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1); -if (`select length('$before_truncate') > 0`) { +if ($before_truncate) { eval $before_truncate; } --echo **** Truncate of empty table shall be logged TRUNCATE TABLE t1; -if (`select length('$before_truncate') > 0`) { +if ($before_truncate) { eval $before_truncate; } TRUNCATE TABLE t2; source include/show_binlog_events.inc; DROP TABLE t1,t2; + +--echo # +--echo # Bug#42643: InnoDB does not support replication of TRUNCATE TABLE +--echo # + +eval CREATE TABLE t1 (a INT) ENGINE=$engine; +eval CREATE TABLE t2 (a INT) ENGINE=$engine; +INSERT INTO t1 VALUES (1),(2); + +let $binlog_start = query_get_value("SHOW MASTER STATUS", Position, 1); +if ($before_truncate) { + eval $before_truncate; +} + +--echo # Connection: default +BEGIN; +INSERT INTO t2 SELECT * FROM t1; + +connect (truncate,localhost,root,,); +--echo # Connection: truncate +send TRUNCATE TABLE t1; + +connection default; +--echo # Connection: default +INSERT INTO t2 SELECT * FROM t1; +SELECT COUNT(*) FROM t2; +COMMIT; + +connection truncate; +--echo # Connection: truncate +--echo # Reaping TRUNCATE TABLE +--reap +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; + +connection default; +--echo # Connection: default + +source include/show_binlog_events.inc; +disconnect truncate; +DROP TABLE t1,t2; diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index da63a7a8619..90146d41471 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -6,6 +6,8 @@ -- source include/have_blackhole.inc -- source include/have_log_bin.inc +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + # The server need to be started in $MYSQLTEST_VARDIR since it # uses ../../std_data/ -- source include/uses_vardir.inc @@ -171,7 +173,7 @@ insert into t1 values(2); rollback; let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); -if (`SELECT $master_log_pos_2 <> $master_log_pos_1`) +if ($master_log_pos_2 != $master_log_pos_1) { echo $master_log_pos_1 $master_log_pos_2; die Rollbacked transaction has been binlogged; diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index b240109f6e6..733ad05b0be 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -15,7 +15,6 @@ source include/show_binlog_events.inc; # absolutely need variables names to be quoted and strings to be # escaped). flush logs; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR let $MYSQLD_DATADIR= `select @@datadir`; --exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 drop table t2; diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test index 326ecedb60e..d071415bf65 100644 --- a/mysql-test/extra/binlog_tests/database.test +++ b/mysql-test/extra/binlog_tests/database.test @@ -30,3 +30,30 @@ drop table tt1, t1; source include/show_binlog_events.inc; FLUSH STATUS; + + +--echo # +--echo # Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT +--echo # BASED REPLICATION +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS db1; +DROP TABLE IF EXISTS t3; +--enable_warnings + +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +CREATE TABLE db1.t2 (b INT, KEY(b)) engine=innodb; +CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b)) + engine=innodb; +RESET MASTER; + +--error ER_ROW_IS_REFERENCED +DROP DATABASE db1; # Fails because of the fk +SHOW TABLES FROM db1; # t1 was dropped, t2 remains +--source include/show_binlog_events.inc # Check that the binlog drops t1 + +# Cleanup +DROP TABLE t3; +DROP DATABASE db1; diff --git a/mysql-test/extra/binlog_tests/drop_table.test b/mysql-test/extra/binlog_tests/drop_table.test new file mode 100644 index 00000000000..c55cbb67560 --- /dev/null +++ b/mysql-test/extra/binlog_tests/drop_table.test @@ -0,0 +1,34 @@ +# +# Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +connection con1; +RESET MASTER; +CREATE TABLE t1 (a INT); +SET AUTOCOMMIT=OFF; +BEGIN; +INSERT INTO t1 VALUES(1); + +connection con2; +--send DROP TABLE t1; + +connection con1; +COMMIT; + +connection con2; +--reap + +connection default; + +--disconnect con1 +--disconnect con2 + +let $VERSION=`select version()`; +source include/show_binlog_events.inc; diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test index 63833c10c14..c852ee4c8a0 100644 --- a/mysql-test/extra/binlog_tests/drop_temp_table.test +++ b/mysql-test/extra/binlog_tests/drop_temp_table.test @@ -69,4 +69,34 @@ let $VERSION=`SELECT VERSION()`; source include/show_binlog_events.inc; DROP DATABASE `drop-temp+table-test`; + +# +# Bug #54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW +# +# Sanity test. Checking that implicit DROP event is logged. +# +# After BUG#52616, the switch to ROW mode becomes effective even +# if there are open temporary tables. As such the implicit drop +# for temporary tables on session closing must be logged. +# + +RESET MASTER; + +CREATE TABLE t1 ( i text ); + +--connect(con1,localhost,root,,) +CREATE TEMPORARY TABLE ttmp1 ( i text ); +SET @@session.binlog_format=ROW; +INSERT INTO t1 VALUES ('1'); +SELECT @@session.binlog_format; +--disconnect con1 + +-- connection default +--let $wait_binlog_event= DROP +--source include/wait_for_binlog_event.inc +-- source include/show_binlog_events.inc +RESET MASTER; + +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/extra/binlog_tests/implicit.test b/mysql-test/extra/binlog_tests/implicit.test new file mode 100644 index 00000000000..de906fc0605 --- /dev/null +++ b/mysql-test/extra/binlog_tests/implicit.test @@ -0,0 +1,28 @@ +# First part: outside a transaction +RESET MASTER; +eval $prepare; + +INSERT INTO t1 VALUES (1); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +if ($cleanup) { + eval $cleanup; +} + +# Second part: inside a transaction +RESET MASTER; +eval $prepare; +BEGIN; +INSERT INTO t1 VALUES (2); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +INSERT INTO t1 VALUES (3); +source include/show_binlog_events.inc; +COMMIT; +source include/show_binlog_events.inc; +if ($cleanup) { + eval $cleanup; +} + diff --git a/mysql-test/extra/binlog_tests/innodb_stat.test b/mysql-test/extra/binlog_tests/innodb_stat.test deleted file mode 100644 index b31e99dfe71..00000000000 --- a/mysql-test/extra/binlog_tests/innodb_stat.test +++ /dev/null @@ -1,41 +0,0 @@ -# Embedded server doesn't support binlog --- source include/not_embedded.inc --- source include/have_innodb.inc - -# -# Let us test binlog_cache_use and binlog_cache_disk_use status vars. -# Actually this test has nothing to do with innodb per se, it just requires -# transactional table. -# -flush status; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1 (a int) engine=innodb; - -# Now we are going to create transaction which is long enough so its -# transaction binlog will be flushed to disk... -let $1=2000; -disable_query_log; -begin; -while ($1) -{ - eval insert into t1 values( $1 ); - dec $1; -} -commit; -enable_query_log; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; - -# Transaction which should not be flushed to disk and so should not -# increase binlog_cache_disk_use. -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -show status like "binlog_cache_disk_use"; -drop table t1; 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 c7e7a491ce1..b41bfeaba74 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); --disable_warnings drop table if exists t1, t2; @@ -204,6 +205,10 @@ select (@after:=unix_timestamp())*0; # always give repeatable output # the bug, the reap would return immediately after the insert into t2. select (@after-@before) >= 2; +connection con3; +commit; + +connection con2; drop table t1,t2; commit; @@ -257,7 +262,6 @@ DROP TABLE IF EXISTS t2; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb; INSERT INTO t1 VALUES (4,4); ---error ER_DUP_ENTRY CREATE TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; SELECT * from t2; TRUNCATE table t2; @@ -272,11 +276,9 @@ CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb ; INSERT INTO t1 values (7,7); ROLLBACK; INSERT INTO t1 values (8,8); ---error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; COMMIT; INSERT INTO t1 values (9,9); ---error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; ROLLBACK; SELECT * from t2; @@ -286,11 +288,9 @@ INSERT INTO t1 values (10,10); INSERT INTO t2 select * from t1; SELECT * from t1; INSERT INTO t2 values (100,100); ---error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; COMMIT; INSERT INTO t2 values (101,101); ---error ER_DUP_ENTRY CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * from t1; ROLLBACK; SELECT * from t2; @@ -316,6 +316,16 @@ disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish +if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) +{ + --let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7) + --let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7) + if ($binlog_query != ROLLBACK) { + --echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query' + --source include/show_rpl_debug_info.inc + --die Wrong value for slave parameter + } +} flush logs; let $MYSQLD_DATADIR= `select @@datadir`; @@ -327,25 +337,23 @@ let $MYSQLD_DATADIR= `select @@datadir`; if (`select @@binlog_format = 'ROW'`) { - let $start_pos= `select @binlog_start_pos + 418`; - --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --echo There is nothing to roll back; transactional changes are removed from the trans cache. } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - let $start_pos= `select @binlog_start_pos + 449`; - --exec $MYSQL_BINLOG --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=$binlog_rollback $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; # @@ -368,7 +376,8 @@ reset master; begin; insert into ti values (1); -insert into ti values (2) ; +insert into ti values (2) ; +# This is SAFE because --binlog-direct-non-transactional-updates=FALSE insert into tt select * from ti; rollback; diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test index 68aa949a7c7..7eca19bc834 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test @@ -24,6 +24,7 @@ reset master; begin; insert into ti values (1); insert into ti values (2) ; +# This is SAFE because --binlog-direct-non-transactional-updates=FALSE insert into tt select * from ti; rollback; diff --git a/mysql-test/extra/rpl_tests/check_type.inc b/mysql-test/extra/rpl_tests/check_type.inc new file mode 100644 index 00000000000..97300753d38 --- /dev/null +++ b/mysql-test/extra/rpl_tests/check_type.inc @@ -0,0 +1,62 @@ +# Helper file to perform one insert of a value into a table with +# different types on master and slave. The file will insert the +# result into the type_conversions table *on the slave* to get a +# summary of failing and succeeding tests. + +# Input: +# $source_type Type on the master +# $target_type Type on the slave +# $source_value Value on the master (inserted into the table) +# $target_value Value on the slave (expected value in the table +# on the slave) +# $can_convert True if conversion shall work, false if it +# shall generate an error +# $engine_type The storage engine to be used for storing table +# on both master and slave + +if (!$engine_type) +{ + # Use the default storage engine + let $engine_type=`SELECT @@storage_engine`; +} + +connection master; +disable_warnings; +DROP TABLE IF EXISTS t1; +enable_warnings; +eval CREATE TABLE t1( + pk INT NOT NULL PRIMARY KEY, + a $source_type +) ENGINE=$engine_type; +sync_slave_with_master; +eval ALTER TABLE t1 MODIFY a $target_type; + +connection master; +eval INSERT INTO t1 VALUES(1, $source_value); +if ($can_convert) { + sync_slave_with_master; + eval SELECT a = $target_value into @compare FROM t1; + eval INSERT INTO type_conversions SET + Source = "$source_type", + Target = "$target_type", + Flags = @@slave_type_conversions, + On_Master = $source_value, + Expected = $target_value, + Compare = @compare; + UPDATE type_conversions + SET On_Slave = (SELECT a FROM t1) + WHERE TestNo = LAST_INSERT_ID(); +} +if (!$can_convert) { + connection slave; + wait_for_slave_to_stop; + let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); + eval INSERT INTO type_conversions SET + Source = "$source_type", + Target = "$target_type", + Flags = @@slave_type_conversions, + On_Master = $source_value, + Error = "$error"; + SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; + START SLAVE; +} diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc new file mode 100644 index 00000000000..6e130a8154f --- /dev/null +++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc @@ -0,0 +1,401 @@ +# ==== Purpose ==== +# +# Creates a stored routine, stored function, trigger, view, or +# prepared statement (commonly referred to as "recursive construct") +# that invokes a given unsafe statement. +# +# Then, it invokes the created recursive construct several times: +# +# - With SQL_LOG_BIN = 1 and binlog_format = STATEMENT, to verify +# that it gives a warning. +# +# - With SQL_LOG_BIN = 0 and binlog_format = STATEMENT, to verify that +# there is no warning and nothing is logged. +# +# - With SQL_LOG_BIN = 1 and binlog_format = MIXED, to verify that it +# writes row events to the binlog. +# +# - In some cases, the recursive construct can be invoked so that it +# has no side-effects but returns a value that may be +# nondeterministic. An example is a function that returns UUID(). +# The function does not have side effects but its a return value +# that may differ on slave. Such statements are invoked so that +# the return value is discarded (e.g., SELECT func()), with +# SQL_LOG_BIN = 1 and binlog_format = STATEMENT. In this case, no +# warning should be given and nothing should be written to the +# binlog. +# +# This is an auxiliary file particularly targeted to being used by the +# test binlog_unsafe. In this context, the purpose is to check how +# warnings for unsafe statements are propagated in recursive +# constructs. +# +# The statement to invoke ("input") is described using mtr variables, +# and the resulting recursive construct ("output") is stored in mtr +# variables in a similar fashion. To create several levels of nested +# recursive constructs, source this file once, then copy the values of +# appropriate output variables to the input variables, and then source +# this file again. +# +# +# ==== Usage ==== +# +# See binlog_unsafe for an example of how to use this file. +# +# let $CRC_ARG_level= <level>; +# let $CRC_ARG_type= <type>; +# let $CRC_ARG_stmt_sidef= <stmt>; +# let $CRC_ARG_value= <stmt>; +# let $CRC_ARG_sel_retval= <stmt>; +# let $CRC_ARG_sel_sidef= <stmt>; +# let $CRC_ARG_desc= <desc>; +# source extra/rpl_tests/create_recursive_construct.inc; +# let $my_stmt_sidef= $CRC_RET_stmt_sidef; +# let $my_value= $CRC_RET_value; +# let $my_sel_sidef= $CRC_RET_sel_sidef; +# let $my_sel_retval= $CRC_RET_sel_retval; +# let $my_drop= $CRC_RET_drop; +# let $my_is_toplevel= $CRC_RET_top_is_toplevel; +# let $my_desc= $CRC_RET_desc; +# +# $CRC_ARG_* are used as input parameters (arguments) to this file: +# +# $CRC_ARG_level is the recursion depth: 1 for the innermost +# statement created, 2 for a statement that invokes a statement on +# level 1, etc. +# +# $CRC_ARG_type is an integer from 0 to 6, indicating what type of +# statement shall be created: +# 0 - Create a stored function where the return value depends on +# the value of the given statement. +# 1 - Create a stored function that invokes the given statement as +# a side-effect but may not return a value that depends on it. +# 2 - Create a stored routine that invokes the given statement. +# 3 - Create a trigger (on table trigger_table_$CRC_ARG_level) that +# invokes the given statement. +# 4 - Create a view that returns a value that depends on the value +# of the given statement. +# 5 - Create a view that invokes the given statement but may return +# a value that does not depend on it. +# 6 - Create a prepared statement that invokes the given statement. +# +# $CRC_ARG_stmt_sidef is the statement to invoke. It should be a +# statement that can be invoked on its own (not sub-statement), +# which causes something unsafe to be written to the binlog. +# +# $CRC_ARG_value is a sub-statement holding the value of the given +# statement. Can be empty if the given statement does not have a +# value. Typically, this is non-empty if the given statement is a +# function call or user variable, but not if it is a stored routine +# call, INSERT, SELECT, etc (because none of them has a value). +# $CRC_ARG_value is used only when $CRC_ARG_type=6. +# +# $CRC_ARG_sel_sidef is a SELECT sub-statement that invokes the +# statement as a side-effect, but returns a result set that may not +# depend on the statement. Can be empty if the statement cannot +# produce a result set from a SELECT. $CRC_ARG_sel_sidef is used +# only if $CRC_ARG_type=2 +# +# $CRC_ARG_sel_retval is a SELECT sub-statement that does not have +# side-effects, but returns a result set that depends on the unsafe +# statement. Can be empty if the statement cannot be invoked from a +# SELECT. $CRC_ARG_sel_retval is used only if $CRC_ARG_type=3. +# +# $CRC_ARG_desc is a human-readable description of the statement to +# invoke. +# +# $CRC_RET_* are used as output parameters (return values) of this +# file: +# +# $CRC_RET_stmt_sidef is a statement invoking the resulting recursive +# construct. +# +# $CRC_RET_value is a sub-statement invoking the resulting recursive +# construct and returning the value of the recursive construct. +# This is the empty string if the resulting recursive construct does +# not have a value. In particular, this is non-empty only if +# $CRC_ARG_value=7. +# +# $CRC_RET_sel_sidef is a SELECT sub-statement that invokes the +# resulting recursive construct as a side-effect but where the +# result set may not depend on the recursive construct. This is the +# empty string if the recursive construct cannot be invoked from a +# SELECT. In particular, this is non-empty only if $CRC_ARG_value=6 +# or $CRC_ARG_value=2. +# +# $CRC_RET_sel_retval is a SELECT sub-statement that does not have +# side-effects, but returns a result set depending on the unsafe +# statement. This is the empty string if the recursive construct +# cannot produce a result set from a SELECT. In particular, this is +# non-empty only if $CRC_ARG_value=7 or $CRC_ARG_value=3. +# +# $CRC_RET_drop is a statement that drops the created object. I.e., +# it is one of 'DROP FUNCTION <func>', 'DROP PROCEDURE <proc>', etc. +# +# $CRC_RET_top_is_toplevel is 0 normally, or 1 if the resulting +# recursive construct can only be called from a top-level statement. +# In particular, this is 1 only when $CRC_ARG_value=1, because +# prepared statements cannot be invoked from other recursive +# constructs. +# +# $CRC_RET_desc is a text string that describes the invokation of +# the recursive construct in a human-readable fashion. +# +# Assumptions +# +# Before sourcing this file with $CRC_ARG_level=X, you need to +# create three tables: tX, taX and trigger_table_X. These are used +# as auxiliary tables. + + +#--echo debug: >>>>ENTER create_recursive_construct +#--echo debug: level=$CRC_ARG_level +#--echo debug: type=$CRC_ARG_type +#--echo debug: stmt_sidef=$CRC_ARG_stmt_sidef +#--echo debug: value=$CRC_ARG_value +#--echo debug: sel_retval=$CRC_ARG_sel_retval +#--echo debug: sel_sidef=$CRC_ARG_sel_sidef + +--let $CRC_RET_stmt_sidef= +--let $CRC_RET_value= +--let $CRC_RET_sel_retval= +--let $CRC_RET_sel_sidef= +--let $CRC_RET_drop= +--let $CRC_RET_is_toplevel= 1 +--let $CRC_RET_desc= +--let $CRC_name= +--let $CRC_create= + +######## func_retval ######## +# if inside if in lieu of AND operand +if ($CRC_ARG_type == 0) { + if ($CRC_ARG_value) { + # It will be safe to call this function and discard the return + # value, but it will be unsafe to use return value (e.g., in + # INSERT...SELECT). + --let $CRC_name= func_retval_$CRC_ARG_level + --let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); RETURN $CRC_ARG_value; END + --let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level VALUES ($CRC_name()) + --let $CRC_RET_value= $CRC_name() + --let $CRC_RET_sel_sidef= + --let $CRC_RET_sel_retval= SELECT $CRC_name() + --let $CRC_RET_drop= DROP FUNCTION $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= function $CRC_name returning value from $CRC_ARG_desc + } +} + +######## func_sidef ######## +if ($CRC_ARG_type == 1) { + # It will be unsafe to call func even if you discard return value. + --let $CRC_name= func_sidef_$CRC_ARG_level + --let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; RETURN 0; END + --let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level SELECT $CRC_name() + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= + --let $CRC_RET_sel_sidef= SELECT $CRC_name() + --let $CRC_RET_drop= DROP FUNCTION $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= function $CRC_name invoking $CRC_ARG_desc +} + +######## proc ######## +if ($CRC_ARG_type == 2) { + # It will be unsafe to call this procedure. + --let $CRC_name= proc_$CRC_ARG_level + --let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN $CRC_ARG_stmt_sidef; INSERT INTO ta$CRC_ARG_level VALUES (47); END + --let $CRC_RET_stmt_sidef= CALL $CRC_name() + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= + --let $CRC_RET_sel_sidef= + --let $CRC_RET_drop= DROP PROCEDURE $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= procedure $CRC_name invoking $CRC_ARG_desc +} + +######## trig ######## +if ($CRC_ARG_type == 3) { + # It will be unsafe to invoke this trigger. + --let $CRC_name= trig_$CRC_ARG_level + --let $CRC_create= CREATE TRIGGER $CRC_name BEFORE INSERT ON trigger_table_$CRC_ARG_level FOR EACH ROW BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END + --let $CRC_RET_stmt_sidef= INSERT INTO trigger_table_$CRC_ARG_level VALUES (1) + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= + --let $CRC_RET_sel_sidef= + --let $CRC_RET_drop= DROP TRIGGER $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= trigger $CRC_name invoking $CRC_ARG_desc +} + +######## view_retval ######## +if ($CRC_ARG_type == 4) { + if ($CRC_ARG_sel_retval) { + # It will be safe to select from this view if you discard the result + # set, but unsafe to use result set (e.g., in INSERT..SELECT). + --let $CRC_name= view_retval_$CRC_ARG_level + --let $CRC_create= CREATE VIEW $CRC_name AS $CRC_ARG_sel_retval + --let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_LEVEL SELECT * FROM $CRC_name + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= SELECT * FROM $CRC_name + --let $CRC_RET_sel_sidef= + --let $CRC_RET_drop= DROP VIEW $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= view $CRC_name returning value from $CRC_ARG_desc + } +} + +######## view_sidef ######## +if ($CRC_ARG_type == 5) { + if ($CRC_ARG_sel_sidef) { + # It will be unsafe to select from this view, even if you discard + # the return value. + --let $CRC_name= view_sidef_$CRC_ARG_level + --let $CRC_create= CREATE VIEW $CRC_name AS $CRC_ARG_sel_sidef + --let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level SELECT * FROM $CRC_name + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= + --let $CRC_RET_sel_sidef= SELECT * FROM $CRC_name + --let $CRC_RET_drop= DROP VIEW $CRC_name + --let $CRC_RET_is_toplevel= 0 + --let $CRC_RET_desc= view $CRC_name invoking $CRC_ARG_desc + } +} + +######## prep ######## +if ($CRC_ARG_type == 6) { + # It will be unsafe to execute this prepared statement + --let $CRC_name= prep_$CRC_ARG_level + --let $CRC_create= PREPARE $CRC_name FROM "$CRC_ARG_stmt_sidef" + --let $CRC_RET_stmt_sidef= EXECUTE $CRC_name + --let $CRC_RET_value= + --let $CRC_RET_sel_retval= + --let $CRC_RET_sel_sidef= + --let $CRC_RET_drop= DROP PREPARE $CRC_name + --let $CRC_RET_is_toplevel= 1 + --let $CRC_RET_desc= prepared statement $CRC_name invoking $CRC_ARG_desc +} + +######## no recursive construct: just return the given statement ######## +if ($CRC_ARG_type == 7) { + # CRC_ARG_type=7 is a special case. We just set $CRC_RET_x = + # $CRC_ARG_x. This way, the $CRC_ARG_stmt gets executed directly + # (below). In binlog_unsafe.test, it is used to invoke the unsafe + # statement created in the outermost loop directly, without + # enclosing it in a recursive construct. + --let $CRC_RET_stmt_sidef= $CRC_ARG_stmt_sidef + --let $CRC_RET_value= $CRC_ARG_value + --let $CRC_RET_sel_retval= $CRC_ARG_sel_retval + --let $CRC_RET_sel_sidef= $CRC_ARG_sel_sidef + --let $CRC_RET_drop= + --let $CRC_RET_is_toplevel= 1 + --let $CRC_RET_desc= $CRC_ARG_desc +} + +######## execute! ######## +if ($CRC_RET_stmt_sidef) { + --echo + --echo Invoking $CRC_RET_desc. + if ($CRC_create) { + --eval $CRC_create + } + + --echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings. + --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if ($n_warnings != $CRC_ARG_expected_number_of_warnings) { + --echo ******** Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. ******** + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --die Wrong number of warnings. + } + + # These queries are run without query log, to make result file more + # readable. Debug info is only printed if something abnormal + # happens. + --disable_query_log + + --echo * SQL_LOG_BIN = 0: expect nothing logged and no warning. + SET SQL_LOG_BIN = 0; + RESET MASTER; + --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if ($n_warnings) { + --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ******** + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --die Wrong number of warnings. + } + --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2) + if ($binlog_event != No such row) { + --enable_query_log + --echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ******** + SHOW BINLOG EVENTS; + --die Binlog not empty + } + SET SQL_LOG_BIN = 1; + + --echo * binlog_format = MIXED: expect row events in binlog and no warning. + SET binlog_format = MIXED; + RESET MASTER; + --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if ($n_warnings) { + --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ******** + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --die Warnings printed + } + --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3) + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Query + # for 'INSERT DELAYED' unsafe_type 3, which is safe after + # the fix of bug#54579. + if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) { + --enable_query_log + --echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ******** + SHOW BINLOG EVENTS; + --die Wrong events in binlog. + } + # The first event is format_description, the second is + # Query_event('BEGIN'), and the third should be our Table_map + # for unsafe statement. + if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) { + --enable_query_log + --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ******** + SHOW BINLOG EVENTS; + --die Wrong events in binlog. + } + SET binlog_format = STATEMENT; + + --enable_query_log +} + +# Invoke created object, discarding the return value. This should not +# give any warning. +if ($CRC_RET_sel_retval) { + --echo * Invoke statement so that return value is dicarded: expect no warning. + --disable_result_log + --eval $CRC_RET_sel_retval + --enable_result_log + + # Currently, due to a bug, we do get warnings here, so we don't + # fail. When the bug is fixed, we should execute the following. + + #--let $n_warnings= `SHOW COUNT(*) WARNINGS` + #if ($n_warnings) { + # --enable_query_log + # --echo Failure! Expected 0 warnings, got $n_warnings warnings. + # SHOW WARNINGS; + # SHOW BINLOG EVENTS; + # --die Wrong number of warnings. + #} +} + +#--echo debug: <<<<EXIT create_recursive_construct +#--echo debug: stmt_sidef=$CRC_RET_stmt_sidef +#--echo debug: value=$CRC_RET_value +#--echo debug: sel_retval=$CRC_RET_sel_retval +#--echo debug: sel_sidef=$CRC_RET_sel_sidef +#--echo debug: drop=$CRC_RET_drop +#--echo debug: is_toplevel=$CRC_RET_is_toplevel +#--echo debug: desc=$CRC_RET_desc diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test index 861bd59253b..bd5943d46ea 100644 --- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test +++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test @@ -240,6 +240,7 @@ connection master; CREATE TABLE t1(s VARCHAR(10)) ENGINE=myisam; # -slave.opt has --replicate-ignore-table=test.t_ignored1 CREATE TABLE t_ignored1(id INT AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column"); sync_slave_with_master; connection slave; 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..e1faec8440b --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test @@ -0,0 +1,452 @@ +######################################################################################## +# 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + +let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); +let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1); +let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1); +let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1); + +SET GLOBAL max_binlog_cache_size = 4096; +SET GLOBAL binlog_cache_size = 4096; +SET GLOBAL max_binlog_stmt_cache_size = 4096; +SET GLOBAL binlog_stmt_cache_size = 4096; +disconnect master; +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); + +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_STMT_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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +eval INSERT INTO t2 (a, data) VALUES (2, + CONCAT($data, $data, $data, $data, $data, $data)); +--enable_query_log + +# Incident event +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--source include/wait_for_slave_sql_error_and_skip.inc + +--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_STMT_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 + +# 1590=ER_SLAVE_INCIDENT +--let $slave_sql_errno= 1590 +--let $slave_skip_counter= `SELECT IF(@@binlog_format = 'ROW', 2, 1)` +--source include/wait_for_slave_sql_error_and_skip.inc + +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc + +--echo ######################################################################################## +--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL +--echo ######################################################################################## + +connection master; +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +TRUNCATE TABLE t3; +set default_storage_engine=innodb; + +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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (4, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (5, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (6, $data); +--enable_query_log +--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'); + +ALTER TABLE t3 ADD COLUMN d int; + +--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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (17, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (18, $data); +--enable_query_log +--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'); + +if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) +{ + CREATE TABLE t4 SELECT * FROM t1; +} +if (`SELECT @@binlog_format = 'ROW'`) +{ + --error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE + CREATE TABLE t4 SELECT * FROM t1; +} + +--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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (25, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (26, $data); +--enable_query_log +--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'); + +CREATE TABLE t5 (a int); + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (4, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (5, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_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; + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (4, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (5, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_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; + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.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_STMT_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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +eval CALL p1($data); +--enable_query_log +ROLLBACK; + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.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_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (4, $data); +SAVEPOINT sv; +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (5, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (6, $data); +--enable_query_log +--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'); +ROLLBACK TO sv; +COMMIT; + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.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); +--eval INSERT INTO t1 (a, data) VALUES (4, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (5, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (6, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (7, $data); +--eval UPDATE t2 SET data= CONCAT($data, $data); +--enable_query_log +--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'); +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); +--eval INSERT INTO t1 (a, data) VALUES (18, $data); +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE +--eval INSERT INTO t1 (a, data) VALUES (19, $data); +--enable_query_log +COMMIT; + +--sync_slave_with_master +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc + +--echo ######################################################################## +--echo # 8 - Bug#55375(Regression Bug) Transaction bigger than +--echo # max_binlog_cache_size crashes slave +--echo ######################################################################## + +--echo # [ On Slave ] +SET GLOBAL max_binlog_cache_size = 4096; +SET GLOBAL binlog_cache_size = 4096; +SET GLOBAL max_binlog_stmt_cache_size = 4096; +SET GLOBAL binlog_stmt_cache_size = 4096; + +source include/stop_slave.inc; +source include/start_slave.inc; +CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); +CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); +CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log"); + +connection master; +TRUNCATE t1; + +sync_slave_with_master; +--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +--let binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + +connection master; +--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size +--replace_result $old_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size +--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size +--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size +disconnect master; +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); + +--let $n=128 +BEGIN; +--disable_query_log +--echo Repeat statement 'INSERT INTO t1 VALUES(\$n, repeat("a", 32))' $n times +while ($n) +{ + --eval INSERT INTO t1 VALUES ($n, repeat("a", 32)) + --dec $n +} +--enable_query_log +COMMIT; + +--connection slave +--let $slave_sql_errno= 1197 +if (`SELECT @@binlog_format = 'ROW'`) +{ + --let $slave_sql_errno= 1534 +} +source include/wait_for_slave_sql_error.inc; + +SELECT count(*) FROM t1; +source include/show_binlog_events.inc; + +--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size +--replace_result $old_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size +--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size +--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size + +source include/stop_slave.inc; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; +SELECT count(*) FROM t1; + +--echo ######################################################################################## +--echo # CLEAN +--echo ######################################################################################## + +connection master; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +# t4 exists only if binlog_format!=row, so so a warning is generated +# if binog_format=row +--disable_warnings +DROP TABLE IF EXISTS t4; +--enable_warnings +DROP TABLE t5; +DROP PROCEDURE p1; diff --git a/mysql-test/extra/rpl_tests/rpl_charset.test b/mysql-test/extra/rpl_tests/rpl_charset.test index e56642cbcb5..fa83b06597d 100644 --- a/mysql-test/extra/rpl_tests/rpl_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_charset.test @@ -110,9 +110,7 @@ set @@character_set_server=latin5; select @@character_set_server; select @@character_set_server; -# ONE_SHOT on not charset/collation stuff is not allowed --- error 1382 -set one_shot max_join_size=10; +set one_shot max_join_size=1000000; # Test of wrong character set numbers; error 1115; diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test index 866a31e92b0..2fbf3dba5dc 100644 --- a/mysql-test/extra/rpl_tests/rpl_conflicts.test +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test @@ -91,9 +91,14 @@ if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRIC # key error, and stops the SQL thread. let $slave_sql_errno= 1062; # ER_DUP_ENTRY source include/wait_for_slave_sql_error.inc; - let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - --echo Last_SQL_Error = $err (expected "duplicate key" error) + + --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1) + --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/ + --disable_query_log + --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)' + --enable_query_log call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.* Error_code: 1062"); + SELECT * FROM t1; --echo ---- Resolve the conflict on the slave and restart SQL thread ---- @@ -138,7 +143,7 @@ connection slave; # replication continues. if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRICT'`) { --echo ---- Wait until slave stops with an error ---- - call mtr.add_suppression("Can.t find record in .t1., Error_code: 1032"); + call mtr.add_suppression("Slave SQL.*Can.t find record in .t1., Error_code: 1032"); let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND source include/wait_for_slave_sql_error.inc; diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc new file mode 100644 index 00000000000..094e84537db --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc @@ -0,0 +1,967 @@ +--source include/have_innodb.inc +--disable_abort_on_error + +if (`SELECT HEX(@commands) = HEX('configure')`) +{ + connection master; + + # + # Creates a T-table that is never dropped. + # + --eval CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb + + # + # Creates a N-table that is never dropped. + # + --eval CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam + + # + # Creates a Temporary N-table that is never dropped. + # + --eval CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam + + # + # Creates a Temporary N-table that is never dropped. + # + --eval CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb + + # + # In what follows, we create a set of tables that are used + # throughout this test case. The number of tables to be + # created is give by the variable $tot_table. + # + # + # Creates Temporay N-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while ($n) + { + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n + --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam + --disable_query_log + --eval SET @check_temp='$available_n_temp' + --enable_query_log + # + # Updates the $available_n_temp that keeps track of the created + # temporary N-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n_temp= $available_n_temp,nt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n_temp= nt_tmp_$n + } + --dec $n + } + + # + # Creates Temporay T-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while ($n) + { + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb + --disable_query_log + --eval SET @check_temp='$available_t_temp' + --enable_query_log + # + # Updates the $available_t_temp that keeps track of the created + # temporary T-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t_temp= $available_t_temp,tt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t_temp= tt_tmp_$n + } + --dec $n + } + + # + # Creates N-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS nt_$n + --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam + --disable_query_log + --eval SET @check_temp='$available_n' + --enable_query_log + # + # Updates the $available_n that keeps track of the created + # N-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n= $available_n,nt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n= nt_$n + } + --dec $n + } + + # + # Creates T-tables that are automatically dropped and recreated + # when a command ends. + # + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS tt_$n + --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb + --disable_query_log + --eval SET @check_temp='$available_t' + --enable_query_log + # + # Updates the $available_t that keeps track of the created + # T-tables. + # + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t= $available_t,tt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t= tt_$n + } + --dec $n + } + + --let $dropped_t_temp= + --let $dropped_n_temp= + + --let $dropped_t= + --let $dropped_n= + + let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1); + + SET @commands= ''; +} + +# +# Drops tables and synchronizes master and slave. Note that temporary +# tables are not explitcily dropped as they will be dropped while +# closing the connection. +# +if (`SELECT HEX(@commands) = HEX('clean')`) +{ + connection master; + + DROP TABLE IF EXISTS tt_xx_1; + + DROP TABLE IF EXISTS nt_xx_1; + + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS nt_$n + --dec $n + } + + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS tt_$n + --dec $n + } + + sync_slave_with_master; + + SET @commands= ''; +} + +# +# This is the core of the test is responsible for processing +# the following commands: +# +# B - Begin +# C - Commit +# R - Rollback +# +# +# T - Inserts a row into a T-table +# N-Temp - Inserts a row into a temporary N-table. +# +# +# T-SELECT-N-Temp - Selects from a temporary N-table and inserts +# into a T-table. +# N-SELECT-N-Temp - Selects from a temporary N-table and inserts +# into a N-table. +# T-SELECT-T-Temp - Selects from a temporary T-table and inserts +# into a T-table. +# N-SELECT-T-Temp - Selects from a temporary T-table and inserts +# into a N-table. +# +# +# Create-N-Temp - Creates a temporary N-table if a temporary N-table +# was dropped before +# Create-T-Temp - Creates a temporary T-table if a temporary T-table +# was dropped before +# +# +# Drop-Temp-T-Temp - Drops a temporary T-table if there is any +# Drop-Temp-N-Temp - Drops a temporary N-table if there is any +# Drop-Temp-TN-Temp - Drops both a temporary T-table and N-table if there +# is any +# Drop-Temp-TT-Temp - Drops two temporary T-tables if there is any +# Drop-Temp-NN-Temp - Drops two temporary N-tables if there is any +# Drop-Temp-Xe-Temp - Tries to drop a temporary table that does not exist +# Drop-Temp-NXe-Temp - Drops a temporary N-table if there is any and +# a temporary table that does not exist +# Drop-Temp-TXe-Temp - Drops a temporary T-table if there is any and +# a temporary table that does not exist +# +# +# Drop-Temp-If-Xe-Temp - Tries to drop a temporary table that does not exist +# Drop-Temp-If-TXe-Temp - Drops a temporary T-table if there is any and +# a temporary table that does not exist +# +# +# Drop-T - Drops a T-table if there is any +# Drop-N - Drops a N-table if there is any +# Drop-Xe - Tries to drop a table that does not exist +# Drop-TXe - Drops a T-table if there is any and a table that does +# not exist +# Drop-NXe - Drops a N-table if there is any and a table that does +# not exist +# Drop-TN - Drops both a T-table and N-table if there is any +# Drop-TT - Drops two T-tables if there is any +# Drop-NN - Drops two N-tables if there is any +# Drop-N-TN-Temp - Drops a N-table and both a temporary T-table and +# N-table if there is any +# +# +# Drop-If-Xe - Tries to drop a table that does not exist +# Drop-If-TXe - Drops a T-table if there is any and a table that does +# not exist +# Drop-If-NXe - Drops a N-table if there is any and a table that does +# not exist +# +while (`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`; + } + + if (`SELECT HEX(@command) = HEX('B')`) + { + --enable_query_log + eval BEGIN; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_tmp_xx_1() VALUES (1); + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-SELECT-N-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('N-SELECT-T-Temp')`) + { + --enable_query_log + eval INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T-SELECT-N-Temp')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('T-SELECT-T-Temp')`) + { + --enable_query_log + eval INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Create-N-Temp') || HEX(@command) = HEX('Create-T-Temp')`) + { + if (`SELECT HEX(@command) = HEX('Create-N-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Create-T-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_temp= $available_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_temp= $table + } + --eval SET @check_temp='$dropped_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $dropped_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Create-N-Temp')`) + { + --enable_query_log + --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= MyIsam + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Create-T-Temp')`) + { + --enable_query_log + --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= Innodb + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp') || HEX(@command) = HEX('Drop-Temp-T-Temp') || HEX(@command) = HEX('Drop-T') || HEX(@command) = HEX('Drop-N')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-N')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-T')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_temp= $table + } + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-N')`) + { + --enable_query_log + --eval DROP TABLE $table + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-T')`) + { + --enable_query_log + --eval DROP TABLE $table + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-Xe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE tt_xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-Xe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS tt_xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Xe')`) + { + --enable_query_log + --eval DROP TABLE xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-If-Xe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS xx_1 + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp') || HEX(@command) = HEX('Drop-If-NXe') || HEX(@command) = HEX('Drop-If-TXe')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-If-NXe')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-If-TXe')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_n_temp= $table + } + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table, tt_1 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table, tt_1 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NXe')`) + { + --enable_query_log + --eval DROP TABLE $table, xx_1 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-If-NXe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS $table, xx_1 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-TXe')`) + { + --enable_query_log + --eval DROP TABLE $table, xx_1 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-If-TXe')`) + { + --enable_query_log + --eval DROP TABLE IF EXISTS $table, xx_1 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') || HEX(@command) = HEX('Drop-Temp-TT-Temp') || HEX(@command) = HEX('Drop-NN') || HEX(@command) = HEX('Drop-TT')`) + { + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp')`) + { + --let $dropped_temp=$dropped_n_temp + --let $available_temp=$available_n_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp')`) + { + --let $dropped_temp=$dropped_t_temp + --let $available_temp=$available_t_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NN')`) + { + --let $dropped_temp=$dropped_n + --let $available_temp=$available_n + } + if (`SELECT HEX(@command) = HEX('Drop-TT')`) + { + --let $dropped_temp=$dropped_t + --let $available_temp=$available_t + } + + --eval SET @check_temp='$available_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $n= 2 + while (`SELECT HEX(@check_temp) != HEX('') && $n != 0`) + { + SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1); + let $table=`SELECT @temp`; + --eval SET @check_temp='$dropped_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $dropped_temp= $dropped_temp,$table + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $dropped_temp= $table + } + if ($n == 1) + { + --let $table_1= $table + } + if ($n == 2) + { + --let $table_2= $table + } + + --dec $n + --eval SET @check_temp='$available_temp' + --eval SET @table_temp='$table' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_temp= `SELECT @check_temp` + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') && $n = 0`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table_1, $table_2 + --disable_query_log + + --let $available_n_temp= $available_temp + --let $dropped_n_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp') && $n= 0`) + { + --enable_query_log + --eval DROP TEMPORARY TABLE $table_1, $table_2 + --disable_query_log + + --let $available_t_temp= $available_temp + --let $dropped_t_temp= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-NN') && $n = 0`) + { + --enable_query_log + --eval DROP TABLE $table_1, $table_2 + --disable_query_log + + --let $available_n= $available_temp + --let $dropped_n= $dropped_temp + } + if (`SELECT HEX(@command) = HEX('Drop-TT') && $n= 0`) + { + --enable_query_log + --eval DROP TABLE $table_1, $table_2 + --disable_query_log + + --let $available_t= $available_temp + --let $dropped_t= $dropped_temp + } + } + } + + if (`SELECT HEX(@command) = HEX('Drop-Temp-TN-Temp')`) + { + --eval SET @check_temp_t='$available_t_temp' + --eval SET @check_temp_n='$available_n_temp' + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t_temp' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t_temp= $dropped_t_temp,$table_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t_temp= $table_t + } + --eval SET @check_temp='$available_t_temp' + --eval SET @table_temp='$table_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t_temp= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n_temp' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n_temp= $dropped_n_temp,$table_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n_temp= $table_n + } + --eval SET @check_temp='$available_n_temp' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_n_temp= `SELECT @check_temp` + + --enable_query_log + --eval DROP TEMPORARY TABLE $table_t, $table_n + --disable_query_log + } + } + + if (`SELECT HEX(@command) = HEX('Drop-TN')`) + { + --eval SET @check_temp_t='$available_t' + --eval SET @check_temp_n='$available_n' + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t= $dropped_t,$table_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t= $table_t + } + --eval SET @check_temp='$available_t' + --eval SET @table_temp='$table_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n= $dropped_n,$table_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n= $table_n + } + --eval SET @check_temp='$available_n' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t= `SELECT @check_temp` + + --enable_query_log + --eval DROP TABLE $table_t, $table_n + --disable_query_log + } + } + + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp') || HEX(@command) = HEX('Drop-TN-Temp')`) + { + --eval SET @check_temp_t='$available_t_temp' + --eval SET @check_temp_n='$available_n_temp' + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`) + { + --eval SET @check_n='$available_n' + } + if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`) + { + # + # Just to be possible to go through the next if... + # + --eval SET @check_n='...' + } + if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('') && HEX(@check_n) != HEX('')`) + { + SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1); + let $table_temp_t=`SELECT @temp_t`; + --eval SET @check_temp_t='$dropped_t_temp' + if (`SELECT HEX(@check_temp_t) != HEX('')`) + { + --let $dropped_t_temp= $dropped_t_temp,$table_temp_t + } + if (`SELECT HEX(@check_temp_t) = HEX('')`) + { + --let $dropped_t_temp= $table_temp_t + } + --eval SET @check_temp='$available_t_temp' + --eval SET @table_temp='$table_temp_t' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_t_temp= `SELECT @check_temp` + + SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1); + let $table_temp_n=`SELECT @temp_n`; + --eval SET @check_temp_n='$dropped_n_temp' + if (`SELECT HEX(@check_temp_n) != HEX('')`) + { + --let $dropped_n_temp= $dropped_n_temp,$table_temp_n + } + if (`SELECT HEX(@check_temp_n) = HEX('')`) + { + --let $dropped_n_temp= $table_temp_n + } + --eval SET @check_temp='$available_n_temp' + --eval SET @table_temp='$table_temp_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_n_temp= `SELECT @check_temp` + + if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`) + { + SET @temp_n= SUBSTRING_INDEX(@check_n, ',', 1); + let $table_n=`SELECT @temp_n`; + --eval SET @check_n='$dropped_n' + if (`SELECT HEX(@check_n) != HEX('')`) + { + --let $dropped_n= $dropped_n,$table_n + } + if (`SELECT HEX(@check_n) = HEX('')`) + { + --let $dropped_n= $table_n + } + --eval SET @check_temp='$available_n' + --eval SET @table_temp='$table_n' + SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2)); + --let $available_n= `SELECT @check_temp` + + --enable_query_log + --eval DROP TABLE $table_temp_t, $table_temp_n, $table_n + --disable_query_log + } + if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`) + { + --enable_query_log + --eval DROP TABLE $table_temp_t, $table_temp_n + --disable_query_log + } + } + } + + if (`SELECT HEX(@command) = HEX('C')`) + { + --enable_query_log + --error 0, ER_GET_ERRMSG + eval COMMIT; + --disable_query_log + } + + if (`SELECT HEX(@command) = HEX('R')`) + { + --enable_query_log + --error 0, ER_GET_ERRMSG + eval ROLLBACK; + --disable_query_log + } + + SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1)); + 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 + + --disable_warnings + --let $available_n_temp= + --let $dropped_n_temp= + --let $n= $tot_table + while ($n) + { + --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n + --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam + --eval SET @check_temp='$available_n_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n_temp= $available_n_temp,nt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n_temp= nt_tmp_$n + } + --dec $n + } + + --let $available_t_temp= + --let $dropped_t_temp= + --let $n= $tot_table + while ($n) + { + --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n + --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb + --eval SET @check_temp='$available_t_temp' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t_temp= $available_t_temp,tt_tmp_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t_temp= tt_tmp_$n + } + --dec $n + } + + --let $available_t= + --let $dropped_t= + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS tt_$n + --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb + --eval SET @check_temp='$available_t' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_t= $available_t,tt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_t= tt_$n + } + --dec $n + } + + --let $available_n= + --let $dropped_n= + --let $n= $tot_table + while ($n) + { + --eval DROP TABLE IF EXISTS nt_$n + --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam + --eval SET @check_temp='$available_n' + if (`SELECT HEX(@check_temp) != HEX('')`) + { + --let $available_n= $available_n,nt_$n + } + if (`SELECT HEX(@check_temp) = HEX('')`) + { + --let $available_n= nt_$n + } + --dec $n + } + --enable_warnings + + let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1); + let $commands= ''; + } + --enable_query_log +} diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test new file mode 100644 index 00000000000..67bf0f5b8ac --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test @@ -0,0 +1,392 @@ +############################################################################### +# In this test case, we check how changes to temporary tables are written +# to the binary log. +# +# (TODO --- GET INFO AS SOON AS THE SITE IS AVAILABLE) +# +# This test uses the commands available at: +# extra/rpl_tests/rpl_drop_create_temp_table.inc +# +############################################################################### + + +--echo ######################################################################### +--echo # CONFIGURATION +--echo ######################################################################### + +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); + +--let $tot_table= 2 +SET @commands= 'configure'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ######################################################################### +--echo # 1 - Tables dropped by "DROP TEMPORARY TABLE" +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-Temp-T-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-N-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-Xe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-Xe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-TXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-NXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-If-NXe-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-TT-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-NN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo +--echo # +--echo #3) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo ######################################################################### +--echo # 2 - Tables dropped by "DROP TABLE" +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-T'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-N'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-If-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TT'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-NN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-N-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-T'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-N'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-Xe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-TXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-If-NXe'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TT'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-NN'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-N-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B T Drop-TN-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ######################################################################### +--echo # 3 - CREATE TEMPORARY TABLE +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo # +--echo #3) Generates in the binlog what follows: +--echo # +SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + + +--echo ######################################################################### +--echo # 4 - CHANGING TEMPORARY TABLES +--echo ######################################################################### +connection master; + +--echo +--echo # +--echo #1) Generates in the binlog what follows: +--echo # +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo +--echo +--echo # +--echo #2) Generates in the binlog what follows: +--echo # +SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc + +--echo ################################################################################### +--echo # CHECK CONSISTENCY +--echo ################################################################################### +connection master; +sync_slave_with_master; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +if (`select @@session.binlog_format != 'STATEMENT'`) +{ + --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql + --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql + --diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql +} + +--echo ######################################################################### +--echo # CLEAN +--echo ######################################################################### +SET @commands= 'clean'; +--source extra/rpl_tests/rpl_drop_create_temp_table.inc diff --git a/mysql-test/extra/rpl_tests/rpl_extra_col_master.test b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test index 07a0f2c9557..235eb858d34 100644 --- a/mysql-test/extra/rpl_tests/rpl_extra_col_master.test +++ b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test @@ -129,8 +129,7 @@ call mtr.add_suppression("Slave SQL.*Table definition on master and slave does n call mtr.add_suppression("Slave.*Can.t DROP .c7.; check that column.key exists.* Error_code: 1091"); call mtr.add_suppression("Slave.*Unknown column .c7. in .t15.* Error_code: 1054"); call mtr.add_suppression("Slave.*Key column .c6. doesn.t exist in table.* Error_code: 1072"); -call mtr.add_suppression("Slave I/O: Get master clock failed with error:.* Error_code: 2013"); -call mtr.add_suppression("Slave I/O: Get master SERVER_ID failed with error:.* Error_code: 2013"); +call mtr.add_suppression("Slave SQL.*Column 2 of table .test.t1.. cannot be converted from type.* Error_code: 1677"); --enable_query_log sync_slave_with_master; @@ -481,12 +480,12 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), --echo --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** --echo connection slave; -# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +# 1677 = ER_SLAVE_CONVERSION_FAILED +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -537,12 +536,12 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), --echo --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** --echo connection slave; -# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +# 1677 = ER_SLAVE_CONVERSION_FAILED +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc diff --git a/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test index cb2421d5d74..119e081878c 100644 --- a/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test @@ -14,6 +14,7 @@ ################################################# call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); +call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot be converted from type.* Error_code: 1677"); --echo **** Diff Table Def Start **** @@ -27,6 +28,9 @@ sync_slave_with_master; STOP SLAVE; RESET SLAVE; +SET @saved_slave_type_conversions = @@slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY'; + eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20), d FLOAT DEFAULT '2.00', e CHAR(4) DEFAULT 'TEST') @@ -53,6 +57,8 @@ SELECT * FROM t1 ORDER BY a; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; +SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; + --echo *** Drop t1 *** connection master; DROP TABLE t1; @@ -87,7 +93,7 @@ SELECT * FROM t2 ORDER BY a; --echo *** Start Slave *** connection slave; START SLAVE; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc STOP SLAVE; @@ -136,10 +142,10 @@ set @b1 = concat(@b1,@b1); INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING'); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -179,10 +185,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), (30000.22,4,'QA TESTING'); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -222,10 +228,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), (2,'JOE',300.01,0,'b2b2',1.0000009); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -266,22 +272,20 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), (2,'JOE',300.01,0); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; -#START SLAVE; --echo *** Drop t6 *** +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc + connection master; DROP TABLE t6; -connection slave; -DROP TABLE t6; -START SLAVE; -#sync_slave_with_master; +--sync_slave_with_master --echo **** Diff Table Def End **** @@ -392,7 +396,7 @@ sync_slave_with_master; # Error reaction is up to sql_mode of the slave sql (bug#38173) #--echo *** Create t9 on slave *** # Please, check BUG#47741 to see why you are not testing NDB. -if (`SELECT $engine_type != 'NDB'`) +if (`SELECT UPPER(LEFT($engine_type, 3)) != 'NDB'`) { STOP SLAVE; RESET SLAVE; @@ -436,12 +440,13 @@ if (`SELECT $engine_type != 'NDB'`) #--let $slave_skip_counter= 2 #--let $show_slave_sql_error= 1 #--source include/wait_for_slave_sql_error_and_skip.inc -} -#--echo *** Drop t9 *** -connection master; -DROP TABLE t9; -sync_slave_with_master; + #--echo *** Drop t9 *** + connection master; + DROP TABLE t9; + sync_slave_with_master; + +} ############################################ # More columns in slave at middle of table # @@ -470,10 +475,10 @@ set @b1 = concat(@b1,@b1); INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -492,7 +497,7 @@ sync_slave_with_master; --echo *** Create t11 on slave *** STOP SLAVE; RESET SLAVE; -eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT, +eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT, c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type; --echo *** Create t11 on Master *** @@ -512,10 +517,10 @@ set @b1 = concat(@b1,@b1); INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -766,9 +771,9 @@ RESET MASTER; connection slave; START SLAVE; -call mtr.add_suppression("Slave SQL.*Error .Unknown table .t6.. on query.* Error_code: 1051"); -call mtr.add_suppression("Slave SQL.*Error .Duplicate column name .c6.. on query.* Error_code: 1060"); -call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column . ...e mismatch.* Error_code: 1535"); +call mtr.add_suppression("Error .Unknown table .t6.. on query.* Error_code: 1051"); +call mtr.add_suppression("Error .Duplicate column name .c6.. on query.* Error_code: 1060"); +call mtr.add_suppression("Table definition on master and slave does not match: Column . ...e mismatch.* Error_code: 1535"); --echo *** Master Data Insert *** connection master; @@ -899,10 +904,10 @@ connection master; INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); --echo ******************************************** ---echo *** Expect slave to fail with Error 1535 *** +--echo *** Expect slave to fail with Error 1677 *** --echo ******************************************** connection slave; ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $slave_skip_counter= 2 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc diff --git a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test index 6817405b2d9..af048aeb92a 100644 --- a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test +++ b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test @@ -2,22 +2,24 @@ # # BUG#5551 "Failed OPTIMIZE TABLE is logged to binary log" -# Replication should work when OPTIMIZE TABLE timeouts, and -# when OPTIMIZE TABLE is executed on a non-existing table +# Replication should work when when OPTIMIZE TABLE is +# executed on a non-existing table. # +# Due to patch for BUG#989, checking that an OPTIMIZE +# that fails due to a lock wait timeout on an InnoDB table +# is not valid anymore, as an mdl lock is hit before, +# thence no timeout occurs, but instead a deadlock. +# + eval CREATE TABLE t1 ( a int ) ENGINE=$engine_type; BEGIN; INSERT INTO t1 VALUES (1); connection master1; -OPTIMIZE TABLE t1; - OPTIMIZE TABLE non_existing; sync_slave_with_master; -# End of 4.1 tests - connection master; select * from t1; commit; diff --git a/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-test/extra/rpl_tests/rpl_foreign_key.test index 19cd1d783e1..db646a736f9 100644 --- a/mysql-test/extra/rpl_tests/rpl_foreign_key.test +++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test @@ -47,7 +47,6 @@ insert into t1 set b=1; insert into t2 set a=1, b=1; set foreign_key_checks=0; -set @@session.binlog_format=row; delete from t1; --echo must sync w/o a problem (could not with the buggy code) diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test index 01036f72785..1ef8544884d 100644 --- a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test +++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test @@ -42,7 +42,7 @@ if (!$debug_sync_action) # Restart slave --source include/stop_slave.inc -eval SET @@global.debug= "+d,$dbug_sync_point"; +eval SET @@global.debug_dbug= "+d,$dbug_sync_point"; --source include/start_slave.inc --echo slave is going to hang in get_master_version_and_clock @@ -71,7 +71,7 @@ source include/wait_for_slave_io_error.inc; # now to avoid restarting IO-thread to re-enter it. # There will be a new IO thread forked out with its @@session.debug # unset. -eval set @@global.debug = "-d,$dbug_sync_point"; +eval set @@global.debug_dbug= "-d,$dbug_sync_point"; --let $rpl_server_number= 1 --source include/rpl_start_server.inc 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..549d184185d --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test @@ -0,0 +1,664 @@ +################################################################################ +# 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 ######################################################################### +connection master; + +eval CREATE TABLE tt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = $engine; +eval CREATE TABLE tt_2 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = $engine; +eval CREATE TABLE nt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = MyIsam; + +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 ($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; + let $ok= yes; + # + # 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; + } + # + # In NDB (RBR and MIXED modes), the commit event is usually the seventh event + # in the binary log: + # + # 1: COMMAND + # 2: BEGIN + # 3: TABLE MAP EVENT + # 4: TABLE MAP EVENT (ndb_apply_status) + # 5: ROW EVENT + # 6: ROW EVENT + # 7: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 7; + } + + 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 ($ddl_cases == 41) + { + let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES; + if ($engine == NDB) + { + # This seems to be related to epochs. + # We need to check this against an updated version or avoid it. + let $ok= no; + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 40) + { + let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 39) + { + let $cmd= ANALYZE TABLE nt_1; + } + if ($ddl_cases == 38) + { + let $cmd= CHECK TABLE nt_1; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 37) + { + let $cmd= OPTIMIZE TABLE nt_1; + } + if ($ddl_cases == 36) + { + let $cmd= REPAIR TABLE nt_1; + } + if ($ddl_cases == 35) + { + let $cmd= LOCK TABLES tt_1 WRITE; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 34) + { + let $cmd= UNLOCK TABLES; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 33) + { + let $cmd= CREATE USER 'user'@'localhost'; + } + if ($ddl_cases == 32) + { + let $cmd= GRANT ALL ON *.* TO 'user'@'localhost'; + } + if ($ddl_cases == 31) + { + let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass'); + # + # In NDB (RBR mode), the commit event is the eleventh event + # in the binary log: + # + # 1: DDL EVENT which triggered the previous commmit. + # 2: BEGIN + # 3: TABLE MAP EVENT + # 4: ROW EVENT + # 5: COMMIT + # 6: BEGIN + # 7: TABLE MAP EVENT + # 8: TABLE MAP EVENT (ndb_apply_status) + # 9: ROW EVENT + # 10: ROW EVENT + # 11: COMMIT + # + if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'`) + { + let $commit_event_row_number= 11; + } + # + # In NDB (MIXED mode), the commit event is the eighth event + # in the binary log: + # + # 1: DDL EVENT which triggered the previous commmit. + # 2: BEGIN + # 3: TABLE MAP EVENT + # 4: TABLE MAP EVENT (ndb_apply_status) + # 5: ROW EVENT + # 6: ROW EVENT + # 7: COMMIT + # + if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`) + { + let $commit_event_row_number= 7; + } + } + if ($ddl_cases == 30) + { + let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost'; + } + if ($ddl_cases == 29) + { + let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost'; + } + if ($ddl_cases == 28) + { + let $cmd= DROP USER 'user_new'@'localhost'; + } + if ($ddl_cases == 27) + { + let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; + } + if ($ddl_cases == 26) + { + let $cmd= ALTER EVENT evt COMMENT 'evt'; + } + if ($ddl_cases == 25) + { + let $cmd= DROP EVENT evt; + } + if ($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 ($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' && '$engine' != 'NDB'`) + { + let $commit_event_row_number= 5; + } + } + if ($ddl_cases == 22) + { + let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc"; + } + if ($ddl_cases == 21) + { + let $cmd= ALTER FUNCTION fc COMMENT 'fc'; + } + if ($ddl_cases == 20) + { + let $cmd= DROP FUNCTION fc; + } + if ($ddl_cases == 19) + { + let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case; + } + if ($ddl_cases == 18) + { + let $cmd= ALTER PROCEDURE pc COMMENT 'pc'; + } + if ($ddl_cases == 17) + { + let $cmd= DROP PROCEDURE pc; + } + if ($ddl_cases == 16) + { + let $cmd= CREATE VIEW v AS SELECT * FROM tt_1; + } + if ($ddl_cases == 15) + { + let $cmd= ALTER VIEW v AS SELECT * FROM tt_1; + } + if ($ddl_cases == 14) + { + let $cmd= DROP VIEW v; + } + if ($ddl_cases == 13) + { + let $cmd= CREATE INDEX ix ON tt_1(ddl_case); + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # 7: DDL EVENT which triggered the previous commmit. + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 12) + { + let $cmd= DROP INDEX ix ON tt_1; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # 7: DDL EVENT which triggered the previous commmit. + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($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: CREATE TEMPORARY + # 3: INSERT + # 4: COMMIT + # + # 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 + # 4: COMMIT + # + if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'` ) + { + let $commit_event_row_number= 4; + } + # + # In NDB (RBR mode), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'` ) + { + let $commit_event_row_number= 6; + } + # + # In NDB (MIXED mode), the commit event is the nineth event + # in the binary log: + # + # 1: BEGIN + # 2: DDL EVENT which triggered the previous commmit. + # 3: COMMIT + # 4: BEGIN + # 5: TABLE MAP EVENT + # 6: TABLE MAP EVENT (ndb_apply_status) + # 7: ROW EVENT + # 8: ROW EVENT + # 9: COMMIT + # + if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` ) + { + let $commit_event_row_number= 9; + } + } + if ($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; + } + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($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; + } + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($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: + # + # In SBR, we have what follows: + # + # 1: BEGIN + # 2: INSERT + # 3: DROP TEMPORARY + # 4: COMMIT + # + # 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 + # 4: COMMIT + # + 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 + # 5: COMMIT + # + if (`select @@binlog_format = 'MIXED' || @@binlog_format = 'ROW'`) + { + let $commit_event_row_number= 5; + } + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: DROP TEMPORARY table IF EXISTS + # 3: COMMIT + # 4: BEGIN + # 5: TABLE MAP EVENT + # 6: TABLE MAP EVENT (ndb_apply_status) + # 7: ROW EVENT + # 8: ROW EVENT + # 9: COMMIT + # + if ($engine == NDB) + { + let $commit_event_row_number= 9; + } + # + # In NDB (MIXED mode), the commit event is the nineth event + # in the binary log: + # + # 1: BEGIN + # 2: DDL EVENT which triggered the previous commmit. + # 3: COMMIT + # 4: BEGIN + # 5: TABLE MAP EVENT + # 6: TABLE MAP EVENT (ndb_apply_status) + # 7: ROW EVENT + # 8: ROW EVENT + # 9: COMMIT + # + if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` ) + { + let $commit_event_row_number= 9; + } + } + if ($ddl_cases == 7) + { + let $cmd= CREATE TABLE tt_xx (a int); + } + if ($ddl_cases == 6) + { + let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int); + } + if ($ddl_cases == 5) + { + let $cmd= RENAME TABLE tt_xx TO new_tt_xx; + } + if ($ddl_cases == 4) + { + let $cmd= TRUNCATE TABLE new_tt_xx; + } + if ($ddl_cases == 3) + { + let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx; + } + if ($ddl_cases == 2) + { + let $cmd= CREATE DATABASE db; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # 7: DDL EVENT which triggered the previous commmit. + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + if ($ddl_cases == 1) + { + let $cmd= DROP DATABASE IF EXISTS db; + # + # In NDB (RBR and MIXED modes), the commit event is the sixth event + # in the binary log: + # + # 1: BEGIN + # 2: TABLE MAP EVENT + # 3: TABLE MAP EVENT (ndb_apply_status) + # 4: ROW EVENT + # 5: ROW EVENT + # 6: COMMIT + # 7: DDL EVENT which triggered the previous commmit. + # + if ($engine == NDB) + { + let $commit_event_row_number= 6; + } + } + --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 ($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"`) + { + if ($ok == yes) + { + --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 ################################################################################### +--sync_slave_with_master + +--let $diff_tables= master:tt_1,slave:tt_1 +--source include/diff_tables.inc + +--echo ################################################################################### +--echo # CLEAN +--echo ################################################################################### +connection master; + +DROP TABLE tt_1; +DROP TABLE tt_2; +DROP TABLE nt_1; + +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..c0ec5299cfd --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_innodb.test @@ -0,0 +1,183 @@ +# +# 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. +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; +--echo ######### 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; +--replace_result MyISAM InnoDB +SHOW CREATE TABLE mysqltest1.tmp2; +--echo ######### 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; +--echo ######### 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; + +--echo End of 5.1 tests + +--echo # +--echo # Bug#39675 rename tables on innodb tables with pending +--echo # transactions causes slave data issue. +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; +--enable_warnings + +CREATE TABLE t1 ( + id INT PRIMARY KEY auto_increment, + b INT DEFAULT NULL +) ENGINE=InnoDB; + +CREATE TABLE t2 ( + id INT PRIMARY KEY auto_increment, + b INT DEFAULT NULL +) ENGINE=InnoDB; + +INSERT INTO t1 (b) VALUES (1),(2),(3); + +BEGIN; +INSERT INTO t1(b) VALUES (4); + +--echo -------- switch to master1 -------- +connection master1; +--send RENAME TABLE t1 TO t3, t2 TO t1; + +--echo -------- switch to master -------- +connection master; +# Need to wait until RENAME is received +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and + state = "Waiting for table metadata lock"; +--source include/wait_condition.inc + +COMMIT; + +--echo -------- switch to master1 -------- +connection master1; +--reap + +--echo -------- switch to master -------- +connection master; +SELECT * FROM t1; +SELECT * FROM t3; + +sync_slave_with_master; + +--echo -------- switch to slave -------- +connection slave; +SELECT * FROM t1; +SELECT * FROM t3; + +--echo -------- switch to master -------- +connection master; +DROP TABLE t1; +DROP TABLE t3; + +--echo End of 6.0 tests diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test index 4d611c15acf..df08622b0bd 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test @@ -9,8 +9,6 @@ CREATE SCHEMA IF NOT EXISTS mysqlslap; USE mysqlslap; --enable_warnings -select @@global.binlog_format; - # # BUG#25507 "multi-row insert delayed + auto increment causes # duplicate key entries on slave"; @@ -38,18 +36,19 @@ connection master; truncate table t1; # first scenario: duplicate on first row insert delayed into t1 values(10, "my name"); -if ($binlog_format_statement) +flush table t1; +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { # statement below will be converted to non-delayed INSERT and so # will stop at first error, guaranteeing replication. --error ER_DUP_ENTRY insert delayed into t1 values(10, "is Bond"), (20, "James Bond"); } -if (!$binlog_format_statement) +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 @@ -59,7 +58,7 @@ select * from t1; # second scenario: duplicate on second row connection master; delete from t1 where id!=10; -if ($binlog_format_statement) +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { # statement below will be converted to non-delayed INSERT and so # will be binlogged with its ER_DUP_ENTRY error code, guaranteeing @@ -67,7 +66,7 @@ if ($binlog_format_statement) --error ER_DUP_ENTRY insert delayed into t1 values(20, "is Bond"), (10, "James Bond"); } -if (!$binlog_format_statement) +if (`SELECT @@global.binlog_format != 'STATEMENT'`) { insert delayed into t1 values(20, "is Bond"), (10, "James Bond"); } @@ -90,7 +89,7 @@ connection master; # Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but # on the slave # -if ($binlog_format_statement) +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { #flush the logs before the test connection slave; @@ -100,25 +99,41 @@ if ($binlog_format_statement) } CREATE TABLE t1(a int, UNIQUE(a)); +--let $_start= query_get_value(SHOW MASTER STATUS, Position, 1) + INSERT DELAYED IGNORE INTO t1 VALUES(1); INSERT DELAYED IGNORE INTO t1 VALUES(1); flush table t1; # to wait for INSERT DELAYED to be done -if ($binlog_format_statement) +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { #must show two INSERT DELAYED --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) - --let $binlog_limit= 1,2 - --source include/show_binlog_events.inc + + # The first INSERT DELAYED + --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 2) + --echo $stmt + +# The second INSERT DELAYED statement is the 3 item if two INSERT DELAYED are +# handled together + --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 3) + +# The second INSERT DELAYED statement is the 5 item if two INSERT DELAYED are +# handled separately + if ($stmt == COMMIT) + { + --let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 5) + } + --echo $stmt } select * from t1; sync_slave_with_master; echo On slave; -if ($binlog_format_statement) +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { #must show two INSERT DELAYED --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) - --let $binlog_limit= 1,2 + --let $binlog_limit= 1,6 --source include/show_binlog_events.inc } select * from t1; @@ -128,7 +143,7 @@ select * from t1; connection master; drop table t1; sync_slave_with_master; -if (`SELECT @@global.binlog_format != 'ROW'`) +if (`SELECT @@global.binlog_format = 'STATEMENT'`) { #flush the logs after the test FLUSH LOGS; diff --git a/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test b/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test deleted file mode 100644 index 77140174f4b..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test +++ /dev/null @@ -1,64 +0,0 @@ -# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR -# In SBR, if a statement does not fail, it is always written to the binary log, -# regardless if rows are changed or not. If there is a failure, a statement is -# only written to the binary log if a non-transactional (.e.g. MyIsam) engine -# is updated. INSERT ON DUPLICATE KEY UPDATE was not following the rule above -# and was not written to the binary log, if then engine was Innodb. -# -# In this test case, we check if INSERT ON DUPLICATE KEY UPDATE that does not -# change anything is still written to the binary log. - -# Prepare environment ---connection master - -eval CREATE TABLE t1 ( - a INT UNSIGNED NOT NULL PRIMARY KEY -) ENGINE=$engine_type; - -eval CREATE TABLE t2 ( - a INT UNSIGNED -) ENGINE=$engine_type; - -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); - -# An insert duplicate that does not update anything must be written to the binary -# log in SBR and MIXED modes. We check this property by summing a before and after -# the update and comparing the binlog positions. The sum should be the same at both -# points and the statement should be in the binary log. ---let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1) ---let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1) ---let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a ---eval $statement_file - ---let $assert_cond= SUM(a) = 1 FROM t1 ---let $assert_text= Sum of elements in t1 should be 1. ---source include/assert.inc - -if (`SELECT @@BINLOG_FORMAT = 'ROW'`) -{ - --let $binlog_position_cmp= = - --let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start - --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. -} -if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`) -{ - --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\' - --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. -} -if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`) -{ - --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 0, 1\', Info, 1]\' LIKE \'%$statement_file\' - --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. -} ---source include/assert.inc - -# Compare master and slave ---sync_slave_with_master ---let $diff_tables= master:test.t1 , slave:test.t1 ---source include/diff_tables.inc - -# Clean up ---connection master -drop table t1, t2; ---sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index 38dfc818041..32d861bd45a 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -11,8 +11,6 @@ --echo # Setup --echo # -use test; - --echo # --echo # See if queries that use both auto_increment and LAST_INSERT_ID() --echo # are replicated well @@ -23,6 +21,13 @@ use test; -- source include/master-slave.inc #should work for both SBR and RBR +--disable_query_log +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--connection slave +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + + # If concurrent inserts are on, it is not guaranteed that the rows # inserted by INSERT are immediately accessible by SELECT in another # thread. This would cause problems near the line 'connection master1' @@ -72,6 +77,7 @@ eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type; insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); +--disable_warnings ONCE insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; sync_slave_with_master; @@ -104,11 +110,14 @@ sync_slave_with_master; --echo # connection master; +set @@session.sql_auto_is_null=1; eval create table t1(a int auto_increment, key(a)) engine=$engine_type; eval create table t2(a int) engine=$engine_type; insert into t1 (a) values (null); +--disable_warnings insert into t2 (a) select a from t1 where a is null; insert into t2 (a) select a from t1 where a is null; +--enable_warnings select * from t2; sync_slave_with_master; connection slave; @@ -166,12 +175,14 @@ begin end| delimiter ;| +--disable_warnings ONCE insert into t1 (last_id) values (0); drop trigger t1_bi; # Check that nested call doesn't affect outer context. select last_insert_id(); +--disable_warnings ONCE select bug15728_insert(); select last_insert_id(); insert into t1 (last_id) values (bug15728()); @@ -180,9 +191,8 @@ select last_insert_id(); # BUG#20339 - stored procedure using LAST_INSERT_ID() does not # replicate statement-based ---disable_warnings +--disable_warnings ONCE drop procedure if exists foo; ---enable_warnings delimiter |; create procedure foo() begin @@ -242,6 +252,7 @@ select * from t1 order by n; # table's counter, the counter for next row is bigger than the # after-value of the updated row. connection master; +--disable_warnings ONCE insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000; select * from t1 order by n; sync_slave_with_master; @@ -260,6 +271,7 @@ delete from t1 where b <> 100; select * from t1 order by n; connection master; +--disable_warnings ONCE insert into t1 values(null,100),(null,350) on duplicate key update n=2; select * from t1 order by n; sync_slave_with_master; @@ -277,6 +289,7 @@ connection master; # testcase with INSERT VALUES eval CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT, UNIQUE(b)) ENGINE=$engine_type; +--disable_warnings ONCE INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; SELECT * FROM t1 ORDER BY a; sync_slave_with_master; @@ -304,19 +317,23 @@ INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c'); INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d'); INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e'); # Updating table t1 based on values from table t2 +--disable_warnings INSERT INTO t1 (field_1, field_2, field_3) SELECT t2.field_a, t2.field_b, t2.field_c FROM t2 ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; +--enable_warnings # Inserting new record into t2 INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f'); # Updating t1 again +--disable_warnings INSERT INTO t1 (field_1, field_2, field_3) SELECT t2.field_a, t2.field_b, t2.field_c FROM t2 ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c; +--enable_warnings SELECT * FROM t1 ORDER BY id; sync_slave_with_master; SELECT * FROM t1 ORDER BY id; @@ -423,6 +440,7 @@ delimiter ;| INSERT INTO t1 VALUES (NULL, -1); CALL p1(); +--disable_warnings ONCE SELECT f1(); INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2()); @@ -492,11 +510,13 @@ insert into t2 (id) values(1),(2),(3); delete from t2; set sql_log_bin=1; #inside SELECT, then inside INSERT +--disable_warnings ONCE select insid(); set sql_log_bin=0; insert into t2 (id) values(5),(6),(7); delete from t2 where id>=5; set sql_log_bin=1; +--disable_warnings ONCE insert into t1 select insid(); select * from t1 order by id; select * from t2 order by id; @@ -521,6 +541,7 @@ begin insert into t2 values(null,3); end| delimiter ;| +--disable_warnings ONCE call foo(); select * from t1 order by n; select * from t2 order by id; @@ -533,5 +554,6 @@ connection master; drop table t1, t2; drop procedure foo; SET @@global.concurrent_insert= @old_concurrent_insert; +set @@session.sql_auto_is_null=default; --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test index c6fc7ef1aae..f6152180e7a 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test @@ -10,9 +10,10 @@ # We also check how the foreign_key_check variable is replicated -- source include/master-slave.inc +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); + #should work for both SBR and RBR -connection master; create table t1(a int auto_increment, primary key(a)); create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (1),(2),(3); @@ -51,6 +52,7 @@ create table t2(b int auto_increment, c int, primary key(b)); insert into t1 values (10); insert into t1 values (null),(null),(null); insert into t2 values (5,0); +--disable_warnings ONCE insert into t2 (c) select * from t1 ORDER BY a; select * from t2 ORDER BY b; sync_slave_with_master; @@ -72,8 +74,10 @@ SET FOREIGN_KEY_CHECKS=0; # Duplicate Key Errors codes --error 1022, ER_DUP_ENTRY INSERT INTO t1 VALUES (1),(1); -drop table t1; sync_slave_with_master; +connection master; +drop table t1; + # End of 4.1 tests --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test index 1eb66358423..f422ef35f8c 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test @@ -31,7 +31,7 @@ INSERT INTO t2 VALUES (3, 5); INSERT INTO t2 VALUES (4, 3); INSERT INTO t2 VALUES (5, 4); INSERT INTO t2 VALUES (6, 6); - +--disable_warnings ONCE INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; --let $assert_cond= COUNT(*) = 6 FROM t1 --let $assert_text= Count of elements in t1 should be 6. @@ -51,30 +51,70 @@ INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a; --let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1) --let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1) --let $statement_file=INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a +--disable_warnings ONCE --eval $statement_file --let $assert_cond= COUNT(*) = 6 FROM t1 --let $assert_text= Count of elements in t1 should be 6. --source include/assert.inc -if (`SELECT @@BINLOG_FORMAT = 'ROW'`) +if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) { --let $binlog_position_cmp= = --let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } -if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('Innodb')`) +if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 2, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } -if (`SELECT @@BINLOG_FORMAT != 'ROW' && UPPER('$engine_type') = UPPER('MyIsam')`) + +--source include/assert.inc + +# An insert duplicate that does not update anything must be written to the binary +# log in SBR and MIXED modes. We check this property by summing a before and after +# the update and comparing the binlog positions. The sum should be the same at both +# points and the statement should be in the binary log. +--disable_warnings +DROP TABLE t1; +DROP TABLE t2; +--enable_warnings +eval CREATE TABLE t1 ( + a INT UNSIGNED NOT NULL PRIMARY KEY +) ENGINE=$engine_type; + +eval CREATE TABLE t2 ( + a INT UNSIGNED +) ENGINE=$engine_type; + +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (1); + +--let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1) +--let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1) +--let $statement_file=INSERT INTO t1 SELECT t2.a FROM t2 ORDER BY t2.a ON DUPLICATE KEY UPDATE t1.a= t1.a +--disable_warnings ONCE +--eval $statement_file + +--let $assert_cond= SUM(a) = 1 FROM t1 +--let $assert_text= Sum of elements in t1 should be 1. +--source include/assert.inc + +if (`SELECT @@BINLOG_FORMAT != 'STATEMENT'`) +{ + --let $binlog_position_cmp= = + --let $assert_cond= [SHOW MASTER STATUS, Position, 1] $binlog_position_cmp $binlog_start + --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. +} +if (`SELECT @@BINLOG_FORMAT = 'STATEMENT'`) { --let $assert_cond= \'[\'SHOW BINLOG EVENTS IN "$binlog_file" FROM $binlog_start LIMIT 1, 1\', Info, 1]\' LIKE \'%$statement_file\' --let $assert_text= In SBR or MIXED modes, the event in the binlog should be the same that was executed. In RBR mode, binlog position should stay unchanged. } --source include/assert.inc + # Clean up --connection master drop table t1, t2; diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index ae04c1b4aaa..b5d230d947e 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -11,10 +11,13 @@ # check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and # Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986) --- source include/have_binlog_format_statement.inc -- source include/master-slave.inc source include/have_innodb.inc; +--disable_query_log +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +--enable_query_log + # MTR is not case-sensitive. let $lower_stmt_head= load data; let $UPPER_STMT_HEAD= LOAD DATA; @@ -37,7 +40,9 @@ create temporary table t2 (day date,id int(9),category enum('a','b','c'),name va eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +--disable_warnings insert into t3 select * from t2; +--enable_warnings sync_slave_with_master; @@ -146,9 +151,15 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fi terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines; connection slave; ---source include/wait_for_slave_sql_to_stop.inc -drop table t1, t2; ---source include/stop_slave_io.inc + +if (`SELECT @@global.binlog_format != 'ROW'`) +{ + # Query causes error on master but not on slave. This causes the slave to + # stop with error code 0 (which is wrong: see BUG#57287) + --let $slave_sql_errno= 0 + --source include/wait_for_slave_sql_error.inc + drop table t1, t2; +} connection master; drop table t1, t2; @@ -158,7 +169,7 @@ CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB; --error ER_DUP_ENTRY eval $UPPER_STMT_HEAD INFILE "../../std_data/words.dat" INTO TABLE t1; -DROP TABLE IF EXISTS t1; +DROP TABLE t1; # BUG#48297: Schema name is ignored when LOAD DATA is written into binlog, # replication aborts @@ -247,5 +258,4 @@ SELECT * FROM t1; -- connection master DROP TABLE t1; -# End of 4.1 tests --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 4de8169a2e6..892d926a156 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -11,10 +11,11 @@ # (otherwise RESET MASTER may come too early). sync_slave_with_master; source include/stop_slave.inc; +--source include/wait_for_slave_to_stop.inc reset master; reset slave; -source include/start_slave.inc; -source include/binlog_start_pos.inc; +start slave; +--source include/wait_for_slave_to_start.inc let $VERSION=`select version()`; @@ -38,7 +39,7 @@ source include/show_binlog_events.inc; let $binlog_limit= 2; source include/show_binlog_events.inc; -let $binlog_limit= 2,1; +let $binlog_limit= 1,4; source include/show_binlog_events.inc; let $binlog_limit=; flush logs; diff --git a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test index cbda85527f1..3a6326fe814 100644 --- a/mysql-test/extra/rpl_tests/rpl_mixing_engines.test +++ b/mysql-test/extra/rpl_tests/rpl_mixing_engines.test @@ -1,710 +1,1779 @@ -################################################################################### -# 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. +# trunc-CS-T - Truncates a T-table previously created. +# trunc-CS-N - Truncates a N-table previously created. +# CT - Creates a temporary T-table. +# drop-CT - Drops a temporary T-table. +# +# - This is INSERT...SELECT: +# IS-T<-T - Inserts data from a T-table into a T-table. +# IS-T<-N - Inserts data from a N-table into a T-table. +# IS-N<-T - Inserts data from a T-table into a N-table. +# IS-N<-N - Inserts data from a N-table into a N-table. +# ISe-T<-T - Fails while inserting data from a T-table into a T-table. +# ISe-T<-N - Fails while inserting data from a N-table into a T-table. +# ISe-N<-T - Fails while inserting data from a T-table into a N-table. +# ISe-N<-N - Fails while inserting data from a N-table into a N-table. +# +# For the CREATE...SELECT and INSERT...SELECT, the table names are defined based +# on the variable $tb_id which is automatically incremented after each drop. +# This indirectly means that two tables cannot co-exist unless we manually keep +# the variable $tb_id. +# +# 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 ######################################################################### -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; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +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 + +SET @commands= 'Te-func'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +--echo +--echo +--echo +--echo +--echo # +--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 # +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 + + +--echo +--echo +--echo +--echo +--echo # +--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 # +SET @commands= 'eN'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'Ne'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'Ne-trig'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'Ne-func'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +--echo +--echo +--echo +--echo +--echo # +--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 # +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 + + +--echo +--echo +--echo +--echo +--echo # +--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 # +--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 + +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 -let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +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 + + +--echo +--echo +--echo +--echo --echo # ---echo #1) "B T T C" generates in binlog the "B T T 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 4", 4, "new text 4"); -INSERT INTO tt_2 VALUES ("new text 4", 4, "new text 4"); -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 ---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 #5) Generates in the binlog what follows: +--echo # --> STMT empty. +--echo # --> ROW empty. +--echo # --> MIXED empty. --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= '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 -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= '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 ---source include/show_binlog_events.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 #5.e) Generates in the binlog what follows: +--echo # --> STMT empty. +--echo # --> ROW empty. +--echo # --> MIXED empty. --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= '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 ---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 #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 # -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; +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 -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 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) "B T N C" 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 # -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 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 ---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 #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 # -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 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 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 + +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 -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-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 + +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 + +SET @commands= 'B TN-trig T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'B TN-func T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + + +--echo +--echo +--echo +--echo --echo # +--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 -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 NeT-func 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 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 ---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 #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 # -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; +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 + +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 ---source include/show_binlog_events.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 -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 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-trig 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 NT-func 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 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-trig 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; +SET @commands= 'B TN-func N R'; +--source extra/rpl_tests/rpl_mixing_engines.inc -BEGIN; -CALL pc_i_tt_3(1900, "Testing..."); -INSERT INTO tt_1 VALUES ("new text 2000", 2000, ''); -COMMIT; -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; +--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 -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 nTe 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 NeT-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 NeT-func N R'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'B TeN-trig N R'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +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 # + +SET @commands= 'B N tN R'; +--source extra/rpl_tests/rpl_mixing_engines.inc -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 nT 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-trig 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-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 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 TN 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-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 - INSERT TABLE...SELECT +--echo ################################################################################### + +SET @commands= 'CS-T->T'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B T IS-T<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B T ISe-T<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B IS-T<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B ISe-T<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CS'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'CS-T->T'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B T IS-T<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B T ISe-T<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B IS-T<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-T B ISe-T<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CS'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'CS-N->N'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B T IS-N<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B T ISe-N<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B IS-N<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B ISe-N<-T T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CS'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'CS-N->N'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B T IS-N<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B T ISe-N<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B IS-N<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'trunc-CS-N B ISe-N<-N T C'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CS'; +--source extra/rpl_tests/rpl_mixing_engines.inc + + +--echo ################################################################################### +--echo # 5 - ROLLBACK TEMPORARY TABLE +--echo ################################################################################### +SET @commands= 'B T CT R'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CT'; +--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= 'drop-CT'; +--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= 'drop-CT'; +--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= 'drop-CT'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'B CT T R'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CT'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'B N CT T R'; +--source extra/rpl_tests/rpl_mixing_engines.inc + +SET @commands= 'drop-CT'; +--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 +if (`select @@session.binlog_direct_non_transactional_updates = 0 || @@session.binlog_format != 'STATEMENT'`) +{ + --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_multi_update.test b/mysql-test/extra/rpl_tests/rpl_multi_update.test index bf7707f9d6d..cdbdbc191d7 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_update.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_update.test @@ -1,5 +1,7 @@ source include/master-slave.inc; +call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); + eval CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned @@ -11,6 +13,7 @@ eval CREATE TABLE t2 ( ) ENGINE=$engine_type; INSERT INTO t1 VALUES (NULL, 0); +--disable_warnings ONCE INSERT INTO t1 SELECT NULL, 0 FROM t1; INSERT INTO t2 VALUES (NULL, 0), (NULL,1); @@ -18,6 +21,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1); SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; +--disable_warnings ONCE UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update2.test b/mysql-test/extra/rpl_tests/rpl_multi_update2.test index ae4261c0516..b85927a2aed 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_update2.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_update2.test @@ -17,6 +17,8 @@ eval CREATE TABLE t2 ( ) ENGINE=$engine_type; INSERT INTO t1 VALUES (NULL, 0); + +--disable_warnings ONCE INSERT INTO t1 SELECT NULL, 0 FROM t1; INSERT INTO t2 VALUES (NULL, 0), (NULL,1); @@ -24,6 +26,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1); SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; +--disable_warnings ONCE UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update3.test b/mysql-test/extra/rpl_tests/rpl_multi_update3.test index 6c7a980aecb..f7d4815e9e5 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_update3.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_update3.test @@ -18,6 +18,8 @@ eval CREATE TABLE t2 ( ) ENGINE=$engine_type; INSERT INTO t1 VALUES (NULL, 0); + +--disable_warnings ONCE INSERT INTO t1 SELECT NULL, 0 FROM t1; INSERT INTO t2 VALUES (NULL, 0), (NULL,1); @@ -25,6 +27,7 @@ INSERT INTO t2 VALUES (NULL, 0), (NULL,1); SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; +--disable_warnings ONCE UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test index 6b968fe2e86..bba860ab9aa 100644 --- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test +++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test @@ -139,7 +139,9 @@ let $run= 5; while ($run) { START TRANSACTION; + --disable_warnings --eval CALL tpcb.trans($rpl_format); + --enable_warnings eval SET @my_errno= $mysql_errno; let $run_good= `SELECT @my_errno = 0`; let $run_bad= `SELECT @my_errno <> 0`; @@ -188,7 +190,9 @@ let $run= 5; while ($run) { START TRANSACTION; + --disable_warnings --eval CALL tpcb.trans($rpl_format); + --enable_warnings eval SET @my_errno= $mysql_errno; let $run_good= `SELECT @my_errno = 0`; let $run_bad= `SELECT @my_errno <> 0`; @@ -238,7 +242,9 @@ let $run= 5; while ($run) { START TRANSACTION; + --disable_warnings --eval CALL tpcb.trans($rpl_format); + --enable_warnings eval SET @my_errno= $mysql_errno; let $run_good= `SELECT @my_errno = 0`; let $run_bad= `SELECT @my_errno <> 0`; diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test index 86f49d1665c..cbb6b787f11 100644 --- a/mysql-test/extra/rpl_tests/rpl_not_null.test +++ b/mysql-test/extra/rpl_tests/rpl_not_null.test @@ -173,7 +173,7 @@ sync_slave_with_master; #--source include/wait_for_slave_to_start.inc # #let $y=0; -#while (`select $y < 6`) +#while ($y < 6) #{ # connection master; # @@ -198,21 +198,21 @@ sync_slave_with_master; # `c` INT DEFAULT 500, # PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; # -# if (`select $y=0`) +# if ($y==0) # { # --echo ************* EXECUTION WITH INSERTS ************* # connection master; # INSERT INTO t1(a) VALUES (1); # } # -# if (`select $y=1`) +# if ($y==1) # { # --echo ************* EXECUTION WITH INSERTS ************* # connection master; # INSERT INTO t1(a, b) VALUES (1, NULL); # } # -# if (`select $y=2`) +# if ($y==2) # { # --echo ************* EXECUTION WITH UPDATES ************* # connection master; @@ -221,14 +221,14 @@ sync_slave_with_master; # UPDATE t3 SET b = NULL where a= 1; # } # -# if (`select $y=3`) +# if ($y==3) # { # --echo ************* EXECUTION WITH INSERTS/REPLACES ************* # connection master; # REPLACE INTO t3(a, b) VALUES (1, null); # } # -# if (`select $y=4`) +# if ($y==4) # { # --echo ************* EXECUTION WITH UPDATES/REPLACES ************* # connection master; @@ -236,7 +236,7 @@ sync_slave_with_master; # REPLACE INTO t3(a, b) VALUES (1, null); # } # -# if (`select $y=5`) +# if ($y==5) # { # --echo ************* EXECUTION WITH MULTI-ROW INSERTS ************* # connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test index 182fde40193..17d949a7790 100644 --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test @@ -23,6 +23,7 @@ source include/show_slave_status.inc; reset slave; source include/show_slave_status.inc; +change master to master_user='root'; source include/start_slave.inc; sync_with_master; source include/show_slave_status.inc; @@ -68,7 +69,7 @@ source include/check_slave_no_error.inc; # verifying reset slave resets Last_{IO,SQL}_Err{or,no} # -source include/stop_slave.inc; +stop slave; change master to master_user='impossible_user_name'; start slave; let $slave_io_errno= 1045; @@ -77,6 +78,33 @@ let $slave_io_errno= 1045; reset slave; source include/check_slave_no_error.inc; +change master to master_user='root'; + + +# +# BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING MYSQL BUG#28796 +# + +reset slave; +--source include/start_slave.inc + +--source include/stop_slave.inc +--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) +--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1) +--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1) + +reset slave all; +--error ER_BAD_SLAVE +start slave; + +--let $_show_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) +if ($_show_master_host != No such row) +{ + die; +} + +--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT +--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port +--source include/start_slave.inc ---let $rpl_only_running_threads= 1 --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test index e72258df06e..c7570de3aba 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -2,17 +2,20 @@ # Basic tests of row-level logging # ---disable_query_log ---disable_result_log -# Add suppression for expected warning(s) in error log -call mtr.add_suppression("Can't find record in 't.'"); ---enable_query_log ---enable_result_log - # # First we test tables with only an index. # +#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS +#Testing command counters -BEFORE +#Storing the before counts of Slave +connection slave; +let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1); +let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1); +let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1); +let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1); + +connection master; eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ; SELECT * FROM t1; sync_slave_with_master; @@ -46,6 +49,32 @@ SELECT * FROM t1 ORDER BY C1,C2; sync_slave_with_master; SELECT * FROM t1 ORDER BY C1,C2; +#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS +#Testing command counters -AFTER +#Storing the after counts of Slave +connection slave; +let $slave_com_commit_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1); +let $slave_com_insert_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1); +let $slave_com_delete_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1); +let $slave_com_update_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1); + +#Commit count check +--let $assert_text= Counter for COM_COMMIT is consistent with the number of actual commits +--let $assert_cond= $slave_com_commit_after - $slave_com_commit_before = 4 +--source include/assert.inc +#Insert count check +--let $assert_text= Counter for COM_INSERT is consistent with the number of actual inserts +--let $assert_cond= $slave_com_insert_after - $slave_com_insert_before = 2 +--source include/assert.inc +#Delete count check +--let $assert_text= Counter for COM_DELETE is consistent with the number of actual deletes +--let $assert_cond= $slave_com_delete_after - $slave_com_delete_before = 1 +--source include/assert.inc +#Update count check +--let $assert_text= Counter for COM_UPDATE is consistent with the number of actual updates +--let $assert_cond= $slave_com_update_after - $slave_com_update_before = 1 +--source include/assert.inc + # Testing update with a condition that does not match any rows, but # which has a match for the index. connection master; @@ -163,6 +192,12 @@ SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5 # Testing special column types # +if (`select char_length('$bit_field_special') > 0`) { + connection slave; + SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS; + eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special'; +} + connection master; eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ; @@ -171,6 +206,10 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; sync_slave_with_master; SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1; +if (`select char_length('$bit_field_special') > 0`) { + SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; +} + # # Testing conflicting operations # @@ -354,6 +393,10 @@ eval CREATE TABLE t7 (i INT NOT NULL, c CHAR(255) CHARACTER SET utf8 NOT NULL, j INT NOT NULL) ENGINE = $type ; +connection slave; +SET @saved_slave_type_conversions = @@slave_type_conversions; +SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY'; + --echo [expecting slave to replicate correctly] connection master; INSERT INTO t1 VALUES (1, "", 1); @@ -372,18 +415,11 @@ sync_slave_with_master; let $diff_tables= master:t2, slave:t2; source include/diff_tables.inc; ---echo [expecting slave to stop] -connection master; -INSERT INTO t3 VALUES (1, "", 1); -INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); - connection slave; -# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535"); call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032"); ---let $slave_sql_errno= 1535 ---let $show_slave_sql_error= 1 ---source include/wait_for_slave_sql_error.inc +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t.. cannot be converted from type.*, Error_code: 1677"); --let $rpl_only_running_threads= 1 --source include/rpl_reset.inc @@ -403,8 +439,8 @@ INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; -# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +# 1677 = ER_SLAVE_CONVERSION_FAILED +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc @@ -416,8 +452,8 @@ INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; -# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF ---let $slave_sql_errno= 1535 +# 1677 = ER_SLAVE_CONVERSION_FAILED +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error.inc @@ -582,7 +618,15 @@ sync_slave_with_master; connection master; +# Since t1 contain a bit field, we have to do this trick to handle InnoDB +if (`select char_length('$bit_field_special') > 0`) { + connection slave; + SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS; + eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special'; +} + --disable_warnings +connection master; eval CREATE TABLE t1 (a bit) ENGINE=$type; INSERT IGNORE INTO t1 VALUES (NULL); INSERT INTO t1 ( a ) VALUES ( 0 ); @@ -627,6 +671,10 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3; sync_slave_with_master; +if (`select char_length('$bit_field_special') > 0`) { + SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions; +} + let $diff_tables= master:t1, slave:t1; source include/diff_tables.inc; diff --git a/mysql-test/extra/rpl_tests/rpl_row_blob.test b/mysql-test/extra/rpl_tests/rpl_row_blob.test index 080df7d75dd..762daa816c0 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test @@ -36,7 +36,7 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3; save_master_pos; connection slave; sync_with_master; -sleep 5; +--source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Insert Validation Slave Section test.t1 **** --echo @@ -56,12 +56,10 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2; --echo SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2; -# Sleep is needed for NDB to allow time for -# Injector thread to populate the bin log. save_master_pos; connection slave; sync_with_master; -sleep 5; +--source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Update Validation Slave Section test.t1 **** --echo @@ -132,7 +130,7 @@ FROM test.t2 WHERE c1=2; save_master_pos; connection slave; sync_with_master; -sleep 5; +--source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Insert Validation Slave Section test.t2 **** --echo @@ -155,12 +153,10 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=1; SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3) FROM test.t2 WHERE c1=2; -# Sleep is needed for NDB to allow time for -# Injector thread to populate the bin log. save_master_pos; connection slave; sync_with_master; -sleep 5; +--source include/wait_for_ndb_to_binlog.inc --echo --echo **** Data Update Validation Slave Section test.t2 **** --echo diff --git a/mysql-test/extra/rpl_tests/rpl_row_func003.test b/mysql-test/extra/rpl_tests/rpl_row_func003.test index 6369d36e7e3..d12b5a3306a 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_func003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test @@ -3,10 +3,7 @@ # Original Date: Aug/15/2005 # # Update: 08/29/2005 Comment out sleep. Only needed for debugging # ############################################################################# -# Note: Many lines are commented out in this test case. These were used for # -# creating the test case and debugging and are being left for # -# debugging, but they can not be used for the regular testing as the # -# Time changes and is not deteministic, so instead we dump both the # +# Note: Time changes and is not deteministic, so instead we dump both the # # master and slave and diff the dumps. If the dumps differ then the # # test case will fail. To run during diff failuers, comment out the # # diff. # @@ -28,7 +25,6 @@ DROP TABLE IF EXISTS test.t1; --enable_warnings - eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type; delimiter |; diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test index c52cf344c5f..90c273eb026 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test @@ -17,7 +17,6 @@ -- source include/have_binlog_format_row.inc -- source include/master-slave.inc - # Begin test section 1 eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type; diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test index 7cf3d0fa19c..d2c2ea0caf3 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -35,16 +35,26 @@ connection master1; send CALL test.p1(); connection master; -# To make sure tha the call on master1 arrived at the get_lock -sleep 1; +# Make sure that the call on master1 arrived at the get_lock. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'User lock' and + info = 'SELECT get_lock("test", 100)'; +--source include/wait_condition.inc CALL test.p2(); SELECT release_lock("test"); + +connection master1; +# Reap CALL test.p1() to ensure that it has fully completed +# before doing any selects on test.t1. +--reap +# Release lock acquired by it. +SELECT release_lock("test"); + +connection master; SELECT * FROM test.t1; #show binlog events; -# Added sleep for use with NDB to ensure that -# the injector thread will populate log before -# we switch to the slave. -sleep 5; +--source include/wait_for_ndb_to_binlog.inc sync_slave_with_master; connection slave; SELECT * FROM test.t1; @@ -54,6 +64,7 @@ DROP TABLE IF EXISTS test.t1; eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type; CALL test.p2(); CALL test.p1(); +SELECT release_lock("test"); SELECT * FROM test.t1; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 4e15a5a98ff..76432febd5e 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -148,8 +148,9 @@ connection master; INSERT INTO t4 VALUES (4); connection slave; call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column [012] type mismatch.* Error_code: 1535"); +call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]. cannot be converted from type.* Error_code: 1677"); --let $slave_skip_counter= 2 ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -161,7 +162,7 @@ connection master; INSERT INTO t5 VALUES (5,10,25); connection slave; --let $slave_skip_counter= 2 ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc @@ -173,7 +174,7 @@ connection master; INSERT INTO t6 VALUES (6,12,36); connection slave; --let $slave_skip_counter= 2 ---let $slave_sql_errno= 1535 +--let $slave_sql_errno= 1677 --let $show_slave_sql_error= 1 --source include/wait_for_slave_sql_error_and_skip.inc diff --git a/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc new file mode 100644 index 00000000000..4530f8c639a --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc @@ -0,0 +1,17 @@ +# Include file for rpl_show_relaylog_events.inc + +--let $log_type= BINLOG +if ($is_relay_log) { + --let $log_type= RELAYLOG +} +--let $args= +if ($binlog_file != '') { + --let $args= IN <FILE> +} +if ($binlog_limit) { + --let $args= $args LIMIT $binlog_limit +} +--echo ******** [$CURRENT_CONNECTION] SHOW $log_type EVENTS $args ******** +--source include/show_events.inc + + diff --git a/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc new file mode 100644 index 00000000000..411f388aaf3 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc @@ -0,0 +1,11 @@ +# Include file for rpl_show_log_events.inc + +--let $binlog_limit= +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1,3 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= +--let $binlog_file= +--source extra/rpl_tests/rpl_show_binlog_events.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 new file mode 100644 index 00000000000..a56e08ece42 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -0,0 +1,63 @@ +-- connection master +-- source include/rpl_reset.inc + +-- connection master + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); + +# PART I +# +# SHOWs contents of binary logs on the master and both, binary and +# relay logs, on the slave. +# + +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + +# +# PART II +# +# Although this second part of the test may seem redudant it is +# actually needed to assert that SHOW RELAYLOG EVENTS works properly +# with respect to the ordering of the relay log in relay-log.index. +# +# If no file is specified with "IN" then first relay log file in +# relay-log.index (ie, the oldest one) should be picked and its +# contents displayed. The same happens for SHOW BINLOG EVENTS, so we +# show them both. All in all, this is the reason for re-assert after +# MASTER and SLAVE's FLUSH LOGS operations. +# + +FLUSH LOGS; +-- connection master +FLUSH LOGS; +DROP TABLE t1; + +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc + + +# clear show_binlog_event/show_relaylog_events parameters +let $binlog_file= ; +let $binlog_limit= ; 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..40bc7746ccf --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test @@ -0,0 +1,216 @@ +# Slow test, don't run during staging part +source include/not_staging.inc; + +# +# Bug#6148 () +# +# Let the master do lots of insertions + +connection master; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + +connection slave; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + +connection master; +create table t1(n int); +sync_slave_with_master; +stop slave; +--source include/wait_for_slave_to_stop.inc +connection master; +let $1=2500; +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; +sync_slave_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; + +--echo # +--echo # Bug#56096 STOP SLAVE hangs if executed in parallel with user sleep +--echo # + +--connection master + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT ); + +sync_slave_with_master; + +--connection slave1 +--echo # Slave1: lock table for synchronization +LOCK TABLES t1 WRITE; + +--connection master +--echo # Master: insert into the table +INSERT INTO t1 SELECT SLEEP(4); + +--connection slave +--echo # Slave: wait for the insert +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE STATE = "Waiting for table metadata lock" + AND INFO = "INSERT INTO t1 SELECT SLEEP(4)"; +--source include/wait_condition.inc + +--echo # Slave: send slave stop +--send STOP SLAVE + +--connection slave1 +--echo # Slave1: wait for stop slave +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE INFO = "STOP SLAVE"; +--source include/wait_condition.inc + +--echo # Slave1: unlock the table +UNLOCK TABLES; + +--connection slave +--echo # Slave: wait for the slave to stop +--reap +--source include/wait_for_slave_to_stop.inc + +--echo # Start slave again +--source include/start_slave.inc + +--echo # Clean up +--connection master +DROP TABLE t1; +sync_slave_with_master; + +# +# bug#3593869-64035 attempt to read a member of event_coordinates +# referenced by NULL pointer crashes server. +# Testing how out of valid range position value is handled with an error. +# + +--connection master +RESET MASTER; +let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1); +let $master_pos= `SELECT $master_pos + 1`; + +--connection slave +--source include/stop_slave.inc +--replace_regex /[0-9]+/MASTER_POS/ +eval CHANGE MASTER TO master_log_pos=$master_pos; + +START SLAVE; +# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +--let $slave_param=Last_IO_Errno +--let $slave_param_value=1236 +--source include/wait_for_slave_param.inc + +--let $slave_field_result_replace= / at [0-9]*/ at XXX/ +--let $status_items= Last_IO_Errno, Last_IO_Error +--source include/show_slave_status.inc + +--source include/stop_slave.inc +RESET SLAVE; + +--connection master +RESET MASTER; + +# Slave is stopped by bug#3593869-64035 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..43c561c5b85 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test @@ -0,0 +1,150 @@ +# 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 written to the binary log using 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_dbug="+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; +call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); +call mtr.add_suppression("Slave SQL.*Slave SQL Thread stopped with incomplete event group having non-transactional changes"); + +# 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_dbug="-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_dbug="+d,stop_slave_middle_group"; +set @@global.debug_dbug="+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_dbug="-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_dbug="+d,stop_slave_middle_group"; +set @@global.debug_dbug="+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_dbug="-d"; + +# +# clean-up +# + +# the sql thread has an error, so reset replication state +--let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc + +connection master; +drop table tm, ti; +--sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_stop_slave.test index 2153db09eb2..b226f4f22f1 100644 --- a/mysql-test/extra/rpl_tests/rpl_stop_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test @@ -9,7 +9,7 @@ # --source extra/rpl_tests/rpl_stop_slave.test # -if (`SELECT "$tmp_table_stm" = ''`) +if (!$tmp_table_stm) { --echo \$tmp_table_stm is NULL --die $tmp_table_stm is NULL @@ -53,8 +53,8 @@ source include/wait_for_slave_sql_to_stop.inc; --echo # Slave should stop after the transaction has committed. --echo # So t1 on master is same to t1 on slave. -let diff_tables= master:t1, slave:t1; -source include/diff_tables.inc; +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc connection slave; START SLAVE SQL_THREAD; diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index bb740e59b11..1687a233914 100644 --- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -21,6 +21,5 @@ sync_slave_with_master; SELECT * FROM t1 ORDER BY id; connection master; DROP TABLE t1; -sync_slave_with_master; --source include/rpl_end.inc diff --git a/mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test b/mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test index cb1639a04ac..9cf287281a0 100644 --- a/mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test +++ b/mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test @@ -157,4 +157,3 @@ INSERT INTO t1 VALUES (1); DROP TEMPORARY TABLE t1; ---sync_slave_with_master diff --git a/mysql-test/extra/rpl_tests/rpl_trig004.test b/mysql-test/extra/rpl_tests/rpl_trig004.test index 45cb11f2787..1a738db27fc 100644 --- a/mysql-test/extra/rpl_tests/rpl_trig004.test +++ b/mysql-test/extra/rpl_tests/rpl_trig004.test @@ -35,9 +35,8 @@ INSERT INTO test.t2 VALUES (1, 0.0); #show binlog events; select * from test.t1; select * from test.t2; -# Have to sleep for a few seconds to allow -# NDB injector thread to populate binlog -sleep 10; +let $wait_time= 10; +--source include/wait_for_ndb_to_binlog.inc sync_slave_with_master; connection slave; select * from test.t1; diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test new file mode 100644 index 00000000000..0096fda3174 --- /dev/null +++ b/mysql-test/extra/rpl_tests/type_conversions.test @@ -0,0 +1,880 @@ +# File containing different lossy and non-lossy type conversions. + +# Integral conversion testing, we do not reduce the test using +# transitivity of conversions since the implementation is not using a +# transitivity strategy. Instead we do an exhaustive testing. + +disable_query_log; +connection slave; +--let $conv = `select @@slave_type_conversions` +--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' **** + +let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; +let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; + +# TINYBLOB + +let $source_type = TINYBLOB; +let $target_type = TINYBLOB; +let $source_value = 'aaa'; +let $target_value = 'aaa'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYBLOB; +let $target_type= BLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYBLOB; +let $target_type= MEDIUMBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYBLOB; +let $target_type= LONGBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +# BLOB + +let $source_type = BLOB; +let $target_type = TINYBLOB; +let $source_value = 'aaa'; +let $target_value = 'aaa'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BLOB; +let $target_type= BLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= BLOB; +let $target_type= MEDIUMBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BLOB; +let $target_type= LONGBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +# MEDIUMBLOB + +let $source_type = MEDIUMBLOB; +let $target_type = TINYBLOB; +let $source_value = 'aaa'; +let $target_value = 'aaa'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMBLOB; +let $target_type= BLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMBLOB; +let $target_type= MEDIUMBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMBLOB; +let $target_type= LONGBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +# LONGBLOB + +let $source_type = LONGBLOB; +let $target_type = TINYBLOB; +let $source_value = 'aaa'; +let $target_value = 'aaa'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= LONGBLOB; +let $target_type= BLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= LONGBLOB; +let $target_type= MEDIUMBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= LONGBLOB; +let $target_type= LONGBLOB; +let $source_value= 'aaa'; +let $target_value= 'aaa'; +let $can_convert= 1; +source extra/rpl_tests/check_type.inc; + +# BUG#49836 (additional tests - GEOMETRY TYPE) + +let $source_type = GEOMETRY; +let $target_type = BLOB; +let $source_value = PointFromText('POINT(10 10)'); +let $target_value = PointFromText('POINT(10 10)'); +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = BLOB; +let $target_type = GEOMETRY; +let $source_value = 'aaa'; +let $target_value = 'aaa'; +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = GEOMETRY; +let $target_type = GEOMETRY; +let $source_value = PointFromText('POINT(10 10)'); +let $target_value = PointFromText('POINT(10 10)'); +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = BIT(1); +let $target_type = BIT(1); +let $source_value = b'1'; +let $target_value = b'1'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = DATE; +let $target_type = DATE; +let $source_value = '2009-11-21'; +let $target_value = '2009-11-21'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = ENUM('master','slave'); +let $target_type = ENUM('master','slave'); +let $source_value = 'master'; +let $target_value = 'master'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = CHAR(10); +let $target_type = ENUM('master','slave'); +let $source_value = 'master'; +let $target_value = 'master'; +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = CHAR(10); +let $target_type = SET('master','slave'); +let $source_value = 'master'; +let $target_value = 'master'; +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = ENUM('master','slave'); +let $target_type = CHAR(10); +let $source_value = 'master'; +let $target_value = 'master'; +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('master','slave'); +let $target_type = CHAR(10); +let $source_value = 'master'; +let $target_value = 'master'; +let $can_convert = 0; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('master','slave'); +let $target_type = SET('master','slave'); +let $source_value = ''; +let $target_value = ''; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('master','slave'); +let $target_type = SET('master','slave'); +let $source_value = 'master,slave'; +let $target_value = 'master,slave'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('0','1','2','3','4','5','6'); +let $target_type = SET('0','1','2','3','4','5','6'); +let $source_value = '5'; +let $target_value = '5'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('0','1','2','3','4','5','6'); +let $target_type = SET('0','1','2','3','4','5','6','7','8','9','10'); +let $source_value = '5'; +let $target_value = '5'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10'); +let $target_type = SET('0','1','2','3','4','5','6'); +let $source_value = '5'; +let $target_value = '5'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10'); +let $target_type = SET('0','1','2','3','4','5','6'); +let $source_value = '7'; +let $target_value = ''; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type = TINYINT; +let $target_type = TINYINT; +let $source_value = 1; +let $target_value = 1; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type = TINYINT; +let $target_type = SMALLINT; +let $source_value = 1; +let $target_value = 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYINT; +let $target_type= MEDIUMINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYINT; +let $target_type= INT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYINT; +let $target_type= BIGINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= TINYINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= TINYINT; +let $source_value= 1 << 9; +let $target_value= (1 << 7) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= TINYINT UNSIGNED; +let $source_value= 1 << 9; +let $target_value= (1 << 8) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= SMALLINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= MEDIUMINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= INT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= SMALLINT; +let $target_type= BIGINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= TINYINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= TINYINT; +let $source_value= 1 << 20; +let $target_value= (1 << 7) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= TINYINT UNSIGNED; +let $source_value= 1 << 20; +let $target_value= (1 << 8) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= SMALLINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= MEDIUMINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= INT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMINT; +let $target_type= BIGINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= TINYINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= TINYINT; +let $source_value= (1 << 30); +let $target_value= (1 << 7) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= TINYINT UNSIGNED; +let $source_value= (1 << 30); +let $target_value= (1 << 8) - 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= SMALLINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= MEDIUMINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= INT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= INT; +let $target_type= BIGINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIGINT; +let $target_type= TINYINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIGINT; +let $target_type= SMALLINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIGINT; +let $target_type= MEDIUMINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIGINT; +let $target_type= INT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIGINT; +let $target_type= BIGINT; +let $source_value= 1; +let $target_value= 1; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= CHAR(20); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= CHAR(30); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= CHAR(10); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnood'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= VARCHAR(20); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= VARCHAR(30); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= VARCHAR(10); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnood'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= TINYTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= TEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= MEDIUMTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= CHAR(20); +let $target_type= LONGTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= VARCHAR(20); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= VARCHAR(30); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= VARCHAR(10); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnood'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= CHAR(30); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= CHAR(10); +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnood'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= TINYTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= TEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= MEDIUMTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(20); +let $target_type= LONGTEXT; +let $source_value= 'Smoothnoodlemaps'; +let $target_value= 'Smoothnoodlemaps'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $blob = `select repeat('abcd', 125)`; +let $truncated_blob = `select left('$blob', 255)`; + +let $source_type= VARCHAR(500); +let $target_type= VARCHAR(500); +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= VARCHAR(510); +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= VARCHAR(255); +let $source_value= '$blob'; +let $target_value= '$truncated_blob'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= TINYTEXT; +let $source_value= '$blob'; +let $target_value= '$truncated_blob'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= TEXT; +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= MEDIUMTEXT; +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= VARCHAR(500); +let $target_type= LONGTEXT; +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $tiny_blob = `select repeat('tiny blob ', 25)`; +let $truncated_tiny_blob = `select left('$tiny_blob', 254)`; + +let $source_type= TINYTEXT; +let $target_type= VARCHAR(500); +let $source_value= '$tiny_blob'; +let $target_value= '$tiny_blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TEXT; +let $target_type= VARCHAR(500); +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMTEXT; +let $target_type= VARCHAR(500); +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= LONGTEXT; +let $target_type= VARCHAR(500); +let $source_value= '$blob'; +let $target_value= '$blob'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYTEXT; +let $target_type= CHAR(255); +let $source_value= '$tiny_blob'; +let $target_value= '$tiny_blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYTEXT; +let $target_type= CHAR(250); +let $source_value= '$tiny_blob'; +let $target_value= left('$tiny_blob', 250); +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TEXT; +let $target_type= CHAR(255); +let $source_value= '$blob'; +let $target_value= left('$blob', 255); +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= MEDIUMTEXT; +let $target_type= CHAR(255); +let $source_value= '$blob'; +let $target_value= left('$blob', 255); +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= LONGTEXT; +let $target_type= CHAR(255); +let $source_value= '$blob'; +let $target_value= left('$blob', 255); +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYTEXT; +let $target_type= TINYTEXT; +let $source_value= '$tiny_blob'; +let $target_value= '$tiny_blob'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= TINYTEXT; +let $target_type= TEXT; +let $source_value= '$tiny_blob'; +let $target_value= '$tiny_blob'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= TEXT; +let $target_type= TINYTEXT; +let $source_value= '$blob'; +let $target_value= left('$blob',255); +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(10,5); +let $source_value= 3.14159; +let $target_value= 3.14159; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(10,6); +let $source_value= 3.14159; +let $target_value= 3.141590; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(11,5); +let $source_value= 3.14159; +let $target_value= 3.14159; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(11,6); +let $source_value= 3.14159; +let $target_value= 3.141590; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(10,4); +let $source_value= 3.14159; +let $target_value= 3.1416; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(9,5); +let $source_value= 3.14159; +let $target_value= 3.14159; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DECIMAL(9,4); +let $source_value= 3.14159; +let $target_value= 3.1416; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= FLOAT; +let $target_type= DECIMAL(10,5); +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DOUBLE; +let $target_type= DECIMAL(10,5); +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= FLOAT; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DECIMAL(10,5); +let $target_type= DOUBLE; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= FLOAT; +let $target_type= FLOAT; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= DOUBLE; +let $target_type= DOUBLE; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= FLOAT; +let $target_type= DOUBLE; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= DOUBLE; +let $target_type= FLOAT; +let $source_value= 3.15625; +let $target_value= 3.15625; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIT(5); +let $target_type= BIT(5); +let $source_value= b'11001'; +let $target_value= b'11001'; +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIT(5); +let $target_type= BIT(6); +let $source_value= b'11001'; +let $target_value= b'11001'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIT(6); +let $target_type= BIT(5); +let $source_value= b'111001'; +let $target_value= b'11111'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIT(5); +let $target_type= BIT(12); +let $source_value= b'11001'; +let $target_value= b'11001'; +let $can_convert = $if_is_non_lossy; +source extra/rpl_tests/check_type.inc; + +let $source_type= BIT(12); +let $target_type= BIT(5); +let $source_value= b'101100111000'; +let $target_value= b'11111'; +let $can_convert = $if_is_lossy; +source extra/rpl_tests/check_type.inc; + + +--source include/rpl_reset.inc +enable_query_log; |