Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test verifies that if the missing transactions on a joining members are
3 # above threshold the server will use clone as its recovery strategy
4 #
5 # 0. The test requires two servers: M1 and M2.
6 # 1. Install the clone plugin on server 1
7 # 2. Bootstrap server1 and add some data
8 # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
9 # 4. Setup the server so group replication starts on boot
10 # Install the clone plugin
11 # 5. Verify clone must not override joiner data.
12 # 6. On a empty server2 start group replication
13 # Wait for it to restart and come back
14 # Check clone was completed
15 # 7. Cleanup
16 #
17
18 --source include/have_mysqld_monitoring_process.inc
19 --source include/have_clone_plugin.inc
20 --source include/have_group_replication_plugin.inc
21 --let $rpl_skip_group_replication_start= 1
22 --source include/group_replication.inc
23
24 # Validate plugins
25 --let plugins = CLONE_PLUGIN,GROUP_REPLICATION
26 --source include/check_plugin_dir.inc
27
28
29 --echo
30 --echo ############################################################
31 --echo # 1. Install clone plugin on server1.
32
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35 --let $server1_port= `SELECT @@GLOBAL.PORT`
36
37 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
38 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
39
40 --echo
41 --echo ############################################################
42 --echo # 2. Bootstrap server1 and add some data
43
44 --source include/start_and_bootstrap_group_replication.inc
45
46 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
47 INSERT INTO t1 VALUES (1);
48 INSERT INTO t1 VALUES (2);
49
50 --echo
51 --echo #######################################################################
52 --echo # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
53
54 --let $rpl_connection_name= server2
55 --source include/rpl_connection.inc
56
57 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
58 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
59 --let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot`
60 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
61
62 --let $plugin_list= $GROUP_REPLICATION
63 --source include/spawn_monitoring_process.inc
64
65 --echo
66 --echo ############################################################
67 --echo # 4. Setup the server so group replication starts on boot
68 --echo # Install the Clone plugin
69
70 --disable_query_log
71 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
72 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
73 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
74 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
75
76 SET PERSIST group_replication_start_on_boot= ON;
77 --enable_query_log
78
79 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
80 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
81
82 --echo
83 --echo ############################################################
84 --echo # 5. Verify clone must not override joiner data.
85 --echo # Joiner must fail to join the group.
86
87 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
88 SET GLOBAL group_replication_clone_threshold= 1;
89
90 --let $errand_transaction_uuid= aaabaaab-bbbb-aaaa-bbbb-aaabaaabaaab
91
92 --eval SET GTID_NEXT= "$errand_transaction_uuid:1"
93 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
94 SET GTID_NEXT= "AUTOMATIC";
95
96 --let $assert_text= The member shall contain a local transaction
97 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1";
98 --source include/assert.inc
99
100 --error ER_GROUP_REPLICATION_CONFIGURATION
101 START GROUP_REPLICATION;
102
103 #For precaution, wait for server 2 to leave before joining again.
104 --let $rpl_connection_name= server1
105 --source include/rpl_connection.inc
106
107 --let $group_replication_number_of_members= 1
108 --source include/gr_wait_for_number_of_members.inc
109
110 --let $rpl_connection_name= server2
111 --source include/rpl_connection.inc
112
113 DROP TABLE t2;
114 RESET MASTER;
115
116 --echo
117 --echo ############################################################
118 --echo # 6. On a empty server2 start group replication
119 --echo # Wait for it to restart and come back
120 --echo # Check clone was completed
121
122 SET GLOBAL group_replication_clone_threshold= 1;
123
124 START GROUP_REPLICATION;
125
126 --source include/wait_until_disconnected.inc
127
128 --let $rpl_server_number= 2
129 --source include/rpl_reconnect.inc
130
131 --let $group_replication_member_state=ONLINE
132 --source include/gr_wait_for_member_state.inc
133
134 --let $assert_text= Clone must be completed
135 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
136 --source include/assert.inc
137
138 # See if the data has been properly cloned in server2
139 --let $diff_tables=server1:test.t1 ,server2:test.t1
140 --source include/diff_tables.inc
141
142 --echo
143 --echo ############################################################
144 --echo # 7. Cleanup
145
146 --let $rpl_connection_name= server1
147 --source include/rpl_connection.inc
148
149 UNINSTALL PLUGIN clone;
150
151 DROP TABLE test.t1;
152
153 --source include/rpl_sync.inc
154
155 --let $rpl_connection_name= server2
156 --source include/rpl_connection.inc
157
158 UNINSTALL PLUGIN clone;
159
160 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
161
162 RESET PERSIST IF EXISTS group_replication_group_name;
163 RESET PERSIST IF EXISTS group_replication_local_address;
164 RESET PERSIST IF EXISTS group_replication_group_seeds;
165 RESET PERSIST IF EXISTS group_replication_start_on_boot;
166 RESET PERSIST IF EXISTS group_replication_communication_stack;
167
168 --replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE
169 --eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot
170
171 set session sql_log_bin=0;
172 call mtr.add_suppression(".*This member has more executed transactions *.*");
173 call mtr.add_suppression(".*The member contains transactions not present *.*");
174 call mtr.add_suppression("This member will start distributed recovery using clone. It is due to the number of missing transactions being higher than the configured threshold of*");
175 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
176 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
177 set session sql_log_bin=1;
178
179 --source include/clean_monitoring_process.inc
180
181 --source include/group_replication_end.inc