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