Debian Codegraph @

mysql-test/suite/rpl/t/rpl_multi_source_relay_log.test

raw
1 --echo #########################################################################
2 --echo # Verify that the "ch1" and "ch2" channels would copy the global
3 --echo # replication filters to its own per-channel replication filters
4 --echo # when they are being created and configured by CHANGE MASTER TO
5 --echo # ... FOR CHANNEL.
6 --echo #
7 --echo # Verify RESET SLAVE and RESET SLAVE FOR CHANNEL
8 --echo # - deletes all relay log files of named channels and reinitializes
9 --echo # them.
10 --echo # - For default channel, it restart the relay log from .000001
11 --echo # - retains replication filters of the channel.
12 --echo # - For named channel, it restart the relay log from ch.000001
13 --echo # - retains all replication filters from all replication channels.
14 --echo #
15 --echo # Verify that "'RESET SLAVE ALL FOR CHANNEL '<channel_name>'" removes
16 --echo # the replication channel specified by 'FOR CHANNEL' clause and all
17 --echo # replication filters of the channel. There is no effect to other
18 --echo # channels.
19 --echo #
20 --echo # "RESET SLAVE ALL FOR CHANNEL ''" removes the default channel and all
21 --echo # replication filters of the channel firstly, but then create a new
22 --echo # default channel which is not configured yet. So performance_schema.
23 --echo # replication_applier_filters and SHOW SLAVE STATUS do not show it.
24 --echo #
25 --echo # Verify that default channel would copy global replication filters
26 --echo # to its per-channel replication filters if there are no per-channel
27 --echo # replication filters and there are global replication filters on the
28 --echo # filter type when it is being configured. Then performance_schema.
29 --echo # replication_applier_filters and SHOW SLAVE STATUS show it.
30 --echo #
31 --echo # Verify that "RESET SLAVE ALL" with no FOR CHANNEL clause removes all
32 --echo # replication channels, so it shall remove all per-channel replication
33 --echo # filters but does not touch all global replication filters. When the
34 --echo # new channel is being configured, it therefore uses the global filters
35 --echo # (copies all global replication filters to its own per-channel
36 --echo # replication filters).
37 --echo #
38 --echo #########################################################################
39 # The test doesn't relate to binlog format, so it is just tested on mixed mode.
40 #Skip on group replication runs
41 --source include/not_group_replication_plugin.inc
42
43 # Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
44 --source include/have_slave_repository_type_table.inc
45
46 --source include/have_binlog_format_mixed.inc
47 --source include/master-slave.inc
48
49 # Clean all configuration changes after running the test.
50 --source include/force_restart.inc
51
52 --source include/rpl_connection_slave.inc
53 --let $datadir= `SELECT @@GLOBAL.datadir`
54
55 --echo #
56 --echo # Verify that the "ch1" and "ch2" channels would copy the global
57 --echo # replication filters to its own per-channel replication filters
58 --echo # when they are being created and configured by CHANGE MASTER TO
59 --echo # ... FOR CHANNEL.
60 --echo #
61 SELECT COUNT(*) FROM performance_schema.replication_applier_global_filters;
62 SELECT FILTER_NAME, FILTER_RULE, CONFIGURED_BY FROM performance_schema.replication_applier_global_filters;
63 CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10 FOR CHANNEL "ch1";
64 CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch2";
65 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
66 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
67
68 FLUSH RELAY LOGS;
69 FLUSH RELAY LOGS FOR CHANNEL "ch1";
70 FLUSH RELAY LOGS FOR CHANNEL "ch2";
71
72 --echo #
73 --echo # Show replication filters for channel 'ch1' and 'ch2' at beginning.
74 --echo #
75 --let $rpl_channel_name= 'ch1'
76 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
77 --source include/show_slave_status.inc
78 --let $rpl_channel_name= 'ch2'
79 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
80 --source include/show_slave_status.inc
81 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
82 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
83
84 --echo #
85 --echo # RESET SLAVE FOR CHANNEL "ch1" deletes all relay log files of ch1.
86 --echo #
87 eval RESET SLAVE FOR CHANNEL "ch1";
88
89 --echo #
90 --echo # Verify that "RESET SLAVE FOR CHANNEL '<channel_name>'" retains
91 --echo # replication filters of the channel.
92 --echo #
93 --let $rpl_channel_name= 'ch1'
94 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
95 --source include/show_slave_status.inc
96 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
97 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
98
99 # all files of "ch1" are deleted and recreated.
100 --list_files $datadir *ch1*
101
102 --echo #
103 --echo # RESET SLAVE deletes all relay log files of ch2
104 --echo #
105 --let $rpl_channel_name=
106 --disable_warnings
107 --source include/stop_slave.inc
108 --enable_warnings
109 RESET SLAVE;
110
111 --echo #
112 --echo # Verify that "RESET SLAVE" retains all replication filters from
113 --echo # all replication channels.
114 --echo #
115 --let $rpl_channel_name= 'ch1'
116 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
117 --source include/show_slave_status.inc
118 --let $rpl_channel_name= 'ch2'
119 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
120 --source include/show_slave_status.inc
121 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
122 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
123
124 # all files of "ch2" are deleted and recreated.
125 --list_files $datadir *ch2*
126
127 --echo #
128 --echo # RESET SLAVE resets relay log of default channel from .000001
129 --echo #
130 # relay log files of default channel is still there
131 --let $relay_log_index= `SELECT @@GLOBAL.relay_log_index`
132 --file_exists $relay_log_index
133
134 --let $relay_log_basename= `SELECT @@GLOBAL.relay_log_basename`
135 --file_exists $relay_log_basename.000001
136
137 --echo #
138 --echo # Relay log files for all channels are recreated automatically.
139 --echo #
140
141 # Check that files exist.
142 --let $relay_log_base_name= `SELECT @@GLOBAL.relay_log_basename`
143 --file_exists $relay_log_base_name-ch1.000001
144 --file_exists $relay_log_base_name-ch2.000001
145
146 RESET SLAVE ALL FOR CHANNEL 'ch1';
147 --echo #
148 --echo # Verify that "'RESET SLAVE ALL FOR CHANNEL '<channel_name>'" removes
149 --echo # the replication channel specified by 'FOR CHANNEL' clause and all
150 --echo # replication filters of the channel. There is no effect to other
151 --echo # channels.
152 --echo #
153 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
154 RESET SLAVE ALL FOR CHANNEL 'ch1';
155 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
156 SHOW SLAVE STATUS FOR CHANNEL 'ch1';
157 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
158 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
159
160 RESET SLAVE ALL FOR CHANNEL '';
161 --echo #
162 --echo # "RESET SLAVE ALL FOR CHANNEL ''" removes the default channel and all
163 --echo # replication filters of the channel firstly, but then create a new
164 --echo # default channel which is not configured yet. So performance_schema.
165 --echo # replication_applier_filters and SHOW SLAVE STATUS do not show it.
166 --echo #
167 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
168 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
169 --let $rpl_channel_name= ''
170 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
171 --source include/show_slave_status.inc
172
173 --echo #
174 --echo # Verify that default channel would copy global replication filters
175 --echo # to its per-channel replication filters if there are no per-channel
176 --echo # replication filters and there are global replication filters on the
177 --echo # filter type when it is being configured. Then performance_schema.
178 --echo # replication_applier_filters and SHOW SLAVE STATUS show it.
179 --echo #
180 --disable_warnings
181 --replace_result $MASTER_MYPORT MASTER_PORT
182 eval CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_PORT=$MASTER_MYPORT,
183 SOURCE_USER="root" FOR CHANNEL '';
184 --enable_warnings
185 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
186 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
187 --let $rpl_channel_name= ''
188 --let $status_items= Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table, Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, Replicate_Rewrite_DB
189 --source include/show_slave_status.inc
190
191 --echo #
192 --echo # Verify that "RESET SLAVE ALL" with no FOR CHANNEL clause removes all
193 --echo # replication channels, so it shall remove all per-channel replication
194 --echo # filters but does not touch all global replication filters. When the
195 --echo # new channel is being configured, it therefore uses the global filters
196 --echo # (copies all global replication filters to its own per-channel
197 --echo # replication filters).
198 --echo #
199 RESET SLAVE ALL;
200
201 # all files of "ch1" and "ch2" are removed
202 --list_files $datadir *ch1*
203 --list_files $datadir *ch2*
204
205 # relay log files of default channel is still there
206 --let $relay_log_index= `SELECT @@GLOBAL.relay_log_index`
207 --file_exists $relay_log_index
208
209 --let $relay_log_basename= `SELECT @@GLOBAL.relay_log_basename`
210 --file_exists $relay_log_basename.000001
211
212 # Verify that "RESET SLAVE ALL" removes all replication channels and
213 # clear all replication filters but does not touch all global
214 # replication filters.
215 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
216 SHOW SLAVE STATUS FOR CHANNEL 'ch1';
217 --error ER_REPLICA_CHANNEL_DOES_NOT_EXIST
218 SHOW SLAVE STATUS FOR CHANNEL 'ch2';
219 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
220 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
221 SELECT COUNT(*) FROM performance_schema.replication_applier_global_filters;
222 SELECT FILTER_NAME, FILTER_RULE, CONFIGURED_BY FROM performance_schema.replication_applier_global_filters;
223
224 # When the new channel is being configured, it therefore uses the global
225 # filters (copies all global replication filters to its own per-channel
226 # replication filters).
227 --disable_warnings
228 --replace_result $MASTER_MYPORT MASTER_PORT
229 eval CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_PORT=$MASTER_MYPORT,
230 SOURCE_USER="root";
231 --enable_warnings
232 SELECT COUNT(*) FROM performance_schema.replication_applier_filters;
233 SELECT CHANNEL_NAME, FILTER_NAME, FILTER_RULE, CONFIGURED_BY, COUNTER FROM performance_schema.replication_applier_filters;
234
235 --let $rpl_channel_name=
236 --source include/start_slave.inc
237 --source include/rpl_end.inc
238