| 1 |
################################################################################ |
| 2 |
# This test verifies the output of the show slave hosts. |
| 3 |
# |
| 4 |
# Test: |
| 5 |
# 0. The test requires two servers: M1 and M2. |
| 6 |
# 1. Bootstrap start a group on M2. Create table t1. |
| 7 |
# 2. verify that the show slave hosts output is empty. |
| 8 |
# 3. Block the SQL_THREAD for channel group_replication_applier |
| 9 |
# so that M1 will be in recovering state when it is joined |
| 10 |
# to the group. |
| 11 |
# 4. Start GR on M1. Wait until it is in RECOVERING state. |
| 12 |
# 5. verify that show slave hosts on M2 shows M1. |
| 13 |
# 6. Resume the SQL_THREAD for channel group_replication_applier |
| 14 |
# 7. Wait until show slave hosts doesn't show server M2 in it's output. |
| 15 |
# 8. Clean up. |
| 16 |
################################################################################ |
| 17 |
|
| 18 |
--source include/have_debug_sync.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--let $rpl_skip_group_replication_start= 1 |
| 21 |
--source include/group_replication.inc |
| 22 |
|
| 23 |
--let $rpl_connection_name= server2 |
| 24 |
--source include/rpl_connection.inc |
| 25 |
--source include/start_and_bootstrap_group_replication.inc |
| 26 |
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY); |
| 27 |
|
| 28 |
# Assert that the show slave hosts is empty. |
| 29 |
--let $host_uuid= query_get_value(show slave hosts,Slave_UUID,1) |
| 30 |
--let $assert_text = Assert that show slave hosts is empty.. |
| 31 |
--let $assert_cond = "$host_uuid" = "No such row" |
| 32 |
--source include/assert.inc |
| 33 |
|
| 34 |
# This is to ensure that M1 will be in recovering state, so that the |
| 35 |
# output of show slave hosts can be verified. |
| 36 |
SET @@GLOBAL.DEBUG='+d,block_applier_updates'; |
| 37 |
|
| 38 |
--let $rpl_connection_name= server1 |
| 39 |
--source include/rpl_connection.inc |
| 40 |
|
| 41 |
# save the value of replica_net_timeout |
| 42 |
SET @restore_replica_net_timeout=@@global.replica_net_timeout; |
| 43 |
|
| 44 |
# Set replica_net_timeout to lower value so that the master(M2) detects |
| 45 |
# that the slave host(M1) has gone sooner. |
| 46 |
SET @@global.replica_net_timeout=20; |
| 47 |
--let $server1_uuid= `SELECT @@GLOBAL.SERVER_UUID` |
| 48 |
|
| 49 |
# Wait until M1 is in recovering state |
| 50 |
--let $group_replication_start_member_state= RECOVERING |
| 51 |
--source include/start_group_replication.inc |
| 52 |
|
| 53 |
# Wait until show slave hosts on M2 shows M1 as it will be |
| 54 |
# connected as slave during recovery |
| 55 |
--let $rpl_connection_name= server2 |
| 56 |
--source include/rpl_connection.inc |
| 57 |
|
| 58 |
let $wait_timeout= 60; |
| 59 |
let $show_statement= SHOW SLAVE HOSTS; |
| 60 |
let $field= Slave_UUID; |
| 61 |
let $condition= = '$server1_uuid'; |
| 62 |
--source include/wait_show_condition.inc |
| 63 |
|
| 64 |
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked"; |
| 65 |
SET @@GLOBAL.DEBUG='-d,block_applier_updates'; |
| 66 |
SET DEBUG_SYNC = "now SIGNAL resume_applier_read"; |
| 67 |
|
| 68 |
# Verify that both the servers are in ONLINE state. |
| 69 |
--let $wait_timeout= 60 |
| 70 |
--let $wait_condition= SELECT COUNT(*)=2 FROM performance_schema.replication_group_members WHERE member_state='ONLINE' |
| 71 |
--source include/wait_condition.inc |
| 72 |
|
| 73 |
# Wait until server1 is removed from the show slave hosts output. |
| 74 |
let $wait_timeout= 60; |
| 75 |
let $wait_for_all= 1; |
| 76 |
let $show_statement= SHOW SLAVE HOSTS; |
| 77 |
let $field= Host; |
| 78 |
let $condition= = 'No such row'; |
| 79 |
--source include/wait_show_condition.inc |
| 80 |
|
| 81 |
# Clean up |
| 82 |
--let $rpl_connection_name= server2 |
| 83 |
--source include/rpl_connection.inc |
| 84 |
SET DEBUG_SYNC= 'RESET'; |
| 85 |
|
| 86 |
--let $rpl_connection_name= server1 |
| 87 |
--source include/rpl_connection.inc |
| 88 |
|
| 89 |
# Restore the value of replica_net_timeout |
| 90 |
SET @@global.replica_net_timeout=@restore_replica_net_timeout; |
| 91 |
DROP TABLE t1; |
| 92 |
|
| 93 |
--source include/group_replication_end.inc |