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