Debian Codegraph @

mysql-test/suite/rpl/t/rpl_semi_sync_slave_reply_fail.test

raw
1 # ==== Purpose ====
2 #
3 # Test verifies that slave IO thread doesn't report an error, when slave fails
4 # to send an acknowledgment to master with semi sync replication in use.
5 #
6 # ==== Implementation ====
7 #
8 # Steps:
9 # 0 - Have semi synchronous replication in use.
10 # 1 - Enable a debug simulation point which simulates network flush failure
11 # at the time of slave reply operation.
12 # 2 - Do some operation on master and wait for it to be replicated. Master
13 # will timeout waiting for reply from slave.
14 # 3 - Check the slave error log for appropriate error message regarding
15 # net_flush operation failure.
16 # 4 - Remove the debug simulation and do some more DML operations on master
17 # and wait for them to be replicated.
18 # 5 - Slave will be able to replicate and data is consistent on both master
19 # and slave. Semi sync will be automatically turned on.
20 #
21 # ==== References ====
22 #
23 # MDEV-20217: Semi_sync: Last_IO_Error: Fatal error: Failed to run
24 # 'after_queue_event' hook
25 #
26 --source include/have_debug.inc
27 --source include/master-slave.inc
28
29 --connection slave
30 --source include/stop_slave.inc
31
32 --connection master
33 call mtr.add_suppression("Timeout waiting for reply of binlog*");
34 call mtr.add_suppression("Master server does not read semi-sync messages*");
35 --let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
36 set global rpl_semi_sync_master_enabled = ON;
37 SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
38 create table t1 (i int);
39
40 --connection slave
41 set global rpl_semi_sync_slave_enabled = ON;
42 CALL mtr.add_suppression("Semi-sync slave net_flush*");
43 SET @save_debug= @@global.debug_dbug;
44 SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
45 --source include/start_slave.inc
46
47 --connection master
48 --sync_slave_with_master
49
50 # Check error log for correct messages.
51 let $log_error_= `SELECT @@GLOBAL.log_error`;
52 if(!$log_error_)
53 {
54 # MySQL Server on windows is started with --console and thus
55 # does not know the location of its .err log, use default location
56 let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
57 }
58 --echo "Assert that Master server does not read semi-sync messages" is present in slave error log.
59 --let SEARCH_FILE=$log_error_
60 --let SEARCH_PATTERN=Master server does not read semi-sync messages
61 --source include/search_pattern_in_file.inc
62
63 --echo "Assert that Slave IO thread is up and running."
64 SHOW STATUS LIKE 'Slave_running';
65 let $status= query_get_value("show slave status", Slave_IO_Running, 1);
66 echo Slave_IO_Running= $status;
67
68 --echo "Clear the network failure simulation."
69 SET GLOBAL debug_dbug= @save_debug;
70
71 --connection master
72 insert into t1 values (10);
73 --sync_slave_with_master
74
75 --connection slave
76 --echo # Compare the tables on master and slave.
77 --let $diff_tables= master:t1, slave:t1
78 --source include/diff_tables.inc
79
80 --connection master
81 set statement sql_log_bin=0 for call mtr.add_suppression("Read semi-sync reply magic number error");
82 SET @save_debug_master= @@global.debug_dbug;
83 SET GLOBAL debug_dbug="+d,semisync_corrupt_magic";
84 insert into t1 values (11);
85
86 --sync_slave_with_master
87
88 --connection master
89 SET GLOBAL debug_dbug= @save_debug_master;
90
91 drop table t1;
92 --sync_slave_with_master
93 set global rpl_semi_sync_slave_enabled = OFF;
94
95 --connection master
96 set global rpl_semi_sync_master_enabled = OFF;
97 --eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master
98 --source include/rpl_end.inc