| 1 |
################################################################################ |
| 2 |
# Validate that a group with an inbound channel does not block when a member joins. |
| 3 |
# |
| 4 |
# Test: |
| 5 |
# 0. The test requires 4 servers: |
| 6 |
# server1: group primary with an inbound channel replicating from server3 |
| 7 |
# server2: secondary |
| 8 |
# server3: secondary |
| 9 |
# server4: standalone server |
| 10 |
# 1. Bootstrap group on server1. |
| 11 |
# Start an inbound channel that replicates from server4. |
| 12 |
# 2. Create table t1 without consuming a GTID to cause a future |
| 13 |
# `group_replication_recovery` channel error. |
| 14 |
# The goal is make the join operation as short as possible, |
| 15 |
# so that we can maximize the number of joins per test. |
| 16 |
# Join server2 to the group. |
| 17 |
# 3. Create table t1 without consuming a GTID to cause a future |
| 18 |
# `group_replication_recovery` channel error. |
| 19 |
# The goal is make the join operation as short as possible, |
| 20 |
# so that we can maximize the number of joins per test. |
| 21 |
# Join server3 to the group. |
| 22 |
# 4. Begin executing a stored procedure that commits transactions continuously |
| 23 |
# "forever" (until we kill it). |
| 24 |
# 5. Wait for the duplicate table error on server2 and server3. |
| 25 |
# 6. Attempt to rejoin server2 and server3 50 times. |
| 26 |
# 7. There must be 0 applier threads on server1 with the state |
| 27 |
# 'Waiting for Binlog Group Commit ticket'. |
| 28 |
# 8. Clean up. |
| 29 |
################################################################################ |
| 30 |
--let $group_replication_group_name= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
| 31 |
--source include/big_test.inc |
| 32 |
--source include/not_valgrind.inc |
| 33 |
--source include/have_group_replication_plugin.inc |
| 34 |
--let $rpl_group_replication_single_primary_mode =1 |
| 35 |
--let $rpl_skip_group_replication_start= 1 |
| 36 |
--let $rpl_server_count= 4 |
| 37 |
--source include/group_replication.inc |
| 38 |
|
| 39 |
|
| 40 |
--echo |
| 41 |
--echo ############################################################ |
| 42 |
--echo # 1. Bootstrap group on server1. |
| 43 |
--echo # Start an inbound channel that replicates from server4. |
| 44 |
--let $rpl_connection_name= server1 |
| 45 |
--source include/rpl_connection.inc |
| 46 |
--source include/start_and_bootstrap_group_replication.inc |
| 47 |
|
| 48 |
--replace_result $SERVER_MYPORT_4 SERVER_4_PORT |
| 49 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=$SERVER_MYPORT_4 FOR CHANNEL 'ch1' |
| 50 |
|
| 51 |
--let $rpl_channel_name='ch1' |
| 52 |
--source include/start_slave.inc |
| 53 |
--let $rpl_channel_name= |
| 54 |
|
| 55 |
|
| 56 |
--echo |
| 57 |
--echo ############################################################ |
| 58 |
--echo # 2. Create table t1 without consuming a GTID to cause a future |
| 59 |
--echo # `group_replication_recovery` channel error. |
| 60 |
--echo # The goal is make the join operation as short as possible, |
| 61 |
--echo # so that we can maximize the number of joins per test. |
| 62 |
--echo # Join server2 to the group. |
| 63 |
--let $rpl_connection_name= server2 |
| 64 |
--source include/rpl_connection.inc |
| 65 |
SET SESSION sql_log_bin=0; |
| 66 |
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); |
| 67 |
SET SESSION sql_log_bin=1; |
| 68 |
--source include/start_group_replication.inc |
| 69 |
|
| 70 |
|
| 71 |
--echo |
| 72 |
--echo ############################################################ |
| 73 |
--echo # 3. Create table t1 without consuming a GTID to cause a future |
| 74 |
--echo # `group_replication_recovery` channel error. |
| 75 |
--echo # The goal is make the join operation as short as possible, |
| 76 |
--echo # so that we can maximize the number of joins per test. |
| 77 |
--echo # Join server3 to the group. |
| 78 |
--let $rpl_connection_name= server3 |
| 79 |
--source include/rpl_connection.inc |
| 80 |
SET SESSION sql_log_bin=0; |
| 81 |
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); |
| 82 |
SET SESSION sql_log_bin=1; |
| 83 |
--source include/start_group_replication.inc |
| 84 |
|
| 85 |
|
| 86 |
--echo |
| 87 |
--echo ############################################################ |
| 88 |
--echo # 4. Execute a procedure on server4 that commits transactions |
| 89 |
--echo # "forever" (until we kill the session). |
| 90 |
--let $rpl_connection_name = server4 |
| 91 |
--source include/rpl_connection.inc |
| 92 |
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); |
| 93 |
|
| 94 |
delimiter |; |
| 95 |
|
| 96 |
CREATE EVENT ev1 |
| 97 |
ON SCHEDULE |
| 98 |
EVERY 1 SECOND |
| 99 |
DO |
| 100 |
BEGIN |
| 101 |
DECLARE i INTEGER; |
| 102 |
SET i = 0; |
| 103 |
|
| 104 |
WHILE i < 5000 DO |
| 105 |
INSERT INTO t1() VALUES (); |
| 106 |
SET i = i + 1; |
| 107 |
END WHILE; |
| 108 |
END | |
| 109 |
|
| 110 |
delimiter ;| |
| 111 |
|
| 112 |
|
| 113 |
--echo |
| 114 |
--echo ############################################################ |
| 115 |
--echo # 5. Wait for the duplicate table error on server2 and server3. |
| 116 |
--let $rpl_connection_name= server2 |
| 117 |
--source include/rpl_connection.inc |
| 118 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ERROR" |
| 119 |
--source include/wait_condition.inc |
| 120 |
--source include/stop_group_replication.inc |
| 121 |
|
| 122 |
--let $rpl_connection_name= server3 |
| 123 |
--source include/rpl_connection.inc |
| 124 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ERROR" |
| 125 |
--source include/wait_condition.inc |
| 126 |
--source include/stop_group_replication.inc |
| 127 |
|
| 128 |
|
| 129 |
--echo |
| 130 |
--echo ############################################################ |
| 131 |
--echo # 6. Attempt to rejoin server2 and server3 50 times. |
| 132 |
--let $cnt=50 |
| 133 |
while ($cnt) |
| 134 |
{ |
| 135 |
--let $rpl_connection_name= server2 |
| 136 |
--source include/rpl_connection.inc |
| 137 |
--error 3092,3094 |
| 138 |
START GROUP_REPLICATION; |
| 139 |
|
| 140 |
--let $rpl_connection_name= server3 |
| 141 |
--source include/rpl_connection.inc |
| 142 |
--error 3092,3094 |
| 143 |
START GROUP_REPLICATION; |
| 144 |
|
| 145 |
--dec $cnt |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
--echo |
| 150 |
--echo ############################################################ |
| 151 |
--echo # 7. There must be 0 applier threads on server1 with the state |
| 152 |
--echo # 'Waiting for Binlog Group Commit ticket'. |
| 153 |
--let $rpl_connection_name= server1 |
| 154 |
--source include/rpl_connection.inc |
| 155 |
# We used a wait_condition instead of a assert because the last rejoin may have |
| 156 |
# caused a wait for ticket which will take some seconds to be complete. |
| 157 |
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.threads WHERE PROCESSLIST_STATE='Waiting for Binlog Group Commit ticket' |
| 158 |
--source include/wait_condition.inc |
| 159 |
|
| 160 |
|
| 161 |
--echo |
| 162 |
--echo ############################################################ |
| 163 |
--echo # 8. Clean up. |
| 164 |
--let $rpl_connection_name= server3 |
| 165 |
--source include/rpl_connection.inc |
| 166 |
DROP TABLE t1; |
| 167 |
|
| 168 |
let $messages = |
| 169 |
Replica SQL for channel 'group_replication_applier': Worker [0-9] failed executing transaction* |
| 170 |
The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group. |
| 171 |
Fatal error during execution on the Applier process of Group Replication. The server will now leave the group. |
| 172 |
The server was automatically set into read only mode after an error was detected. |
| 173 |
Skipping leave operation: concurrent attempt to leave the group is on-going. |
| 174 |
Skipping leave operation: member already left the group. |
| 175 |
Unable to confirm whether the server has left the group or not. Check *.* |
| 176 |
The server was automatically set into read only mode after an error was detected. |
| 177 |
There was a previous plugin error while the member joined the group. The member will now exit the group. |
| 178 |
Message received while the plugin is not ready, message discarded. |
| 179 |
Unable to initialize the Group Replication applier module. |
| 180 |
.*Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state* |
| 181 |
.*Coordinator experienced an error or was killed while scheduling an event at.* |
| 182 |
; |
| 183 |
--let $suppress_on_current_connection = 1 |
| 184 |
--source include/suppress_messages.inc |
| 185 |
|
| 186 |
--let $rpl_connection_name= server2 |
| 187 |
--source include/rpl_connection.inc |
| 188 |
DROP TABLE t1; |
| 189 |
|
| 190 |
# Reuse $messages defined previously. |
| 191 |
--let $suppress_on_current_connection = 1 |
| 192 |
--source include/suppress_messages.inc |
| 193 |
|
| 194 |
--let $rpl_connection_name= server1 |
| 195 |
--source include/rpl_connection.inc |
| 196 |
--let $rpl_channel_name='ch1' |
| 197 |
--source include/stop_slave.inc |
| 198 |
--let $rpl_channel_name= |
| 199 |
|
| 200 |
--source include/stop_group_replication.inc |
| 201 |
|
| 202 |
RESET REPLICA ALL FOR CHANNEL 'ch1'; |
| 203 |
|
| 204 |
DROP EVENT ev1; |
| 205 |
DROP TABLE t1; |
| 206 |
|
| 207 |
let $messages = |
| 208 |
The transaction '[a-z0-9\-]*:[0-9]*' will commit out of order with respect to its source to follow the group global order. |
| 209 |
; |
| 210 |
--let $suppress_on_current_connection = 1 |
| 211 |
--source include/suppress_messages.inc |
| 212 |
|
| 213 |
--let $rpl_connection_name= server4 |
| 214 |
--source include/rpl_connection.inc |
| 215 |
DROP EVENT ev1; |
| 216 |
DROP TABLE t1; |
| 217 |
|
| 218 |
--source include/group_replication_end.inc |