Debian Codegraph @

mysql-test/suite/group_replication/t/gr_addmember_insert_on_nondonor.test

raw
1 ################################################################################
2 # Add a member to GR group and parallely insert data onto the non-donor
3 #
4 # 0. Start 3 servers, and add 2 among them to GR
5 # 1. Add 3rd member to the GR group
6 # 2. Insert data into the non-donor member
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/have_group_replication_plugin.inc
14 --let $rpl_skip_group_replication_start= 1
15 --let $rpl_server_count= 3
16 --source include/group_replication.inc
17
18 # Start group replication on two servers
19 --echo
20 --let $rpl_connection_name= server1
21 --source include/rpl_connection.inc
22 SET sql_log_bin=0;
23 CREATE TABLE test.t1 (a int primary key);
24 SET sql_log_bin=1;
25 --source include/start_and_bootstrap_group_replication.inc
26
27 --echo
28 --let $rpl_connection_name= server2
29 --source include/rpl_connection.inc
30 SET sql_log_bin=0;
31 CREATE TABLE test.t1 (a int primary key);
32 SET sql_log_bin=1;
33 --source include/start_group_replication.inc
34 # Extract the server_uuid
35 --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
36
37 # Connect to server1 and add some data
38 --echo
39 --let $rpl_connection_name= server1
40 --source include/rpl_connection.inc
41 USE test;
42 --disable_query_log
43 --let $i=100
44 while($i)
45 {
46 --EVAL INSERT INTO t1 VALUES ($i)
47 --dec $i
48 }
49 --enable_query_log
50
51 # Start GR on server3
52 --echo
53 --let $rpl_connection_name= server3
54 --source include/rpl_connection.inc
55 SET sql_log_bin=0;
56 CREATE TABLE test.t1 (a int primary key);
57 SET sql_log_bin=1;
58 LOCK TABLES t1 READ;
59
60 connect(server3_2,localhost,root,,test,$SERVER_MYPORT_3,$SERVER_MYSOCK_3);
61 --connection server3_2
62 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
63 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
64 --source include/start_group_replication_command.inc
65
66 # Find a non-donor
67 --let $wait_timeout= 100
68 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_recovery' AND service_state='ON';
69 --source include/wait_condition.inc
70
71 --let $non_donor_id= 2
72 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'`)
73 {
74 --let $non_donor_id= 1
75 }
76 --disconnect server3_2
77
78 --echo
79 --let $rpl_connection_name= server3
80 --source include/rpl_connection.inc
81 UNLOCK TABLES;
82
83 --echo
84 --echo Add data on the non-donor member
85 --connection server$non_donor_id
86 USE test;
87 --disable_query_log
88 --let $i=100
89 --let $j=200
90 while($i)
91 {
92 --EVAL INSERT INTO t1 VALUES ($j)
93 --dec $i
94 --dec $j
95 }
96 --enable_query_log
97
98 # Make sure the servers are part of the group
99 --let $wait_timeout= 300
100 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
101 --source include/wait_condition.inc
102
103 --echo
104 --echo #Validating the records in server3#
105 --let $rpl_connection_name= server3
106 --source include/rpl_connection.inc
107 --let $wait_timeout= 300
108 --let $wait_condition= SELECT COUNT(*)=200 FROM test.t1;
109 --source include/wait_condition.inc
110 --source include/rpl_sync.inc
111
112 # Drop the tables
113 --echo
114 --let $group_replication_member_state= ONLINE
115 --source include/gr_wait_for_member_state.inc
116 DROP TABLE test.t1;
117
118 --source include/group_replication_end.inc