| 1 |
# |
| 2 |
# BUG |
| 3 |
# --- |
| 4 |
# BUG#28796: CHANGE MASTER TO MASTER_HOST="" leads to invalid master.info |
| 5 |
# |
| 6 |
# Description |
| 7 |
# ----------- |
| 8 |
# |
| 9 |
# This test aims at: |
| 10 |
# i) verifying that an error is thrown when setting MASTER_HOST='' |
| 11 |
# ii) no error is thrown when setting non empty MASTER_HOST |
| 12 |
# iii) replication works after setting a correct host name/ip |
| 13 |
# |
| 14 |
# Implementation is performed by feeding different values (according |
| 15 |
# to i), ii) and iii) ) to CHANGE MASTER TO MASTER_HOST= x and checking |
| 16 |
# along the way if error/no error is thrown and/or if replication starts |
| 17 |
# working when expected. |
| 18 |
|
| 19 |
--source include/master-slave.inc |
| 20 |
--source include/have_binlog_format_mixed.inc |
| 21 |
|
| 22 |
connection slave; |
| 23 |
STOP SLAVE; |
| 24 |
--source include/wait_for_slave_to_stop.inc |
| 25 |
|
| 26 |
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); |
| 27 |
--echo Master_Host = '$master_host' (expected '127.0.0.1') |
| 28 |
|
| 29 |
# attempt to change to an empty master host should |
| 30 |
# result in error ER_WRONG_ARGUMENTS: "Incorrect arguments to ..." |
| 31 |
error ER_WRONG_ARGUMENTS; |
| 32 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST=""; |
| 33 |
|
| 34 |
# show slave status still holds previous information |
| 35 |
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); |
| 36 |
--echo Master_Host = '$master_host' (expected '127.0.0.1') |
| 37 |
|
| 38 |
# changing master to other than empty master host succeeds |
| 39 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="foo"; |
| 40 |
|
| 41 |
# show slave status should hold "foo" as master host |
| 42 |
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); |
| 43 |
--echo Master_Host = '$master_host' (expected 'foo') |
| 44 |
|
| 45 |
# changing back to localhost |
| 46 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1"; |
| 47 |
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); |
| 48 |
--echo Master_Host = '$master_host' (expected '127.0.0.1') |
| 49 |
|
| 50 |
# start slave must succeed. |
| 51 |
START SLAVE; |
| 52 |
--source include/wait_for_slave_to_start.inc |
| 53 |
--source include/rpl_end.inc |