Debian Codegraph @

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

raw
1 --source include/not_group_replication_plugin.inc
2
3 # There is no point in running this test in more
4 # than once, ie, one for each binary log format.
5 -- source include/have_binlog_format_row.inc
6 -- source include/master-slave.inc
7
8 #
9 # BUG#43535: last_io_error in show slave status is confusing
10 #
11
12 --let $ts_regexp= [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]
13
14 ############# CHECKS SQL ERRORS #############
15
16 --let $field= Last_SQL_Error_Timestamp
17
18 -- connection master
19 CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
20 --source include/sync_slave_sql_with_master.inc
21 # action: remove table on the slave to force SQL error
22 DROP TABLE t1;
23
24 -- connection master
25 # action: drop the table on the master
26 DROP TABLE t1;
27
28 -- connection slave
29 # action: now wait for the slave to stop because it cannot
30 # remove a table that does not exist
31 let $slave_sql_errno=1051; # ER_BAD_TABLE_ERROR
32 call mtr.add_suppression("Replica SQL for channel '': .*Error .Unknown table .test.t1.. on query.* Error_code: MY-001051");
33 call mtr.add_suppression("Unknown table .test.t1. Error_code: MY-001051");
34 call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
35
36 -- source include/wait_for_slave_sql_error.inc
37
38 --let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
39 --let $assert_text= $field is not null and matches the expected format
40 --let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
41 --source include/assert.inc
42
43 # action: stop the slave (this should preserve the error)
44 -- source include/stop_slave.inc
45 --let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
46 --let $assert_text= $field matches the one reported before stopping slave threads
47 --source include/assert.inc
48
49 -- connection slave
50 # action: create the table again on the slave so that it resumes replication
51 # correctly when we restart the slave
52 CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
53 -- let $sql_errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
54 -- echo Last_SQL_Errno: $sql_errno
55 -- source include/start_slave.inc
56
57 -- echo # assertion: show that the error is not reported anymore since replication
58 -- echo # has resumed correctly
59 let $slave_param= Last_SQL_Errno;
60 let $slave_param_comparison= =;
61 let $slave_param_value= 0;
62 let $slave_error_message= Failed while waiting for replica to clear the SQL error after starting;
63 source include/wait_for_slave_param.inc;
64
65
66 ############# CHECKS IO ERRORS #############
67
68 --let $rpl_only_running_threads= 1
69 --source include/rpl_reset.inc
70 --let $field= Last_IO_Error_Timestamp
71
72 # mostly copied and extended from rpl_server_id1.test
73 -- connection slave
74
75 # replicate ourselves
76 -- source include/stop_slave.inc
77 -- replace_result $SLAVE_MYPORT SLAVE_PORT
78 -- eval CHANGE REPLICATION SOURCE to SOURCE_PORT=$SLAVE_MYPORT
79 START SLAVE;
80
81 -- let $slave_param= Last_IO_Errno
82 -- let $slave_param_value= 13117
83 -- source include/wait_for_slave_param.inc
84 -- echo *** must be having the replicate-same-server-id IO thread error ***
85
86 --let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
87 --let $assert_text= $field is not null and matches the expected format
88 --let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
89 --source include/assert.inc
90
91 # action: stop the slave
92 -- source include/stop_slave.inc
93
94 --let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
95 --let $assert_text= $field matches the one reported before stopping slave threads
96 --source include/assert.inc
97
98 # action: restore correct settings
99 -- replace_result $MASTER_MYPORT MASTER_PORT
100 -- eval CHANGE REPLICATION SOURCE to SOURCE_PORT=$MASTER_MYPORT
101 -- let $io_errno= query_get_value("SHOW SLAVE STATUS", Last_IO_Errno, 1)
102 -- echo Last_IO_Errno: $io_errno
103 -- source include/start_slave.inc
104
105 -- echo # assertion: show that no error is reported anymore
106 let $slave_param= Last_IO_Errno;
107 let $slave_param_comparison= =;
108 let $slave_param_value= 0;
109 let $slave_error_message= Failed while waiting for replica to clear the IO error after starting;
110 source include/wait_for_slave_param.inc;
111
112 --source include/rpl_end.inc