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