MySQL 8.0.40
Source Code Documentation
que0que.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/que0que.h
29 Query graph
30
31 Created 5/27/1996 Heikki Tuuri
32 *******************************************************/
33
34#ifndef que0que_h
35#define que0que_h
36
37#include "data0data.h"
38#include "dict0types.h"
39#include "pars0types.h"
40#include "que0types.h"
41#include "row0types.h"
42#include "srv0srv.h"
43#include "trx0roll.h"
44#include "trx0trx.h"
45#include "univ.i"
46#include "usr0types.h"
47
48/** Mutex protecting the query threads. */
49extern ib_mutex_t que_thr_mutex;
50
51/** Creates a query graph fork node.
52 @return own: fork node */
54 que_t *graph, /*!< in: graph, if NULL then this
55 fork node is assumed to be the
56 graph root */
57 que_node_t *parent, /*!< in: parent node */
58 ulint fork_type, /*!< in: fork type */
59 mem_heap_t *heap); /*!< in: memory heap where created */
60/** Gets the first thr in a fork. */
62 que_fork_t *fork); /*!< in: query fork */
63/** Gets the child node of the first thr in a fork. */
65 que_fork_t *fork); /*!< in: query fork */
66
67/** Sets the parent of a graph node.
68@param[in] node graph node
69@param[in] parent parent */
70static inline void que_node_set_parent(que_node_t *node, que_node_t *parent);
71
72/** Creates a query graph thread node.
73@param[in] parent parent node, i.e., a fork node
74@param[in] heap memory heap where created
75@param[in] prebuilt row prebuilt structure
76@return own: query thread node */
78 row_prebuilt_t *prebuilt);
79/** Frees a query graph, but not the heap where it was created. Does not free
80 explicit cursor declarations, they are freed in que_graph_free. */
81void que_graph_free_recursive(que_node_t *node); /*!< in: query graph node */
82/** Frees a query graph. */
83void que_graph_free(que_t *graph); /*!< in: query graph; we assume that the
84 memory heap where this graph was created is
85 private to this graph: if not, then use
86 que_graph_free_recursive and free the heap
87 afterwards! */
88/** Stops a query thread if graph or trx is in a state requiring it. The
89 conditions are tested in the order (1) graph, (2) trx.
90 Caller must hold the trx mutex.
91 @param[in,out] thr query thread
92 @return true if stopped */
93bool que_thr_stop(que_thr_t *thr);
94
95/** Moves a thread from another state to the QUE_THR_RUNNING state. Increments
96 the n_active_thrs counters of the query graph and transaction. */
98 que_thr_t *thr, /*!< in: an query thread */
99 trx_t *trx); /*!< in: transaction */
100
101/** A patch for MySQL used to 'stop' a dummy query thread used in MySQL
102 select, when there is no error or lock wait.
103@param[in] thr Query thread
104@param[in] trx Transaction */
106
107/** A patch for MySQL used to 'stop' a dummy query thread used in MySQL. The
108 query thread is stopped and made inactive, except in the case where
109 it was put to the lock wait state in lock0lock.cc, but the lock has already
110 been granted or the transaction chosen as a victim in deadlock resolution. */
111void que_thr_stop_for_mysql(que_thr_t *thr); /*!< in: query thread */
112/** Run a query thread. Handles lock waits. */
113void que_run_threads(que_thr_t *thr); /*!< in: query thread */
114/** Moves a suspended query thread to the QUE_THR_RUNNING state and release
115 a worker thread to execute it. This function should be used to end
116 the wait state of a query thread waiting for a lock or a stored procedure
117 completion.
118 @return query thread instance of thread to wakeup or NULL */
119que_thr_t *que_thr_end_lock_wait(trx_t *trx); /*!< in: transaction in the
120 QUE_THR_LOCK_WAIT state */
121/** Starts execution of a command in a query fork. Picks a query thread which
122 is not in the QUE_THR_RUNNING state and moves it to that state. If none
123 can be chosen, a situation which may arise in parallelized fetches, NULL
124 is returned.
125 @return a query thread of the graph moved to QUE_THR_RUNNING state, or
126 NULL; the query thread should be executed by que_run_threads by the
127 caller */
128que_thr_t *que_fork_start_command(que_fork_t *fork); /*!< in: a query fork */
129/** Gets the trx of a query thread. */
130static inline trx_t *thr_get_trx(que_thr_t *thr); /*!< in: query thread */
131/** Determines if this thread is rolling back an incomplete transaction
132 in crash recovery.
133 @return true if thr is rolling back an incomplete transaction in crash
134 recovery */
135static inline bool thr_is_recv(const que_thr_t *thr); /*!< in: query thread */
136/** Gets the type of a graph node. */
138 const que_node_t *node); /*!< in: graph node */
139/** Gets pointer to the value data type field of a graph node. */
141 que_node_t *node); /*!< in: graph node */
142/** Gets pointer to the value dfield of a graph node. */
144 que_node_t *node); /*!< in: graph node */
145/** Gets the value buffer size of a graph node.
146 @return val buffer size, not defined if val.data == NULL in node */
148 que_node_t *node); /*!< in: graph node */
149
150/** Sets the value buffer size of a graph node.
151@param[in] node graph node
152@param[in] size size */
153static inline void que_node_set_val_buf_size(que_node_t *node, ulint size);
154
155/** Gets the next list node in a list of query graph nodes. */
157 que_node_t *node); /*!< in: node in a list */
158/** Gets the parent node of a query graph node.
159 @return parent node or NULL */
161 que_node_t *node); /*!< in: node */
162/** Get the first containing loop node (e.g. while_node_t or for_node_t) for the
163 given node, or NULL if the node is not within a loop.
164 @return containing loop node, or NULL. */
166 que_node_t *node); /*!< in: node */
167
168/** Catenates a query graph node to a list of them, possible empty list.
169@param[in] node_list node list, or NULL
170@param[in] node node
171@return one-way list of nodes */
173 que_node_t *node);
174
175/*************************************************************************
176Get the last node from the list.*/
178 /* out: node last node from list.*/
179 que_node_t *node_list); /* in: node list, or NULL */
180/** Gets a query graph node list length.
181 @return length, for NULL list 0 */
183 que_node_t *node_list); /*!< in: node list, or NULL */
184/** Checks if graph, trx, or session is in a state where the query thread should
185 be stopped.
186 @return true if should be stopped; NOTE that if the peek is made
187 without reserving the trx_t::mutex, then another peek with the mutex
188 reserved is necessary before deciding the actual stopping */
189static inline bool que_thr_peek_stop(que_thr_t *thr); /*!< in: query thread */
190/** Returns true if the query graph is for a SELECT statement.
191 @return true if a select */
192static inline bool que_graph_is_select(que_t *graph); /*!< in: graph */
193/** Prints info of an SQL query graph node. */
194void que_node_print_info(que_node_t *node); /*!< in: query graph node */
195/** Evaluate the given SQL
196@param[in] info Info struct, or nullptr.
197@param[in] sql SQL string.
198@param[in] trx Transaction.
199@return error code or DB_SUCCESS */
200dberr_t que_eval_sql(pars_info_t *info, const char *sql, trx_t *trx);
201
202/** Round robin scheduler.
203 @return a query thread of the graph moved to QUE_THR_RUNNING state, or
204 NULL; the query thread should be executed by que_run_threads by the
205 caller */
207 que_fork_t *fork, /*!< in: a query fork */
208 que_thr_t *thr); /*!< in: current pos */
209
210/** Initialise the query sub-system. */
211void que_init(void);
212
213/** Close the query sub-system. */
214void que_close(void);
215
216/** Query thread states */
220 /** in selects this means that the thread is at the end of its
221 result set (or start, in case of a scroll cursor); in other
222 statements, this means the thread has done its task */
228
229/** Query thread lock states */
235
236/** From where the cursor position is counted */
238
239/* Query graph query thread node: the fields are protected by the
240trx_t::mutex with the exceptions named below */
241
242struct que_thr_t {
243 que_common_t common; /*!< type: QUE_NODE_THR */
244 ulint magic_n; /*!< magic number to catch memory
245 corruption */
246 que_node_t *child; /*!< graph child node */
247 que_t *graph; /*!< graph where this node belongs */
248 que_thr_state_t state; /*!< state of the query thread */
249 bool is_active; /*!< true if the thread has been set
250 to the run state in
251 que_thr_move_to_run_state, but not
252 deactivated in
253 que_thr_dec_reference_count */
254 /*------------------------------*/
255 /* The following fields are private to the OS thread executing the
256 query thread, and are not protected by any mutex: */
257
258 que_node_t *run_node; /*!< pointer to the node where the
259 subgraph down from this node is
260 currently executed */
261 que_node_t *prev_node; /*!< pointer to the node from which
262 the control came */
263 ulint resource; /*!< resource usage of the query thread
264 thus far */
265 ulint lock_state; /*!< lock state of thread (table or
266 row) */
267
268 /** The thread slot in the lock_sys->waiting_threads array protected by
269 lock_sys->wait_mutex when writing to it, and also by trx->mutex when changing
270 from null to non-null.
271 While reading, one can either hold the lock_sys->wait_mutex, or hold the
272 trx->mutex and a proof that no one has woken the trx yet,
273 so the slot is either still null (if trx hadn't yet started the sleep), or
274 already non-null (if it already started sleep), but definitely not
275 changing from null to non-null (as it requires trx->mutex) nor
276 changing from non-null to null (as it happens after wake up). */
278 /*------------------------------*/
279 /* The following fields are links for the various lists that
280 this type can be on. */
282 thrs; /*!< list of thread nodes of the fork
283 node */
285 trx_thrs; /*!< lists of threads in wait list of
286 the trx */
288 queue; /*!< list of runnable thread nodes in
289 the server task queue */
290 ulint fk_cascade_depth; /*!< maximum cascading call depth
291 supported for foreign key constraint
292 related delete/updates */
293 row_prebuilt_t *prebuilt; /*!< prebuilt structure processed by
294 the query thread */
295};
296
297constexpr uint32_t QUE_THR_MAGIC_N = 8476583;
298constexpr uint32_t QUE_THR_MAGIC_FREED = 123461526;
299
300/* Query graph fork node: its fields are protected by the query thread mutex */
302 que_common_t common; /*!< type: QUE_NODE_FORK */
303 que_t *graph; /*!< query graph of this node */
304 ulint fork_type; /*!< fork type */
305 ulint n_active_thrs; /*!< if this is the root of a graph, the
306 number query threads that have been
307 started in que_thr_move_to_run_state
308 but for which que_thr_dec_refer_count
309 has not yet been called */
310 trx_t *trx; /*!< transaction: this is set only in
311 the root node */
312 ulint state; /*!< state of the fork node */
313 que_thr_t *caller; /*!< pointer to a possible calling query
314 thread */
316 thrs; /*!< list of query threads */
317 /*------------------------------*/
318 /* The fields in this section are defined only in the root node */
319 sym_tab_t *sym_tab; /*!< symbol table of the query,
320 generated by the parser, or NULL
321 if the graph was created 'by hand' */
322 pars_info_t *info; /*!< info struct, or NULL */
323 /* The following cur_... fields are relevant only in a select graph */
324
325 ulint cur_end; /*!< QUE_CUR_NOT_DEFINED, QUE_CUR_START,
326 QUE_CUR_END */
327 ulint cur_pos; /*!< if there are n rows in the result
328 set, values 0 and n + 1 mean before
329 first row, or after last row, depending
330 on cur_end; values 1...n mean a row
331 index */
332 bool cur_on_row; /*!< true if cursor is on a row, i.e.,
333 it is not before the first row or
334 after the last row */
335 sel_node_t *last_sel_node; /*!< last executed select node, or NULL
336 if none */
338 graphs; /*!< list of query graphs of a session
339 or a stored procedure */
340 /*------------------------------*/
341 mem_heap_t *heap; /*!< memory heap where the fork was
342 created */
343};
344
345/* Query fork (or graph) types */
346constexpr uint32_t QUE_FORK_SELECT_NON_SCROLL = 1; /* forward-only cursor */
347constexpr uint32_t QUE_FORK_SELECT_SCROLL = 2; /* scrollable cursor */
348constexpr uint32_t QUE_FORK_INSERT = 3;
349constexpr uint32_t QUE_FORK_UPDATE = 4;
350constexpr uint32_t QUE_FORK_ROLLBACK = 5;
351/* This is really the undo graph used in rollback,
352no signal-sending roll_node in this graph */
353constexpr uint32_t QUE_FORK_PURGE = 6;
354constexpr uint32_t QUE_FORK_EXECUTE = 7;
355constexpr uint32_t QUE_FORK_PROCEDURE = 8;
356constexpr uint32_t QUE_FORK_PROCEDURE_CALL = 9;
357constexpr uint32_t QUE_FORK_MYSQL_INTERFACE = 10;
358constexpr uint32_t QUE_FORK_RECOVERY = 11;
359
360/* Query fork (or graph) states */
361constexpr uint32_t QUE_FORK_ACTIVE = 1;
362constexpr uint32_t QUE_FORK_COMMAND_WAIT = 2;
363constexpr uint32_t QUE_FORK_INVALID = 3;
364constexpr uint32_t QUE_FORK_BEING_FREED = 4;
365
366/* Flag which is ORed to control structure statement node types */
367constexpr uint32_t QUE_NODE_CONTROL_STAT = 1024;
368
369/* Query graph node types */
370constexpr uint32_t QUE_NODE_LOCK = 1;
371constexpr uint32_t QUE_NODE_INSERT = 2;
372constexpr uint32_t QUE_NODE_UPDATE = 4;
373constexpr uint32_t QUE_NODE_CURSOR = 5;
374constexpr uint32_t QUE_NODE_SELECT = 6;
375constexpr uint32_t QUE_NODE_AGGREGATE = 7;
376constexpr uint32_t QUE_NODE_FORK = 8;
377constexpr uint32_t QUE_NODE_THR = 9;
378constexpr uint32_t QUE_NODE_UNDO = 10;
379constexpr uint32_t QUE_NODE_COMMIT = 11;
380constexpr uint32_t QUE_NODE_ROLLBACK = 12;
381constexpr uint32_t QUE_NODE_PURGE = 13;
382constexpr uint32_t QUE_NODE_SYMBOL = 14;
383constexpr uint32_t QUE_NODE_RES_WORD = 15;
384constexpr uint32_t QUE_NODE_FUNC = 16;
385constexpr uint32_t QUE_NODE_ORDER = 17;
386constexpr uint32_t QUE_NODE_PROC = 18 + QUE_NODE_CONTROL_STAT;
387constexpr uint32_t QUE_NODE_IF = 19 + QUE_NODE_CONTROL_STAT;
388constexpr uint32_t QUE_NODE_WHILE = 20 + QUE_NODE_CONTROL_STAT;
389constexpr uint32_t QUE_NODE_ASSIGNMENT = 21;
390constexpr uint32_t QUE_NODE_FETCH = 22;
391constexpr uint32_t QUE_NODE_OPEN = 23;
392constexpr uint32_t QUE_NODE_COL_ASSIGNMENT = 24;
393constexpr uint32_t QUE_NODE_FOR = 25 + QUE_NODE_CONTROL_STAT;
394constexpr uint32_t QUE_NODE_RETURN = 26;
395constexpr uint32_t QUE_NODE_ELSIF = 27;
396constexpr uint32_t QUE_NODE_CALL = 28;
397constexpr uint32_t QUE_NODE_EXIT = 29;
398
399#include "que0que.ic"
400
401#endif
SQL data field and tuple.
dberr_t
Definition: db0err.h:39
Data dictionary global types.
Log info(cout, "NOTE")
SQL parser global types.
void que_graph_free_recursive(que_node_t *node)
Frees a query graph, but not the heap where it was created.
Definition: que0que.cc:362
void que_thr_move_to_run_state_for_mysql(que_thr_t *thr, trx_t *trx)
Moves a thread from another state to the QUE_THR_RUNNING state.
Definition: que0que.cc:725
constexpr uint32_t QUE_NODE_CONTROL_STAT
Definition: que0que.h:367
static dtype_t * que_node_get_data_type(que_node_t *node)
Gets pointer to the value data type field of a graph node.
constexpr uint32_t QUE_NODE_PURGE
Definition: que0que.h:381
static que_node_t * que_node_list_get_last(que_node_t *node_list)
constexpr uint32_t QUE_FORK_PROCEDURE_CALL
Definition: que0que.h:356
static que_node_t * que_node_get_next(que_node_t *node)
Gets the next list node in a list of query graph nodes.
constexpr uint32_t QUE_NODE_ASSIGNMENT
Definition: que0que.h:389
que_cur_t
From where the cursor position is counted.
Definition: que0que.h:237
@ QUE_CUR_START
Definition: que0que.h:237
@ QUE_CUR_END
Definition: que0que.h:237
@ QUE_CUR_NOT_DEFINED
Definition: que0que.h:237
constexpr uint32_t QUE_FORK_EXECUTE
Definition: que0que.h:354
static ulint que_node_get_val_buf_size(que_node_t *node)
Gets the value buffer size of a graph node.
constexpr uint32_t QUE_NODE_UPDATE
Definition: que0que.h:372
static dfield_t * que_node_get_val(que_node_t *node)
Gets pointer to the value dfield of a graph node.
constexpr uint32_t QUE_NODE_ROLLBACK
Definition: que0que.h:380
que_thr_t * que_fork_start_command(que_fork_t *fork)
Starts execution of a command in a query fork.
Definition: que0que.cc:277
constexpr uint32_t QUE_FORK_BEING_FREED
Definition: que0que.h:364
constexpr uint32_t QUE_NODE_WHILE
Definition: que0que.h:388
constexpr uint32_t QUE_FORK_INVALID
Definition: que0que.h:363
constexpr uint32_t QUE_NODE_FETCH
Definition: que0que.h:390
void que_thr_stop_for_mysql_no_error(que_thr_t *thr, trx_t *trx)
A patch for MySQL used to 'stop' a dummy query thread used in MySQL select, when there is no error or...
Definition: que0que.cc:746
constexpr uint32_t QUE_THR_MAGIC_N
Definition: que0que.h:297
constexpr uint32_t QUE_NODE_SYMBOL
Definition: que0que.h:382
dberr_t que_eval_sql(pars_info_t *info, const char *sql, trx_t *trx)
Evaluate the given SQL.
Definition: que0que.cc:1040
constexpr uint32_t QUE_FORK_UPDATE
Definition: que0que.h:349
constexpr uint32_t QUE_THR_MAGIC_FREED
Definition: que0que.h:298
void que_run_threads(que_thr_t *thr)
Run a query thread.
Definition: que0que.cc:995
void que_thr_stop_for_mysql(que_thr_t *thr)
A patch for MySQL used to 'stop' a dummy query thread used in MySQL.
Definition: que0que.cc:687
constexpr uint32_t QUE_FORK_RECOVERY
Definition: que0que.h:358
void que_init(void)
Initialise the query sub-system.
Definition: que0que.cc:1072
que_thr_t * que_thr_create(que_fork_t *parent, mem_heap_t *heap, row_prebuilt_t *prebuilt)
Creates a query graph thread node.
Definition: que0que.cc:158
static que_thr_t * que_fork_get_first_thr(que_fork_t *fork)
Gets the first thr in a fork.
constexpr uint32_t QUE_FORK_SELECT_NON_SCROLL
Definition: que0que.h:346
constexpr uint32_t QUE_NODE_CURSOR
Definition: que0que.h:373
static ulint que_node_get_type(const que_node_t *node)
Gets the type of a graph node.
constexpr uint32_t QUE_NODE_EXIT
Definition: que0que.h:397
static ulint que_node_list_get_len(que_node_t *node_list)
Gets a query graph node list length.
static bool que_thr_peek_stop(que_thr_t *thr)
Checks if graph, trx, or session is in a state where the query thread should be stopped.
void que_graph_free(que_t *graph)
Frees a query graph.
Definition: que0que.cc:509
constexpr uint32_t QUE_FORK_PURGE
Definition: que0que.h:353
constexpr uint32_t QUE_NODE_CALL
Definition: que0que.h:396
constexpr uint32_t QUE_FORK_PROCEDURE
Definition: que0que.h:355
constexpr uint32_t QUE_NODE_FUNC
Definition: que0que.h:384
constexpr uint32_t QUE_NODE_ELSIF
Definition: que0que.h:395
constexpr uint32_t QUE_FORK_MYSQL_INTERFACE
Definition: que0que.h:357
constexpr uint32_t QUE_FORK_ACTIVE
Definition: que0que.h:361
ib_mutex_t que_thr_mutex
Mutex protecting the query threads.
que_thr_state_t
Query thread states.
Definition: que0que.h:217
@ QUE_THR_COMMAND_WAIT
Definition: que0que.h:224
@ QUE_THR_RUNNING
Definition: que0que.h:218
@ QUE_THR_SUSPENDED
Definition: que0que.h:226
@ QUE_THR_LOCK_WAIT
Definition: que0que.h:225
@ QUE_THR_COMPLETED
in selects this means that the thread is at the end of its result set (or start, in case of a scroll ...
Definition: que0que.h:223
@ QUE_THR_PROCEDURE_WAIT
Definition: que0que.h:219
static bool thr_is_recv(const que_thr_t *thr)
Determines if this thread is rolling back an incomplete transaction in crash recovery.
constexpr uint32_t QUE_NODE_ORDER
Definition: que0que.h:385
constexpr uint32_t QUE_NODE_INSERT
Definition: que0que.h:371
constexpr uint32_t QUE_FORK_COMMAND_WAIT
Definition: que0que.h:362
constexpr uint32_t QUE_NODE_IF
Definition: que0que.h:387
constexpr uint32_t QUE_FORK_ROLLBACK
Definition: que0que.h:350
constexpr uint32_t QUE_FORK_SELECT_SCROLL
Definition: que0que.h:347
constexpr uint32_t QUE_NODE_OPEN
Definition: que0que.h:391
constexpr uint32_t QUE_NODE_COMMIT
Definition: que0que.h:379
constexpr uint32_t QUE_NODE_LOCK
Definition: que0que.h:370
constexpr uint32_t QUE_NODE_FOR
Definition: que0que.h:393
bool que_thr_stop(que_thr_t *thr)
Stops a query thread if graph or trx is in a state requiring it.
Definition: que0que.cc:594
que_node_t * que_node_get_containing_loop_node(que_node_t *node)
Get the first containing loop node (e.g.
Definition: que0que.cc:764
constexpr uint32_t QUE_FORK_INSERT
Definition: que0que.h:348
que_thr_t * que_fork_scheduler_round_robin(que_fork_t *fork, que_thr_t *thr)
Round robin scheduler.
Definition: que0que.cc:233
que_thr_lock_t
Query thread lock states.
Definition: que0que.h:230
@ QUE_THR_LOCK_NOLOCK
Definition: que0que.h:231
@ QUE_THR_LOCK_TABLE
Definition: que0que.h:233
@ QUE_THR_LOCK_ROW
Definition: que0que.h:232
void que_close(void)
Close the query sub-system.
Definition: que0que.cc:1076
static trx_t * thr_get_trx(que_thr_t *thr)
Gets the trx of a query thread.
static que_node_t * que_fork_get_child(que_fork_t *fork)
Gets the child node of the first thr in a fork.
constexpr uint32_t QUE_NODE_PROC
Definition: que0que.h:386
constexpr uint32_t QUE_NODE_UNDO
Definition: que0que.h:378
que_fork_t * que_fork_create(que_t *graph, que_node_t *parent, ulint fork_type, mem_heap_t *heap)
Creates a query graph fork node.
Definition: que0que.cc:122
static que_node_t * que_node_list_add_last(que_node_t *node_list, que_node_t *node)
Catenates a query graph node to a list of them, possible empty list.
static bool que_graph_is_select(que_t *graph)
Returns true if the query graph is for a SELECT statement.
constexpr uint32_t QUE_NODE_FORK
Definition: que0que.h:376
void que_node_print_info(que_node_t *node)
Prints info of an SQL query graph node.
constexpr uint32_t QUE_NODE_SELECT
Definition: que0que.h:374
que_thr_t * que_thr_end_lock_wait(trx_t *trx)
Moves a suspended query thread to the QUE_THR_RUNNING state and release a worker thread to execute it...
Definition: que0que.cc:191
constexpr uint32_t QUE_NODE_RES_WORD
Definition: que0que.h:383
static void que_node_set_val_buf_size(que_node_t *node, ulint size)
Sets the value buffer size of a graph node.
static void que_node_set_parent(que_node_t *node, que_node_t *parent)
Sets the parent of a graph node.
constexpr uint32_t QUE_NODE_COL_ASSIGNMENT
Definition: que0que.h:392
static que_node_t * que_node_get_parent(que_node_t *node)
Gets the parent node of a query graph node.
constexpr uint32_t QUE_NODE_RETURN
Definition: que0que.h:394
constexpr uint32_t QUE_NODE_THR
Definition: que0que.h:377
constexpr uint32_t QUE_NODE_AGGREGATE
Definition: que0que.h:375
Query graph global types.
void que_node_t
Definition: que0types.h:41
Row operation global types.
The server main program.
Structure for an SQL data field.
Definition: data0data.h:617
Definition: data0type.h:498
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Extra information supplied for pars_sql().
Definition: pars0pars.h:452
Definition: que0types.h:51
Definition: que0que.h:301
ulint fork_type
fork type
Definition: que0que.h:304
que_common_t common
type: QUE_NODE_FORK
Definition: que0que.h:302
ulint n_active_thrs
if this is the root of a graph, the number query threads that have been started in que_thr_move_to_ru...
Definition: que0que.h:305
ulint state
state of the fork node
Definition: que0que.h:312
que_t * graph
query graph of this node
Definition: que0que.h:303
trx_t * trx
transaction: this is set only in the root node
Definition: que0que.h:310
que_thr_t * caller
pointer to a possible calling query thread
Definition: que0que.h:313
Definition: que0que.h:242
bool is_active
true if the thread has been set to the run state in que_thr_move_to_run_state, but not deactivated in...
Definition: que0que.h:249
que_t * graph
graph where this node belongs
Definition: que0que.h:247
ulint lock_state
lock state of thread (table or row)
Definition: que0que.h:265
row_prebuilt_t * prebuilt
prebuilt structure processed by the query thread
Definition: que0que.h:293
que_node_t * prev_node
pointer to the node from which the control came
Definition: que0que.h:261
struct srv_slot_t * slot
The thread slot in the lock_sys->waiting_threads array protected by lock_sys->wait_mutex when writing...
Definition: que0que.h:277
que_common_t common
type: QUE_NODE_THR
Definition: que0que.h:243
que_node_t * run_node
pointer to the node where the subgraph down from this node is currently executed
Definition: que0que.h:258
que_node_t * child
graph child node
Definition: que0que.h:246
que_thr_state_t state
state of the query thread
Definition: que0que.h:248
ulint magic_n
magic number to catch memory corruption
Definition: que0que.h:244
trx_thrs
lists of threads in wait list of the trx
Definition: que0que.h:285
queue
list of runnable thread nodes in the server task queue
Definition: que0que.h:288
ulint resource
resource usage of the query thread thus far
Definition: que0que.h:263
ulint fk_cascade_depth
maximum cascading call depth supported for foreign key constraint related delete/updates
Definition: que0que.h:290
thrs
list of thread nodes of the fork node
Definition: que0que.h:282
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:515
Select statement node.
Definition: row0sel.h:329
Thread slot in the thread table.
Definition: srv0srv.h:1227
Symbol table.
Definition: pars0sym.h:203
Definition: trx0trx.h:675
typedef UT_LIST_BASE_NODE_T(rw_lock_t, list) rw_lock_list_t
Transaction rollback.
The transaction.
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:406
Users and sessions global types.
#define UT_LIST_NODE_T(t)
Macro used for legacy reasons.
Definition: ut0lst.h:64