| 1 |
################################################################################ |
| 2 |
# Add a member to GR group when some DML's are happenning on the GR group |
| 3 |
# |
| 4 |
# 0. Start 3 servers, and add 2 among them to GR |
| 5 |
# 1. Start an insert operation on a server in the GR group |
| 6 |
# 2. Parallely, add one more member to the GR group |
| 7 |
# 3. Validate the record counts on different tables |
| 8 |
# 4. Check the number of servers online and status of servers |
| 9 |
# 5. Cleanup |
| 10 |
################################################################################ |
| 11 |
|
| 12 |
--source include/big_test.inc |
| 13 |
--source include/set_privilege_checks_user_as_system_user.inc |
| 14 |
--source include/have_group_replication_plugin.inc |
| 15 |
--let $rpl_skip_group_replication_start= 1 |
| 16 |
--let $rpl_server_count= 3 |
| 17 |
--source include/group_replication.inc |
| 18 |
|
| 19 |
# Start group replication on two servers |
| 20 |
|
| 21 |
--echo |
| 22 |
--let $rpl_connection_name= server1 |
| 23 |
--source include/rpl_connection.inc |
| 24 |
--source include/start_and_bootstrap_group_replication.inc |
| 25 |
|
| 26 |
--echo |
| 27 |
--let $rpl_connection_name= server2 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
|
| 30 |
--source include/start_group_replication.inc |
| 31 |
|
| 32 |
# Make sure number of servers in the group is 2 |
| 33 |
--let $group_replication_number_of_members= 2 |
| 34 |
--source include/gr_wait_for_number_of_members.inc |
| 35 |
|
| 36 |
# Make 3rd member ready for starting GR |
| 37 |
--echo |
| 38 |
--let $rpl_connection_name= server3 |
| 39 |
--source include/rpl_connection.inc |
| 40 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 41 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 42 |
|
| 43 |
# Connect to server1, create a table and also define a procedure to insert data |
| 44 |
--let $rpl_connection_name= server1 |
| 45 |
--source include/rpl_connection.inc |
| 46 |
CREATE TABLE test.t1 ( a int primary key); |
| 47 |
--source include/rpl_sync.inc |
| 48 |
USE test; |
| 49 |
delimiter $$; |
| 50 |
CREATE PROCEDURE insert_into_t1() |
| 51 |
BEGIN |
| 52 |
declare x INT; |
| 53 |
set x=0; |
| 54 |
while x<100 do |
| 55 |
insert into t1 values (x); |
| 56 |
set x=x+1; |
| 57 |
end while; |
| 58 |
end$$ |
| 59 |
delimiter ;$$ |
| 60 |
--echo |
| 61 |
|
| 62 |
# Call the procedure to insert data on server1 |
| 63 |
--echo ----call procedure---- |
| 64 |
--send call insert_into_t1() |
| 65 |
--echo |
| 66 |
|
| 67 |
# Add 3rd member parallely while the insertion is in progress |
| 68 |
--echo |
| 69 |
--let $rpl_connection_name= server3 |
| 70 |
--source include/rpl_connection.inc |
| 71 |
--source include/start_group_replication_command.inc |
| 72 |
|
| 73 |
# Reap the insert call |
| 74 |
--echo |
| 75 |
--let $rpl_connection_name= server1 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
--reap |
| 78 |
|
| 79 |
# Make sure that all the servers in the group are ONLINE |
| 80 |
--echo |
| 81 |
--let $rpl_connection_name= server2 |
| 82 |
--source include/rpl_connection.inc |
| 83 |
--let $wait_timeout= 600 |
| 84 |
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 85 |
--source include/wait_condition.inc |
| 86 |
|
| 87 |
--echo |
| 88 |
--echo #Validating the records in server3# |
| 89 |
--let $rpl_connection_name= server3 |
| 90 |
--source include/rpl_connection.inc |
| 91 |
--let $wait_condition= SELECT COUNT(*)=100 FROM test.t1; |
| 92 |
--source include/wait_condition.inc |
| 93 |
--source include/rpl_sync.inc |
| 94 |
|
| 95 |
# Verify the consistency of number of records on all the servers |
| 96 |
--echo |
| 97 |
--echo #Validating the records in server2# |
| 98 |
--let $rpl_connection_name= server2 |
| 99 |
--source include/rpl_connection.inc |
| 100 |
--let $assert_text= 'Checking the number of records in test.t1' |
| 101 |
--let $assert_cond= [SELECT COUNT(*) as count FROM test.t1,count, 1] = 100 |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
# Drop the tables created and the procedures defined |
| 105 |
--echo |
| 106 |
DROP TABLE test.t1; |
| 107 |
DROP PROCEDURE insert_into_t1; |
| 108 |
|
| 109 |
--source include/group_replication_end.inc |