| 1 |
################################################################################ |
| 2 |
# This test verifies whether the group_replication works fine when one of the |
| 3 |
# three servers in a group goes down while there are dml operations running on |
| 4 |
# some server. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. The test requires three servers: M1,M2 and M3. |
| 8 |
# 1. Start the group_replication on all the servers. |
| 9 |
# 2. CREATE TABLE ON M1 and CREATE a procedure to perform the dml |
| 10 |
# operations on the table. |
| 11 |
# 3. Call the procedure using send operation |
| 12 |
# 4. Kill and restart the server M2 |
| 13 |
# 5. Verify that there are two members in the group |
| 14 |
# 6. Start GR on server M2. |
| 15 |
# 7. Obtain the result of the send command by connecting to server M1 |
| 16 |
# 8. Verify that table t1 has same data across all the members. |
| 17 |
# 9. Clean up |
| 18 |
################################################################################ |
| 19 |
|
| 20 |
# This test does crashes servers, thence we skip it on valgrind. |
| 21 |
--source include/not_valgrind.inc |
| 22 |
--source include/big_test.inc |
| 23 |
--source include/force_restart.inc |
| 24 |
--source include/set_privilege_checks_user_as_system_user.inc |
| 25 |
--source include/have_group_replication_plugin.inc |
| 26 |
--let $rpl_server_count= 3 |
| 27 |
--source include/group_replication.inc |
| 28 |
|
| 29 |
--let $rpl_connection_name= server1 |
| 30 |
--source include/rpl_connection.inc |
| 31 |
|
| 32 |
CREATE TABLE t1(a int primary key); |
| 33 |
|
| 34 |
--source include/rpl_sync.inc |
| 35 |
|
| 36 |
# Create the procedure to perform dml operations |
| 37 |
delimiter $$; |
| 38 |
CREATE PROCEDURE dml_operations() |
| 39 |
BEGIN |
| 40 |
declare x INT; |
| 41 |
set x=1; |
| 42 |
while x<300 do |
| 43 |
insert into t1 values (x); |
| 44 |
update t1 set a=x+300 where a=x; |
| 45 |
delete from t1 where a<310; |
| 46 |
set x=x+1; |
| 47 |
end while; |
| 48 |
end$$ |
| 49 |
delimiter ;$$ |
| 50 |
--echo |
| 51 |
|
| 52 |
--echo ----call procedure---- |
| 53 |
--send call dml_operations() |
| 54 |
--echo |
| 55 |
|
| 56 |
--let $rpl_connection_name= server2 |
| 57 |
--source include/rpl_connection.inc |
| 58 |
|
| 59 |
set sql_log_bin=0; |
| 60 |
call mtr.add_suppression(".*Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state*"); |
| 61 |
call mtr.add_suppression("Error in Log_event::read_log_event()"); |
| 62 |
set sql_log_bin=1; |
| 63 |
|
| 64 |
# Wait until some data is entered into table t1 to ensure that the server2 |
| 65 |
# will get killed while there are dml operations running on server1 |
| 66 |
--let $wait_condition= SELECT COUNT(*) >20 FROM t1 |
| 67 |
--source include/wait_condition.inc |
| 68 |
|
| 69 |
# Kill server2 |
| 70 |
--echo # killing |
| 71 |
--let $group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 72 |
--let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 73 |
|
| 74 |
--let $restart_parameters=restart:--group_replication_local_address=$group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name |
| 75 |
--replace_result $group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 76 |
--source include/kill_and_restart_mysqld.inc |
| 77 |
--echo # restarting |
| 78 |
|
| 79 |
# Needed as we are not using rpl_restart_server.inc |
| 80 |
--let $rpl_server_number= 2 |
| 81 |
--source include/rpl_reconnect.inc |
| 82 |
|
| 83 |
--let $rpl_connection_name= server3 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
|
| 86 |
# Wait until group has only 2 members, that is, server2's death is detected by |
| 87 |
# the group. |
| 88 |
--echo # check that there are 2 members in the group |
| 89 |
--let $group_replication_number_of_members= 2 |
| 90 |
--source include/gr_wait_for_number_of_members.inc |
| 91 |
|
| 92 |
# Start GR on server2 |
| 93 |
--let $rpl_connection_name= server2 |
| 94 |
--source include/rpl_connection.inc |
| 95 |
--let $wait_timeout=300 |
| 96 |
--source include/start_group_replication.inc |
| 97 |
|
| 98 |
--let $rpl_connection_name= server1 |
| 99 |
--source include/rpl_connection.inc |
| 100 |
# Obtain the result of send command. |
| 101 |
reap; |
| 102 |
|
| 103 |
# Sync all the servers. |
| 104 |
--source include/rpl_sync.inc |
| 105 |
|
| 106 |
# Verify that table t1 has same data on all the servers. |
| 107 |
--let $diff_tables=server1:t1, server2:t1, server3:t1 |
| 108 |
--source include/diff_tables.inc |
| 109 |
|
| 110 |
# Clean up. |
| 111 |
drop table t1; |
| 112 |
drop procedure dml_operations; |
| 113 |
--source include/group_replication_end.inc |