File: rpl_show_errors.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (112 lines) | stat: -rw-r--r-- 4,126 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--source include/not_group_replication_plugin.inc

# There is no point in running this test in more
# than once, ie, one for each binary log format.
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc

#
# BUG#43535: last_io_error in show slave status is confusing
#

--let $ts_regexp= [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]

############# CHECKS SQL ERRORS #############

--let $field= Last_SQL_Error_Timestamp

-- connection master
CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
--source include/sync_slave_sql_with_master.inc
# action: remove table on the slave to force SQL error
DROP TABLE t1;

-- connection master
# action: drop the table on the master
DROP TABLE t1; 

-- connection slave
# action: now  wait for the slave to stop because it cannot
#         remove a table that does not exist
let $slave_sql_errno=1051; # ER_BAD_TABLE_ERROR
call mtr.add_suppression("Replica SQL for channel '': .*Error .Unknown table .test.t1.. on query.* Error_code: MY-001051");
call mtr.add_suppression("Unknown table .test.t1. Error_code: MY-001051");
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");

-- source include/wait_for_slave_sql_error.inc

--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
--let $assert_text= $field is not null and matches the expected format
--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
--source include/assert.inc

# action: stop the slave (this should preserve the error)
-- source include/stop_slave.inc
--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
--let $assert_text= $field matches the one reported before stopping slave threads
--source include/assert.inc

-- connection slave
# action: create the table again on the slave so that it resumes replication
#         correctly when we restart the slave
CREATE TABLE  t1 (a INT, b blob, PRIMARY KEY(b(512)));
-- let $sql_errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
-- echo Last_SQL_Errno: $sql_errno
-- source include/start_slave.inc

-- echo # assertion: show that the error is not reported anymore since replication
-- echo #            has resumed correctly
let $slave_param= Last_SQL_Errno;
let $slave_param_comparison= =; 
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for replica to clear the SQL error after starting;
source include/wait_for_slave_param.inc;


############# CHECKS IO ERRORS #############

--let $rpl_only_running_threads= 1
--source include/rpl_reset.inc
--let $field= Last_IO_Error_Timestamp

# mostly copied and extended from rpl_server_id1.test
-- connection slave

# replicate ourselves
-- source include/stop_slave.inc
-- replace_result $SLAVE_MYPORT SLAVE_PORT
-- eval CHANGE REPLICATION SOURCE to SOURCE_PORT=$SLAVE_MYPORT
START SLAVE;

-- let $slave_param= Last_IO_Errno
-- let $slave_param_value= 13117
-- source include/wait_for_slave_param.inc
-- echo *** must be having the replicate-same-server-id IO thread error ***

--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
--let $assert_text= $field is not null and matches the expected format
--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
--source include/assert.inc

# action: stop the slave
-- source include/stop_slave.inc

--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
--let $assert_text= $field matches the one reported before stopping slave threads
--source include/assert.inc

# action: restore correct settings
-- replace_result $MASTER_MYPORT MASTER_PORT
-- eval CHANGE REPLICATION SOURCE to SOURCE_PORT=$MASTER_MYPORT
-- let $io_errno= query_get_value("SHOW SLAVE STATUS", Last_IO_Errno, 1)
-- echo Last_IO_Errno: $io_errno
-- source include/start_slave.inc

-- echo # assertion: show that no error is reported anymore
let $slave_param= Last_IO_Errno;
let $slave_param_comparison= =; 
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for replica to clear the IO error after starting;
source include/wait_for_slave_param.inc;

--source include/rpl_end.inc