| 1 |
# The slave is started with relay_log_space_limit=10 bytes, |
| 2 |
# to force the deadlock after one event. |
| 3 |
|
| 4 |
source include/master-slave.inc; |
| 5 |
--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 6 |
connection slave; |
| 7 |
--source include/stop_slave.inc |
| 8 |
connection master; |
| 9 |
# This will generate a master's binlog > 10 bytes |
| 10 |
create table t1 (a int); |
| 11 |
drop table t1; |
| 12 |
create table t1 (a int); |
| 13 |
drop table t1; |
| 14 |
connection slave; |
| 15 |
reset slave; |
| 16 |
start slave io_thread; |
| 17 |
# Give the I/O thread time to block. |
| 18 |
let $slave_param= Slave_IO_State; |
| 19 |
let $slave_param_value= Waiting for the slave SQL thread to free enough relay log space; |
| 20 |
source include/wait_for_slave_param.inc; |
| 21 |
|
| 22 |
# A bug caused the I/O thread to refuse stopping. |
| 23 |
--source include/stop_slave_io.inc |
| 24 |
reset slave; |
| 25 |
--source include/start_slave.inc |
| 26 |
|
| 27 |
# The I/O thread stops filling the relay log when it's >10b. And the |
| 28 |
# SQL thread cannot purge this relay log as purge is done only when |
| 29 |
# the SQL thread switches to another relay log, which does not exist |
| 30 |
# here. So we should have a deadlock. If it is not resolved |
| 31 |
# automatically we'll detect it with master_pos_wait that waits for |
| 32 |
# farther than 1Ob; it will timeout after 300 seconds (which is inline |
| 33 |
# with the default used for sync_slave_with_master and will protect us |
| 34 |
# against slow test envs); also the slave will probably not cooperate |
| 35 |
# to shutdown (as 2 threads are locked) |
| 36 |
--let $outcome= `SELECT MASTER_POS_WAIT('$master_log_file',200,300) AS mpw;` |
| 37 |
|
| 38 |
# master_pos_wait returns: |
| 39 |
# |
| 40 |
# * >= 0, the number of events the slave had to wait to advance to the |
| 41 |
# position |
| 42 |
# |
| 43 |
# * -1, if there was a timeout |
| 44 |
# |
| 45 |
# * NULL, if an error occurred, or the SQL thread was not started, |
| 46 |
# slave master info is not initialized, the arguments are incorrect |
| 47 |
--let $assert_text= Assert that master_pos_wait does not timeout nor it returns NULL |
| 48 |
--let $assert_cond= $outcome IS NOT NULL AND $outcome <> -1 |
| 49 |
--source include/assert.inc |
| 50 |
|
| 51 |
# End of 4.1 tests |
| 52 |
--source include/rpl_end.inc |