summaryrefslogtreecommitdiff
path: root/mysql-test/extra/rpl_tests
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /mysql-test/extra/rpl_tests
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'mysql-test/extra/rpl_tests')
-rw-r--r--mysql-test/extra/rpl_tests/check_type.inc14
-rw-r--r--mysql-test/extra/rpl_tests/create_recursive_construct.inc39
-rw-r--r--mysql-test/extra/rpl_tests/rpl_EE_err.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment.test50
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test223
-rw-r--r--mysql-test/extra/rpl_tests/rpl_charset.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_commit_after_flush.test8
-rw-r--r--mysql-test/extra/rpl_tests/rpl_conflicts.test17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ddl.test11
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc24
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extra_col_master.test (renamed from mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test)31
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extra_col_slave.test (renamed from mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test)55
-rw-r--r--mysql-test/extra/rpl_tests/rpl_failed_optimize.test17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_flsh_tbls.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_foreign_key.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test48
-rw-r--r--mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test127
-rw-r--r--mysql-test/extra/rpl_tests/rpl_innodb.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_delayed.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_duplicate.test59
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id.test39
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_id_pk.test25
-rw-r--r--mysql-test/extra/rpl_tests/rpl_insert_ignore.test77
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test71
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test4
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_query.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_multi_update.test7
-rw-r--r--mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_not_null.test28
-rw-r--r--mysql-test/extra/rpl_tests/rpl_record_compare.test35
-rw-r--r--mysql-test/extra/rpl_tests/rpl_reset_slave.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_UUID.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_basic.test60
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test5
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp002.test57
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp003.test18
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp007.test25
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_tabledefs.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_set_null.test16
-rw-r--r--mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc17
-rw-r--r--mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc11
-rw-r--r--mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc127
-rw-r--r--mysql-test/extra/rpl_tests/rpl_start_stop_slave.test56
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_000001.test131
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test6
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test268
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stop_middle_group.test11
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stop_slave.test60
-rw-r--r--mysql-test/extra/rpl_tests/rpl_sv_relay_space.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_test_framework.inc86
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate.test7
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test8
-rw-r--r--mysql-test/extra/rpl_tests/type_conversions.test4
58 files changed, 1200 insertions, 865 deletions
diff --git a/mysql-test/extra/rpl_tests/check_type.inc b/mysql-test/extra/rpl_tests/check_type.inc
index 63491d81da4..97300753d38 100644
--- a/mysql-test/extra/rpl_tests/check_type.inc
+++ b/mysql-test/extra/rpl_tests/check_type.inc
@@ -11,18 +11,28 @@
# 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 (a $source_type);
+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($source_value);
+eval INSERT INTO t1 VALUES(1, $source_value);
if ($can_convert) {
sync_slave_with_master;
eval SELECT a = $target_value into @compare FROM t1;
diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
index ac10ab8ddb2..6e130a8154f 100644
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc
@@ -167,7 +167,9 @@
--let $CRC_create=
######## func_retval ########
-if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) {
+# 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).
@@ -180,10 +182,11 @@ if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) {
--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 (`SELECT $CRC_ARG_type = 1`) {
+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
@@ -197,7 +200,7 @@ if (`SELECT $CRC_ARG_type = 1`) {
}
######## proc ########
-if (`SELECT $CRC_ARG_type = 2`) {
+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
@@ -211,7 +214,7 @@ if (`SELECT $CRC_ARG_type = 2`) {
}
######## trig ########
-if (`SELECT $CRC_ARG_type = 3`) {
+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
@@ -225,7 +228,8 @@ if (`SELECT $CRC_ARG_type = 3`) {
}
######## view_retval ########
-if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_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
@@ -237,10 +241,12 @@ if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_retval' != ''`) {
--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 (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_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
@@ -252,10 +258,11 @@ if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_sidef' != ''`) {
--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 (`SELECT $CRC_ARG_type = 6`) {
+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"
@@ -269,7 +276,7 @@ if (`SELECT $CRC_ARG_type = 6`) {
}
######## no recursive construct: just return the given statement ########
-if (`SELECT $CRC_ARG_type = 7`) {
+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
@@ -285,17 +292,17 @@ if (`SELECT $CRC_ARG_type = 7`) {
}
######## execute! ########
-if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
+if ($CRC_RET_stmt_sidef) {
--echo
--echo Invoking $CRC_RET_desc.
- if (`SELECT '$CRC_create' != ''`) {
+ 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 (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_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;
@@ -312,14 +319,14 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
RESET MASTER;
--eval $CRC_RET_stmt_sidef
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- if (`SELECT '$n_warnings' != '0'`) {
+ 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 (`SELECT '$binlog_event' != 'No such row'`) {
+ 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;
@@ -332,7 +339,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
RESET MASTER;
--eval $CRC_RET_stmt_sidef
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- if (`SELECT '$n_warnings' != '0'`) {
+ if ($n_warnings) {
--echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
SHOW WARNINGS;
SHOW BINLOG EVENTS;
@@ -365,7 +372,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
# Invoke created object, discarding the return value. This should not
# give any warning.
-if (`SELECT '$CRC_RET_sel_retval' != ''`) {
+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
@@ -375,7 +382,7 @@ if (`SELECT '$CRC_RET_sel_retval' != ''`) {
# fail. When the bug is fixed, we should execute the following.
#--let $n_warnings= `SHOW COUNT(*) WARNINGS`
- #if (`SELECT '$n_warnings' != '0'`) {
+ #if ($n_warnings) {
# --enable_query_log
# --echo Failure! Expected 0 warnings, got $n_warnings warnings.
# SHOW WARNINGS;
diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test
index 205bbe79dac..0b3fec1f605 100644
--- a/mysql-test/extra/rpl_tests/rpl_EE_err.test
+++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test
@@ -9,10 +9,6 @@
# 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).
####################################
-# Change Author: JBM
-# Change Date: 2006-01-11
-# Change: Split test per lars review
-####################################
#"REQUIREMENT: A master DROP TABLE on a table with non-existing MYI
# file must be correctly replicated to the slave"
####################################
@@ -23,8 +19,5 @@ flush tables;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.MYI ;
drop table if exists t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
index 86885a14f94..24bcb5dbb77 100644
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
@@ -1,14 +1,6 @@
#
# Test of auto_increment with offset
#
-#####################################
-# By: JBM
-# Date: 2006-02-10
-# Change: NDB does not support auto inc
-# in this usage. Currently there is no
-# plan to implment. Skipping test when
-# NDB is default engine.
-#####################################
-- source include/not_ndb_default.inc
-- source include/master-slave.inc
@@ -169,7 +161,7 @@ drop table t1;
# auto_increment fields if the values of them are 0. There is an inconsistency
# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
#
-source include/master-slave-reset.inc;
+source include/rpl_reset.inc;
connection master;
--disable_warnings
@@ -210,12 +202,10 @@ INSERT INTO t2 VALUES(4);
FLUSH LOGS;
sync_slave_with_master;
-let $diff_table_1= master:test.t1;
-let $diff_table_2= slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
-let $diff_table_1= master:test.t2;
-let $diff_table_2= slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
connection master;
@@ -228,16 +218,42 @@ let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
sync_slave_with_master;
-let $diff_table_1= master:test.t1;
-let $diff_table_2= slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
-let $diff_table_1= master:test.t2;
-let $diff_table_2= slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
# End cleanup
+--connection master
DROP TABLE t1;
DROP TABLE t2;
SET SQL_MODE='';
sync_slave_with_master;
+
+#
+# BUG#56662
+# The test verifies if the assertion of "next_insert_id == 0"
+# will fail in ha_external_lock() function.
+#
+connection master;
+CREATE TABLE t1 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, data INT) ENGINE=innodb;
+
+BEGIN;
+--echo # Set sql_mode with NO_AUTO_VALUE_ON_ZERO for allowing
+--echo # zero to fill the auto_increment field.
+SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
+INSERT INTO t1(id,data) VALUES(0,2);
+--echo # Resetting sql_mode without NO_AUTO_VALUE_ON_ZERO to
+--echo # affect the execution of the transaction on slave.
+SET SQL_MODE=0;
+COMMIT;
+SELECT * FROM t1;
+sync_slave_with_master;
+SELECT * FROM t1;
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test b/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test
index 0bfa46de113..30b25955ecb 100644
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test
@@ -29,8 +29,7 @@ commit;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
-let $diff_table_1=master:test.t3;
-let $diff_table_2=slave:test.t3;
+let $diff_tables= master:t3, slave:t3;
source include/diff_tables.inc;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test b/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test
index 614d79d9c2d..f93d435349f 100644
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test
@@ -60,14 +60,11 @@ connection master;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'INVOKES A TRIGGER with $trigger_action action'
-let $diff_table_1=master:test.t2;
-let $diff_table_2=slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
-let $diff_table_1=master:test.t4;
-let $diff_table_2=slave:test.t4;
+let $diff_tables= master:t4, slave:t4;
source include/diff_tables.inc;
-let $diff_table_1=master:test.t6;
-let $diff_table_2=slave:test.t6;
+let $diff_tables= master:t6, slave:t6;
source include/diff_tables.inc;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test b/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test
index fece19b397d..d7c26ea42f1 100644
--- a/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test
+++ b/mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test
@@ -41,11 +41,9 @@ connection master;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action'
-let $diff_table_1=master:test.t2;
-let $diff_table_2=slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
-let $diff_table_1=master:test.t3;
-let $diff_table_2=slave:test.t3;
+let $diff_tables= master:t3, slave:t3;
source include/diff_tables.inc;
connection master;
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
index 1fb6b3dcb8a..54b5c95080e 100644
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
@@ -21,9 +21,20 @@
# 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;
@@ -38,25 +49,22 @@ connection master;
--echo *** Single statement on transactional table ***
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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
-connection slave;
---source include/wait_for_slave_sql_to_stop.inc
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
-START SLAVE SQL_THREAD;
---source include/wait_for_slave_sql_to_start.inc
-
-connection master;
+# 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);
@@ -69,28 +77,18 @@ eval INSERT INTO t2 (a, data) VALUES (5, $data);
--echo *** Single statement on both transactional and non-transactional tables. ***
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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
-connection slave;
---source include/wait_for_slave_sql_to_stop.inc
-
-if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
-{
- SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
-}
-if (`SELECT @@binlog_format = 'ROW'`)
-{
- SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
-}
-START SLAVE SQL_THREAD;
---source include/wait_for_slave_sql_to_start.inc
-connection master;
+# 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_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
@@ -106,11 +104,11 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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');
@@ -133,9 +131,9 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (14, $data);
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
--eval INSERT INTO t1 (a, data) VALUES (19, 's');
--eval INSERT INTO t2 (a, data) VALUES (20, 's');
@@ -151,7 +149,7 @@ if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
if (`SELECT @@binlog_format = 'ROW'`)
{
--disable_query_log
- --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+ --error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
CREATE TABLE t4 SELECT * FROM t1;
--enable_query_log
}
@@ -165,9 +163,9 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (22, $data);
--eval INSERT INTO t1 (a, data) VALUES (23, $data);
--eval INSERT INTO t1 (a, data) VALUES (24, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
--eval INSERT INTO t1 (a, data) VALUES (26, $data);
--eval INSERT INTO t1 (a, data) VALUES (27, 's');
--eval INSERT INTO t2 (a, data) VALUES (28, 's');
@@ -178,19 +176,9 @@ BEGIN;
CREATE TABLE t5 (a int);
--enable_query_log
-if (`SELECT @@binlog_format = 'ROW'`)
-{
- connection slave;
- --source include/wait_for_slave_sql_to_stop.inc
-
- SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
- START SLAVE SQL_THREAD;
- --source include/wait_for_slave_sql_to_start.inc
- connection master;
-}
-
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 3 - BEGIN - COMMIT
@@ -206,11 +194,11 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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');
@@ -218,8 +206,9 @@ BEGIN;
--enable_query_log
COMMIT;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 4 - BEGIN - ROLLBACK
@@ -235,11 +224,11 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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');
@@ -247,8 +236,9 @@ BEGIN;
--enable_query_log
ROLLBACK;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 5 - PROCEDURE
@@ -282,7 +272,7 @@ TRUNCATE TABLE t1;
BEGIN;
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
eval CALL p1($data);
--enable_query_log
COMMIT;
@@ -291,13 +281,14 @@ TRUNCATE TABLE t1;
BEGIN;
--disable_query_log
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
eval CALL p1($data);
--enable_query_log
ROLLBACK;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 6 - XID
@@ -313,12 +304,12 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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');
@@ -327,8 +318,9 @@ SAVEPOINT sv;
ROLLBACK TO sv;
COMMIT;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--sync_slave_with_master
+--let $diff_tables= master:t1,slave:t1
+--source include/diff_tables.inc
--echo ########################################################################################
--echo # 7 - NON-TRANS TABLE
@@ -345,11 +337,11 @@ BEGIN;
--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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_ERROR_ON_WRITE
+--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);
--eval INSERT INTO t1 (a, data) VALUES (8, 's');
@@ -365,13 +357,90 @@ BEGIN;
--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_ERROR_ON_WRITE
+--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;
-let $diff_statement= SELECT * FROM t1;
---source include/diff_master_slave.inc
+--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
@@ -381,8 +450,10 @@ 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;
-DROP TABLE IF EXISTS t5;
-DROP TABLE IF EXISTS t6;
+--enable_warnings
+DROP TABLE t5;
DROP PROCEDURE p1;
-sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_charset.test b/mysql-test/extra/rpl_tests/rpl_charset.test
index d884bd1178c..fa83b06597d 100644
--- a/mysql-test/extra/rpl_tests/rpl_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_charset.test
@@ -2,11 +2,7 @@
# This test will fail if the server/client does not support enough charsets.
source include/master-slave.inc;
---disable_warnings
set timestamp=1000000000;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
---enable_warnings
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
@@ -149,6 +145,6 @@ eval create table `t1` (
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
-sync_slave_with_master;
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
index 98638b0b1f6..7de4f421c35 100644
--- a/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
+++ b/mysql-test/extra/rpl_tests/rpl_commit_after_flush.test
@@ -1,16 +1,10 @@
-#################################
-# Test updated to use a wrapper #
-#################################
-
eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
begin;
insert into t1 values(1);
flush tables with read lock;
commit;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# cleanup
connection master;
unlock tables;
diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test
index b20bbb15a1a..2fbf3dba5dc 100644
--- a/mysql-test/extra/rpl_tests/rpl_conflicts.test
+++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test
@@ -91,11 +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);
+
+ --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 ----
@@ -140,10 +143,16 @@ 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("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;
- let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
- --echo Last_SQL_Error = $err (expected "can't find record" 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
+
SELECT * FROM t1;
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
@@ -168,4 +177,4 @@ connection master;
DROP TABLE t1;
--echo [on slave]
-sync_slave_with_master;
+--sync_slave_with_master
diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test
index f1064dc268f..3b0348cc29f 100644
--- a/mysql-test/extra/rpl_tests/rpl_ddl.test
+++ b/mysql-test/extra/rpl_tests/rpl_ddl.test
@@ -136,14 +136,6 @@ sync_slave_with_master;
connection master;
SET AUTOCOMMIT = 1;
#
-# 1. DROP all objects, which probably already exist, but must be created here
-#
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
---enable_warnings
-#
# 2. CREATE all objects needed
# working database is mysqltest1
# working table (transactional!) is mysqltest1.t1
@@ -619,6 +611,3 @@ connection master;
DROP DATABASE mysqltest1;
# mysqltest2 was alreday DROPPED some tests before.
DROP DATABASE mysqltest3;
---enable_warnings
-
--- source include/master-slave-end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index 607348ae97b..bd446c86943 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -131,3 +131,4 @@ sync_slave_with_master;
SET global max_relay_log_size= @my_max_relay_log_size;
--echo End of 5.1 tests
+--source include/rpl_end.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
index 8e89cde004d..094e84537db 100644
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
@@ -35,7 +35,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
--eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
@@ -62,7 +62,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
--eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
@@ -89,7 +89,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
@@ -116,7 +116,7 @@ if (`SELECT HEX(@commands) = HEX('configure')`)
# when a command ends.
#
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
@@ -163,14 +163,14 @@ if (`SELECT HEX(@commands) = HEX('clean')`)
DROP TABLE IF EXISTS nt_xx_1;
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--dec $n
}
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--dec $n
@@ -634,11 +634,11 @@ while (`SELECT HEX(@commands) != HEX('')`)
{
--let $dropped_temp= $table
}
- if (`SELECT $n = 1`)
+ if ($n == 1)
{
--let $table_1= $table
}
- if (`SELECT $n = 2`)
+ if ($n == 2)
{
--let $table_2= $table
}
@@ -886,7 +886,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_n_temp=
--let $dropped_n_temp=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
--eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
@@ -905,7 +905,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_t_temp=
--let $dropped_t_temp=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
--eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
@@ -924,7 +924,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_t=
--let $dropped_t=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS tt_$n
--eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
@@ -943,7 +943,7 @@ while (`SELECT HEX(@commands) != HEX('')`)
--let $available_n=
--let $dropped_n=
--let $n= $tot_table
- while (`SELECT $n != 0`)
+ while ($n)
{
--eval DROP TABLE IF EXISTS nt_$n
--eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test
index d4310f50909..513bc949c5d 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test
@@ -1,24 +1,7 @@
#############################################################
-# Author: Chuck
-#############################################################
# Purpose: To test having extra columns on the master WL#3915
# engine inspecific sourced part
#############################################################
-# Change Author: Jeb
-# Change: Cleanup and extend testing
-#############################################################
-# TODO: partition specific
-# -- source include/have_partition.inc
-# Note: Will be done in different test due to NDB using this
-# test case.
-############################################################
-
-########### Clean up ################
---disable_warnings
---disable_query_log
-DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t10,t11,t12,t13,t14,t15,t16,t17,t18,t31;
---enable_query_log
---enable_warnings
#
# Setup differently defined tables on master and slave
@@ -138,6 +121,15 @@ SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
#connection slave;
+
+--disable_query_log
+call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 2 type mismatch.* 1535");
+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 SQL.*Column 2 of table .test.t1.. cannot be converted from type.* Error_code: 1677");
+--enable_query_log
+
sync_slave_with_master;
--echo
--echo * Select count and 20 rows from Slave *
@@ -1025,8 +1017,3 @@ SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
---echo
-
-# END of 5.1 tests case
-
-
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test
index 568cf802763..119e081878c 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extra_col_slave.test
@@ -1,19 +1,10 @@
#################################################
-# Author: Jeb
-# Date: 2006-09-07
# Purpose: To test having extra columns on the slave.
##################################################
# Some tests in here requre partitioning
-- source include/have_partition.inc
-########### Clean up ################
---disable_warnings
---disable_query_log
-DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
---enable_query_log
---enable_warnings
-
#################################################
############ Different Table Def Test ###########
#################################################
@@ -23,6 +14,7 @@ DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t1
#################################################
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 ****
@@ -286,16 +278,14 @@ connection slave;
--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 ****
@@ -406,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;
@@ -450,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 #
@@ -730,6 +721,10 @@ sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14a ORDER BY c1;
+--connection master
+DROP TABLE t14a;
+--sync_slave_with_master
+
####################################################
# - Alter Master Dropping columns from the middle. #
# Expect: columns dropped #
@@ -776,6 +771,10 @@ RESET MASTER;
connection slave;
START SLAVE;
+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;
set @b1 = 'b1b1b1b1';
@@ -917,17 +916,3 @@ connection slave;
connection master;
DROP TABLE t17;
sync_slave_with_master;
-
-#### Clean Up ####
---disable_warnings
---disable_query_log
-connection master;
-DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
-sync_slave_with_master;
-connection master;
---enable_query_log
---enable_warnings
-
-# END 5.1 Test Case
-
-
diff --git a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test
index cd81f2497b8..af048aeb92a 100644
--- a/mysql-test/extra/rpl_tests/rpl_failed_optimize.test
+++ b/mysql-test/extra/rpl_tests/rpl_failed_optimize.test
@@ -2,24 +2,27 @@
#
# 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;
drop table t1;
--- sync_slave_with_master
+
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index fd51601176e..06253c5defb 100644
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -54,7 +54,6 @@ unlock tables;
connection master;
drop table t3, t4, t5;
-sync_slave_with_master;
-
# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_foreign_key.test b/mysql-test/extra/rpl_tests/rpl_foreign_key.test
index ea16237435c..db646a736f9 100644
--- a/mysql-test/extra/rpl_tests/rpl_foreign_key.test
+++ b/mysql-test/extra/rpl_tests/rpl_foreign_key.test
@@ -59,6 +59,4 @@ select count(*) from t1 /* must be zero */;
connection master;
drop table t2,t1;
-sync_slave_with_master;
-
-
+--source include/rpl_end.inc
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 66bd61a8ea9..01036f72785 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
@@ -34,34 +34,22 @@
#
connection slave;
-if (`SELECT $debug_sync_action = ''`)
+if (!$debug_sync_action)
{
--die Cannot continue. Please set value for debug_sync_action.
}
# Restart slave
---disable_warnings
-stop slave;
-source include/wait_for_slave_to_stop.inc;
+--source include/stop_slave.inc
eval SET @@global.debug= "+d,$dbug_sync_point";
-start slave;
-source include/wait_for_slave_to_start.inc;
+--source include/start_slave.inc
--echo slave is going to hang in get_master_version_and_clock
-connection master;
-# Write file to make mysql-test-run.pl expect the "crash", but don't start
-# it until it's told to
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-wait
-EOF
+--let $rpl_server_number= 1
+--source include/rpl_stop_server.inc
-# Send shutdown to the connected server and give
-# it 10 seconds to die before zapping it
-shutdown_server 10;
-
-connection slave;
--echo slave is unblocked
eval SET DEBUG_SYNC=$debug_sync_action;
@@ -76,6 +64,7 @@ connection slave;
# '1040' ER_CON_COUNT_ERROR
# '1053' ER_SERVER_SHUTDOWN
let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013;
+--let $slave_io_error_is_nonfatal= 1
source include/wait_for_slave_io_error.inc;
# deactivate the sync point of get_master_version_and_clock()
@@ -84,21 +73,12 @@ source include/wait_for_slave_io_error.inc;
# unset.
eval set @@global.debug = "-d,$dbug_sync_point";
-# Write file to make mysql-test-run.pl start up the server again
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-restart
-EOF
-
-connection master;
-# Turn on reconnect
---enable_reconnect
-
-# Call script that will poll the server waiting for it to be back online again
---source include/wait_until_connected_again.inc
-
-# Turn off reconnect again
---disable_reconnect
-
-connection slave;
-source include/wait_for_slave_to_start.inc;
+--let $rpl_server_number= 1
+--source include/rpl_start_server.inc
+# We don't source include/wait_for_slave_io_to_start.inc, because the
+# IO thread has an error and wait_for_slave_io_to_start.inc fails if
+# the IO thread has an error.
+--let $slave_param= Slave_IO_Running
+--let $slave_param_value= Yes
+--source include/wait_for_slave_param.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
index 14368ba4321..549d184185d 100644
--- a/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
+++ b/mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
@@ -33,11 +33,11 @@ INSERT INTO tt_2(ddl_case) VALUES(0);
--echo #########################################################################
SET AUTOCOMMIT= 0;
let $ddl_cases= 41;
-while (`SELECT $ddl_cases >= 1`)
+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";
+ let $in_temporary= no;
+ let $ok= yes;
#
# In SBR and MIXED modes, the commit event is usually the third event in the
# binary log:
@@ -76,7 +76,7 @@ while (`SELECT $ddl_cases >= 1`)
# 6: ROW EVENT
# 7: COMMIT
#
- if (`select '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 7;
}
@@ -84,18 +84,18 @@ while (`SELECT $ddl_cases >= 1`)
let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1);
--enable_query_log
eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases);
- if (`SELECT $ddl_cases = 41`)
+ if ($ddl_cases == 41)
{
let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES;
- if (`SELECT '$engine' = 'NDB'`)
+ 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 $ok= no;
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 40`)
+ if ($ddl_cases == 40)
{
let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES;
#
@@ -109,16 +109,16 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 39`)
+ if ($ddl_cases == 39)
{
let $cmd= ANALYZE TABLE nt_1;
}
- if (`SELECT $ddl_cases = 38`)
+ if ($ddl_cases == 38)
{
let $cmd= CHECK TABLE nt_1;
#
@@ -132,20 +132,20 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 37`)
+ if ($ddl_cases == 37)
{
let $cmd= OPTIMIZE TABLE nt_1;
}
- if (`SELECT $ddl_cases = 36`)
+ if ($ddl_cases == 36)
{
let $cmd= REPAIR TABLE nt_1;
}
- if (`SELECT $ddl_cases = 35`)
+ if ($ddl_cases == 35)
{
let $cmd= LOCK TABLES tt_1 WRITE;
#
@@ -159,12 +159,12 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 34`)
+ if ($ddl_cases == 34)
{
let $cmd= UNLOCK TABLES;
#
@@ -178,20 +178,20 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 33`)
+ if ($ddl_cases == 33)
{
let $cmd= CREATE USER 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 32`)
+ if ($ddl_cases == 32)
{
let $cmd= GRANT ALL ON *.* TO 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 31`)
+ if ($ddl_cases == 31)
{
let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass');
#
@@ -231,35 +231,35 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 7;
}
}
- if (`SELECT $ddl_cases = 30`)
+ if ($ddl_cases == 30)
{
let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
}
- if (`SELECT $ddl_cases = 29`)
+ if ($ddl_cases == 29)
{
let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost';
}
- if (`SELECT $ddl_cases = 28`)
+ if ($ddl_cases == 28)
{
let $cmd= DROP USER 'user_new'@'localhost';
}
- if (`SELECT $ddl_cases = 27`)
+ if ($ddl_cases == 27)
{
let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 26`)
+ if ($ddl_cases == 26)
{
let $cmd= ALTER EVENT evt COMMENT 'evt';
}
- if (`SELECT $ddl_cases = 25`)
+ if ($ddl_cases == 25)
{
let $cmd= DROP EVENT evt;
}
- if (`SELECT $ddl_cases = 24`)
+ 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 (`SELECT $ddl_cases = 23`)
+ if ($ddl_cases == 23)
{
let $cmd= DROP TRIGGER tr;
#
@@ -277,43 +277,43 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 5;
}
}
- if (`SELECT $ddl_cases = 22`)
+ if ($ddl_cases == 22)
{
let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
}
- if (`SELECT $ddl_cases = 21`)
+ if ($ddl_cases == 21)
{
let $cmd= ALTER FUNCTION fc COMMENT 'fc';
}
- if (`SELECT $ddl_cases = 20`)
+ if ($ddl_cases == 20)
{
let $cmd= DROP FUNCTION fc;
}
- if (`SELECT $ddl_cases = 19`)
+ if ($ddl_cases == 19)
{
let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
}
- if (`SELECT $ddl_cases = 18`)
+ if ($ddl_cases == 18)
{
let $cmd= ALTER PROCEDURE pc COMMENT 'pc';
}
- if (`SELECT $ddl_cases = 17`)
+ if ($ddl_cases == 17)
{
let $cmd= DROP PROCEDURE pc;
}
- if (`SELECT $ddl_cases = 16`)
+ if ($ddl_cases == 16)
{
let $cmd= CREATE VIEW v AS SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 15`)
+ if ($ddl_cases == 15)
{
let $cmd= ALTER VIEW v AS SELECT * FROM tt_1;
}
- if (`SELECT $ddl_cases = 14`)
+ if ($ddl_cases == 14)
{
let $cmd= DROP VIEW v;
}
- if (`SELECT $ddl_cases = 13`)
+ if ($ddl_cases == 13)
{
let $cmd= CREATE INDEX ix ON tt_1(ddl_case);
#
@@ -328,12 +328,12 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 12`)
+ if ($ddl_cases == 12)
{
let $cmd= DROP INDEX ix ON tt_1;
#
@@ -348,15 +348,15 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 11`)
+ if ($ddl_cases == 11)
{
let $cmd= CREATE TEMPORARY TABLE tt_xx (a int);
- let $in_temporary= "yes";
+ 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.
#
@@ -411,7 +411,7 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 9;
}
}
- if (`SELECT $ddl_cases = 10`)
+ if ($ddl_cases == 10)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
#
@@ -438,12 +438,12 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 9`)
+ if ($ddl_cases == 9)
{
let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx;
#
@@ -470,15 +470,15 @@ while (`SELECT $ddl_cases >= 1`)
# 5: ROW EVENT
# 6: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 8`)
+ if ($ddl_cases == 8)
{
let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
- let $in_temporary= "yes";
+ 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:
@@ -528,7 +528,7 @@ while (`SELECT $ddl_cases >= 1`)
# 8: ROW EVENT
# 9: COMMIT
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 9;
}
@@ -551,27 +551,27 @@ while (`SELECT $ddl_cases >= 1`)
let $commit_event_row_number= 9;
}
}
- if (`SELECT $ddl_cases = 7`)
+ if ($ddl_cases == 7)
{
let $cmd= CREATE TABLE tt_xx (a int);
}
- if (`SELECT $ddl_cases = 6`)
+ if ($ddl_cases == 6)
{
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
}
- if (`SELECT $ddl_cases = 5`)
+ if ($ddl_cases == 5)
{
let $cmd= RENAME TABLE tt_xx TO new_tt_xx;
}
- if (`SELECT $ddl_cases = 4`)
+ if ($ddl_cases == 4)
{
let $cmd= TRUNCATE TABLE new_tt_xx;
}
- if (`SELECT $ddl_cases = 3`)
+ if ($ddl_cases == 3)
{
let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx;
}
- if (`SELECT $ddl_cases = 2`)
+ if ($ddl_cases == 2)
{
let $cmd= CREATE DATABASE db;
#
@@ -586,12 +586,12 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
}
- if (`SELECT $ddl_cases = 1`)
+ if ($ddl_cases == 1)
{
let $cmd= DROP DATABASE IF EXISTS db;
#
@@ -606,7 +606,7 @@ while (`SELECT $ddl_cases >= 1`)
# 6: COMMIT
# 7: DDL EVENT which triggered the previous commmit.
#
- if (`SELECT '$engine' = 'NDB'`)
+ if ($engine == NDB)
{
let $commit_event_row_number= 6;
}
@@ -618,14 +618,14 @@ while (`SELECT $ddl_cases >= 1`)
# commit. The flag in_temporary is used to avoid aborting the test in such
# cases. Thus we force the commit.
#
- if (`SELECT $in_temporary = "yes"`)
+ 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 (`SELECT $ok = "yes"`)
+ if ($ok == yes)
{
--echo it *does not* commit the current transaction.
--echo $cmd
@@ -649,8 +649,7 @@ SET AUTOCOMMIT= 1;
--echo ###################################################################################
--sync_slave_with_master
---let $diff_table_1= master:test.tt_1
---let $diff_table_2= slave:test.tt_1
+--let $diff_tables= master:tt_1,slave:tt_1
--source include/diff_tables.inc
--echo ###################################################################################
diff --git a/mysql-test/extra/rpl_tests/rpl_innodb.test b/mysql-test/extra/rpl_tests/rpl_innodb.test
index 2eee3402da9..c0ec5299cfd 100644
--- a/mysql-test/extra/rpl_tests/rpl_innodb.test
+++ b/mysql-test/extra/rpl_tests/rpl_innodb.test
@@ -181,5 +181,3 @@ DROP TABLE t1;
DROP TABLE t3;
--echo End of 6.0 tests
-
---source include/master-slave-end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
index 46c1df0c88b..5b0b52c3106 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test
@@ -121,7 +121,7 @@ if (`SELECT @@global.binlog_format = 'STATEMENT'`)
# The second INSERT DELAYED statement is the 5 item if two INSERT DELAYED are
# handled separately
- if (`SELECT '$stmt' = 'COMMIT'`)
+ if ($stmt == COMMIT)
{
--let $stmt= query_get_value(SHOW BINLOG EVENTS IN '$binlog_file' FROM $_start, Info, 5)
}
diff --git a/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test b/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
new file mode 100644
index 00000000000..a81eeba3231
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_insert_duplicate.test
@@ -0,0 +1,59 @@
+# 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'`)
+{
+ --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
+
+# 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 b542ff27231..565ab4a67ad 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_id.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test
@@ -1,6 +1,4 @@
###########################################################
-# 2006-02-01: By JBM: Added 1022, ORDER BY
-###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
@@ -9,17 +7,10 @@
# column and index but without primary key.
##############################################################
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-
--echo #
--echo # Setup
--echo #
-use test;
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
--echo #
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
--echo # are replicated well
@@ -30,6 +21,13 @@ drop table if exists t1, t2, t3;
-- 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'
@@ -44,9 +42,7 @@ eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type;
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
@@ -65,9 +61,7 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
@@ -85,17 +79,13 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--echo #
--echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
@@ -215,9 +205,7 @@ call foo();
select * from t1;
select * from t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
@@ -562,4 +550,5 @@ drop table t1, t2;
drop procedure foo;
SET @@global.concurrent_insert= @old_concurrent_insert;
set @@session.sql_auto_is_null=default;
-sync_slave_with_master;
+
+--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 0be33a46c04..c3ecd9381c9 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
@@ -1,6 +1,4 @@
###########################################################
-# 2006-02-08: By JBM:
-###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
@@ -14,15 +12,12 @@
-- source include/master-slave.inc
#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);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
@@ -41,9 +36,7 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
@@ -59,17 +52,13 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
@@ -82,6 +71,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 ee09c316354..270dde7675c 100644
--- a/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
+++ b/mysql-test/extra/rpl_tests/rpl_insert_ignore.test
@@ -5,6 +5,7 @@
# Slave needs to be started with --innodb to store table in InnoDB.
# Same test for MyISAM (which had no bug).
+--connection master
eval CREATE TABLE t1 (
a int unsigned not null auto_increment primary key,
b int unsigned,
@@ -32,40 +33,44 @@ INSERT INTO t2 VALUES (5, 4);
INSERT INTO t2 VALUES (6, 6);
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
-
-# Compare results
-
-SELECT * FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-# Now do the same for MyISAM
-
-connection master;
-drop table t1;
-eval CREATE TABLE t1 (
- a int unsigned not null auto_increment primary key,
- b int unsigned,
- unique (b)
-) ENGINE=$engine_type2;
-
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 VALUES (2, 2);
-INSERT INTO t1 VALUES (3, 3);
-INSERT INTO t1 VALUES (4, 4);
-
---disable_warnings
-INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
---enable_warnings
-
-SELECT * FROM t1 ORDER BY a;
-
-sync_slave_with_master;
-SELECT * FROM t1 ORDER BY a;
-
-connection master;
+--let $assert_cond= COUNT(*) = 6 FROM t1
+--let $assert_text= Count of elements in t1 should be 6.
+--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
+
+# BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
+# An insert ignore that does not update anything must be written to the binary log in SBR
+# and MIXED modes. We check this property by counting occurrences in t1 before and after
+# the insert and comparing the binlog positions. The count should be the same in both points
+# and the statement should be in the binary log.
+--connection master
+--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
+--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'`)
+{
+ --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'`)
+{
+ --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.
+}
+--source include/assert.inc
+
+# Clean up
+--connection master
drop table t1, t2;
-sync_slave_with_master;
-
-# End of 4.1 tests
+--sync_slave_with_master
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index ed89bd66531..0b3fcc25b33 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -11,13 +11,10 @@
# 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;
-connection slave;
-reset master;
-connection master;
-
--disable_query_log
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--enable_query_log
@@ -25,7 +22,7 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state
# MTR is not case-sensitive.
let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA;
-if (`SELECT '$lock_option' <> ''`)
+if ($lock_option)
{
#if $lock_option is null, an extra blank is added into the statement,
#this will change the result of rpl_loaddata test case. so $lock_option
@@ -48,9 +45,7 @@ create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60))
insert into t3 select * from t2;
--enable_warnings
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
select * from t3;
@@ -62,9 +57,7 @@ drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
@@ -75,21 +68,18 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
-# The SQL slave thread should be stopped now.
---source include/wait_for_slave_sql_to_stop.inc
+# 1062 = ER_DUP_ENTRY
+call mtr.add_suppression("Slave SQL.*Error .Duplicate entry .10. for key .b.. on query.* Error_code: 1062");
+call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.*error code=1062.*Error on slave:.*Error_code: 0");
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error_and_skip.inc
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
# takes us directly to the end of the relay log).
-set global sql_slave_skip_counter=1;
-start slave;
sync_with_master;
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-echo Last_SQL_Errno=$last_error;
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-echo Last_SQL_Error;
-echo $last_error;
+--source include/check_slave_no_error.inc
# Trigger error again to test CHANGE MASTER
@@ -103,17 +93,15 @@ connection slave;
# The SQL slave thread should be stopped now.
# Exec_Master_Log_Pos should point to the start of Execute event
# for last load data.
---source include/wait_for_slave_sql_to_stop.inc
+# 1062 = ER_DUP_ENTRY
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
-stop slave;
+--source include/stop_slave_io.inc
change master to master_user='test';
change master to master_user='root';
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-echo Last_SQL_Errno=$last_error;
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-echo Last_SQL_Error;
-echo $last_error;
+--source include/check_slave_no_error.inc
# Trigger error again to test RESET SLAVE
@@ -128,16 +116,14 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
---source include/wait_for_slave_sql_to_stop.inc
+# 1062 = ER_DUP_ENTRY
+--let $slave_sql_errno= 1062
+--source include/wait_for_slave_sql_error.inc
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
reset slave;
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
-echo Last_SQL_Errno=$last_error;
-let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-echo Last_SQL_Error;
-echo $last_error;
+--source include/check_slave_no_error.inc
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
@@ -166,9 +152,13 @@ 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;
+
if (`SELECT @@global.binlog_format != 'ROW'`)
{
- --source include/wait_for_slave_sql_to_stop.inc
+ # 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;
@@ -180,11 +170,12 @@ 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
--- source include/master-slave-reset.inc
+-- let $rpl_only_running_threads= 1
+-- source include/rpl_reset.inc
-- let $db1= b48297_db1
-- let $db2= b42897_db2
@@ -245,8 +236,7 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- sync_slave_with_master
-- eval use $db1
-let $diff_table_1=master:$db1.t1;
-let $diff_table_2=slave:$db1.t1;
+let $diff_tables= master:$db1.t1, slave:$db1.t1;
source include/diff_tables.inc;
-- connection master
@@ -257,7 +247,7 @@ source include/diff_tables.inc;
-- sync_slave_with_master
# BUG#49479: LOAD DATA INFILE is binlogged without escaping field names
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
use test;
CREATE TABLE t1 (`key` TEXT, `text` TEXT);
@@ -268,6 +258,5 @@ SELECT * FROM t1;
-- sync_slave_with_master
-- connection master
DROP TABLE t1;
--- sync_slave_with_master
-# 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 da251068ba1..892d926a156 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -126,7 +126,7 @@ DROP TABLE t3;
# Reset binlog so that show binlog events will not show the tests
# above.
-source include/master-slave-reset.inc;
+source include/rpl_reset.inc;
connection master;
create table t1(a int auto_increment primary key, b int);
diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index 8415522ec92..d8cd4f2d284 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -6,9 +6,6 @@
# Requires statement logging
-- source include/master-slave.inc
-# We have to sync with master, to ensure slave had time to start properly
-# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
-sync_slave_with_master;
connection slave;
stop slave;
connection master;
@@ -117,3 +114,4 @@ set global max_binlog_size= @my_max_binlog_size;
--echo #
--echo # End of 4.1 tests
--echo #
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test
index 2438556450d..ae2a3aa45d2 100644
--- a/mysql-test/extra/rpl_tests/rpl_multi_query.test
+++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test
@@ -7,9 +7,6 @@
# PS doesn't support multi-statements
--disable_ps_protocol
-- source include/master-slave.inc
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
create database mysqltest;
delimiter /;
@@ -25,4 +22,5 @@ select * from mysqltest.t1;
connection master;
source include/show_binlog_events.inc;
drop database mysqltest;
-sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_multi_update.test b/mysql-test/extra/rpl_tests/rpl_multi_update.test
index 121ae18daa8..bf7707f9d6d 100644
--- a/mysql-test/extra/rpl_tests/rpl_multi_update.test
+++ b/mysql-test/extra/rpl_tests/rpl_multi_update.test
@@ -19,12 +19,11 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# End of 4.1 tests
connection master;
drop table t1, t2;
-sync_slave_with_master;
+
+--source include/rpl_end.inc
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 40439d59dee..bba860ab9aa 100644
--- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
+++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test
@@ -230,7 +230,7 @@ connection master;
# Reset both slave and master
# This should reset binlog to #1
---source include/master-slave-reset.inc
+--source include/rpl_reset.inc
--echo
diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test
index 58dbd9ce29f..cbb6b787f11 100644
--- a/mysql-test/extra/rpl_tests/rpl_not_null.test
+++ b/mysql-test/extra/rpl_tests/rpl_not_null.test
@@ -71,12 +71,10 @@ INSERT INTO t4(a) VALUES (5);
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
-let $diff_table_1=master:test.t2;
-let $diff_table_2=slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
--echo TABLES t2 and t3 must be different.
@@ -101,8 +99,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ************* CLEANING *************
@@ -154,8 +151,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
sync_slave_with_master;
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
@@ -177,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;
#
@@ -202,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;
@@ -225,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;
@@ -240,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;
@@ -273,7 +269,7 @@ sync_slave_with_master;
# SELECT * FROM t3 ORDER BY a;
# connection slave;
# SELECT * FROM t3 ORDER BY a;
-# --source include/reset_master_and_slave.inc
+# --source include/rpl_reset.inc
#
# connection master;
#
diff --git a/mysql-test/extra/rpl_tests/rpl_record_compare.test b/mysql-test/extra/rpl_tests/rpl_record_compare.test
index dc27dcb1f9d..210aee025d0 100644
--- a/mysql-test/extra/rpl_tests/rpl_record_compare.test
+++ b/mysql-test/extra/rpl_tests/rpl_record_compare.test
@@ -4,7 +4,7 @@
#
-- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
@@ -16,8 +16,7 @@ UPDATE t1 SET c5 = 'a';
-- enable_warnings
-- sync_slave_with_master
--- let $diff_table_1= master:test.t1
--- let $diff_table_2= slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
--connection master
@@ -26,7 +25,7 @@ DROP TABLE t1;
-- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
-- echo ## (1 column less and no varchar)
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
@@ -38,8 +37,7 @@ UPDATE t1 SET c5 = 'a';
-- enable_warnings
-- sync_slave_with_master
--- let $diff_table_1= master:test.t1
--- let $diff_table_2= slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
--connection master
@@ -48,7 +46,7 @@ DROP TABLE t1;
-- echo ## case #2 - X bit is wrongly set.
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1
@@ -57,12 +55,31 @@ INSERT INTO t1(c1) VALUES (NULL);
UPDATE t1 SET c1= 0;
-- sync_slave_with_master
--- let $diff_table_1= master:test.t1
--- let $diff_table_2= slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
+#
+# BUG#11766865: 60091: RBR + NO PK + UPDATE NULL VALUE --> SLAVE BREAK WITH ERROR HA_ERR_END_OF_
+#
+
+--connection master
+--source include/rpl_reset.inc
+--connection master
+
+--eval CREATE TABLE t1 (c1 int(11) NOT NULL, c2 int(11) NOT NULL, c3 int(11) DEFAULT '-1') ENGINE=$engine DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1,2,NULL);
+UPDATE t1 SET c1=1, c2=2, c3=-1 WHERE c1=1 AND c2=2 AND ISNULL(c3);
+
+--sync_slave_with_master
+
+--let $diff_tables=master:test.t1, slave:test.t1
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t1;
+--sync_slave_with_master
diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
index e76cf1530ee..14b457f601e 100644
--- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test
@@ -55,9 +55,9 @@ source include/check_slave_no_error.inc;
change master to master_user='impossible_user_name';
start slave;
let $slave_io_errno= 1045;
-source include/wait_for_slave_io_error.inc;
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
-stop slave;
change master to master_user='root';
source include/start_slave.inc;
source include/check_slave_no_error.inc;
@@ -70,8 +70,12 @@ stop slave;
change master to master_user='impossible_user_name';
start slave;
let $slave_io_errno= 1045;
-source include/wait_for_slave_io_error.inc;
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
-stop slave;
reset slave;
source include/check_slave_no_error.inc;
+change master to master_user='root';
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test
index 9f2dbb4ce4b..368596d4fbc 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_UUID.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test
@@ -75,5 +75,3 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/r
# this cleanup as no other test will use these files and they'll
# be removed at next testsuite run.
-# End of 5.0 test case
--- source include/master-slave-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 72d4a8ac759..fee0cace294 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test
@@ -158,8 +158,8 @@ SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5
#
if (`select char_length('$bit_field_special') > 0`) {
- SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
connection slave;
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
}
@@ -252,7 +252,7 @@ DELETE FROM t1;
sync_slave_with_master;
# Just to get a clean binary log
-source include/reset_master_and_slave.inc;
+--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
@@ -368,8 +368,7 @@ INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
sync_slave_with_master;
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo [expecting slave to replicate correctly]
@@ -378,20 +377,17 @@ INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
sync_slave_with_master;
-let $diff_table_1=master:test.t2;
-let $diff_table_2=slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
connection slave;
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");
+call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t.. cannot be converted from type.*, Error_code: 1677");
-connection master;
-RESET MASTER;
-connection slave;
-STOP SLAVE;
-RESET SLAVE;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+--let $rpl_only_running_threads= 1
+--source include/rpl_reset.inc
--echo [expecting slave to replicate correctly]
connection master;
@@ -399,8 +395,7 @@ INSERT INTO t4 VALUES (1, "", 1);
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
sync_slave_with_master;
-let $diff_table_1=master:test.t4;
-let $diff_table_2=slave:test.t4;
+let $diff_tables= master:t4, slave:t4;
source include/diff_tables.inc;
--echo [expecting slave to stop]
@@ -413,13 +408,8 @@ connection slave;
--let $slave_sql_errno= 1677
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
-connection master;
-RESET MASTER;
-connection slave;
-STOP SLAVE;
-RESET SLAVE;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+
+--source include/rpl_reset.inc
--echo [expecting slave to stop]
connection master;
@@ -431,13 +421,8 @@ connection slave;
--let $slave_sql_errno= 1677
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
-connection master;
-RESET MASTER;
-connection slave;
-STOP SLAVE;
-RESET SLAVE;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+
+--source include/rpl_reset.inc
--echo [expecting slave to replicate correctly]
connection master;
@@ -445,8 +430,7 @@ INSERT INTO t7 VALUES (1, "", 1);
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
sync_slave_with_master;
-let $diff_table_1=master:test.t7;
-let $diff_table_2=slave:test.t7;
+let $diff_tables= master:t7, slave:t7;
source include/diff_tables.inc;
connection master;
@@ -466,8 +450,7 @@ UPDATE t1 SET a = 10;
INSERT INTO t1 VALUES (4);
sync_slave_with_master;
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
@@ -545,8 +528,7 @@ UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6;
--sync_slave_with_master
--echo *** results: t2 must be consistent ****
-let $diff_table_1=master:test.t2;
-let $diff_table_2=master:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
--connection master
@@ -584,8 +566,7 @@ UPDATE t1 SET a = 8 WHERE a < 5;
sync_slave_with_master;
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
@@ -604,8 +585,8 @@ 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`) {
- SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
connection slave;
+ SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
}
@@ -659,8 +640,7 @@ if (`select char_length('$bit_field_special') > 0`) {
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
}
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
index 214027160a9..bad308ff814 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test
@@ -14,9 +14,8 @@ flush tables;
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
-connection master;
-sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
-sync_slave_with_master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
index 5a2ab1912b8..90c273eb026 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
@@ -1,9 +1,6 @@
#############################################################################
# This test is being created to test out the non deterministic items with #
# row based replication. #
-# Original Author: JBM #
-# Original Date: Aug/09/2005 #
-# Updated: Aug/29/2005 #
#############################################################################
# Test: Contains two stored procedures test one that insert data into tables#
# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
@@ -13,9 +10,6 @@
# the table depending on the CASE outcome. The test uses this SP in a#
# transaction first rolling back and then commiting, #
#############################################################################
-# Mod Date: 08/22/2005 #
-# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy #
-#############################################################################
@@ -23,19 +17,6 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP TABLE IF EXISTS test.t3;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
---enable_warnings
-# End of cleanup
-
# Begin test section 1
eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
@@ -71,9 +52,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p1 -- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
@@ -86,9 +65,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p2 -- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
@@ -136,9 +113,7 @@ SELECT * FROM test.t2;
let $message=< -- test 2 select Slave after p1 -- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
@@ -153,9 +128,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select Slave after p2 -- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
@@ -195,9 +168,7 @@ while ($n)
ROLLBACK;
select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from test.t3;
connection master;
@@ -216,9 +187,7 @@ while ($n)
COMMIT;
select * from test.t3;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from test.t3;
connection master;
@@ -228,12 +197,12 @@ connection master;
# First lets cleanup
SET AUTOCOMMIT=1;
SET FOREIGN_KEY_CHECKS=0;
-DROP PROCEDURE IF EXISTS test.p3;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP PROCEDURE IF EXISTS test.p2;
-DROP TABLE IF EXISTS test.t1;
-DROP TABLE IF EXISTS test.t2;
-DROP TABLE IF EXISTS test.t3;
-sync_slave_with_master;
+DROP PROCEDURE test.p3;
+DROP PROCEDURE test.p1;
+DROP PROCEDURE test.p2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+DROP TABLE test.t3;
# End of 5.0 test case
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
index 7bc326a3791..d2c2ea0caf3 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test
@@ -35,10 +35,23 @@ 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;
--source include/wait_for_ndb_to_binlog.inc
@@ -51,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_sp007.test b/mysql-test/extra/rpl_tests/rpl_row_sp007.test
index 8f2b72e4d32..492cd2d88f1 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp007.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp007.test
@@ -1,8 +1,4 @@
#############################################################################
-# Original Author: JBM #
-# Original Date: Aug/15/2005 #
-# Updated: 08/29/2005 Remove sleeps #
-#############################################################################
# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
# rollback to save point and then commits. #
#############################################################################
@@ -10,14 +6,6 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-# Begin clean up test section
-connection master;
---disable_warnings
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
---enable_warnings
-# End of cleanup
-
# Begin test section 1
delimiter |;
eval CREATE PROCEDURE test.p1(IN i INT)
@@ -42,9 +30,7 @@ SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
let $message=< ---- Master selects-- >;
@@ -55,16 +41,15 @@ SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
SELECT * FROM test.t1;
connection master;
#show binlog events;
-DROP PROCEDURE IF EXISTS test.p1;
-DROP TABLE IF EXISTS test.t1;
+DROP PROCEDURE test.p1;
+DROP TABLE test.t1;
# End of 5.0 test case
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
index 9e752e4b69f..76432febd5e 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
@@ -147,6 +147,8 @@ sync_slave_with_master;
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= 1677
--let $show_slave_sql_error= 1
diff --git a/mysql-test/extra/rpl_tests/rpl_set_null.test b/mysql-test/extra/rpl_tests/rpl_set_null.test
index f2aba089279..3755c8bbfa5 100644
--- a/mysql-test/extra/rpl_tests/rpl_set_null.test
+++ b/mysql-test/extra/rpl_tests/rpl_set_null.test
@@ -29,7 +29,7 @@
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on
# delete cant find record
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine
@@ -37,8 +37,7 @@ INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
-- sync_slave_with_master
--- let $diff_table_1=master:test.t1
--- let $diff_table_2=slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
@@ -46,15 +45,14 @@ UPDATE t1 SET c1=NULL where c2=1;
DELETE FROM t1 WHERE c2=1 LIMIT 1;
-- sync_slave_with_master
--- let $diff_table_1=master:test.t1
--- let $diff_table_2=slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
--- source include/master-slave-reset.inc
+-- source include/rpl_reset.inc
-- connection master
@@ -68,8 +66,7 @@ SELECT * FROM t1;
UPDATE t1 SET c1=NULL WHERE c1='w';
-- sync_slave_with_master
--- let $diff_table_1=master:test.t1
--- let $diff_table_2=slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
@@ -77,8 +74,7 @@ UPDATE t1 SET c1=NULL WHERE c1='w';
DELETE FROM t1 LIMIT 2;
-- sync_slave_with_master
--- let $diff_table_1=master:test.t1
--- let $diff_table_2=slave:test.t1
+-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
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
index d32dd485e19..a56e08ece42 100644
--- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
+++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc
@@ -1,103 +1,62 @@
-- 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);
-INSERT INTO t1 VALUES (4);
-INSERT INTO t1 VALUES (5);
-INSERT INTO t1 VALUES (6);
-
--- echo [MASTER] ********* SOW BINLOG EVENTS IN ... *********
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows *********
-let $binlog_limit= 3;
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
-let $binlog_limit= 1,4;
--- source include/show_binlog_events.inc
-
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_limit= ;
-
--- sync_slave_with_master
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... *********
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows *********
-let $binlog_limit= 3;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
-let $binlog_limit= 1,4;
--- source include/show_binlog_events.inc
-
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_limit= ;
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
--- source include/show_relaylog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_relaylog_events.inc
--- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows *********
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
-let $binlog_limit= 3;
--- source include/show_relaylog_events.inc
-
--- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows *********
-let $binlog_limit= 1,3;
--- source include/show_relaylog_events.inc
+# 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;
-let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
-
-- connection master
FLUSH LOGS;
DROP TABLE t1;
-# clear show_binlog_event/show_relaylog_events parameters
-let $binlog_file= ;
-let $binlog_limit= ;
-
--- echo [MASTER] ********* SOW BINLOG EVENTS IN ... *********
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
--- source include/show_binlog_events.inc
-
--- echo [MASTER] ********* SOW BINLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
+--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
+--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
--- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... *********
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
--- source include/show_binlog_events.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
--- echo [SLAVE] ********* SOW BINLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_binlog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... *********
--- source include/show_relaylog_events.inc
-
--- echo [SLAVE] ********* SOW RELAYLOG EVENTS *********
-let $binlog_file= ;
--- source include/show_relaylog_events.inc
# clear show_binlog_event/show_relaylog_events parameters
let $binlog_file= ;
diff --git a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
index f7e4f204afa..e42affebaed 100644
--- a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
+++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
@@ -125,4 +125,58 @@ drop table t1i, t2m;
sync_slave_with_master;
-# End of tests
+--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;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
deleted file mode 100644
index 175d80aa183..00000000000
--- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test
+++ /dev/null
@@ -1,131 +0,0 @@
-# Requires binlog_format=statement format since query involving
-# get_lock() is logged in row format if binlog_format=mixed or row.
--- source include/have_binlog_format_statement.inc
--- source include/master-slave.inc
-
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-
-# Load some data into t1
-create table t1 (word char(20) not null);
-load data infile '../../std_data/words.dat' into table t1;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
-select * from t1 limit 10;
-
-#
-# Test slave with wrong password
-#
-sync_slave_with_master;
-stop slave;
-connection master;
-set password for root@"localhost" = password('foo');
-connection slave;
-start slave;
-connection master;
-#
-# Give slave time to do at last one failed connect retry
-# This one must be short so that the slave will not stop retrying
-real_sleep 2;
-set password for root@"localhost" = password('');
-# Give slave time to connect (will retry every second)
-sleep 2;
-
-create table t3(n int);
-insert into t3 values(1),(2);
-sync_slave_with_master;
-select * from t3;
-select sum(length(word)) from t1;
-connection master;
-drop table t1,t3;
-sync_slave_with_master;
-
-# Test if the slave SQL thread can be more than 16K behind the slave
-# I/O thread (> IO_SIZE)
-
-connection master;
-# we'll use table-level locking to delay slave SQL thread
-eval create table t1 (n int) engine=$engine_type;
-sync_slave_with_master;
-connection master;
-reset master;
-connection slave;
-stop slave;
-reset slave;
-
-connection master;
-let $1=5000;
-# Generate 16K of relay log
-disable_query_log;
-while ($1)
-{
- eval insert into t1 values($1);
- dec $1;
-}
-enable_query_log;
-
-# Try to cause a large relay log lag on the slave by locking t1
-connection slave;
-lock tables t1 read;
-start slave;
-connection master;
---source include/sync_slave_io_with_master.inc
-unlock tables;
-
-#test handling of aborted connection in the middle of update
-
-connection master;
-create table t2(id int);
-insert into t2 values(connection_id());
-
-connection master1;
-# Avoid generating result
-create temporary table t3(n int);
---disable_warnings
-insert into t3 select get_lock('crash_lock%20C', 1) from t2;
---enable_warnings
-
-connection master;
-send update t1 set n = n + get_lock('crash_lock%20C', 2);
-connection master1;
-sleep 3;
-select (@id := id) - id from t2;
-kill @id;
-# We don't drop t3 as this is a temporary table
-drop table t2;
-connection master;
-# The get_lock function causes warning for unsafe statement.
---disable_warnings
---error 1317,2013
-reap;
---enable_warnings
-connection slave;
-# The SQL slave thread should now have stopped because the query was killed on
-# the master (so it has a non-zero error code in the binlog).
---source include/wait_for_slave_sql_to_stop.inc
-
-# The following test can't be done because the result of Pos will differ
-# on different computers
-# --replace_result $MASTER_MYPORT MASTER_PORT
-# show slave status;
-
-set global sql_slave_skip_counter=1;
-start slave;
-select count(*) from t1;
-connection master1;
-drop table t1;
-create table t1 (n int);
-insert into t1 values(3456);
-insert into mysql.user (Host, User, Password)
- VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-sync_slave_with_master;
-select n from t1;
-select select_priv,user from mysql.user where user = _binary'blafasel2';
-connection master1;
-drop table t1;
-delete from mysql.user where user="blafasel2";
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
index 2c396c9a209..cc69c08fe7c 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
@@ -25,11 +25,17 @@ drop table t1;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
+call mtr.add_suppression("Slave SQL.*Query caused different errors on master and slave.*Error on master:.* error code=1062.*Error on slave:.* Error_code: 0");
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
--echo Error: "$error" (expected different error codes on master and slave)
--echo Errno: "$errno" (expected 0)
drop table t1;
+--source include/stop_slave.inc
+# Clear error messages.
+RESET SLAVE;
# End of 4.1 tests
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test b/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test
new file mode 100644
index 00000000000..cecbd45c02a
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test
@@ -0,0 +1,268 @@
+--echo
+--echo
+connection master;
+
+if ($is_temporary)
+{
+ --let $_temporary=TEMPORARY
+}
+
+CREATE TABLE t2(c1 INT, c2 char(10));
+INSERT INTO t2 VALUES(1, 'abc'), (2, 'abc');
+
+--echo
+--echo # The original query should be binlogged if the table does not exist.
+--echo # ------------------------------------------------------------------
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4 INT KEY)
+ SELECT 'abc' AS c3, 1 AS c4;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # The statement should be binlogged as two events. one is
+--echo # 'CREATE $_temporary TABLE IF NOT EXISTS ..', another one is
+--echo # 'INSERT ... SELECT'.
+--echo # ------------------------------------------------------------------
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ SELECT 'abc', 2;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # Verify if it can be binlogged with right database name when the table
+--echo # is not in the default database
+--echo
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+CREATE DATABASE db1;
+USE db1;
+
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS test.t1
+ SELECT 'abc', 20;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:test.t1,slave:test.t1
+ --source include/diff_tables.inc
+}
+USE test;
+DROP DATABASE db1;
+
+--echo
+--echo # It should be binlogged as 'REPLACE ... SELECT'
+--echo # if the original statement has option REPLACE
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ REPLACE SELECT '123', 2;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # It should be binlogged as 'INSERT IGNORE... SELECT'
+--echo # if the original statement has option IGNORE
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ IGNORE SELECT '123', 2;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # Nothing should be binlogged if error happens and no any row is inserted
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+--error ER_DUP_ENTRY
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ SELECT '123', 2;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # Verify it can binlog well when there are some braces('(')
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ (SELECT '123', 3) UNION (SELECT '123', 4);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ REPLACE (SELECT 'abc', 3) UNION (SELECT 'abc', 4);
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ IGNORE (SELECT '123', 3) UNION (SELECT '123', 4);
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+if (!$is_temporary)
+{
+ --echo
+ --echo # Throw a warning that table already exists and don't insert anything
+ --echo
+ CREATE VIEW t3 AS SELECT * FROM t2;
+ let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+ CREATE TABLE IF NOT EXISTS t3
+ SELECT '123', 2;
+ source include/show_binlog_events.inc;
+ DROP VIEW t3;
+}
+
+--echo
+--echo # The statement can be binlogged correctly when it is in a SP/EVENT/TRIGGER
+--echo
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+eval CREATE PROCEDURE p1(IN a INT)
+ CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', a;
+
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+call p1(500);
+call p1(600);
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+DROP PROCEDURE p1;
+
+--echo
+--echo # The statement can be binlogged correctly when it is in a prepared statement
+--echo
+eval PREPARE stm FROM "CREATE $_temporary TABLE IF NOT EXISTS t1 SELECT '123', ?";
+
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+SET @a= 700;
+EXECUTE stm USING @a;
+SET @a= 800;
+EXECUTE stm USING @a;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+--echo
+--echo # The statement can be binlogged correctly when it is in a conditional comment
+--echo
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo # The whole statement in a conditional comment
+eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
+ SELECT 'abc', 900*/;
+source include/show_binlog_events.inc;
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # There is an long comment before SELECT
+eval /*!CREATE $_temporary /*blabla*/ TABLE IF NOT EXISTS t1
+ SELECT 'abc', 901*/;
+source include/show_binlog_events.inc;
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Conditional comment starts just from SELECT
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ /*!SELECT 'abc',*/ 902;
+source include/show_binlog_events.inc;
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Only SELECT keyword is in the conditional comment
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ /*!SELECT*/ /*!'abc',*/ 904;
+source include/show_binlog_events.inc;
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Conditional comment is after SELECT keyword
+eval CREATE $_temporary TABLE IF NOT EXISTS t1
+ SELECT /*!'abc',*/ 903;
+source include/show_binlog_events.inc;
+let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+--echo
+--echo # Conditional comment ends just before SELECT keyword
+eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
+ */SELECT 'abc', 905;
+source include/show_binlog_events.inc;
+
+--sync_slave_with_master
+--connection master
+
+if (!$is_temporary)
+{
+ --let $diff_tables= master:t1,slave:t1
+ --source include/diff_tables.inc
+}
+
+DROP TABLE t2;
+eval DROP $_temporary TABLE t1;
+
diff --git a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
index d0f19e6d913..977d93ec36d 100644
--- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
+++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
@@ -23,6 +23,8 @@ 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)
@@ -139,9 +141,10 @@ set @@global.debug="-d";
# clean-up
#
-connection master;
-drop table tm, ti;
+# the sql thread has an error, so reset replication state
+--let $rpl_only_running_threads= 1
+--source include/rpl_reset.inc
-connection slave; # slave SQL thread is stopped
-source include/stop_slave.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
new file mode 100644
index 00000000000..64e69cebc32
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test
@@ -0,0 +1,60 @@
+#
+# Auxiliary file which is used to test BUG#56118
+#
+# Slave should apply all statements in the transaction before stop if any
+# temporary table is created or dropped.
+#
+# USEAGE:
+# --let $tmp_table_stm= a SQL statement
+# --source extra/rpl_tests/rpl_stop_slave.test
+#
+
+if (!$tmp_table_stm)
+{
+ --echo \$tmp_table_stm is NULL
+ --die $tmp_table_stm is NULL
+}
+
+--echo
+--echo [ On Master ]
+connection master;
+BEGIN;
+DELETE FROM t1;
+eval $tmp_table_stm;
+INSERT INTO t1 VALUES (1);
+DROP TEMPORARY TABLE tt1;
+COMMIT;
+
+--echo
+--echo [ On Slave ]
+connection slave;
+
+# To check if slave SQL thread is applying INSERT statement
+let $show_statement= SHOW PROCESSLIST;
+let $field= Info;
+let $condition= LIKE 'INSERT%';
+source include/wait_show_condition.inc;
+
+send STOP SLAVE SQL_THREAD;
+
+--echo
+--echo [ On Slave1 ]
+connection slave1;
+--echo # To resume slave SQL thread
+SET DEBUG_SYNC= 'now SIGNAL signal.continue';
+SET DEBUG_SYNC= 'RESET';
+
+--echo
+--echo [ On Slave ]
+connection slave;
+reap;
+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
+
+connection slave;
+START SLAVE SQL_THREAD;
+source include/wait_for_slave_sql_to_start.inc;
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 3b6fe7a0ef4..1687a233914 100644
--- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test
+++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test
@@ -1,12 +1,3 @@
-####################
-# Change Author: JBM
-# Change Date: 2006-01-17
-# Change: Added order by in select
-####################
-# Change Date: 2006-02-02
-# Change: renamed to make bettre sense,
-# and wrapped per Engine test
-############################
source include/master-slave.inc;
#
@@ -30,6 +21,5 @@ sync_slave_with_master;
SELECT * FROM t1 ORDER BY id;
connection master;
DROP TABLE t1;
-sync_slave_with_master;
-# End of 4.1 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_test_framework.inc b/mysql-test/extra/rpl_tests/rpl_test_framework.inc
new file mode 100644
index 00000000000..fb42d2efb9a
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_test_framework.inc
@@ -0,0 +1,86 @@
+# ==== Purpose ====
+#
+# Auxiliary file used by suite/rpl/t/rpl_test_framework.test
+#
+# The purpose is to check that the sync chain generated in
+# rpl_change_topology.inc (invoked from rpl_init.inc) is correct. This
+# is done in two ways:
+# (1) Print the sync chain.
+# (2) Execute a statement and verify that it replicates to all slaves.
+#
+#
+# ==== Implementation ====
+#
+# Does this:
+# (1) Set up a given replication topology (rpl_init.inc)
+# (2) Print $rpl_sync_chain
+# (3) Execute "DELETE FROM t1" and then "INSERT INTO t1" on the master
+# (4) Sync and compare all servers.
+# (5) Clean up the replication topology (rpl_end.inc)
+#
+# (Technical detail: Since DELETE FROM t1 is not executed at the end,
+# some servers may have rows left in t1 from a previous invocation of
+# rpl_test_framework.inc. Therefore, this file will only work in
+# statement mode where "DELETE FROM t1" removes rows that exist on
+# slave but not on master.)
+#
+#
+# ==== Usage ====
+#
+# --let $rpl_server_count= <number>
+# --let $rpl_topology= <topology specification>
+# --let $masters= <list of masters>
+# [--let $rpl_diff_servers= <list of servers>]
+# --source extra/rpl_tests/rpl_test_framework.inc
+#
+# Parameters:
+# $next_number
+# The INSERT statement will insert $next_number into t1, and
+# $next_number will increase by 1.
+#
+# $rpl_server_count, $rpl_topology:
+# See include/rpl_init.inc
+#
+# $masters
+# This should be a list of numbers, each identifying a server.
+# The DELETE and INSERT statements will be executed on all servers
+# in the list.
+#
+# $rpl_diff_servers
+# See include/rpl_diff.inc
+
+--source include/rpl_init.inc
+--source include/rpl_generate_sync_chain.inc
+--echo rpl_sync_chain= '$rpl_sync_chain'
+
+--inc $next_number
+
+# Iterate over masters
+while ($masters)
+{
+ --let $master_i= `SELECT SUBSTRING_INDEX('$masters', ',', 1)`
+ --let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)`
+
+ # Connect to master and execute statement
+ --let $rpl_connection_name= server_$master_i
+ --source include/rpl_connection.inc
+ DELETE FROM t1;
+ --eval INSERT INTO t1 VALUES ($next_number)
+}
+
+--source include/rpl_sync.inc
+
+# Compare all servers.
+--let $diff_tables= server_$rpl_server_count:t1
+--let $server_i= $rpl_server_count
+--dec $server_i
+while ($server_i)
+{
+ --let $diff_tables= server_$server_i:t1,$diff_tables
+ --dec $server_i
+}
+--source include/diff_tables.inc
+
+--let $diff_servers=
+--let $masters=
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate.test b/mysql-test/extra/rpl_tests/rpl_truncate.test
index 7036ab126e1..c1d70b4dab2 100644
--- a/mysql-test/extra/rpl_tests/rpl_truncate.test
+++ b/mysql-test/extra/rpl_tests/rpl_truncate.test
@@ -1,11 +1,6 @@
-#
-# Copyright 2006 MySQL. All rights reserved.
-#
# Test to check for the different version of truncating a table.
# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
# the behaviour of each possible value for BINLOG_FORMAT.
-#
-# Author(s): Mats Kindahl
--source include/master-slave.inc
@@ -14,3 +9,5 @@ let $trunc_stmt = TRUNCATE TABLE;
let $trunc_stmt = DELETE FROM;
--source extra/rpl_tests/rpl_truncate_helper.test
+
+--source include/rpl_end.inc
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
index cd1ce93177a..d1d0e06e32f 100644
--- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -1,4 +1,4 @@
-source include/reset_master_and_slave.inc;
+--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
@@ -10,8 +10,7 @@ connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
-let $diff_table_1=master:test.t1;
-let $diff_table_2=slave:test.t1;
+let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ==== Test using a table with delete triggers ====
@@ -26,8 +25,7 @@ connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
-let $diff_table_1=master:test.t2;
-let $diff_table_2=slave:test.t2;
+let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
connection master;
diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test
index 731eef8f41e..0096fda3174 100644
--- a/mysql-test/extra/rpl_tests/type_conversions.test
+++ b/mysql-test/extra/rpl_tests/type_conversions.test
@@ -876,7 +876,5 @@ let $can_convert = $if_is_lossy;
source extra/rpl_tests/check_type.inc;
-disable_warnings;
-source include/reset_master_and_slave.inc;
-enable_warnings;
+--source include/rpl_reset.inc
enable_query_log;