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