Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test evaluates that on critical scenarios like the execution of a
3 # concurrent DDL query on the donor, the joiner cloning process will fail.
4 # It also evaluates that on errors like this that happen when all the data was
5 # already removed from the joiner, no distributed recovery attempts occur.
6 #
7 # 1. Install clone plugin on server1.
8 # 2. Bootstrap server1 and add some data
9 # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
10 # 4. Setup the server so group replication starts on boot
11 # Install the Clone plugin
12 # 5. On a empty server2 start group replication
13 # Pause it and execute a DDL query on the donor
14 # The clone process should fail on the joiner
15 # 6. Restart Group replication
16 # The clone process should now be successful
17 # 7. Cleanup
18 #
19
20 --source include/have_debug.inc
21 --source include/big_test.inc
22 --source include/have_mysqld_monitoring_process.inc
23 --source include/have_clone_plugin.inc
24 --source include/have_group_replication_plugin.inc
25 --let $rpl_skip_group_replication_start= 1
26 --source include/group_replication.inc
27
28 --echo
29 --echo ############################################################
30 --echo # 1. Install clone plugin on server1.
31
32 --let $rpl_connection_name= server1
33 --source include/rpl_connection.inc
34
35 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
36 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
37 SET GLOBAL clone_ddl_timeout = 0;
38
39 --echo
40 --echo ############################################################
41 --echo # 2. Bootstrap server1 and add some data
42
43 --source include/start_and_bootstrap_group_replication.inc
44
45 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
46 INSERT INTO t1 VALUES (1);
47 INSERT INTO t1 VALUES (2);
48
49 --echo
50 --echo #######################################################################
51 --echo # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
52
53 --let $rpl_connection_name= server2
54 --source include/rpl_connection.inc
55
56 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
57 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
58 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
59
60 --let $plugin_list= $GROUP_REPLICATION
61 --source include/spawn_monitoring_process.inc
62
63 --echo
64 --echo ############################################################
65 --echo # 4. Setup the server so group replication starts on boot
66 --echo # Install the Clone plugin
67
68 --disable_query_log
69 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
70 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
71 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
72 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
73
74 --let $_group_replication_start_on_boot_save= `SELECT @@GLOBAL.group_replication_start_on_boot`
75 SET PERSIST group_replication_start_on_boot= ON;
76 --enable_query_log
77
78 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
79 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
80
81 --echo
82 --echo ############################################################
83 --echo # 5. On a empty server2 start group replication
84 --echo # Pause it and execute a DDL query on the donor
85 --echo # The clone process should fail on the joiner
86
87 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
88
89 SET GLOBAL group_replication_clone_threshold= 1;
90 SET GLOBAL clone_autotune_concurrency = OFF;
91 SET GLOBAL clone_max_concurrency = 1;
92 SET GLOBAL clone_ddl_timeout = 0;
93
94 SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
95
96 START GROUP_REPLICATION;
97
98 SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
99 SET @@GLOBAL.DEBUG='-d,gr_clone_wait';
100
101 --let $rpl_connection_name= server_1_1
102 --source include/rpl_connection.inc
103
104 --send ALTER TABLE t1 ADD COLUMN col2 int, ALGORITHM=COPY
105
106 --let $rpl_connection_name= server1
107 --source include/rpl_connection.inc
108
109 # Wait until the ALTER TABLE is waiting for clone to bail out.
110 --let $wait_condition= SELECT PROCESSLIST_STATE="After create" FROM performance_schema.threads WHERE PROCESSLIST_INFO LIKE "ALTER TABLE t1 ADD COLUMN col2 int, ALGORITHM=COPY"
111 --source include/wait_condition.inc
112
113 --let $rpl_connection_name= server2
114 --source include/rpl_connection.inc
115
116 SET DEBUG_SYNC = 'now SIGNAL gr_clone_continue';
117
118 --let $group_replication_member_state=ERROR
119 --source include/gr_wait_for_member_state.inc
120
121 --let $assert_text= Clone should have failed
122 --let $assert_cond= [SELECT state="Failed" FROM performance_schema.clone_status] = 1;
123 --source include/assert.inc
124
125 # Verify in the log file that recovery cannot be executed
126 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
127 --let $assert_only_after = CURRENT_TEST: group_replication.gr_clone_integration_ddl_error
128 --let $assert_text = Clone failed and no recovery is possible
129 --let $assert_select = Due to a critical cloning error or lack of donors, distributed recovery cannot be executed.
130 --let $assert_count = 1
131 --source include/assert_grep.inc
132
133 --echo
134 --echo ############################################################
135 --echo # 6. Restart Group replication
136 --echo # The clone process should now be successful
137
138 --source include/stop_group_replication.inc
139
140 START GROUP_REPLICATION;
141
142 --source include/wait_until_disconnected.inc
143
144 --let $rpl_server_number= 2
145 --source include/rpl_reconnect.inc
146
147 --let $group_replication_member_state=ONLINE
148 --source include/gr_wait_for_member_state.inc
149
150 # See if the data has been properly cloned in server2
151 --let $diff_tables=server1:test.t1 ,server2:test.t1
152 --source include/diff_tables.inc
153
154 --echo
155 --echo ############################################################
156 --echo # 7. Cleanup
157
158 --replace_result $_group_replication_threshold_save CLONE_THRESHOLD_VALUE
159 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
160
161 RESET PERSIST IF EXISTS group_replication_group_name;
162 RESET PERSIST IF EXISTS group_replication_local_address;
163 RESET PERSIST IF EXISTS group_replication_group_seeds;
164 RESET PERSIST IF EXISTS group_replication_start_on_boot;
165 RESET PERSIST IF EXISTS group_replication_communication_stack;
166 --replace_result $_group_replication_start_on_boot_save START_ON_BOOT_VALUE
167 --eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot_save
168
169 --let $rpl_connection_name= server_1_1
170 --source include/rpl_connection.inc
171
172 --reap
173
174 DROP TABLE t1;
175
176 --source include/rpl_sync.inc
177
178 --let $rpl_connection_name= server2
179 --source include/rpl_connection.inc
180
181 --source include/clean_monitoring_process.inc
182
183 set session sql_log_bin=0;
184 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
185 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
186 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.");
187 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:*");
188 call mtr.add_suppression("There was an issue when cloning from another server: Error number: 3862 Error message: Clone Donor Error: 3633 : Concurrent DDL is performed during clone operation. Please try again.");
189 call mtr.add_suppression("Due to a critical cloning error or lack of donors, distributed recovery cannot be executed. The member will now leave the group.");
190 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
191 set session sql_log_bin=1;
192
193 --let $rpl_connection_name= server1
194 --source include/rpl_connection.inc
195
196 UNINSTALL PLUGIN clone;
197
198 --let $rpl_connection_name= server2
199 --source include/rpl_connection.inc
200
201 UNINSTALL PLUGIN clone;
202
203 --source include/group_replication_end.inc