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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
################################################################################
# WL#9053
# Desc : Stop group replication on M1 using a client when some DML's(inserts) are
# happening in some other clients connected to M1
# Test:
# 0. This test requires 3 servers
# M1 -> server1, M2 -> server2, M3 -> server3
# 1. Start 3 servers and add them to group replication group
# 2. Start a insert operation on M1 which inserts 500 records
# using "send call"
# 3. perform stop GR on M1 from a parallel client when insert operation is
# going on in another client connected to M1
# 4. Check the number of servers online and status of servers (M1,M2,M3)
# 5. Join M1 back to the group
# 6. Validate the record counts on different tables from M1 and M3
# 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
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Transaction cannot be executed while Group Replication is stopping.");
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
SET SESSION sql_log_bin= 1;
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 ;$$
--source include/rpl_sync.inc
--echo
# Connect a client (server1_1) to server1 and perform insert
# operation using send call
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--echo ----call procedure----
--send call insert_into_t1()
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo ####### Wait for atleast 50 records to be inserted from the parallel client #######
--let $wait_condition= SELECT COUNT(*)>=50 FROM test.t1
--source include/wait_condition.inc
--echo ###### Stop the group replication from the parallel client on Server 1 ######
--source include/stop_group_replication.inc
--let $rpl_connection_name= server_1_1
--source include/rpl_connection.inc
--echo ####### Performing a reap for send operation #######
--error ER_RUN_HOOK_ERROR
--reap
--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
--let $rpl_connection_name= server3
--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
#
## Connect a client to S1 and start the group replication again
#
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_group_replication.inc
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
--source include/wait_condition.inc
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.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
--source include/rpl_sync.inc
# Validate the record count in all the tables in server1
--echo # Validating the records in server1 #
--let $assert_text= 'Checking the number of records in test.t1'
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t1,count, 1] >= 50
--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
--echo
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_text= 'Checking the number of records in test.t1'
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t1,count, 1] >= 50
--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
# Validate the record count in all the tables in server2
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--echo # Validating the records in server2 #
--let $assert_text= 'Checking the number of records in test.t1'
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t1,count, 1] >= 50
--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
--let $diff_tables=server1:t1, server2:t1, server3:t1
--source include/diff_tables.inc
--let $diff_tables=server1:t2, server2:t2, server3:t2
--source include/diff_tables.inc
#Cleanup
--echo #cleanup#
DROP TABLE test.t2;
DROP PROCEDURE insert_into_t1;
DROP TABLE test.t1;
--source include/group_replication_end.inc
|