| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test that thread stages set while the replica receiver is |
| 4 |
# reconnecting, are translated according to |
| 5 |
# terminology_use_previous. |
| 6 |
# |
| 7 |
# ==== Requirements ==== |
| 8 |
# |
| 9 |
# R1. When the receiver is reconnecting, the stages use terminology |
| 10 |
# according to @@session.terminology_use_previous. |
| 11 |
# |
| 12 |
# ==== Implementation ==== |
| 13 |
# |
| 14 |
# For each value of terminology_use_previous, |
| 15 |
# and each of three possible conditions that cause a reconnect, |
| 16 |
# and each of two stages that the server passes while reconnecting, |
| 17 |
# do the following: |
| 18 |
# - Set two debug sync points: one that makes the receiver simulate |
| 19 |
# the condition that leads to the reconnect, and one that makes |
| 20 |
# the receiver sleep during the given stage. |
| 21 |
# - Start the receiver and let it reach the point where it sleeps. |
| 22 |
# - Show the thread stage in the test result log. |
| 23 |
# - Kill the receiver. |
| 24 |
# |
| 25 |
# ==== References ==== |
| 26 |
# |
| 27 |
# This was implemented as a post-push fix to the following worklogs: |
| 28 |
# WL#14194: Replace old terms in replication system variables, options, and strings |
| 29 |
# - Updated stages to use new terminology |
| 30 |
# WL#14628: Compatibility option to enable old replication terminology in P_S instrumentation |
| 31 |
# - Introduced the compatibility option |
| 32 |
|
| 33 |
# Test is binlog_format-agnostic. |
| 34 |
--source include/have_binlog_format_row.inc |
| 35 |
|
| 36 |
# Test uses SET debug to ensure replica pauses in specific stages. |
| 37 |
--source include/have_debug.inc |
| 38 |
|
| 39 |
--let $rpl_skip_start_slave = 1 |
| 40 |
--source include/master-slave.inc |
| 41 |
|
| 42 |
--echo #### Initialize #### |
| 43 |
|
| 44 |
--connection slave |
| 45 |
|
| 46 |
let $messages = |
| 47 |
Source command COM_REGISTER_REPLICA failed: failed |
| 48 |
Source command COM_BINLOG_DUMP failed: failed |
| 49 |
Failed on request_dump.. for channel |
| 50 |
; |
| 51 |
--source include/suppress_messages.inc |
| 52 |
|
| 53 |
let $reconnect_conditions = [ |
| 54 |
"failed_registration", |
| 55 |
"failed_binlog_dump", |
| 56 |
"failed_event_read" |
| 57 |
]; |
| 58 |
let $reconnect_stages = [ |
| 59 |
"replica_waiting_to_reconnect", |
| 60 |
"replica_reconnecting" |
| 61 |
]; |
| 62 |
--let $json_label = condition |
| 63 |
--source include/create_json_iterator.inc |
| 64 |
--let $json_label = stage |
| 65 |
--source include/create_json_iterator.inc |
| 66 |
|
| 67 |
--let $terminology_use_previous = 0 |
| 68 |
while ($terminology_use_previous < 2) { |
| 69 |
--echo |
| 70 |
--echo #### Testing terminology_use_previous = $terminology_use_previous #### |
| 71 |
|
| 72 |
eval SET @@session.terminology_use_previous = $terminology_use_previous; |
| 73 |
--let $json_array = $reconnect_conditions |
| 74 |
--source $json_condition_start |
| 75 |
while (!$json_condition_done) { |
| 76 |
--let $json_array = $reconnect_stages |
| 77 |
--source $json_stage_start |
| 78 |
while (!$json_stage_done) { |
| 79 |
--echo |
| 80 |
--echo ---- $json_stage_value after $json_condition_value ---- |
| 81 |
# Tell receiver thread to simulate error and cause reconnect |
| 82 |
--let $debug_point = simulate_reconnect_after_$json_condition_value |
| 83 |
--source include/add_debug_point.inc |
| 84 |
# Tell receiver thread to hang at a given stage during reconnect |
| 85 |
--let $debug_point = hang_in_stage_$json_stage_value |
| 86 |
--source include/add_debug_point.inc |
| 87 |
|
| 88 |
# Make dump thread reach the stage |
| 89 |
START REPLICA IO_THREAD; |
| 90 |
--let $wait_condition = SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%connect%after a failed%' |
| 91 |
--source include/wait_condition.inc |
| 92 |
|
| 93 |
# Show the result |
| 94 |
SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%connect%after a failed%'; |
| 95 |
|
| 96 |
SELECT STATE FROM performance_schema.processlist WHERE STATE LIKE '%connect%after a failed%'; |
| 97 |
|
| 98 |
SELECT PROCESSLIST_STATE FROM performance_schema.threads WHERE PROCESSLIST_STATE LIKE '%connect%after a failed%'; |
| 99 |
|
| 100 |
--let $status_items = Slave_IO_State |
| 101 |
--source include/show_slave_status.inc |
| 102 |
|
| 103 |
# Remove the debug points, allowing receiver to succeed reconnecting |
| 104 |
--let $debug_point = simulate_reconnect_after_$json_condition_value |
| 105 |
--source include/remove_debug_point.inc |
| 106 |
--let $debug_point = hang_in_stage_$json_stage_value |
| 107 |
--source include/remove_debug_point.inc |
| 108 |
|
| 109 |
# Kill receiver thread |
| 110 |
--let $thread_id = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%connect%after a failed%'` |
| 111 |
--replace_result $thread_id THREAD_ID_OF_RECEIVER |
| 112 |
eval KILL $thread_id; |
| 113 |
--source include/wait_for_slave_io_to_stop.inc |
| 114 |
|
| 115 |
--source $json_stage_next |
| 116 |
} |
| 117 |
--source $json_condition_next |
| 118 |
} |
| 119 |
--inc $terminology_use_previous |
| 120 |
} |
| 121 |
|
| 122 |
--echo |
| 123 |
--echo #### Clean up #### |
| 124 |
|
| 125 |
SET @@session.terminology_use_previous = NONE; |
| 126 |
--source include/start_slave.inc |
| 127 |
--source include/destroy_json_functions.inc |
| 128 |
|
| 129 |
--source include/rpl_end.inc |