MySQL 26.10.0
Source Code Documentation
rpl_debug_points.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2026, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/*****************************************************************************
25Replication debug wait points
26
27This file contains methods used to decrease pollution in replication code
28Instead of inserting a entire block
29
30 DBUG_EXECUTE_IF(rpl_replica_debug_point
31
32 now SIGNAL this
33
34 WAIT_FOR that
35
36you can simply do
37
38 DBUG_EXECUTE_IF("rpl_replica_debug_point", {rpl_replica_debug();});
39
40The ideas is to have a method per file/context, like slave, master, gtid, etc
41
42*****************************************************************************/
43
44#ifndef RPL_DEBUG_POINTS_H
45#define RPL_DEBUG_POINTS_H
46
47#ifndef NDEBUG
48
49#include "my_dbug.h"
50
52 /** stop_replica_dont_release_backup_lock */
54
55 /** pause_after_queue_event */
57
58 /** simulate_io_thd_wait_for_disk_space */
60
61 /** dbug.before_get_SOURCE_UUID */
63
64 /** dbug.simulate_busy_io */
66
67 /** dbug.before_get_UNIX_TIMESTAMP */
69
70 /** dbug.before_get_SERVER_ID */
72
73 /** rpl_before_forced_rotate */
75
76 /** calculate_sbm_after_previous_gtid_log_event */
78
79 /** calculate_sbm_after_fake_rotate_log_event */
81
82 /** rpl_ps_tables_worker_retry */
84
85 /** before_get_running_status_yes */
87
88 /** rpl_ps_tables_queue */
90
91 /** rpl_ps_tables */
93
94 /** pause_after_queue_event */
96
97 /** flush_after_reading_user_var_event */
99
100 /** pause_after_io_thread_stop_hook */
102
103 /** mta_checkpoint - start */
105
106 /** mta_checkpoint - end */
108
109 /** pause_after_sql_thread_stop_hook */
111
112 /** pause_on_queuing_event */
114
115 /** reached_heart_beat_queue_event */
117
118 /** handle_slave_io */
120
121 /** Pause on a replica thread stop after aweking the THD */
124
125/**
126 Method used to decrease code pollution in slave methods
127*/
129 THD *thd = nullptr) {
130 if (!thd) thd = current_thd;
131
132 std::string debug_point_string{""};
133
134 switch (point_id) {
135 /* stop_slave_cmd */
137 debug_point_string.assign(
138 "now SIGNAL replica_acquired_backup_lock WAIT_FOR "
139 "tried_to_lock_instance_for_backup");
140 break;
141 }
142 /* terminate_slave_threads */
144 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
145 break;
146 }
147 /* terminate_slave_threads */
149 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
150 break;
151 }
152 /* get_master_uuid */
154 debug_point_string.assign("now wait_for signal.get_source_uuid");
155 break;
156 }
157 /* get_master_uuid */
159 debug_point_string.assign(
160 "now signal Reached wait_for signal.got_stop_replica");
161 break;
162 }
163 /* get_master_version_and_clock */
165 debug_point_string.assign("now wait_for signal.get_unix_timestamp");
166 break;
167 }
168 /* get_master_version_and_clock */
170 debug_point_string.assign("now wait_for signal.get_server_id");
171 break;
172 }
173 /* wait_for_relay_log_space */
175 debug_point_string.assign(
176 "now SIGNAL signal.rpl_before_forced_rotate_reached WAIT_FOR "
177 "signal.rpl_before_forced_rotate_continue");
178 break;
179 }
180 /* exec_relay_log_event */
182 debug_point_string.assign(
183 "now signal signal.reached wait_for signal.done_sbm_calculation");
184 break;
185 }
186 /* exec_relay_log_event */
188 debug_point_string.assign(
189 "now signal signal.reached wait_for signal.done_sbm_calculation");
190 break;
191 }
192 /* exec_relay_log_event */
194 debug_point_string.assign(
195 "now SIGNAL signal.rpl_ps_tables_worker_retry_pause WAIT_FOR "
196 "signal.rpl_ps_tables_worker_retry_continue");
197 break;
198 }
199 /* handle_slave_io */
201 debug_point_string.assign("now wait_for signal.io_thread_let_running");
202 break;
203 }
204 /* handle_slave_io */
206 debug_point_string.assign(
207 "now SIGNAL signal.rpl_ps_tables_queue_before WAIT_FOR "
208 "signal.rpl_ps_tables_queue_finish");
209 break;
210 }
211 /* handle_slave_io */
213 debug_point_string.assign(
214 "now SIGNAL signal.rpl_ps_tables_queue_after_finish WAIT_FOR "
215 "signal.rpl_ps_tables_queue_continue");
216 break;
217 }
218 /* handle_slave_io */
220 debug_point_string.assign(
221 "now SIGNAL reached_after_queue_event WAIT_FOR "
222 "continue_after_queue_event");
223 break;
224 }
225 /* handle_slave_io */
227 debug_point_string.assign(
228 "now signal Reached wait_for signal.flush_complete_continue");
229 break;
230 }
231 /* handle_slave_io */
233 debug_point_string.assign(
234 "now SIGNAL reached_stopping_io_thread WAIT_FOR "
235 "continue_to_stop_io_thread");
236 break;
237 }
238 /* mta_checkpoint_routine */
240 debug_point_string.assign("now signal mta_checkpoint_start");
241 break;
242 }
243 /* mta_checkpoint_routine */
245 debug_point_string.assign("now signal mta_checkpoint_end");
246 break;
247 }
248 /* handle_slave_sql */
250 debug_point_string.assign(
251 "now SIGNAL reached_stopping_sql_thread WAIT_FOR "
252 "continue_to_stop_sql_thread");
253 break;
254 }
255 /* queue_event */
257 debug_point_string.assign(
258 "now SIGNAL reached_queuing_event WAIT_FOR continue_queuing_event");
259 break;
260 }
261 /* queue_event */
263 debug_point_string.assign(
264 "now SIGNAL check_replica_source_info WAIT_FOR proceed_write_rotate");
265 break;
266 }
267 /* handle_slave_io */
269 debug_point_string.assign(
270 "now SIGNAL wait_for_retry_count_exceed WAIT_FOR "
271 "continue_retry_count_exceed");
272 break;
273 }
274 /* terminate_slave_thread */
276 debug_point_string.assign("now signal signal.stop_point_after_awake");
277 break;
278 }
279 }
280
281 assert(!debug_point_string.empty());
282 assert(!debug_sync_set_action(thd, debug_point_string.c_str(),
283 debug_point_string.length()));
284}
285
286#endif /* NDEBUG */
287
288#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:36
thread_local THD * current_thd
Definition: current_thd.cc:26
enum_rpl_replica_debug_point
Definition: rpl_debug_points.h:51
@ DBUG_RPL_S_SBM_AFTER_FAKE_ROTATE_EV
calculate_sbm_after_fake_rotate_log_event
Definition: rpl_debug_points.h:80
@ DBUG_RPL_S_BEFORE_RUNNING_STATUS
before_get_running_status_yes
Definition: rpl_debug_points.h:86
@ DBUG_RPL_S_PS_TABLE_WORKER_RETRY
rpl_ps_tables_worker_retry
Definition: rpl_debug_points.h:83
@ DBUG_RPL_S_PAUSE_AFTER_IO_STOP
pause_after_io_thread_stop_hook
Definition: rpl_debug_points.h:101
@ DBUG_RPL_S_PAUSE_AFTER_QUEUE_EV
pause_after_queue_event
Definition: rpl_debug_points.h:95
@ DBUG_RPL_S_IO_WAIT_FOR_SPACE
simulate_io_thd_wait_for_disk_space
Definition: rpl_debug_points.h:59
@ DBUG_RPL_S_SIMULATE_BUSY_IO
dbug.simulate_busy_io
Definition: rpl_debug_points.h:65
@ DBUG_RPL_S_FLUSH_AFTER_USERV_EV
flush_after_reading_user_var_event
Definition: rpl_debug_points.h:98
@ DBUG_RPL_S_AFTER_SQL_STOP
pause_after_sql_thread_stop_hook
Definition: rpl_debug_points.h:110
@ DBUG_RPL_S_MTS_CHECKPOINT_START
mta_checkpoint - start
Definition: rpl_debug_points.h:104
@ DBUG_RPL_S_RETRY_COUNT_EXCEED
handle_slave_io
Definition: rpl_debug_points.h:119
@ DBUG_RPL_S_HEARTBEAT_EV
reached_heart_beat_queue_event
Definition: rpl_debug_points.h:116
@ DBUG_RPL_S_PAUSE_QUEUING
pause_on_queuing_event
Definition: rpl_debug_points.h:113
@ DBUG_RPL_S_BEFORE_FORCED_ROTATE
rpl_before_forced_rotate
Definition: rpl_debug_points.h:74
@ DBUG_RPL_S_PS_TABLE_QUEUE
rpl_ps_tables_queue
Definition: rpl_debug_points.h:89
@ DBUG_RPL_S_STOP_SLAVE_BACKUP_LOCK
stop_replica_dont_release_backup_lock
Definition: rpl_debug_points.h:53
@ DBUG_RPL_S_MTS_CHECKPOINT_END
mta_checkpoint - end
Definition: rpl_debug_points.h:107
@ DBUG_RPL_S_PAUSE_QUEUE_EV
pause_after_queue_event
Definition: rpl_debug_points.h:56
@ DBUG_RPL_S_PS_TABLES
rpl_ps_tables
Definition: rpl_debug_points.h:92
@ DBUG_RPL_S_BEFORE_MASTER_UUID
dbug.before_get_SOURCE_UUID
Definition: rpl_debug_points.h:62
@ DBUG_RPL_S_BEFORE_UNIX_TIMESTAMP
dbug.before_get_UNIX_TIMESTAMP
Definition: rpl_debug_points.h:68
@ DBUG_RPL_S_BEFORE_SERVER_ID
dbug.before_get_SERVER_ID
Definition: rpl_debug_points.h:71
@ DBUG_RPL_S_SBM_AFTER_PREVIOUS_GTID_EV
calculate_sbm_after_previous_gtid_log_event
Definition: rpl_debug_points.h:77
@ DBUG_RPL_R_WAIT_AFTER_AWAKE_ON_THREAD_STOP
Pause on a replica thread stop after aweking the THD.
Definition: rpl_debug_points.h:122
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:128