diff options
author | unknown <Li-Bing.Song@sun.com> | 2010-05-24 21:54:08 +0800 |
---|---|---|
committer | unknown <Li-Bing.Song@sun.com> | 2010-05-24 21:54:08 +0800 |
commit | 7e80f1c5dc5e834117d85d6d71aab598d193a6e9 (patch) | |
tree | 2de3927e65b02adb6a579f2d4f866344ca9f534b /mysql-test/extra | |
parent | f4e46c5ce1856cc92fb89712f50c1df712dedc5f (diff) | |
download | mariadb-git-7e80f1c5dc5e834117d85d6d71aab598d193a6e9.tar.gz |
Bug #49741 test files contain explicit references to bin/relay-log positions
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes.
There are a couple of cases explicit position number appears,
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
Replaced by show_binlog_events.inc or wait_for_binlog_event.inc.
show_binlog_events.inc file's function is enhanced by given
$binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
only the items related to each test case are showed.
'show_slave_status.inc' is rebuild, only the given items in $status_items
will be showed.
'check_slave_is_running.inc' and 'check_slave_no_error.inc'
and 'check_slave_param.inc' are auxiliary files helping
to show running status and error information easily.
mysql-test/extra/binlog_tests/binlog.test:
It only cares whether current binlog file index is changed, so it is ok
with 'show_master_status.inc' instead of 'show mater status'.
mysql-test/extra/binlog_tests/blackhole.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_deadlock.test:
Use 'check_slave_is_running.inc' instead of 'show_slave_status2.inc'.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Use 'wait_for_slave_sql_error.inc' and 'ait_for_slave_sql_error_and_skip.inc' instead of 'show slave status'.
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
It is need now to give a error number, so use 'wait_for_slave_io_to_stop.inc'
instead of 'wait_for_slave_io_error.inc'.
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_log.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_reset_slave.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc' statement.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
Use 'show_slave_error_status_and_skip.inc' instead of 'show slave status'.
mysql-test/include/check_slave_is_running.inc:
To make sure both sql and io thread are running well. If not, the test will be aborted.
mysql-test/include/check_slave_no_error.inc:
To make sure both sql and io thread have no error. If not, the test will be aborted.
mysql-test/include/get_relay_log_pos.inc:
According to the position of a log event in master binlog file,
find the peer position of a log event in relay log file.
mysql-test/include/rpl_stmt_seq.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/include/show_binlog_events.inc:
Add two options $binlog_file and $binlog_limit for showing binlog events from different binlog files or/and given different limits on position or row number.
mysql-test/include/show_rpl_debug_info.inc:
Add 'SELECT NOW()' in the debug information.
mysql-test/include/show_slave_status.inc:
It's more clean and tidy Only the given columns of slave status are printed.
mysql-test/include/test_fieldsize.inc:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/include/wait_for_binlog_event.inc:
Use show_rpl_debug_info.inc instead of 'SHOW BINLOG EVENTS'.
mysql-test/include/wait_for_slave_io_error.inc:
Add $slave_io_errno and $show_slave_io_error, it waits only a given error.
mysql-test/include/wait_for_slave_param.inc:
Use die instead of exit.
mysql-test/include/wait_for_slave_sql_error.inc:
Add $slave_sql_errno and $show_slave_sql_error, it waits only a given error.
mysql-test/include/wait_for_status_var.inc:
Use die instead of exit.
mysql-test/r/flush_block_commit_notembedded.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/r/multi_update.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_innodb.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/t/binlog_innodb.test:
It checks whether somethings are binlogged, so we use 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/t/binlog_stm_binlog.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/r/rpl_bug36391.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/bugs/t/rpl_bug12691.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/t/rpl_bug36391.test:
'show master status' is replaced by 'show_master_status.inc'.
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/engines/funcs/r/rpl_000015.result:
It checks whether somethings are binlogged,
so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/engines/funcs/t/rpl_000015.test:
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test:
Use 'query_vertical SHOW SLAVE STATUS' instead of 'show slave status'.
There is no status columns in the result file, for no slave exists on master's server.
mysql-test/suite/engines/funcs/t/rpl_change_master.test:
This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test:
We doesn't really need the statement.
mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test:
Just show Relay_Log_File, running status and error informations.
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_log_pos.test:
Mask the explicit positions in the result file.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_drop.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_row_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
Mask the explicit binary log positions in the result file.
mysql-test/suite/engines/funcs/t/rpl_server_id1.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/suite/engines/funcs/t/rpl_server_id2.test:
It doesn't really need in this test.
mysql-test/suite/engines/funcs/t/rpl_slave_status.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/manual/t/rpl_replication_delay.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/parts/t/rpl_partition.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/include/rpl_mixed_ddl.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/include/rpl_mixed_dml.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_000015.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_binlog_grant.test:
Use 'wait_for_binlog_event.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_bug33931.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_change_master.test:
This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/rpl/t/rpl_critical_errors.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Mask the explicit position numbers in result file.
It is restricted running on SBR, for it want to binlog 'set @a=1' statement.
mysql-test/suite/rpl/t/rpl_empty_master_crash.test:
It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
UUse 'check_slave_is_running.inc' and 'show_slave_status.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
mysql-test/suite/rpl/t/rpl_grant.test:
It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_incident.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test:
Use 'wait_for_slave_sql_error_and_skip.inc' to wait the given sql thread error happening and then skip the event. There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_replicate_do.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rotate_logs.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_create_table.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_drop.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_skip_error.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and mask the explicit position number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_sp.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_ssl.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_ssl1.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test:
Mask master_log_pos and master_log_file
mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/alter_table-big.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/create-big.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/ctype_cp932_binlog_stm.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/flush_block_commit_notembedded.test:
It checks whether somethings are binlogged,
so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/t/multi_update.test:
It checks whether somethings are binlogged,
so we using 'wait_binlog_event.inc' instead of 'show master status'.
mysql-test/t/sp_trans_log.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
Diffstat (limited to 'mysql-test/extra')
-rw-r--r-- | mysql-test/extra/binlog_tests/binlog.test | 25 | ||||
-rw-r--r-- | mysql-test/extra/binlog_tests/blackhole.test | 24 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_deadlock.test | 7 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test | 67 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test | 104 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_flsh_tbls.test | 12 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test | 2 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_insert_delayed.test | 17 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_log.test | 57 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_max_relay_size.test | 19 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test | 38 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_reset_slave.test | 59 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_row_basic.test | 32 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_row_tabledefs.test | 38 |
14 files changed, 206 insertions, 295 deletions
diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index b819996acb0..7f48341077e 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -41,13 +41,10 @@ while ($1) --enable_query_log commit; drop table t1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000001' from 106; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000002' from 106; - +--source include/show_binlog_events.inc +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source include/show_binlog_events.inc +--let $binlog_file= # # Bug#22540 - Incorrect value in column End_log_pos of @@ -77,8 +74,7 @@ insert into t1 values (2); insert into t1 values (3); commit; drop table t1; ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ -show binlog events from 0; +--source include/show_binlog_events.inc # now show that nothing breaks if we need to read from the cache more # than once, resulting in split event-headers @@ -100,8 +96,7 @@ while ($1) commit; enable_query_log; ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ -show binlog events from 0; +--source include/show_binlog_events.inc drop table t1; @@ -122,8 +117,7 @@ set @b= 14632475938453979136; execute stmt using @a, @b; deallocate prepare stmt; drop table t1; ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ -show binlog events from 0; +--source include/show_binlog_events.inc # @@ -249,14 +243,15 @@ reset master; drop table if exists t3; --enable_warnings create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; -show master status; +source include/show_master_status.inc; let $it=4; while ($it) { insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); dec $it; } -show master status /* must show new binlog index after rotating */; +# must show new binlog index after rotating; +source include/show_master_status.inc; drop table t3; --echo # diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index 14c15a58e18..da63a7a8619 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -125,12 +125,7 @@ select * from t1; select * from t2; select * from t3; -let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---replace_regex /file_id=[0-9]+/file_id=#/ -show binlog events; +--source include/show_binlog_events.inc drop table t1,t2,t3; @@ -168,18 +163,21 @@ set autocommit=0; start transaction; insert into t1 values(1); commit; + +let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); + start transaction; insert into t1 values(2); rollback; -set autocommit=1; -let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---replace_regex /file_id=[0-9]+/file_id=#/ -show binlog events; +let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); +if (`SELECT $master_log_pos_2 <> $master_log_pos_1`) +{ + echo $master_log_pos_1 $master_log_pos_2; + die Rollbacked transaction has been binlogged; +} +set autocommit=1; drop table if exists t1; # diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index 1b331cc948b..607348ae97b 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -61,7 +61,7 @@ sync_with_master; SELECT * FROM t1; SELECT * FROM t3; # Check that no error is reported ---source include/show_slave_status2.inc +source include/check_slave_is_running.inc; --echo # 2) Test lock wait timeout @@ -89,7 +89,7 @@ sync_with_master; SELECT * FROM t1; SELECT * FROM t3; # Check that no error is reported ---source include/show_slave_status2.inc +source include/check_slave_is_running.inc; --echo # 3) Test lock wait timeout and purged relay log @@ -103,6 +103,7 @@ SET global max_relay_log_size=0; --source include/stop_slave.inc DELETE FROM t2; # Set slave position to the BEGIN log event +--replace_result $master_pos_begin MASTER_POS_BEGIN eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin; BEGIN; # Hold lock @@ -119,7 +120,7 @@ sync_with_master; SELECT * FROM t1; SELECT * FROM t3; # Check that no error is reported ---source include/show_slave_status2.inc +source include/check_slave_is_running.inc; --echo # Clean up diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test index c426ac1fae8..16c4bc8e2da 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test @@ -146,12 +146,7 @@ SELECT COUNT(*) FROM t1; --echo SELECT * FROM t1 ORDER BY f3 LIMIT 20; ---echo ---echo * Show Slave Status * ---echo ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical show slave status; ---echo +--source include/check_slave_is_running.inc ### Altering table def scenario --echo @@ -431,16 +426,14 @@ connection master; delete from t4; delete from t31; ---echo ---echo ** Check slave status ** ---echo #connection slave; sync_slave_with_master; select * from t31; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical show slave status; +--echo +--echo ** Check slave status ** +--echo +--source include/check_slave_is_running.inc #### Clean Up #### @@ -493,16 +486,15 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT), --echo --echo ******************************************** ---echo *** Expect slave to fail with Error 1523 *** +--echo *** Expect slave to fail with Error 1535 *** --echo ******************************************** --echo connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo --echo *** Drop t10 *** @@ -550,16 +542,15 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT), --echo --echo ******************************************** ---echo *** Expect slave to fail with Error 1523 *** +--echo *** Expect slave to fail with Error 1535 *** --echo ******************************************** --echo connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo --echo *** Drop t11 *** @@ -697,10 +688,10 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1; # Remove below once fixed #*************************** connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +# 1091 = ER_CANT_DROP_FIELD_OR_KEY +--let $slave_sql_errno= 1091 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc #*************************** STOP SLAVE; @@ -763,10 +754,10 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1; --echo ******************************************** --echo connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +# 1054 = ER_BAD_FIELD_ERROR +--let $slave_sql_errno= 1054 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc STOP SLAVE; RESET SLAVE; @@ -840,10 +831,10 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1; --echo ***************** --echo connection slave; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +# 1072 = ER_KEY_COLUMN_DOES_NOT_EXITS +--let $slave_sql_errno= 1072 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc STOP SLAVE; RESET SLAVE; diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 46168d6b97a..0317aa79891 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -96,10 +96,9 @@ SELECT * FROM t2 ORDER BY a; --echo *** Start Slave *** connection slave; START SLAVE; -source include/wait_for_slave_sql_to_stop.inc; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -149,12 +148,10 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t3 *** connection master; @@ -194,12 +191,10 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'), --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t4 *** connection master; @@ -239,12 +234,10 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098), --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t5 *** connection master; @@ -285,10 +278,9 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1), --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; #START SLAVE; @@ -387,12 +379,10 @@ INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); ### Uncomment once bug is fixed #connection slave; -#wait_for_slave_to_stop; -#--replace_result $MASTER_MYPORT MASTER_PORT -#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # -#--query_vertical SHOW SLAVE STATUS -#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -#START SLAVE; +#--let $slave_sql_errno= SOMETHING +#--let $slave_skip_counter= 2 +#--let $show_slave_sql_error= 1 +#--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t8 *** connection master; @@ -451,12 +441,10 @@ if (`SELECT $engine_type != 'NDB'`) # todo: fix Bug #43992 slave sql thread can't tune own sql_mode ... # and add/restore waiting for stop test - #--source include/wait_for_slave_sql_to_stop.inc - #--replace_result $MASTER_MYPORT MASTER_PORT - #--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # - #--query_vertical SHOW SLAVE STATUS - #SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; - #START SLAVE; + #--let $slave_sql_errno= SOMETHING + #--let $slave_skip_counter= 2 + #--let $show_slave_sql_error= 1 + #--source include/wait_for_slave_sql_error_and_skip.inc } #--echo *** Drop t9 *** @@ -494,12 +482,10 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t10 *** connection master; @@ -538,12 +524,10 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Drop t11 *** connection master; @@ -810,12 +794,10 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; --echo *** Expect slave to fail with Error 1060 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; -START SLAVE; +--let $slave_sql_errno= 1060 +--let $slave_skip_counter= 1 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo *** Try to insert in master **** connection master; @@ -921,12 +903,10 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX'); --echo *** Expect slave to fail with Error 1522 *** --echo ******************************************** connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_sql_errno= 1535 +--let $slave_skip_counter= 2 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc --echo ** DROP table t17 *** connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index 0baf49c9fac..0a1a4503975 100644 --- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -20,19 +20,15 @@ rename table t1 to t5, t2 to t1; # first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword. flush no_write_to_binlog tables; # Check that it's not in the binlog. ---replace_result $SERVER_VERSION SERVER_VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -eval SHOW BINLOG EVENTS FROM $rename_event_pos ; +let $binlog_start= $rename_event_pos; +source include/show_binlog_events.inc; # Check that the master is not confused. select * from t3; # This FLUSH should go into the binlog to not confuse the slave. flush tables; # Check that it's in the binlog. ---replace_result $SERVER_VERSION SERVER_VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -eval SHOW BINLOG EVENTS FROM $rename_event_pos ; +let $wait_binlog_event= flush tables; +source include/wait_for_binlog_event.inc; sync_slave_with_master; # Check that the slave is not confused. 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 c392686454d..6e750d57c56 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 @@ -68,7 +68,7 @@ eval SET DEBUG_SYNC=$debug_sync_action; # Show slave last IO errno connection slave; -source include/wait_for_slave_io_error.inc; +source include/wait_for_slave_io_to_stop.inc; let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1); --echo Check network error happened here if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST diff --git a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test index e492903afad..e2762eab8df 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_delayed.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_delayed.test @@ -90,7 +90,7 @@ connection master; # Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but # on the slave # -if (`SELECT @@global.binlog_format != 'ROW'`) +if ($binlog_format_statement) { #flush the logs before the test connection slave; @@ -103,22 +103,23 @@ CREATE TABLE t1(a int, UNIQUE(a)); INSERT DELAYED IGNORE INTO t1 VALUES(1); INSERT DELAYED IGNORE INTO t1 VALUES(1); flush table t1; # to wait for INSERT DELAYED to be done - -if (`SELECT @@global.binlog_format != 'ROW'`) +if ($binlog_format_statement) { #must show two INSERT DELAYED - --replace_column 1 x 2 x 3 x 4 x 5 x - show binlog events in 'master-bin.000002' LIMIT 2,2; + --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + --let $binlog_limit= 1,2 + --source include/show_binlog_events.inc } select * from t1; sync_slave_with_master; echo On slave; -if (`SELECT @@global.binlog_format != 'ROW'`) +if ($binlog_format_statement) { #must show two INSERT DELAYED - --replace_column 1 x 2 x 3 x 4 x 5 x - show binlog events in 'slave-bin.000002' LIMIT 2,2; + --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + --let $binlog_limit= 1,2 + --source include/show_binlog_events.inc } select * from t1; diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index e4ebfd68761..e714d84a51b 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -11,11 +11,9 @@ # (otherwise RESET MASTER may come too early). sync_slave_with_master; source include/stop_slave.inc; ---source include/wait_for_slave_to_stop.inc reset master; reset slave; -start slave; ---source include/wait_for_slave_to_start.inc +source include/start_slave.inc; let $VERSION=`select version()`; @@ -31,19 +29,17 @@ eval create table t1 (word char(20) not null)ENGINE=$engine_type; --replace_result $LOAD_FILE LOAD_FILE eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines; select count(*) from t1; ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events; ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 1; ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 2; ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 2,1; +source include/show_binlog_events.inc; + +let $binlog_limit= 1; +source include/show_binlog_events.inc; + +let $binlog_limit= 2; +source include/show_binlog_events.inc; + +let $binlog_limit= 2,1; +source include/show_binlog_events.inc; +let $binlog_limit=; flush logs; # We need an extra update before doing save_master_pos. @@ -84,27 +80,24 @@ connection master; eval create table t2 (n int)ENGINE=$engine_type; insert into t2 values (1); source include/show_binlog_events.inc; ---replace_result $VERSION VERSION ---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/ ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events in 'master-bin.000002'; + +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +source include/show_binlog_events.inc; + --replace_column 2 # show binary logs; sync_slave_with_master; ---source include/wait_for_slave_to_start.inc --replace_column 2 # show binary logs; ---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/ ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events in 'slave-bin.000001' from 4; ---replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events in 'slave-bin.000002' from 4; -source include/show_slave_status.inc; + +let $binlog_file=; +source include/show_binlog_events.inc; + +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +source include/show_binlog_events.inc; +let $binlog_file=; + +source include/check_slave_is_running.inc; # Need to recode the following 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 5b546bbd891..8415522ec92 100644 --- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test +++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test @@ -43,7 +43,7 @@ set global max_relay_log_size=8192-1; # mapped to 4096 select @@global.max_relay_log_size; start slave; sync_with_master; -source include/show_slave_status2.inc; +--source include/check_slave_is_running.inc --echo # --echo # Test 2 @@ -55,7 +55,7 @@ set global max_relay_log_size=(5*4096); query_vertical select @@global.max_relay_log_size; start slave; sync_with_master; -source include/show_slave_status2.inc; +--source include/check_slave_is_running.inc --echo # --echo # Test 3: max_relay_log_size = 0 @@ -67,7 +67,7 @@ set global max_relay_log_size=0; query_vertical select @@global.max_relay_log_size; start slave; sync_with_master; -source include/show_slave_status2.inc; +--source include/check_slave_is_running.inc --echo # --echo # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions @@ -78,7 +78,6 @@ reset slave; # test of relay log rotation when the slave is stopped # (to make sure it does not crash). flush logs; -source include/show_slave_status2.inc; --echo # --echo # Test 5 @@ -93,10 +92,8 @@ flush logs; # log we just closed. But a trick to achieve this is do an update on the master. connection master; create table t1 (a int); -save_master_pos; -connection slave; -sync_with_master; -source include/show_slave_status2.inc; +sync_slave_with_master; +--source include/check_slave_is_running.inc --echo # --echo # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated @@ -105,10 +102,8 @@ source include/show_slave_status2.inc; flush logs; connection master; drop table t1; -save_master_pos; -connection slave; -sync_with_master; -source include/show_slave_status2.inc; +sync_slave_with_master; +--source include/check_slave_is_running.inc connection master; # test that the absence of relay logs does not make a master crash 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 4677f6da25d..3de1d42c34f 100644 --- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test +++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test @@ -56,24 +56,23 @@ connection master; --echo # since insert is done with transactional engine, expect a BEGIN --echo # at <start_pos> --echo ---replace_result $start_pos <start_pos> ---replace_column 5 # ---eval show binlog events from $start_pos limit 1 +--let $binlog_start= $start_pos +--let $binlog_limit= 1 +--source include/show_binlog_events.inc --echo --echo # Now the insert, one step after --echo ---replace_result $start_pos <start_pos> ---replace_column 2 # 5 # ---eval show binlog events from $start_pos limit 1,1 +--let $binlog_start= $start_pos +--let $binlog_limit= 1,1 +--source include/show_binlog_events.inc --echo --echo # and the COMMIT should be at <end_pos> --echo ---replace_result $start_pos <start_pos> $end_pos <end_pos> ---replace_column 2 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---eval show binlog events from $start_pos limit 2,1 +--let $binlog_start= $start_pos +--let $binlog_limit= 2,1 +--source include/show_binlog_events.inc --echo @@ -89,18 +88,17 @@ commit; --source include/select_ndb_apply_status.inc connection master; ---replace_result $start_pos <start_pos> ---replace_column 5 # ---eval show binlog events from $start_pos limit 1 +--let $binlog_start= $start_pos +--let $binlog_limit= 1 +--source include/show_binlog_events.inc --echo ---replace_result $start_pos <start_pos> ---replace_column 2 # 4 # 5 # ---eval show binlog events from $start_pos limit 1,2 +--let $binlog_start= $start_pos +--let $binlog_limit= 1,2 +--source include/show_binlog_events.inc --echo ---replace_result $start_pos <start_pos> $end_pos <end_pos> ---replace_column 2 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---eval show binlog events from $start_pos limit 3,1 +--let $binlog_start= $start_pos +--let $binlog_limit= 3,1 +--source include/show_binlog_events.inc --echo diff --git a/mysql-test/extra/rpl_tests/rpl_reset_slave.test b/mysql-test/extra/rpl_tests/rpl_reset_slave.test index 1f88c792fce..5c7d33d519e 100644 --- a/mysql-test/extra/rpl_tests/rpl_reset_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_reset_slave.test @@ -9,36 +9,32 @@ # RESET SLAVE. -- source include/master-slave.inc -connection master; -save_master_pos; -connection slave; -sync_with_master; -source include/show_slave_status2.inc; +sync_slave_with_master; +let $status_items= Master_User, Master_Host; +source include/show_slave_status.inc; -stop slave; +source include/stop_slave.inc; change master to master_user='test'; -source include/show_slave_status2.inc; +source include/show_slave_status.inc; reset slave; -source include/show_slave_status2.inc; +source include/show_slave_status.inc; -start slave; +source include/start_slave.inc; sync_with_master; -source include/show_slave_status2.inc; +source include/show_slave_status.inc; # test of crash with temp tables & RESET SLAVE # (test to see if RESET SLAVE clears temp tables in memory and disk) -stop slave; +source include/stop_slave.inc; reset slave; -start slave; +source include/start_slave.inc; connection master; create temporary table t1 (a int); -save_master_pos; -connection slave; -sync_with_master; -stop slave; +sync_slave_with_master; +source include/stop_slave.inc; reset slave; -start slave; +source include/start_slave.inc; sync_with_master; show status like 'slave_open_temp_tables'; @@ -47,10 +43,9 @@ show status like 'slave_open_temp_tables'; # # clearing the status -stop slave; +source include/stop_slave.inc; reset slave; -let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); -echo *** errno must be zero: $last_io_errno ***; +source include/check_slave_no_error.inc; # # verifying start slave resets Last_IO_Error and Last_IO_Errno. @@ -58,19 +53,13 @@ echo *** errno must be zero: $last_io_errno ***; change master to master_user='impossible_user_name'; start slave; +let $slave_io_errno= 1045; source include/wait_for_slave_io_error.inc; -let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); ---disable_query_log -eval SELECT $last_io_errno > 0 as ONE; ---enable_query_log source include/stop_slave.inc; change master to master_user='root'; source include/start_slave.inc; -let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); ---echo *** last errno must be zero: $last_io_errno *** ---echo *** last error must be blank: $last_io_error *** +source include/check_slave_no_error.inc; # # verifying reset slave resets Last_{IO,SQL}_Err{or,no} @@ -79,19 +68,9 @@ let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); source include/stop_slave.inc; change master to master_user='impossible_user_name'; start slave; +let $slave_io_errno= 1045; source include/wait_for_slave_io_error.inc; -let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); ---disable_query_log -eval SELECT $last_io_errno > 0 as ONE; ---enable_query_log source include/stop_slave.inc; reset slave; -let $last_io_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); -let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); -let $last_sql_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -let $last_sql_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1); ---echo *** io last errno must be zero: $last_io_errno *** ---echo *** io last error must be blank: $last_io_error *** ---echo *** sql last errno must be zero: $last_sql_errno *** ---echo *** sql last error must be blank: $last_sql_error *** +source include/check_slave_no_error.inc; diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test index 0ba27c69a55..84f7b79e733 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -259,10 +259,7 @@ DELETE FROM t1; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; sync_slave_with_master; set @@global.slave_exec_mode= default; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +source include/check_slave_is_running.inc; query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2; # BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly @@ -376,11 +373,10 @@ INSERT INTO t3 VALUES (1, "", 1); INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2); connection slave; -source include/wait_for_slave_sql_to_stop.inc; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc connection master; RESET MASTER; connection slave; @@ -405,11 +401,10 @@ INSERT INTO t5 VALUES (1, "", 1); INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; -source include/wait_for_slave_sql_to_stop.inc; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc connection master; RESET MASTER; connection slave; @@ -424,11 +419,10 @@ INSERT INTO t6 VALUES (1, "", 1); INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2); connection slave; -source include/wait_for_slave_sql_to_stop.inc; -let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); -disable_query_log; -eval SELECT "$last_error" AS Last_SQL_Error; -enable_query_log; +# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc connection master; RESET MASTER; connection slave; diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 083088f12ff..ee6205c79d8 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -138,9 +138,7 @@ SELECT * FROM t2; sync_slave_with_master; --echo **** On Slave **** SELECT * FROM t2; ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> ---query_vertical SHOW SLAVE STATUS +--source include/check_slave_is_running.inc connection master; INSERT INTO t9 VALUES (4); @@ -149,12 +147,10 @@ sync_slave_with_master; connection master; INSERT INTO t4 VALUES (4); connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_skip_counter= 2 +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc connection master; INSERT INTO t9 VALUES (5); @@ -163,12 +159,10 @@ sync_slave_with_master; connection master; INSERT INTO t5 VALUES (5,10,25); connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_skip_counter= 2 +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc connection master; INSERT INTO t9 VALUES (6); @@ -177,19 +171,15 @@ sync_slave_with_master; connection master; INSERT INTO t6 VALUES (6,12,36); connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +--let $slave_skip_counter= 2 +--let $slave_sql_errno= 1535 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error_and_skip.inc connection master; INSERT INTO t9 VALUES (6); sync_slave_with_master; ---replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> ---query_vertical SHOW SLAVE STATUS +--source include/check_slave_is_running.inc # Testing some tables extra field that can be null and cannot be null # (but have default values) |