| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test script serves as the functionality testing for |
| 4 |
# WL#6120- Change master without stopping Slave threads. |
| 5 |
# |
| 6 |
# This test script does the following: |
| 7 |
|
| 8 |
# - Temporary table(s) should NOT be dropped if applier is running during |
| 9 |
# CHANGE MASTER. |
| 10 |
# - If there are open temporary tables and there is a STOP SLAVE/ |
| 11 |
# STOP SLAVE[IO_THREAD/SQL_THREAD]there should be a warning. |
| 12 |
# - If there are open temporary tables and there is a CHANGE MASTER, |
| 13 |
# there should be a warning. |
| 14 |
# - There is no warning if the change master option only changes connection |
| 15 |
# or execution configuration. |
| 16 |
# |
| 17 |
# ==== Related Worklog(s) And Bug(s)==== |
| 18 |
# |
| 19 |
# WL#6120- Change master without stopping Slave threads. |
| 20 |
# |
| 21 |
|
| 22 |
--source include/master-slave.inc |
| 23 |
--source include/have_binlog_format_statement.inc |
| 24 |
|
| 25 |
--echo |
| 26 |
--echo # create a temporary table, replicate at slave for all the tests below. |
| 27 |
--echo |
| 28 |
|
| 29 |
CREATE TEMPORARY TABLE t1(a int); |
| 30 |
--source include/sync_slave_sql_with_master.inc |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # Make sure STOP SLAVE generates a warning. |
| 34 |
--echo |
| 35 |
|
| 36 |
STOP SLAVE; |
| 37 |
--source include/wait_for_slave_to_stop.inc |
| 38 |
|
| 39 |
--echo |
| 40 |
--echo # Make sure STOP SLAVE SQL_THREAD generates a warning. |
| 41 |
--echo |
| 42 |
|
| 43 |
STOP SLAVE SQL_THREAD; |
| 44 |
--source include/wait_for_slave_sql_to_stop.inc |
| 45 |
|
| 46 |
--echo |
| 47 |
--echo # Make sure STOP SLAVE IO_THREAD generates a warning. |
| 48 |
--echo |
| 49 |
|
| 50 |
STOP SLAVE IO_THREAD; |
| 51 |
--source include/wait_for_slave_io_to_stop.inc |
| 52 |
|
| 53 |
--echo |
| 54 |
--echo # No warning here since we are changing a configuration parameter only. |
| 55 |
--echo |
| 56 |
|
| 57 |
CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD= 10; |
| 58 |
|
| 59 |
--echo |
| 60 |
--echo # Use of (master/relay)log_file/log_pos options should generate a warning. |
| 61 |
--echo |
| 62 |
|
| 63 |
--let $save_autoposition= query_get_value(SHOW SLAVE STATUS, Auto_Position, 1) |
| 64 |
CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION= 0; |
| 65 |
|
| 66 |
let $master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1); |
| 67 |
replace_result $master_log_file MASTER_LOG_FILE; |
| 68 |
eval CHANGE REPLICATION SOURCE TO SOURCE_LOG_FILE= '$master_log_file'; |
| 69 |
|
| 70 |
let $master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); |
| 71 |
replace_result $master_log_pos MASTER_LOG_POS; |
| 72 |
eval CHANGE REPLICATION SOURCE TO SOURCE_LOG_POS= $master_log_pos; |
| 73 |
|
| 74 |
let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); |
| 75 |
replace_result $relay_log_file RELAY_LOG_FILE; |
| 76 |
eval CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE= '$relay_log_file'; |
| 77 |
|
| 78 |
let $relay_log_pos= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); |
| 79 |
replace_result $relay_log_pos RELAY_LOG_POS; |
| 80 |
--disable_warnings |
| 81 |
eval CHANGE REPLICATION SOURCE TO RELAY_LOG_POS= $relay_log_pos; |
| 82 |
--enable_warnings |
| 83 |
# Do SHOW WARINGS explicitly to avoid replace_result affecting the output |
| 84 |
SHOW WARNINGS; |
| 85 |
|
| 86 |
--replace_result $save_autoposition SAVE_AUTOPOSITION |
| 87 |
eval CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION= $save_autoposition; |
| 88 |
|
| 89 |
--echo |
| 90 |
--echo # cleanup |
| 91 |
--echo |
| 92 |
|
| 93 |
--source include/start_slave.inc |
| 94 |
--connection master |
| 95 |
DROP TEMPORARY TABLE t1; |
| 96 |
|
| 97 |
--source include/rpl_end.inc |