Debian Codegraph @

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

raw
1 ############################################################################### \
2 # This test verifies the behavior of Group Replication while cloning if you
3 # stop GR when the clone process is ongoing.
4 #
5 # 0. The test requires three servers: M1, M2 and M3.
6 # 1. Install the clone plugin on server 1
7 # 2. Bootstrap server1 and add some data
8 # 3. Install the clone plugin and start GR on server3
9 # 4. Restart server 2 with a monitoring process (mysqld_safe) if needed
10 # Setup the server so group replication starts on boot
11 # 5. Start group replication on server 2
12 # Set a debug point so clone blocks
13 # 6. Verify that the server state is RECOVERING during clone
14 # 7. Stop group replication on server 2
15 # The clone process should have been killed
16 # 8. Start GR again on server 2
17 # Clone should fix the server in proper way
18 # 9. Cleanup
19 #
20
21 --source include/big_test.inc
22 --source include/have_debug_sync.inc
23 --source include/have_mysqld_monitoring_process.inc
24 --source include/have_clone_plugin.inc
25 --source include/force_restart.inc
26 --source include/have_group_replication_plugin.inc
27 --let $rpl_server_count= 3
28 --let $rpl_skip_group_replication_start= 1
29 --source include/group_replication.inc
30
31 # Validate plugins
32 --let plugins = CLONE_PLUGIN,GROUP_REPLICATION
33 --source include/check_plugin_dir.inc
34
35 --echo
36 --echo ############################################################
37 --echo # 1. Install clone plugin on server1.
38
39 --let $rpl_connection_name= server1
40 --source include/rpl_connection.inc
41
42 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
43 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
44
45 --echo
46 --echo ############################################################
47 --echo # 2. Bootstrap server1 and add some data
48
49 --source include/start_and_bootstrap_group_replication.inc
50
51 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
52 INSERT INTO t1 VALUES (1);
53 INSERT INTO t1 VALUES (2);
54
55 --echo
56 --echo #################################################################
57 --echo # 3. Install the clone plugin and start GR on server3
58 --let $rpl_connection_name= server3
59 --source include/rpl_connection.inc
60
61 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
62 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
63
64 --source include/start_group_replication.inc
65
66 --echo
67 --echo #######################################################################
68 --echo # 4. Restart server 2 with a monitoring process (mysqld_safe) if needed
69 --echo # Setup the server so group replication starts on boot
70
71 --let $rpl_connection_name= server2
72 --source include/rpl_connection.inc
73
74 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
75 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
76 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
77
78 --let $plugin_list= $GROUP_REPLICATION
79 --source include/spawn_monitoring_process.inc
80
81 --disable_query_log
82 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
83 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
84 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
85 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
86
87 SET PERSIST group_replication_start_on_boot= ON;
88 --enable_query_log
89
90 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
91 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
92
93 --echo
94 --echo ############################################################
95 --echo # 5. Start group replication on server 2
96 --echo # Set a debug point so clone blocks
97
98 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
99 SET GLOBAL group_replication_clone_threshold= 1;
100
101 SET GLOBAL clone_autotune_concurrency = OFF;
102 SET GLOBAL clone_max_concurrency = 1;
103 SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
104
105 START GROUP_REPLICATION;
106
107 SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
108
109 --echo
110 --echo ############################################################
111 --echo # 6. Verify that the server state is RECOVERING during clone
112
113 --let $group_replication_member_state= RECOVERING
114 --source include/gr_wait_for_member_state.inc
115
116 --echo
117 --echo ############################################################
118 --echo # 7. Stop group replication on server 2
119 --echo # The clone process should have been killed
120
121 --source include/stop_group_replication.inc
122
123 --let $assert_text= Clone should have failed
124 --let $assert_cond= [SELECT state="Failed" FROM performance_schema.clone_status] = 1;
125 --source include/assert.inc
126
127 # Verify in the log file that Clone was killed
128 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
129 --let $assert_text = Clone query was aborted
130 --let $assert_select = There was an issue when cloning from another server: Error number: 1317 Error message: Query execution was interrupted
131 --let $assert_count = 1
132 --source include/assert_grep.inc
133
134 --echo
135 --echo ############################################################
136 --echo # 8. Start GR again on server 2
137 --echo # Clone should fix the server in proper way
138
139 SET DEBUG_SYNC = 'RESET';
140 SET @@GLOBAL.DEBUG = '-d,gr_clone_wait';
141
142 START GROUP_REPLICATION;
143
144 --source include/wait_until_disconnected.inc
145
146 --let $rpl_server_number= 2
147 --source include/rpl_reconnect.inc
148
149 --let $group_replication_member_state=ONLINE
150 --source include/gr_wait_for_member_state.inc
151
152 --let $assert_text= Clone must be completed
153 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
154 --source include/assert.inc
155
156 # See if the data has been properly cloned in server2
157 --let $diff_tables=server1:test.t1 ,server2:test.t1
158 --source include/diff_tables.inc
159
160 --echo
161 --echo ############################################################
162 --echo # 9. Cleanup
163
164 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
165
166 RESET PERSIST IF EXISTS group_replication_group_name;
167 RESET PERSIST IF EXISTS group_replication_local_address;
168 RESET PERSIST IF EXISTS group_replication_group_seeds;
169 RESET PERSIST IF EXISTS group_replication_start_on_boot;
170 RESET PERSIST IF EXISTS group_replication_communication_stack;
171
172 DROP TABLE t1;
173
174 --source include/rpl_sync.inc
175
176 set session sql_log_bin=0;
177 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 1.");
178 call mtr.add_suppression("Internal query: CLONE INSTANCE FROM \'root\'@\'127.0.0.1\':[0-9]+ IDENTIFIED BY \'\\*\\*\\*\\*\\*\' REQUIRE NO SSL; result in error. Error number:*");
179 call mtr.add_suppression("There was an issue when cloning from another server: Error number: 1317 Error message: Query execution was interrupted");
180 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
181 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
182 set session sql_log_bin=1;
183
184 --source include/clean_monitoring_process.inc
185
186 --source include/group_replication_end.inc