| 1 |
################################################################################ |
| 2 |
# This test validates that no issue exists when a member auto joins an existing |
| 3 |
# group during installation. |
| 4 |
# |
| 5 |
# To test this: |
| 6 |
# 0) The test requires two servers: M1 and M2. |
| 7 |
# 1) Bootstrap group replication on member 1. |
| 8 |
# 2) Restart server 2 with start_on_boot=1 (to enable it for the install) |
| 9 |
# Stop group replication and reset the applier channel. |
| 10 |
# 3) Insert some data on server 1 and stop the applier to block recovery on |
| 11 |
# server 2. |
| 12 |
# 4) Uninstall and Install the plugin on member 2 (auto start enabled on 2) |
| 13 |
# 5) Verify that no transaction can be executed while server 2 recovers. |
| 14 |
# 6) Check all is fine after unblocking recovery. |
| 15 |
# 7) Clean up. |
| 16 |
################################################################################ |
| 17 |
|
| 18 |
--source include/big_test.inc |
| 19 |
--source include/have_debug_sync.inc |
| 20 |
--let $group_replication_group_name= ce94c230-2fc0-11e5-a2cb-0800200c9a66 |
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--source include/force_restart.inc |
| 23 |
--let $rpl_skip_group_replication_start= 1 |
| 24 |
--source include/group_replication.inc |
| 25 |
|
| 26 |
--echo # |
| 27 |
--echo # Bootstrap group with server 1. |
| 28 |
--echo # |
| 29 |
|
| 30 |
--connection server1 |
| 31 |
--source include/start_and_bootstrap_group_replication.inc |
| 32 |
|
| 33 |
--echo # |
| 34 |
--echo # Restart group replication on server 2 |
| 35 |
--echo # with group_replication_start_on_boot=1 |
| 36 |
--echo # |
| 37 |
|
| 38 |
--connection server2 |
| 39 |
|
| 40 |
--let $allow_rpl_inited= 1 |
| 41 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 42 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 43 |
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_start_on_boot=1 |
| 44 |
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS |
| 45 |
--source include/restart_mysqld.inc |
| 46 |
|
| 47 |
# Needed as we are not using rpl_restart_server.inc |
| 48 |
--let $rpl_server_number= 2 |
| 49 |
--source include/rpl_reconnect.inc |
| 50 |
|
| 51 |
--let $_init_server2_auto_increment= `SELECT @@GLOBAL.AUTO_INCREMENT_INCREMENT` |
| 52 |
--let $_init_server2_auto_offset= `SELECT @@GLOBAL.AUTO_INCREMENT_OFFSET` |
| 53 |
|
| 54 |
--let $group_replication_member_state= ONLINE |
| 55 |
--source include/gr_wait_for_member_state.inc |
| 56 |
|
| 57 |
--source include/stop_group_replication.inc |
| 58 |
|
| 59 |
# A RESET MASTER was executed in the context of include/master-slave.inc after |
| 60 |
# the server auto started group replication. |
| 61 |
# The server applier logs will be reset to avoid recovery problems. |
| 62 |
RESET SLAVE ALL FOR CHANNEL "group_replication_applier"; |
| 63 |
|
| 64 |
--echo # |
| 65 |
--echo # Add some data to server 1. |
| 66 |
--echo # |
| 67 |
|
| 68 |
--connection server1 |
| 69 |
|
| 70 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 71 |
INSERT INTO t1 VALUES (1); |
| 72 |
|
| 73 |
SET @@GLOBAL.DEBUG='+d,block_applier_updates'; |
| 74 |
|
| 75 |
--echo # |
| 76 |
--echo # On server 2 uninstall and install the plugin with auto start. |
| 77 |
--echo # The plugin should start automatically and recover the missing data |
| 78 |
--echo # |
| 79 |
|
| 80 |
--connection server2 |
| 81 |
|
| 82 |
--source include/uninstall_group_replication_plugin.inc |
| 83 |
--source include/install_group_replication_plugin.inc |
| 84 |
|
| 85 |
--echo # |
| 86 |
--echo # On server 2 after restart, recovery should be stuck |
| 87 |
--echo # Query execution is not allowed |
| 88 |
--echo # |
| 89 |
|
| 90 |
--let $group_replication_member_state= RECOVERING |
| 91 |
--source include/gr_wait_for_member_state.inc |
| 92 |
|
| 93 |
--let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE table_name = 't1' |
| 94 |
--source include/wait_condition.inc |
| 95 |
|
| 96 |
# install plugin return before set super_read_only, wait to confirm change |
| 97 |
--let $wait_condition= SELECT @@GLOBAL.super_read_only = '1' |
| 98 |
--source include/wait_condition.inc |
| 99 |
|
| 100 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 101 |
INSERT INTO t1 VALUES (2); |
| 102 |
|
| 103 |
--echo # |
| 104 |
--echo # After unblocking recovery all should be fine |
| 105 |
--echo # |
| 106 |
|
| 107 |
--connection server1 |
| 108 |
|
| 109 |
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked"; |
| 110 |
SET @@GLOBAL.DEBUG='-d,block_applier_updates'; |
| 111 |
SET DEBUG_SYNC = "now SIGNAL resume_applier_read"; |
| 112 |
|
| 113 |
--connection server2 |
| 114 |
|
| 115 |
--let $group_replication_member_state= ONLINE |
| 116 |
--source include/gr_wait_for_member_state.inc |
| 117 |
|
| 118 |
# The data should be there. |
| 119 |
--let $wait_condition= SELECT COUNT(*) = 1 FROM t1; |
| 120 |
--source include/wait_condition.inc |
| 121 |
|
| 122 |
--echo # |
| 123 |
--echo # Clean up |
| 124 |
--echo # |
| 125 |
|
| 126 |
--connection server1 |
| 127 |
SET DEBUG_SYNC= 'RESET'; |
| 128 |
|
| 129 |
--connection server2 |
| 130 |
DROP TABLE t1; |
| 131 |
|
| 132 |
--source include/rpl_sync.inc |
| 133 |
|
| 134 |
#Stop group replication and set the auto_increment values recorded on start |
| 135 |
--source include/stop_group_replication.inc |
| 136 |
|
| 137 |
# reset auto_increment variables from initial saved values in |
| 138 |
# store_group_replication_auto_increment.inc |
| 139 |
--let $rpl_server_number=2 |
| 140 |
--source include/restore_group_replication_auto_increment.inc |
| 141 |
|
| 142 |
--source include/group_replication_end.inc |