File: rpl_init_replica_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 (102 lines) | stat: -rw-r--r-- 3,609 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
######################################################################
# Some errors that cause the slave SQL thread to stop are not shown in 
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error 
# is only in the server's error log.
#
# Two failures and their respective reporting are verified:
#             
# 1 - Failures during slave thread initialization
# 2 - Failures while processing queries passed through the init_replica
# option.
#
# In order to check the first type of failure, we inject a fault in the 
# SQL/IO Threads through SET GLOBAL debug.
#
# To check the second type, we set @@global.init_replica to an invalid 
# command thus preventing the initialization of the SQL Thread.
#
# Obs:
# 1 - Note that testing failures while initializing the relay log position 
# is hard as the same function is called before the code reaches the point 
# that we want to test.
#
# 2 - This test does not target failures that are reported while applying 
# events such as duplicate keys, errors while reading the relay-log.bin*, 
# etc. Such errors are already checked on other tests.
######################################################################

######################################################################
#                    Configuring the Environment
######################################################################
source include/have_debug.inc;
source include/master-slave.inc;

connection slave;

--disable_warnings
stop slave;
--enable_warnings
reset slave;

######################################################################
#           Injecting faults in the threads' initialization
######################################################################
connection slave;

# Set debug flags on slave to force errors to occur
--let $debug_point= simulate_io_replica_error_on_init
--source include/add_debug_point.inc
--let $debug_point= simulate_sql_replica_error_on_init
--source include/add_debug_point.inc

start slave;

#
# slave is going to stop because of emulated failures
# but there won't be any crashes nor asserts hit.
#
--let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Failed during replica.* thread initialization");
SET SESSION sql_log_bin= 1;

# Bug#11765758 - 58754
# above tests part logics make sure the IO thread is down to allow 
# safe updating to @@global.debug
--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc

--let $debug_point= simulate_io_replica_error_on_init
--source include/remove_debug_point.inc
--let $debug_point= simulate_sql_replica_error_on_init
--source include/remove_debug_point.inc

######################################################################
#             Injecting faults in the init_replica option
######################################################################
connection slave;

reset slave;

SET GLOBAL init_replica= "garbage";

start slave;
# 13145 = ER_SERVER_REPLICA_INIT_QUERY_FAILED
--let $slave_sql_errno= 13145
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc

######################################################################
#                             Clean up
######################################################################
SET GLOBAL init_replica= "";

# Clean up Last_SQL_Error
--source include/stop_slave_io.inc
RESET SLAVE;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc