Debian Codegraph @

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

raw
1 # Verify that after CHANGE MASTER, replication (I/O thread and SQL
2 # thread) restart from where SQL thread left, not from where
3 # I/O thread left (some old bug fixed in 4.0.17)
4
5 source include/master-slave.inc;
6 call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
7
8 connection master;
9 # Make SQL slave thread advance a bit
10 create table t1(n int);
11 sync_slave_with_master;
12 select * from t1;
13 # Now stop it and make I/O slave thread be ahead
14 stop slave sql_thread;
15 connection master;
16 insert into t1 values(1);
17 insert into t1 values(2);
18 save_master_pos;
19 let $slave_param= Read_Master_Log_Pos;
20 let $slave_param_value= query_get_value(SHOW MASTER STATUS, Position, 1);
21 connection slave;
22 source include/wait_for_slave_param.inc;
23 source include/stop_slave.inc;
24
25 let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
26 let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
27 if ($read_pos == $exec_pos)
28 {
29 source include/show_rpl_debug_info.inc;
30 echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
31 die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
32 }
33 change master to master_user='root';
34 let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
35 let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
36 if ($read_pos != $exec_pos)
37 {
38 source include/show_rpl_debug_info.inc;
39 echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
40 die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
41 }
42
43 start slave;
44 sync_with_master;
45 select * from t1;
46 connection master;
47 drop table t1;
48 sync_slave_with_master;
49
50 # End of 4.1 tests
51
52 #
53 # BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE
54 #
55
56 if ($bug_59037_is_fixed == 'true') {
57 --source include/rpl_reset.inc
58
59 connection master;
60 create table t1 (a int);
61 insert into t1 values (1);
62 flush logs;
63 insert into t1 values (2);
64
65 # Note: the master positon saved by this will also be used by the
66 # 'sync_with_master' below.
67 sync_slave_with_master;
68
69 # Check if the table t1 and t2 are identical on master and slave;
70 let $diff_tables= master:t1,slave:t1
71 source include/diff_tables.inc;
72
73 connection slave;
74 source include/stop_slave.inc;
75 delete from t1 where a=2;
76
77 # start replication from the second insert, after fix of BUG#12190,
78 # relay_log_file does not use absolute path, only the filename is
79 # required
80 #
81 # Note: the follow change master will automatically reset
82 # relay_log_purge to false, save the old value to restore
83 let $relay_log_purge= `select @@global.relay_log_purge`;
84 CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4;
85 start slave sql_thread;
86 source include/wait_for_slave_sql_to_start.inc;
87
88 # Sync to the same position saved by the 'sync_slave_with_master' above.
89 sync_with_master;
90
91 # Check if the table t1 and t2 are identical on master and slave;
92 let $diff_tables= master:t1,slave:t1
93 source include/diff_tables.inc;
94
95 # clean up
96 connection slave;
97 start slave io_thread;
98 source include/wait_for_slave_io_to_start.inc;
99 eval set global relay_log_purge=$relay_log_purge;
100 connection master;
101 drop table t1;
102 }
103
104 --connection master
105 # MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in
106 # instrings/strmake.c:36 from change_master (on optimized builds)
107 CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
108 MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
109 CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
110
111
112 --source include/rpl_end.inc