| 1 |
############################################################################### |
| 2 |
# WL#9053 |
| 3 |
# Stop group replication on a (M3)particular member when some DML's are |
| 4 |
# happening on M1 |
| 5 |
# Test: |
| 6 |
# 0. This test requires 3 servers M1, M2 and M3 |
| 7 |
# M1 -> server1, M2 -> server2, M3 -> server3 |
| 8 |
# 1. Start 3 servers and add them into group replication group |
| 9 |
# 2. Start a insert operation on M1 which inserts 500 records |
| 10 |
# using "send call" |
| 11 |
# 3. Perform stop group replication on M3 in parallel |
| 12 |
# client when inserts are happening on M1 |
| 13 |
# 4. Check the number of servers online and status of servers(M1,M2,M3) |
| 14 |
# 5. Start group replication again on M3 and check the status |
| 15 |
# 6. Validate the record counts on different tables |
| 16 |
# 7. Cleanup |
| 17 |
################################################################################ |
| 18 |
--source include/big_test.inc |
| 19 |
--source include/set_privilege_checks_user_as_system_user.inc |
| 20 |
--source include/have_group_replication_plugin.inc |
| 21 |
--let $rpl_server_count= 3 |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--let $rpl_connection_name= server1 |
| 25 |
--source include/rpl_connection.inc |
| 26 |
CREATE TABLE test.t1 ( a int primary key); |
| 27 |
|
| 28 |
--source include/rpl_sync.inc |
| 29 |
|
| 30 |
USE test; |
| 31 |
delimiter $$; |
| 32 |
CREATE PROCEDURE insert_into_t1() |
| 33 |
BEGIN |
| 34 |
declare x INT; |
| 35 |
set x=1; |
| 36 |
while x<500 do |
| 37 |
insert into t1 values (x); |
| 38 |
set x=x+1; |
| 39 |
end while; |
| 40 |
end$$ |
| 41 |
delimiter ;$$ |
| 42 |
--echo |
| 43 |
|
| 44 |
# Start a insert operation in parallel client on server1 |
| 45 |
--echo ----call procedure---- |
| 46 |
--send call insert_into_t1() |
| 47 |
--echo |
| 48 |
|
| 49 |
# |
| 50 |
# Stop group replication on server3 once atleast 50 records are inserted and synched |
| 51 |
# |
| 52 |
--let $rpl_connection_name= server3 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
--let $wait_condition= SELECT COUNT(*)>=50 FROM test.t1 |
| 55 |
--source include/wait_condition.inc |
| 56 |
|
| 57 |
--echo ###### Stop the group replication on server3 ###### |
| 58 |
--source include/stop_group_replication.inc |
| 59 |
|
| 60 |
#reap has been done after send |
| 61 |
--let $rpl_connection_name= server1 |
| 62 |
--source include/rpl_connection.inc |
| 63 |
--reap |
| 64 |
|
| 65 |
# Check the no of online servers by connecting client to server 1 and server2 |
| 66 |
--echo ####### Checking the member count having online status ####### |
| 67 |
--let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" |
| 68 |
--source include/wait_condition.inc |
| 69 |
|
| 70 |
--echo |
| 71 |
--let $rpl_connection_name= server2 |
| 72 |
--source include/rpl_connection.inc |
| 73 |
|
| 74 |
--echo ####### Checking the member count having online status ####### |
| 75 |
--let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" |
| 76 |
--source include/wait_condition.inc |
| 77 |
|
| 78 |
CREATE TABLE test.t2 ( a int primary key); |
| 79 |
--disable_query_log |
| 80 |
--let $i=10 |
| 81 |
while($i) |
| 82 |
{ |
| 83 |
--EVAL INSERT INTO t2 VALUES ($i) |
| 84 |
--dec $i |
| 85 |
} |
| 86 |
--enable_query_log |
| 87 |
|
| 88 |
# Start the group replication again and check the status |
| 89 |
--echo |
| 90 |
--let $rpl_connection_name= server3 |
| 91 |
--source include/rpl_connection.inc |
| 92 |
--let $wait_timeout= 600 |
| 93 |
--source include/start_group_replication.inc |
| 94 |
|
| 95 |
# Validate the record count in all the tables in server3 |
| 96 |
--echo ##### validating the records in server3 ##### |
| 97 |
--let $assert_text= 'Checking the number of records in test.t1' |
| 98 |
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t1,count, 1] = 499 |
| 99 |
--source include/assert.inc |
| 100 |
|
| 101 |
--let $assert_text= 'Checking the number of records in test.t2' |
| 102 |
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t2,count, 1] = 10 |
| 103 |
--source include/assert.inc |
| 104 |
|
| 105 |
DROP TABLE test.t1; |
| 106 |
DROP PROCEDURE insert_into_t1; |
| 107 |
DROP TABLE test.t2; |
| 108 |
|
| 109 |
--source include/group_replication_end.inc |
| 110 |
|