MySQL 8.0.32
Source Code Documentation
rpl_debug_points.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2022, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23/*****************************************************************************
24Replication debug wait points
25
26This file contains methods used to decrease pollution in replication code
27Instead of inserting a entire block
28
29 DBUG_EXECUTE_IF(rpl_replica_debug_point
30
31 now SIGNAL this
32
33 WAIT_FOR that
34
35you can simply do
36
37 DBUG_EXECUTE_IF("rpl_replica_debug_point", {rpl_replica_debug();});
38
39The ideas is to have a method per file/context, like slave, master, gtid, etc
40
41*****************************************************************************/
42
43#ifndef RPL_DEBUG_POINTS_H
44#define RPL_DEBUG_POINTS_H
45
46#ifndef NDEBUG
47
48#include "my_dbug.h"
49
51 /** stop_replica_dont_release_backup_lock */
53
54 /** pause_after_queue_event */
56
57 /** simulate_io_thd_wait_for_disk_space */
59
60 /** dbug.before_get_SOURCE_UUID */
62
63 /** dbug.simulate_busy_io */
65
66 /** dbug.before_get_UNIX_TIMESTAMP */
68
69 /** dbug.before_get_SERVER_ID */
71
72 /** rpl_before_forced_rotate */
74
75 /** calculate_sbm_after_previous_gtid_log_event */
77
78 /** calculate_sbm_after_fake_rotate_log_event */
80
81 /** rpl_ps_tables_worker_retry */
83
84 /** before_get_running_status_yes */
86
87 /** rpl_ps_tables_queue */
89
90 /** rpl_ps_tables */
92
93 /** pause_after_queue_event */
95
96 /** flush_after_reading_user_var_event */
98
99 /** pause_after_io_thread_stop_hook */
101
102 /** mta_checkpoint - start */
104
105 /** mta_checkpoint - end */
107
108 /** pause_after_sql_thread_stop_hook */
110
111 /** pause_on_queuing_event */
113
114 /** reached_heart_beat_queue_event */
116
117 /** handle_slave_io */
119
120 /** Pause on a replica thread stop after aweking the THD */
123
124/**
125 Method used to decrease code pollution in slave methods
126*/
128 THD *thd = nullptr) {
129 if (!thd) thd = current_thd;
130
131 assert(opt_debug_sync_timeout > 0);
132
133 std::string debug_point_string{""};
134
135 switch (point_id) {
136 /* stop_slave_cmd */
138 debug_point_string.assign(
139 "now SIGNAL replica_acquired_backup_lock WAIT_FOR "
140 "tried_to_lock_instance_for_backup");
141 break;
142 }
143 /* terminate_slave_threads */
145 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
146 break;
147 }
148 /* terminate_slave_threads */
150 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
151 break;
152 }
153 /* get_master_uuid */
155 debug_point_string.assign("now wait_for signal.get_source_uuid");
156 break;
157 }
158 /* get_master_uuid */
160 debug_point_string.assign(
161 "now signal Reached wait_for signal.got_stop_replica");
162 break;
163 }
164 /* get_master_version_and_clock */
166 debug_point_string.assign("now wait_for signal.get_unix_timestamp");
167 break;
168 }
169 /* get_master_version_and_clock */
171 debug_point_string.assign("now wait_for signal.get_server_id");
172 break;
173 }
174 /* wait_for_relay_log_space */
176 debug_point_string.assign(
177 "now SIGNAL signal.rpl_before_forced_rotate_reached WAIT_FOR "
178 "signal.rpl_before_forced_rotate_continue");
179 break;
180 }
181 /* exec_relay_log_event */
183 debug_point_string.assign(
184 "now signal signal.reached wait_for signal.done_sbm_calculation");
185 break;
186 }
187 /* exec_relay_log_event */
189 debug_point_string.assign(
190 "now signal signal.reached wait_for signal.done_sbm_calculation");
191 break;
192 }
193 /* exec_relay_log_event */
195 debug_point_string.assign(
196 "now SIGNAL signal.rpl_ps_tables_worker_retry_pause WAIT_FOR "
197 "signal.rpl_ps_tables_worker_retry_continue");
198 break;
199 }
200 /* handle_slave_io */
202 debug_point_string.assign("now wait_for signal.io_thread_let_running");
203 break;
204 }
205 /* handle_slave_io */
207 debug_point_string.assign(
208 "now SIGNAL signal.rpl_ps_tables_queue_before WAIT_FOR "
209 "signal.rpl_ps_tables_queue_finish");
210 break;
211 }
212 /* handle_slave_io */
214 debug_point_string.assign(
215 "now SIGNAL signal.rpl_ps_tables_queue_after_finish WAIT_FOR "
216 "signal.rpl_ps_tables_queue_continue");
217 break;
218 }
219 /* handle_slave_io */
221 debug_point_string.assign(
222 "now SIGNAL reached_after_queue_event WAIT_FOR "
223 "continue_after_queue_event");
224 break;
225 }
226 /* handle_slave_io */
228 debug_point_string.assign(
229 "now signal Reached wait_for signal.flush_complete_continue");
230 break;
231 }
232 /* handle_slave_io */
234 debug_point_string.assign(
235 "now SIGNAL reached_stopping_io_thread WAIT_FOR "
236 "continue_to_stop_io_thread");
237 break;
238 }
239 /* mta_checkpoint_routine */
241 debug_point_string.assign("now signal mta_checkpoint_start");
242 break;
243 }
244 /* mta_checkpoint_routine */
246 debug_point_string.assign("now signal mta_checkpoint_end");
247 break;
248 }
249 /* handle_slave_sql */
251 debug_point_string.assign(
252 "now SIGNAL reached_stopping_sql_thread WAIT_FOR "
253 "continue_to_stop_sql_thread");
254 break;
255 }
256 /* queue_event */
258 debug_point_string.assign(
259 "now SIGNAL reached_queuing_event WAIT_FOR continue_queuing_event");
260 break;
261 }
262 /* queue_event */
264 debug_point_string.assign(
265 "now SIGNAL check_replica_source_info WAIT_FOR proceed_write_rotate");
266 break;
267 }
268 /* handle_slave_io */
270 debug_point_string.assign(
271 "now SIGNAL wait_for_retry_count_exceed WAIT_FOR "
272 "continue_retry_count_exceed");
273 break;
274 }
275 /* terminate_slave_thread */
277 debug_point_string.assign("now signal signal.stop_point_after_awake");
278 break;
279 }
280 }
281
282 assert(!debug_point_string.empty());
283 assert(!debug_sync_set_action(thd, debug_point_string.c_str(),
284 debug_point_string.length()));
285}
286
287#endif /* NDEBUG */
288
289#endif /* RPL_DEBUG_POINTS_H */
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
thread_local THD * current_thd
Definition: current_thd.cc:25
enum_rpl_replica_debug_point
Definition: rpl_debug_points.h:50
@ DBUG_RPL_S_SBM_AFTER_FAKE_ROTATE_EV
calculate_sbm_after_fake_rotate_log_event
Definition: rpl_debug_points.h:79
@ DBUG_RPL_S_BEFORE_RUNNING_STATUS
before_get_running_status_yes
Definition: rpl_debug_points.h:85
@ DBUG_RPL_S_PS_TABLE_WORKER_RETRY
rpl_ps_tables_worker_retry
Definition: rpl_debug_points.h:82
@ DBUG_RPL_S_PAUSE_AFTER_IO_STOP
pause_after_io_thread_stop_hook
Definition: rpl_debug_points.h:100
@ DBUG_RPL_S_PAUSE_AFTER_QUEUE_EV
pause_after_queue_event
Definition: rpl_debug_points.h:94
@ DBUG_RPL_S_IO_WAIT_FOR_SPACE
simulate_io_thd_wait_for_disk_space
Definition: rpl_debug_points.h:58
@ DBUG_RPL_S_SIMULATE_BUSY_IO
dbug.simulate_busy_io
Definition: rpl_debug_points.h:64
@ DBUG_RPL_S_FLUSH_AFTER_USERV_EV
flush_after_reading_user_var_event
Definition: rpl_debug_points.h:97
@ DBUG_RPL_S_AFTER_SQL_STOP
pause_after_sql_thread_stop_hook
Definition: rpl_debug_points.h:109
@ DBUG_RPL_S_MTS_CHECKPOINT_START
mta_checkpoint - start
Definition: rpl_debug_points.h:103
@ DBUG_RPL_S_RETRY_COUNT_EXCEED
handle_slave_io
Definition: rpl_debug_points.h:118
@ DBUG_RPL_S_HEARTBEAT_EV
reached_heart_beat_queue_event
Definition: rpl_debug_points.h:115
@ DBUG_RPL_S_PAUSE_QUEUING
pause_on_queuing_event
Definition: rpl_debug_points.h:112
@ DBUG_RPL_S_BEFORE_FORCED_ROTATE
rpl_before_forced_rotate
Definition: rpl_debug_points.h:73
@ DBUG_RPL_S_PS_TABLE_QUEUE
rpl_ps_tables_queue
Definition: rpl_debug_points.h:88
@ DBUG_RPL_S_STOP_SLAVE_BACKUP_LOCK
stop_replica_dont_release_backup_lock
Definition: rpl_debug_points.h:52
@ DBUG_RPL_S_MTS_CHECKPOINT_END
mta_checkpoint - end
Definition: rpl_debug_points.h:106
@ DBUG_RPL_S_PAUSE_QUEUE_EV
pause_after_queue_event
Definition: rpl_debug_points.h:55
@ DBUG_RPL_S_PS_TABLES
rpl_ps_tables
Definition: rpl_debug_points.h:91
@ DBUG_RPL_S_BEFORE_MASTER_UUID
dbug.before_get_SOURCE_UUID
Definition: rpl_debug_points.h:61
@ DBUG_RPL_S_BEFORE_UNIX_TIMESTAMP
dbug.before_get_UNIX_TIMESTAMP
Definition: rpl_debug_points.h:67
@ DBUG_RPL_S_BEFORE_SERVER_ID
dbug.before_get_SERVER_ID
Definition: rpl_debug_points.h:70
@ DBUG_RPL_S_SBM_AFTER_PREVIOUS_GTID_EV
calculate_sbm_after_previous_gtid_log_event
Definition: rpl_debug_points.h:76
@ DBUG_RPL_R_WAIT_AFTER_AWAKE_ON_THREAD_STOP
Pause on a replica thread stop after aweking the THD.
Definition: rpl_debug_points.h:121
void rpl_replica_debug_point(enum_rpl_replica_debug_point point_id, THD *thd=nullptr)
Method used to decrease code pollution in slave methods.
Definition: rpl_debug_points.h:127