MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_change_master_bind.inc
1 #
2 # Test CHANGE MASTER MASTER_BIND=xxx
3 #
4 # Parameters:
5 # $master_bind - the address to use for MASTER_BIND
6 # $master_bind_error_expected - expect an error when using the specified
7 # master_bind address
8 #
9 #
10 
11 # Stop the slave
12 connection slave;
13 source include/stop_slave.inc;
14 
15 # Create table and insert one record with the bind address on master
16 connection master;
17 create table t1(n int, b varchar(256));
18 --replace_result $master_bind <master_bind>
19 eval insert into t1 values(1, $master_bind);
20 
21 # Configure slave to connect to master with the give bind address
22 # for master_bind and master_host unless it's an invalid address
23 connection slave;
24 let $_master_host=;
25 if (!$master_bind_error_expected)
26 {
27  if ($master_bind != "''")
28  {
29  let $_master_host=master_host=$master_bind,;
30  }
31 }
32 
33 --replace_result $master_bind <master_bind>
34 eval change master to $_master_host master_bind=$master_bind;
35 start slave;
36 
37 # Check that SHOW SLAVE STATUS has Master_bind column set to $master_bind
38 let $master_bind_value= query_get_value(SHOW SLAVE STATUS, Master_Bind, 1);
39 if (`select '$master_bind_value' != $master_bind`)
40 {
41  source include/show_rpl_debug_info.inc;
42  echo 'master_bind_value: $master_bind_value' != 'master_bind: $master_bind';
43  die Master_bind in SHOW SLAVE STAUS not showing configured value;
44 }
45 
46 if ($master_bind_error_expected)
47 {
48  # The given master bind address is not valid
49  # and replication should fail
50  let $slave_io_errno= $master_bind_error_expected;
51  let $slave_io_error_is_nonfatal= 1;
52  source include/wait_for_slave_io_error.inc;
53  echo got expected error $master_bind_error_expected;
54  source include/stop_slave.inc;
55 
56  # Reset the master_bind so that cleanup can run
57  eval change master to master_bind='';
58  start slave;
59 
60 }
61 
62 source include/wait_for_slave_to_start.inc;
63 
64 connection master;
65 sync_slave_with_master;
66 
67 connection slave;
68 let $master_bind_repl= query_get_value(select b from t1, b, 1);
69 if (`select '$master_bind_repl' != $master_bind`)
70 {
71  select * from t1;
72  source include/show_rpl_debug_info.inc;
73  echo 'master_bind_repl: $master_bind_repl' != 'master_bind: $master_bind';
74  die The replicated value to show replication working was not correct;
75 }
76 
77 # Clean up
78 connection master;
79 drop table t1;
80 sync_slave_with_master;