| 1 |
############################################################################### |
| 2 |
# Bug#19021091: RELAY_LOG_RECOVERY KO WHEN CHANGE MASTER WITHOUT FILE AND |
| 3 |
# SQL_THREAD NOT STARTED |
| 4 |
# |
| 5 |
# Problem: |
| 6 |
# ======== |
| 7 |
# If, on an empty database: |
| 8 |
# - CHANGE MASTER TO without a MASTER_FILE and MASTER_POS is used, |
| 9 |
# - the IO_THREAD is started WITHOUT starting the SQL_THREAD, |
| 10 |
# - MySQL crashed, |
| 11 |
# - MySQL is restarted with relay_log_recovery = 1. |
| 12 |
# |
| 13 |
# Crash recovery will not work as expected: |
| 14 |
# - The IO_THREAD position will NOT be initialized to the SQL_THREAD position, |
| 15 |
# - SQL_THREAD position will NOT be initialized to the new relay log. |
| 16 |
# |
| 17 |
# It looks like, when the SQL_THREAD does not have a Relay_Master_Log_File, |
| 18 |
# relay_log_recovery does not work. |
| 19 |
# |
| 20 |
# Test: |
| 21 |
# ===== |
| 22 |
# Use master and slave info repositories to be tables and set |
| 23 |
# relay-log-recovery=1. Stop the slave, execute a CREATE DATABASE statement on |
| 24 |
# the master. Execute a CHANGE MASTER statement on slave without a MASTER_FILE |
| 25 |
# and MASTER_POS. Start IO thread alone. Crash the slave and restart it. When |
| 26 |
# slave is restarted with bug, sql thread will not be able to start. It will fail |
| 27 |
# with an error saying the database already exists. Post fix sql thread will |
| 28 |
# read positions from the first rotate event that is received from the master. |
| 29 |
# Sql thread will start without any error. |
| 30 |
############################################################################### |
| 31 |
--source include/not_group_replication_plugin.inc |
| 32 |
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE |
| 33 |
--source include/have_slave_repository_type_table.inc |
| 34 |
--source include/master-slave.inc |
| 35 |
--source include/force_restart.inc |
| 36 |
--source include/rpl_connection_slave.inc |
| 37 |
call mtr.add_suppression("Recovery from source pos .*"); |
| 38 |
call mtr.add_suppression("Relay log recovery on channel with GTID_ONLY=1*"); |
| 39 |
|
| 40 |
--source include/rpl_connection_slave.inc |
| 41 |
--source include/stop_slave.inc |
| 42 |
|
| 43 |
--source include/rpl_connection_master.inc |
| 44 |
CREATE DATABASE test_jfg; |
| 45 |
|
| 46 |
--source include/rpl_connection_slave.inc |
| 47 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 48 |
--replace_column 2 #### |
| 49 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1',SOURCE_PORT=$MASTER_MYPORT,SOURCE_USER='root' |
| 50 |
START SLAVE IO_THREAD; |
| 51 |
source include/wait_for_slave_io_to_start.inc; |
| 52 |
|
| 53 |
--source include/rpl_connection_master.inc |
| 54 |
source include/sync_slave_io_with_master.inc; |
| 55 |
|
| 56 |
# Restart the slave server |
| 57 |
--let $rpl_server_number= 2 |
| 58 |
--let $rpl_force_stop= 1 |
| 59 |
--let $rpl_server_parameters=--skip_replica_start=FALSE --relay-log-recovery=1 |
| 60 |
--source include/rpl_restart_server.inc |
| 61 |
|
| 62 |
# With bug sql thread will not be able to start it will fail with error 1007 |
| 63 |
# Slave: Can't create database 'test_jfg'; database exists Error_code: 1007 |
| 64 |
source include/wait_for_slave_sql_to_start.inc; |
| 65 |
|
| 66 |
--source include/rpl_connection_master.inc |
| 67 |
DROP DATABASE test_jfg; |
| 68 |
--source include/rpl_end.inc |