| 1 |
################################################################################ |
| 2 |
# This test evaluates the plugin ability to detect error in the applier thread. |
| 3 |
# |
| 4 |
# Test: |
| 5 |
# 0) The test requires two servers. |
| 6 |
# 1) Start a 2 member group and create a table. |
| 7 |
# 2) Without logging, add a row to the table on server 1. |
| 8 |
# 3) Insert the same row on server 2. Check that server 1 errors out. After the |
| 9 |
# stop server 1 goes to OFFLINE. |
| 10 |
# 4) Clean the state. |
| 11 |
################################################################################ |
| 12 |
|
| 13 |
--source include/big_test.inc |
| 14 |
--source include/have_group_replication_plugin.inc |
| 15 |
--source include/group_replication.inc |
| 16 |
|
| 17 |
--echo # |
| 18 |
--echo # Create a table replicated to the group |
| 19 |
--echo # |
| 20 |
|
| 21 |
--let $rpl_connection_name= server1 |
| 22 |
--source include/rpl_connection.inc |
| 23 |
|
| 24 |
SET SESSION sql_log_bin= 0; |
| 25 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Could not execute Write_rows event on table test.t1;*"); |
| 26 |
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group."); |
| 27 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker .* failed executing transaction .*; Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 't1.PRIMARY'.*"); |
| 28 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped.*"); |
| 29 |
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 30 |
call mtr.add_suppression("The member is leaving a group without being on one"); |
| 31 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 32 |
call mtr.add_suppression("The member is already leaving or joining a group."); |
| 33 |
call mtr.add_suppression("Error leaving the group"); |
| 34 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 35 |
SET SESSION sql_log_bin= 1; |
| 36 |
|
| 37 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 38 |
--source include/rpl_sync.inc |
| 39 |
|
| 40 |
--echo # |
| 41 |
--echo # Insert a row on server 1 assuring it is not replicated |
| 42 |
--echo # |
| 43 |
|
| 44 |
--let $rpl_connection_name= server1 |
| 45 |
--source include/rpl_connection.inc |
| 46 |
|
| 47 |
SET SESSION sql_log_bin= 0; |
| 48 |
INSERT INTO t1 VALUES (1); |
| 49 |
SET SESSION sql_log_bin= 1; |
| 50 |
|
| 51 |
--echo # |
| 52 |
--echo # Insert the same row on server 2 |
| 53 |
--echo # |
| 54 |
|
| 55 |
--let $rpl_connection_name= server2 |
| 56 |
--source include/rpl_connection.inc |
| 57 |
|
| 58 |
INSERT INTO t1 VALUES (1); |
| 59 |
|
| 60 |
--echo # |
| 61 |
--echo # Server 1 should error out and leave the group |
| 62 |
--echo # The member state should be ERROR |
| 63 |
--echo # |
| 64 |
|
| 65 |
--let $rpl_connection_name= server1 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
--let $group_replication_member_state= ERROR |
| 69 |
--source include/gr_wait_for_member_state.inc |
| 70 |
|
| 71 |
--let $rpl_connection_name= server2 |
| 72 |
--source include/rpl_connection.inc |
| 73 |
|
| 74 |
--let $group_replication_number_of_members= 1 |
| 75 |
--source include/gr_wait_for_number_of_members.inc |
| 76 |
|
| 77 |
--echo # |
| 78 |
--echo # After the stop, the state goes to OFFLINE |
| 79 |
--echo # |
| 80 |
|
| 81 |
--let $rpl_connection_name= server1 |
| 82 |
--source include/rpl_connection.inc |
| 83 |
|
| 84 |
--source include/stop_group_replication.inc |
| 85 |
|
| 86 |
--let $group_replication_member_state= OFFLINE |
| 87 |
--source include/gr_wait_for_member_state.inc |
| 88 |
|
| 89 |
--echo # |
| 90 |
--echo # Clean |
| 91 |
--echo # |
| 92 |
|
| 93 |
SET SESSION sql_log_bin= 0; |
| 94 |
DELETE FROM t1 WHERE c1=1; |
| 95 |
SET SESSION sql_log_bin= 1; |
| 96 |
|
| 97 |
--source include/start_group_replication.inc |
| 98 |
|
| 99 |
DROP TABLE t1; |
| 100 |
|
| 101 |
--source include/group_replication_end.inc |