Debian Codegraph @

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

raw
1 ###############################################################################
2 # Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE
3 #
4 # Problem:
5 # =======
6 # If you have a relay log index file that has ended up with
7 # some relay log files that do not exists, then RESET SLAVE
8 # ALL is not enough to get back to a clean state.
9 ###############################################################################
10 # Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index)
11 # During server restart rli initialization will fail as there are no
12 # relay logs. In case of bug RESET SLAVE will not do the required clean up
13 # as rli is not inited and subsequent START SLAVE will fail.
14 # Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
15 # because it is different on Unix and Windows systems.
16
17 --source include/have_binlog_format_mixed.inc
18 --source include/master-slave.inc
19
20 --source include/rpl_connection_master.inc
21 CREATE TABLE t1 (c1 INT);
22 INSERT INTO t1 (c1) VALUES (1);
23 --source include/sync_slave_sql_with_master.inc
24
25 --source include/rpl_connection_slave.inc
26 --source include/stop_slave_sql.inc
27 --let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
28
29 --source include/rpl_connection_master.inc
30 # Generate more relay logs on slave.
31 FLUSH LOGS;
32 FLUSH LOGS;
33 INSERT INTO t1 (c1) VALUES (2);
34
35 --source include/sync_slave_io_with_master.inc
36 call mtr.add_suppression("File '.*slave-relay-bin.");
37 call mtr.add_suppression("Could not open log file");
38 call mtr.add_suppression("Failed to open the relay log");
39 call mtr.add_suppression("Replica failed to initialize applier metadata structure");
40 call mtr.add_suppression("Could not find target log file mentioned in applier metadata in the index file");
41 call mtr.add_suppression("Failed to initialize the relay-log-info structure");
42 call mtr.add_suppression("Failed to initialize the connection metadata structure");
43 call mtr.add_suppression("Failed to create or recover replication info repositories");
44 call mtr.add_suppression("listed in the index, but failed to stat");
45 call mtr.add_suppression("Error counting relay log space");
46
47 # Stop slave
48 --let $rpl_server_number= 2
49 --source include/rpl_stop_server.inc
50
51 # Delete file(s)
52 --echo # Removing $remove_pattern file(s)
53 --let $remove_pattern= slave-relay-bin.0*
54 --remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern
55
56 # Start slave
57 --let $rpl_server_number= 2
58 --source include/rpl_start_server.inc
59
60 # Start slave must fail because of the removed file(s).
61 --error ER_REPLICA_AM_INIT_REPOSITORY
62 START SLAVE;
63
64 # Try a second time, it must fail again.
65 --error ER_REPLICA_AM_INIT_REPOSITORY
66 START SLAVE;
67
68 # Retrieve master executed position before reset slave.
69 --let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1)
70 --let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1)
71
72 # Reset slave.
73 # Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
74 # because it is different on Unix and Windows systems.
75 --disable_warnings
76 RESET SLAVE;
77 --enable_warnings
78 RESET MASTER;
79 DROP TABLE t1;
80 # Start slave.
81 --source include/start_slave.inc
82
83 --source include/rpl_connection_master.inc
84 --source include/sync_slave_sql_with_master.inc
85 # Check consistency.
86 --let $diff_tables= master:t1, slave:t1
87 --source include/diff_tables.inc
88
89 # Cleanup
90 --source include/rpl_connection_master.inc
91 DROP TABLE t1;
92 --source include/sync_slave_sql_with_master.inc
93 --source include/rpl_end.inc