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