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
|
################################################################################
# Add a member to GR group and parallely insert data onto the non-donor
#
# 0. Start 3 servers, and add 2 among them to GR
# 1. Add 3rd member to the GR group
# 2. Insert data into the non-donor member
# 3. Validate the record counts on different tables
# 4. Check the number of servers online and status of servers
# 5. Cleanup
################################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc
# Start group replication on two servers
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET sql_log_bin=0;
CREATE TABLE test.t1 (a int primary key);
SET sql_log_bin=1;
--source include/start_and_bootstrap_group_replication.inc
--echo
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET sql_log_bin=0;
CREATE TABLE test.t1 (a int primary key);
SET sql_log_bin=1;
--source include/start_group_replication.inc
# Extract the server_uuid
--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
# Connect to server1 and add some data
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
USE test;
--disable_query_log
--let $i=100
while($i)
{
--EVAL INSERT INTO t1 VALUES ($i)
--dec $i
}
--enable_query_log
# Start GR on server3
--echo
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
SET sql_log_bin=0;
CREATE TABLE test.t1 (a int primary key);
SET sql_log_bin=1;
LOCK TABLES t1 READ;
connect(server3_2,localhost,root,,test,$SERVER_MYPORT_3,$SERVER_MYSOCK_3);
--connection server3_2
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--source include/start_group_replication_command.inc
# Find a non-donor
--let $wait_timeout= 100
let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_recovery' AND service_state='ON';
--source include/wait_condition.inc
--let $non_donor_id= 2
if (`SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_recovery' AND service_state='ON' AND source_uuid='$server2_uuid'`)
{
--let $non_donor_id= 1
}
--disconnect server3_2
--echo
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
UNLOCK TABLES;
--echo
--echo Add data on the non-donor member
--connection server$non_donor_id
USE test;
--disable_query_log
--let $i=100
--let $j=200
while($i)
{
--EVAL INSERT INTO t1 VALUES ($j)
--dec $i
--dec $j
}
--enable_query_log
# Make sure the servers are part of the group
--let $wait_timeout= 300
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
--source include/wait_condition.inc
--echo
--echo #Validating the records in server3#
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $wait_timeout= 300
--let $wait_condition= SELECT COUNT(*)=200 FROM test.t1;
--source include/wait_condition.inc
--source include/rpl_sync.inc
# Drop the tables
--echo
--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc
DROP TABLE test.t1;
--source include/group_replication_end.inc
|