| 1 |
################################################################################ |
| 2 |
# This test evaluates that group replication STOP GR is safe in error state. |
| 3 |
# |
| 4 |
# The test guide is: |
| 5 |
# 0. A two member group with started plugins. |
| 6 |
# 1. Create a table on server 1 and replicate |
| 7 |
# 2. Insert a row on server 2 with log to the binlog disabled. |
| 8 |
# 3. Insert record in server1 to put server2 in error state. |
| 9 |
# Server2 will go in ERROR state due to PRIMARY key violation. |
| 10 |
# 4. Stop GR should succed when member is in ERROR state. |
| 11 |
# 5. Clean up. |
| 12 |
################################################################################ |
| 13 |
|
| 14 |
--source include/have_debug_sync.inc |
| 15 |
--source include/have_group_replication_plugin.inc |
| 16 |
--source include/group_replication.inc |
| 17 |
|
| 18 |
--echo |
| 19 |
--echo # 1. Create a table on server 1 and replicate. |
| 20 |
--echo |
| 21 |
|
| 22 |
--let $rpl_connection_name= server1 |
| 23 |
--source include/rpl_connection.inc |
| 24 |
|
| 25 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 26 |
|
| 27 |
--source include/rpl_sync.inc |
| 28 |
|
| 29 |
--echo |
| 30 |
--echo # 2. Insert a row on server 2 with log to the binlog disabled. |
| 31 |
--echo |
| 32 |
|
| 33 |
--let $rpl_connection_name= server2 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
|
| 36 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 37 |
SET @@GLOBAL.DEBUG='+d,group_replication_applier_thread_wait_kill_pending_transaction'; |
| 38 |
|
| 39 |
SET SESSION sql_log_bin= 0; |
| 40 |
|
| 41 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker [0-9] failed executing transaction*"); |
| 42 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped,*"); |
| 43 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Could not execute Write_rows event on table .*"); |
| 44 |
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group."); |
| 45 |
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 46 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 47 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 48 |
|
| 49 |
INSERT INTO t1 VALUES (1); |
| 50 |
|
| 51 |
SET SESSION sql_log_bin= 1; |
| 52 |
|
| 53 |
--echo |
| 54 |
--echo # 3. Insert record in server1 to put server2 in error state. |
| 55 |
--echo # Server2 will go in ERROR state due to PRIMARY key violation. |
| 56 |
--echo |
| 57 |
|
| 58 |
--let $rpl_connection_name= server1 |
| 59 |
--source include/rpl_connection.inc |
| 60 |
|
| 61 |
INSERT INTO t1 VALUES (1); |
| 62 |
|
| 63 |
--let $rpl_connection_name= server2 |
| 64 |
--source include/rpl_connection.inc |
| 65 |
|
| 66 |
--let $group_replication_member_state= ERROR |
| 67 |
--source include/gr_wait_for_member_state.inc |
| 68 |
|
| 69 |
--echo |
| 70 |
--echo # 4. Stop GR should succed when member is in ERROR state. |
| 71 |
--echo |
| 72 |
|
| 73 |
SET DEBUG_SYNC= 'RESET'; |
| 74 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 75 |
SET @@GLOBAL.DEBUG='+d,group_replication_continue_kill_pending_transaction'; |
| 76 |
--source include/stop_group_replication.inc |
| 77 |
|
| 78 |
--echo |
| 79 |
--echo # 5. Clean up. |
| 80 |
--echo |
| 81 |
|
| 82 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 83 |
SET GLOBAL read_only= 0; |
| 84 |
SET SESSION sql_log_bin= 0; |
| 85 |
DELETE from t1; |
| 86 |
SET SESSION sql_log_bin= 1; |
| 87 |
--source include/start_group_replication.inc |
| 88 |
DROP TABLE t1; |
| 89 |
|
| 90 |
--source include/group_replication_end.inc |