Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_assign_gtids_to_anonymous_transactions_clone.test

raw
1 # ==== Purpose ====
2 #
3 # This script verifies that after cloning, the cloned server uses
4 # the UUID local to that server while generating Gtid event from
5 # anonymous_gtid event.
6 #
7 # ==== Implementation ====
8 #
9 # 1. Set up source server_1 with server_2 being a replica.
10 # 2. Create a table for testing
11 # 3. Install clone on server 2
12 # Configure server 3 to invoke clone
13 # 4. Verify the UUID being used for converting Gtid event from
14 # anonymous_gtid event.
15 #
16 --source include/big_test.inc
17 --let $rpl_gtid_utils= 1
18 --source include/have_mysqld_monitoring_process.inc
19 --source include/have_clone_plugin.inc
20 --source include/not_have_privilege_checks_user.inc
21 --source include/have_binlog_format_row.inc
22
23 # Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
24 --source include/have_slave_repository_type_table.inc
25
26 --echo #
27 --echo # 1. Set up source server_1 with server_2 being a replica.
28 --let $rpl_multi_source= 1
29 --let $rpl_topology= 1->2
30 --source include/rpl_init.inc
31
32 --connect(server_3,127.0.0.1,root,,test,$SERVER_MYPORT_3,)
33 --connect(server_3_1,127.0.0.1,root,,test,$SERVER_MYPORT_3,)
34
35 --echo #
36 --echo # 2. Create a table for testing
37
38 --let $rpl_connection_name= server_1
39 --source include/rpl_connection.inc
40
41 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
42 --let $sync_slave_connection= server_2
43 --let $rpl_channel_name= 'channel_1'
44 --source include/sync_slave_sql_with_master.inc
45
46 --echo #
47 --echo # 3. Configure ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = LOCAL on server 2
48 --echo # verify the UUID used while creating gtid_events from the corresponding
49 --echo # anonymous_gtid_event.
50 --echo # Install clone on server 2
51 --echo # Configure server 3 to invoke clone
52
53 --let $rpl_connection_name= server_2
54 --source include/rpl_connection.inc
55
56 --let $rpl_set_enforce_gtid_consistency= 1
57 --let $rpl_gtid_mode= ON
58 --let $rpl_server_numbers= 2
59 --let $rpl_skip_sync= 1
60 --source include/rpl_set_gtid_mode.inc
61 --source include/stop_slave.inc
62
63 CHANGE REPLICATION SOURCE TO ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = LOCAL for channel 'channel_1';
64 --source include/start_slave.inc
65 --let $rpl_connection_name= server_1
66 --source include/rpl_connection.inc
67 INSERT INTO t1 VALUES(10);
68
69 --let $sync_slave_connection= server_2
70
71 # Check the genereted gtid event to verify the UUID in use is that of local server.
72 --let $rpl_channel_name= 'channel_1'
73 --source include/sync_slave_sql_with_master.inc
74
75 --let server_2_uuid = `SELECT @@GLOBAL.SERVER_UUID`
76 --let $gtid_step_count= 1
77 --let $gtid_step_uuid = $server_2_uuid
78 --let $gtid_step_only_count = 1
79 --source include/gtid_step_assert.inc
80
81 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
82
83 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
84
85 --let $rpl_connection_name= server_3
86 --source include/rpl_connection.inc
87
88 # Make server 3 run with mysqld_safe
89
90 --let $mysqld_extra_settings=--skip-replica-start=1
91 --source include/spawn_monitoring_process.inc
92
93 # Install clone
94
95 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
96 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
97
98 # Set the clone valid donor list to include server 2
99
100 --replace_result $SERVER_MYPORT_2 SERVER2_PORT
101 --eval SET GLOBAL clone_valid_donor_list = 'localhost:$SERVER_MYPORT_2'
102
103 # Clone server 3 from server 2
104
105 --replace_result $SERVER_MYPORT_2 SERVER2_PORT
106 --eval CLONE INSTANCE FROM root@localhost:$SERVER_MYPORT_2 IDENTIFIED BY ''
107 --source include/wait_until_disconnected.inc
108
109 --let $rpl_server_number= 3
110 --source include/rpl_reconnect.inc
111
112 --echo #
113 --echo # Verify the UUID being used for converting Gtid event from
114 --echo # anonymous_gtid event.
115
116 --let $rpl_channel_name=
117
118 # Setting up variables to test for assign_gtids_to_anonymous_transactions:
119
120 --let $rpl_set_enforce_gtid_consistency= 1
121 --let $rpl_gtid_mode= ON
122 --let $rpl_server_numbers= 3
123 --let $rpl_skip_sync= 1
124 --source include/rpl_set_gtid_mode.inc
125
126 --source include/start_slave.inc
127 --let $rpl_connection_name= server_1
128 --source include/rpl_connection.inc
129
130 INSERT INTO t1 VALUES (1);
131
132 --let $sync_slave_connection= server_3
133 --let $rpl_channel_name= 'channel_1'
134 --source include/sync_slave_sql_with_master.inc
135 # Verifying the UUID generated for the Gtid_events
136
137 USE test;
138 --let $server_local_uuid = `SELECT @@GLOBAL.SERVER_UUID`
139 --let $gtid_step_count= 1
140 --let $gtid_step_uuid = $server_local_uuid
141 --let $gtid_step_only_count = 1
142 --source include/gtid_step_assert.inc
143
144 # Verifying that the UUID of server_2 has not been used
145 --let $gtid_step_count= 0
146 --let $gtid_step_uuid = $server_2_uuid
147 --source include/gtid_step_assert.inc
148
149 --let $server_1_data = `SELECT COUNT(*) FROM test.t1`
150 --let $assert_text= All info from server 1 is present
151 --let $assert_cond= $server_1_data = 2
152 --source include/assert.inc
153
154 #Verify that the system tables contains the correct server_uuid
155
156 --let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME="channel_1" AND ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE = '$server_local_uuid'`
157 --let $assert_text = ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE_CHECK for channel_1 in performance_schema.replication_applier_configuration is $assign_gtids_to_anonymous_transactions_value
158 --let $assert_cond = $count = 1
159 --source include/assert.inc
160
161 --let $count = `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME="channel_1" AND ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS_VALUE = '$server_local_uuid'`
162 --let $assert_text = Check entry for channel_1 in mysql.slave_relay_log_info
163 --let $assert_cond = $count = 1
164 --source include/assert.inc
165
166 --echo #
167 --echo # 8. Cleanup
168
169 --let $rpl_connection_name= server_1
170 --source include/rpl_connection.inc
171
172 DROP TABLE t1;
173
174 --let $sync_slave_connection= server_3
175 --let $rpl_channel_name= 'channel_1'
176 --source include/sync_slave_sql_with_master.inc
177
178 --let $rpl_connection_name= server_1
179 --source include/rpl_connection.inc
180
181 --let $sync_slave_connection= server_2
182 --let $rpl_channel_name= 'channel_1'
183 --source include/sync_slave_sql_with_master.inc
184
185 --let $rpl_connection_name= server_2
186 --source include/rpl_connection.inc
187
188 --source include/stop_slave.inc
189
190 # reset the gtid value to off
191 #
192 CHANGE REPLICATION SOURCE TO ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = OFF for channel 'channel_1';
193
194 --let $rpl_set_enforce_gtid_consistency= 0
195 --let $rpl_gtid_mode= OFF
196 --let $rpl_server_numbers= 2
197 --let $rpl_skip_sync= 1
198 --source include/rpl_set_gtid_mode.inc
199 --source include/start_slave.inc
200
201 UNINSTALL PLUGIN clone;
202
203 --let $rpl_connection_name= server_3
204 --source include/rpl_connection.inc
205
206 --source include/stop_slave.inc
207
208 CHANGE REPLICATION SOURCE TO ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = OFF for channel 'channel_1';
209
210 --let $rpl_set_enforce_gtid_consistency= 0
211 --let $rpl_gtid_mode= OFF
212 --let $rpl_server_numbers= 3
213 --let $rpl_skip_sync= 1
214 --source include/rpl_set_gtid_mode.inc
215 --source include/start_slave.inc
216 UNINSTALL PLUGIN clone;
217
218 --source include/clean_monitoring_process.inc
219
220 # mysqld_safe restarts but does not start slave channels
221 --disable_warnings
222
223 --let $rpl_channel_name=
224 --source include/stop_slave.inc
225
226 --enable_warnings
227
228 RESET SLAVE ALL;
229
230 set session sql_log_bin=0;
231
232 CALL mtr.add_suppression("Clone removing all user data for provisioning: Started");
233 CALL mtr.add_suppression("Clone removing all user data for provisioning: Finished");
234 CALL mtr.add_suppression("Recovery from source pos [0-9]+ and file [a-zA-Z-]+\.[0-9]+ for channel 'channel_1'*");
235 CALL mtr.add_suppression("Recovery from source pos [0-9]+ and file [a-zA-Z-]+\.[0-9]+ for channel 'channel_3'*");
236 CALL mtr.add_suppression("Applier metadata information for channel 'channel_1' was found after a clone operation. Relay log recovery*");
237 CALL mtr.add_suppression("Applier metadata information for channel 'channel_3' was found after a clone operation. Relay log recovery*");
238 CALL mtr.add_suppression("If you intend to use GTID_MODE = ON everywhere, change to ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS = OFF");
239 CALL mtr.add_suppression(".*Failed to initialize the connection metadata structure for channel.*");
240 CALL mtr.add_suppression("Error reading relay log configuration");
241
242 set session sql_log_bin=1;
243 --source include/gtid_utils_end.inc
244
245 --let $rpl_skip_sync= 1
246 --let $rpl_skip_delete_channels = 1
247 --source include/rpl_end.inc