| 1 |
###################################################################### |
| 2 |
# Some errors that cause the slave SQL thread to stop are not shown in |
| 3 |
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error |
| 4 |
# is only in the server's error log. |
| 5 |
# |
| 6 |
# Two failures and their respective reporting are verified: |
| 7 |
# |
| 8 |
# 1 - Failures during slave thread initialization |
| 9 |
# 2 - Failures while processing queries passed through the init_replica |
| 10 |
# option. |
| 11 |
# |
| 12 |
# In order to check the first type of failure, we inject a fault in the |
| 13 |
# SQL/IO Threads through SET GLOBAL debug. |
| 14 |
# |
| 15 |
# To check the second type, we set @@global.init_replica to an invalid |
| 16 |
# command thus preventing the initialization of the SQL Thread. |
| 17 |
# |
| 18 |
# Obs: |
| 19 |
# 1 - Note that testing failures while initializing the relay log position |
| 20 |
# is hard as the same function is called before the code reaches the point |
| 21 |
# that we want to test. |
| 22 |
# |
| 23 |
# 2 - This test does not target failures that are reported while applying |
| 24 |
# events such as duplicate keys, errors while reading the relay-log.bin*, |
| 25 |
# etc. Such errors are already checked on other tests. |
| 26 |
###################################################################### |
| 27 |
|
| 28 |
###################################################################### |
| 29 |
# Configuring the Environment |
| 30 |
###################################################################### |
| 31 |
source include/have_debug.inc; |
| 32 |
source include/master-slave.inc; |
| 33 |
|
| 34 |
connection slave; |
| 35 |
|
| 36 |
--disable_warnings |
| 37 |
stop slave; |
| 38 |
--enable_warnings |
| 39 |
reset slave; |
| 40 |
|
| 41 |
###################################################################### |
| 42 |
# Injecting faults in the threads' initialization |
| 43 |
###################################################################### |
| 44 |
connection slave; |
| 45 |
|
| 46 |
# Set debug flags on slave to force errors to occur |
| 47 |
--let $debug_point= simulate_io_replica_error_on_init |
| 48 |
--source include/add_debug_point.inc |
| 49 |
--let $debug_point= simulate_sql_replica_error_on_init |
| 50 |
--source include/add_debug_point.inc |
| 51 |
|
| 52 |
start slave; |
| 53 |
|
| 54 |
# |
| 55 |
# slave is going to stop because of emulated failures |
| 56 |
# but there won't be any crashes nor asserts hit. |
| 57 |
# |
| 58 |
--let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR) |
| 59 |
--let $show_slave_sql_error= 1 |
| 60 |
--source include/wait_for_slave_sql_error.inc |
| 61 |
|
| 62 |
SET SESSION sql_log_bin= 0; |
| 63 |
call mtr.add_suppression("Failed during replica.* thread initialization"); |
| 64 |
SET SESSION sql_log_bin= 1; |
| 65 |
|
| 66 |
# Bug#11765758 - 58754 |
| 67 |
# above tests part logics make sure the IO thread is down to allow |
| 68 |
# safe updating to @@global.debug |
| 69 |
--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR) |
| 70 |
--let $show_slave_io_error= 1 |
| 71 |
--source include/wait_for_slave_io_error.inc |
| 72 |
|
| 73 |
--let $debug_point= simulate_io_replica_error_on_init |
| 74 |
--source include/remove_debug_point.inc |
| 75 |
--let $debug_point= simulate_sql_replica_error_on_init |
| 76 |
--source include/remove_debug_point.inc |
| 77 |
|
| 78 |
###################################################################### |
| 79 |
# Injecting faults in the init_replica option |
| 80 |
###################################################################### |
| 81 |
connection slave; |
| 82 |
|
| 83 |
reset slave; |
| 84 |
|
| 85 |
SET GLOBAL init_replica= "garbage"; |
| 86 |
|
| 87 |
start slave; |
| 88 |
# 13145 = ER_SERVER_REPLICA_INIT_QUERY_FAILED |
| 89 |
--let $slave_sql_errno= 13145 |
| 90 |
--let $show_slave_sql_error= 1 |
| 91 |
--source include/wait_for_slave_sql_error.inc |
| 92 |
|
| 93 |
###################################################################### |
| 94 |
# Clean up |
| 95 |
###################################################################### |
| 96 |
SET GLOBAL init_replica= ""; |
| 97 |
|
| 98 |
# Clean up Last_SQL_Error |
| 99 |
--source include/stop_slave_io.inc |
| 100 |
RESET SLAVE; |
| 101 |
--let $rpl_only_running_threads= 1 |
| 102 |
--source include/rpl_end.inc |