diff options
author | Andrei Elkin <aelkin@mysql.com> | 2010-03-19 11:06:40 +0200 |
---|---|---|
committer | Andrei Elkin <aelkin@mysql.com> | 2010-03-19 11:06:40 +0200 |
commit | c3cd608aef94f8b8507997faac9e81eebc32a2d6 (patch) | |
tree | c257cbcf2d3f4379d5a037b6ed0c67206ac0be43 /mysql-test/suite | |
parent | c7fad393fd73cc941190fde1b56a2f9e68e9d132 (diff) | |
download | mariadb-git-c3cd608aef94f8b8507997faac9e81eebc32a2d6.tar.gz |
Bug #51648 DBUG_SYNC_POINT is not defined on all platforms and mtr cant pre-check that
DBUG_SYNC_POINT has at least one strong limitation that it's not defined
on all platforms. It has issues cooperating with @@debug.
All in all its functionality is superseded by DEBUG_SYNC facility and
there is no reason to maintain the old less flexible one.
Fixed with adding debug_sync_set_action() function as a facility to set up
a sync-action in the server sources code and re-writing existing simulations
(found 3) to use it.
Couple of tests have been reworked as well.
The patch offers a pattern for setting sync-points in replication threads
where the standard DEBUG_SYNC does not suffice to reach goals.
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
a pattern of usage DEBUG_SYNC for replication testing is provided.
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result:
results are changed.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based;
limiting the test to run only with MIXED binlog-format as the test last
some 10 secs sensitively contributing to the total of tests run.
mysql-test/suite/rpl/t/rpl_show_slave_running.test:
rewriting the test from GET_LOCK()-based to DEBUG_SYNC-based.
sql/debug_sync.cc:
adding debug_sync_set_action() function as a facility to set up
a sync-action in the server sources code.
sql/debug_sync.h:
externalizing debug_sync_set_action().
sql/item_func.cc:
purging sources from DBUG_SYNC_POINT.
sql/mysql_priv.h:
purging sources from DBUG_SYNC_POINT.
sql/slave.cc:
rewriting failure simulations to base on DEBUG_SYNC rather than GET_LOCK()-based DBUG_SYNC_POINT.
sql/sql_repl.cc:
removing an orphan failure simulation line because no counterpart in tests existing.
Diffstat (limited to 'mysql-test/suite')
4 files changed, 39 insertions, 42 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index d054cb573d3..a34c536feb8 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -7,34 +7,24 @@ start slave; call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Slave I/O thread .* register on master"); -SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP"); -IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP") -1 -SELECT GET_LOCK("debug_lock.before_get_UNIX_TIMESTAMP", 1000); -GET_LOCK("debug_lock.before_get_UNIX_TIMESTAMP", 1000) -1 -set global debug= 'd,debug_lock.before_get_UNIX_TIMESTAMP'; stop slave; +SET @@global.debug= "+d,'debug_lock.before_get_UNIX_TIMESTAMP'"; start slave; -SELECT RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP"); -RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP") -1 +slave is going to hang in get_master_version_and_clock +slave is unblocked +SET DEBUG_SYNC='now SIGNAL signal.get_unix_timestamp'; Check network error happened here NETWORK ERROR -SELECT IS_FREE_LOCK("debug_lock.before_get_SERVER_ID"); -IS_FREE_LOCK("debug_lock.before_get_SERVER_ID") -1 -SELECT GET_LOCK("debug_lock.before_get_SERVER_ID", 1000); -GET_LOCK("debug_lock.before_get_SERVER_ID", 1000) -1 -set global debug= 'd,debug_lock.before_get_SERVER_ID'; +set @@global.debug = "-d,'debug_lock.before_get_UNIX_TIMESTAMP'"; stop slave; +SET @@global.debug= "+d,'debug_lock.before_get_SERVER_ID'"; start slave; -SELECT RELEASE_LOCK("debug_lock.before_get_SERVER_ID"); -RELEASE_LOCK("debug_lock.before_get_SERVER_ID") -1 +slave is going to hang in get_master_version_and_clock +slave is unblocked +SET DEBUG_SYNC='now SIGNAL signal.get_server_id'; Check network error happened here NETWORK ERROR +set @@global.debug = "-d,'debug_lock.before_get_SERVER_ID'"; set global debug= ''; reset master; include/stop_slave.inc @@ -43,3 +33,4 @@ start slave; *** must be having the replicate-same-server-id IO thread error *** Slave_IO_Errno= 1593 Slave_IO_Error= Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it). +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/rpl/r/rpl_show_slave_running.result b/mysql-test/suite/rpl/r/rpl_show_slave_running.result index da26190e76d..598762d5188 100644 --- a/mysql-test/suite/rpl/r/rpl_show_slave_running.result +++ b/mysql-test/suite/rpl/r/rpl_show_slave_running.result @@ -4,11 +4,9 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +SET DEBUG_SYNC= 'RESET'; include/stop_slave.inc -SELECT GET_LOCK("debug_lock.before_get_running_status_yes", 1000); -GET_LOCK("debug_lock.before_get_running_status_yes", 1000) -1 -set global debug= 'd,debug_lock.before_get_running_status_yes'; +set global debug= 'd,dbug.before_get_running_status_yes'; Slave_running, Slave_IO_Running, Slave_SQL_Running, must be OFF, NO, NO in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -22,9 +20,7 @@ Variable_name Value Slave_running OFF Slave_IO_Running= No Slave_SQL_Running= No -SELECT RELEASE_LOCK("debug_lock.before_get_running_status_yes"); -RELEASE_LOCK("debug_lock.before_get_running_status_yes") -1 +SET DEBUG_SYNC='now SIGNAL signal.io_thread_let_running'; Slave_running, Slave_IO_Running, Slave_SQL_Running must be OFF YES NO in three following queries SHOW STATUS LIKE 'Slave_running'; Variable_name Value @@ -39,4 +35,5 @@ Slave_running ON Slave_IO_Running= Yes Slave_SQL_Running= Yes set global debug= ''; +SET DEBUG_SYNC= 'RESET'; End of tests diff --git a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test index 24309e8a14a..4a9276d9880 100644 --- a/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test +++ b/mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test @@ -16,8 +16,16 @@ source include/master-slave.inc; source include/have_debug.inc; +source include/have_debug_sync.inc; + +# +# The test is not supposed to have any binglog affairs. +# Hence it's enough it to run only with one binlog format +# +source include/have_binlog_format_mixed.inc; connection slave; + call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: .*"); call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*"); call mtr.add_suppression("Slave I/O thread .* register on master"); @@ -25,20 +33,16 @@ call mtr.add_suppression("Slave I/O thread .* register on master"); #Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection let $debug_saved= `select @@global.debug`; -let $debug_lock= "debug_lock.before_get_UNIX_TIMESTAMP"; -eval SELECT IS_FREE_LOCK($debug_lock); -eval SELECT GET_LOCK($debug_lock, 1000); - -set global debug= 'd,debug_lock.before_get_UNIX_TIMESTAMP'; +# set up two parameters to pass into extra/rpl_tests/rpl_get_master_version_and_clock +let $dbug_sync_point= 'debug_lock.before_get_UNIX_TIMESTAMP'; +let $debug_sync_action= 'now SIGNAL signal.get_unix_timestamp'; source extra/rpl_tests/rpl_get_master_version_and_clock.test; #Test case 2: Try to get the value of the SERVER_ID from master under network disconnection connection slave; -let $debug_lock= "debug_lock.before_get_SERVER_ID"; -eval SELECT IS_FREE_LOCK($debug_lock); -eval SELECT GET_LOCK($debug_lock, 1000); -set global debug= 'd,debug_lock.before_get_SERVER_ID'; +let $dbug_sync_point= 'debug_lock.before_get_SERVER_ID'; +let $debug_sync_action= 'now SIGNAL signal.get_server_id'; source extra/rpl_tests/rpl_get_master_version_and_clock.test; eval set global debug= '$debug_saved'; @@ -62,4 +66,9 @@ let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1); echo Slave_IO_Errno= $last_io_errno; echo Slave_IO_Error= $last_io_error; +# cleanup + +# is not really necessary but avoids mtr post-run env check warnings +SET DEBUG_SYNC= 'RESET'; + # End of tests diff --git a/mysql-test/suite/rpl/t/rpl_show_slave_running.test b/mysql-test/suite/rpl/t/rpl_show_slave_running.test index 62cc311e6b2..bfdd1c279fc 100644 --- a/mysql-test/suite/rpl/t/rpl_show_slave_running.test +++ b/mysql-test/suite/rpl/t/rpl_show_slave_running.test @@ -5,14 +5,14 @@ # source include/master-slave.inc; source include/have_debug.inc; +source include/have_debug_sync.inc; connection slave; - +SET DEBUG_SYNC= 'RESET'; source include/stop_slave.inc; let $debug_saved= `select @@global.debug`; -let $debug_lock= "debug_lock.before_get_running_status_yes"; -eval SELECT GET_LOCK($debug_lock, 1000); -set global debug= 'd,debug_lock.before_get_running_status_yes'; +set global debug= 'd,dbug.before_get_running_status_yes'; # to block due-started IO + # Test 1. Slave is stopped @@ -40,7 +40,7 @@ echo Slave_SQL_Running= $status; # Test 3. The slave IO thread is started and got connected to master # and SQL thread is still not started -eval SELECT RELEASE_LOCK($debug_lock); +SET DEBUG_SYNC='now SIGNAL signal.io_thread_let_running'; # unblock IO thread now let $slave_param= Slave_IO_Running; let $slave_param_value= YES; source include/wait_for_slave_param.inc; @@ -72,5 +72,5 @@ echo Slave_SQL_Running= $status; connection slave; eval set global debug= '$debug_saved'; - +SET DEBUG_SYNC= 'RESET'; --echo End of tests |