MySQL 8.0.39
Source Code Documentation
rpl_debug_points.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2024, 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 assert(opt_debug_sync_timeout > 0);
133
134 std::string debug_point_string{""};
135
136 switch (point_id) {
137 /* stop_slave_cmd */
139 debug_point_string.assign(
140 "now SIGNAL replica_acquired_backup_lock WAIT_FOR "
141 "tried_to_lock_instance_for_backup");
142 break;
143 }
144 /* terminate_slave_threads */
146 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
147 break;
148 }
149 /* terminate_slave_threads */
151 debug_point_string.assign("now SIGNAL reached_stopping_io_thread");
152 break;
153 }
154 /* get_master_uuid */
156 debug_point_string.assign("now wait_for signal.get_source_uuid");
157 break;
158 }
159 /* get_master_uuid */
161 debug_point_string.assign(
162 "now signal Reached wait_for signal.got_stop_replica");
163 break;
164 }
165 /* get_master_version_and_clock */
167 debug_point_string.assign("now wait_for signal.get_unix_timestamp");
168 break;
169 }
170 /* get_master_version_and_clock */
172 debug_point_string.assign("now wait_for signal.get_server_id");
173 break;
174 }
175 /* wait_for_relay_log_space */
177 debug_point_string.assign(
178 "now SIGNAL signal.rpl_before_forced_rotate_reached WAIT_FOR "
179 "signal.rpl_before_forced_rotate_continue");
180 break;
181 }
182 /* exec_relay_log_event */
184 debug_point_string.assign(
185 "now signal signal.reached wait_for signal.done_sbm_calculation");
186 break;
187 }
188 /* exec_relay_log_event */
190 debug_point_string.assign(
191 "now signal signal.reached wait_for signal.done_sbm_calculation");
192 break;
193 }
194 /* exec_relay_log_event */
196 debug_point_string.assign(
197 "now SIGNAL signal.rpl_ps_tables_worker_retry_pause WAIT_FOR "
198 "signal.rpl_ps_tables_worker_retry_continue");
199 break;
200 }
201 /* handle_slave_io */
203 debug_point_string.assign("now wait_for signal.io_thread_let_running");
204 break;
205 }
206 /* handle_slave_io */
208 debug_point_string.assign(
209 "now SIGNAL signal.rpl_ps_tables_queue_before WAIT_FOR "
210 "signal.rpl_ps_tables_queue_finish");
211 break;
212 }
213 /* handle_slave_io */
215 debug_point_string.assign(
216 "now SIGNAL signal.rpl_ps_tables_queue_after_finish WAIT_FOR "
217 "signal.rpl_ps_tables_queue_continue");
218 break;
219 }
220 /* handle_slave_io */
222 debug_point_string.assign(
223 "now SIGNAL reached_after_queue_event WAIT_FOR "
224 "continue_after_queue_event");
225 break;
226 }
227 /* handle_slave_io */
229 debug_point_string.assign(
230 "now signal Reached wait_for signal.flush_complete_continue");
231 break;
232 }
233 /* handle_slave_io */
235 debug_point_string.assign(
236 "now SIGNAL reached_stopping_io_thread WAIT_FOR "
237 "continue_to_stop_io_thread");
238 break;
239 }
240 /* mta_checkpoint_routine */
242 debug_point_string.assign("now signal mta_checkpoint_start");
243 break;
244 }
245 /* mta_checkpoint_routine */
247 debug_point_string.assign("now signal mta_checkpoint_end");
248 break;
249 }
250 /* handle_slave_sql */
252 debug_point_string.assign(
253 "now SIGNAL reached_stopping_sql_thread WAIT_FOR "
254 "continue_to_stop_sql_thread");
255 break;
256 }
257 /* queue_event */
259 debug_point_string.assign(
260 "now SIGNAL reached_queuing_event WAIT_FOR continue_queuing_event");
261 break;
262 }
263 /* queue_event */
265 debug_point_string.assign(
266 "now SIGNAL check_replica_source_info WAIT_FOR proceed_write_rotate");
267 break;
268 }
269 /* handle_slave_io */
271 debug_point_string.assign(
272 "now SIGNAL wait_for_retry_count_exceed WAIT_FOR "
273 "continue_retry_count_exceed");
274 break;
275 }
276 /* terminate_slave_thread */
278 debug_point_string.assign("now signal signal.stop_point_after_awake");
279 break;
280 }
281 }
282
283 assert(!debug_point_string.empty());
284 assert(!debug_sync_set_action(thd, debug_point_string.c_str(),
285 debug_point_string.length()));
286}
287
288#endif /* NDEBUG */
289
290#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:34
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