MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
que0que.cc File Reference
#include "que0que.h"
#include "usr0sess.h"
#include "trx0trx.h"
#include "trx0roll.h"
#include "row0undo.h"
#include "row0ins.h"
#include "row0upd.h"
#include "row0sel.h"
#include "row0purge.h"
#include "dict0crea.h"
#include "log0log.h"
#include "eval0proc.h"
#include "lock0lock.h"
#include "eval0eval.h"
#include "pars0types.h"
Include dependency graph for que0que.cc:

Go to the source code of this file.

Macros

#define QUE_MAX_LOOPS_WITHOUT_CHECK   16

Functions

UNIV_INTERN que_fork_tque_fork_create (que_t *graph, que_node_t *parent, ulint fork_type, mem_heap_t *heap)
UNIV_INTERN que_thr_tque_thr_create (que_fork_t *parent, mem_heap_t *heap)
UNIV_INTERN que_thr_tque_thr_end_lock_wait (trx_t *trx)
UNIV_INLINE void que_thr_init_command (que_thr_t *thr)
UNIV_INTERN que_thr_tque_fork_scheduler_round_robin (que_fork_t *fork, que_thr_t *thr)
UNIV_INTERN que_thr_tque_fork_start_command (que_fork_t *fork)
UNIV_INLINE ibool que_fork_all_thrs_in_state (que_fork_t *fork, ulint state)
UNIV_INTERN void que_graph_free_recursive (que_node_t *node)
UNIV_INTERN void que_graph_free (que_t *graph)
UNIV_INTERN ibool que_thr_stop (que_thr_t *thr)
UNIV_INTERN void que_thr_stop_for_mysql (que_thr_t *thr)
UNIV_INTERN void que_thr_move_to_run_state_for_mysql (que_thr_t *thr, trx_t *trx)
UNIV_INTERN void que_thr_stop_for_mysql_no_error (que_thr_t *thr, trx_t *trx)
UNIV_INTERN que_node_t * que_node_get_containing_loop_node (que_node_t *node)
UNIV_INTERN void que_node_print_info (que_node_t *node)
UNIV_INLINE que_thr_tque_thr_step (que_thr_t *thr)
UNIV_INTERN void que_run_threads (que_thr_t *thr)
UNIV_INTERN dberr_t que_eval_sql (pars_info_t *info, const char *sql, ibool reserve_dict_mutex, trx_t *trx)
UNIV_INTERN void que_init (void)
UNIV_INTERN void que_close (void)

Detailed Description

Query graph

Created 5/27/1996 Heikki Tuuri

Definition in file que0que.cc.

Function Documentation

UNIV_INTERN void que_close ( void  )

Close the query sub-system.

Definition at line 1314 of file que0que.cc.

UNIV_INTERN dberr_t que_eval_sql ( pars_info_t info,
const char *  sql,
ibool  reserve_dict_mutex,
trx_t trx 
)

Evaluate the given SQL.

Returns
error code or DB_SUCCESS
Parameters
infoin: info struct, or NULL
sqlin: SQL string
reserve_dict_mutexin: if TRUE, acquire/release dict_sys->mutex around call to pars_sql.
trxin: trx

Definition at line 1252 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE ibool que_fork_all_thrs_in_state ( que_fork_t fork,
ulint  state 
)

Tests if all the query threads in the same fork have a given state.

Returns
TRUE if all the query threads in the same fork were in the given state
Parameters
forkin: query fork
statein: state

Definition at line 389 of file que0que.cc.

UNIV_INTERN 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.

Returns
own: fork node
Parameters
graphin: graph, if NULL then this fork node is assumed to be the graph root
parentin: parent node
fork_typein: fork type
heapin: memory heap where created

Definition at line 129 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN que_thr_t* que_fork_scheduler_round_robin ( que_fork_t fork,
que_thr_t thr 
)

Round robin scheduler.

Returns
a query thread of the graph moved to QUE_THR_RUNNING state, or NULL; the query thread should be executed by que_run_threads by the caller
Parameters
forkin: a query fork
thrin: current pos

Definition at line 254 of file que0que.cc.

Here is the call graph for this function:

UNIV_INTERN que_thr_t* que_fork_start_command ( que_fork_t fork)

Starts execution of a command in a query fork. Picks a query thread which is not in the QUE_THR_RUNNING state and moves it to that state. If none can be chosen, a situation which may arise in parallelized fetches, NULL is returned.

Returns
a query thread of the graph moved to QUE_THR_RUNNING state, or NULL; the query thread should be executed by que_run_threads by the caller
Parameters
forkin: a query fork

Definition at line 304 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void que_graph_free ( que_t graph)

Frees a query graph.

Parameters
graphin: query graph; we assume that the memory heap where this graph was created is private to this graph: if not, then use que_graph_free_recursive and free the heap afterwards!

Definition at line 600 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void que_graph_free_recursive ( que_node_t *  node)

Frees a query graph, but not the heap where it was created. Does not free explicit cursor declarations, they are freed in que_graph_free.

Parameters
nodein: query graph node

Definition at line 429 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void que_init ( void  )

Initialise the query sub-system.

Definition at line 1304 of file que0que.cc.

Here is the caller graph for this function:

UNIV_INTERN que_node_t* que_node_get_containing_loop_node ( que_node_t *  node)

Get the first containing loop node (e.g. while_node_t or for_node_t) for the given node, or NULL if the node is not within a loop.

Returns
containing loop node, or NULL.
Parameters
nodein: node

Definition at line 928 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void que_node_print_info ( que_node_t *  node)

Prints info of an SQL query graph node.

Parameters
nodein: query graph node

Definition at line 957 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void que_run_threads ( que_thr_t thr)

Run a query thread. Handles lock waits.

Parameters
thrin: query thread

Definition at line 1199 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN que_thr_t* que_thr_create ( que_fork_t parent,
mem_heap_t heap 
)

Creates a query graph thread node.

Returns
own: query thread node
Parameters
parentin: parent node, i.e., a fork node
heapin: memory heap where created

Definition at line 164 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN que_thr_t* que_thr_end_lock_wait ( trx_t trx)

Moves a suspended query thread to the QUE_THR_RUNNING state and may release a worker thread to execute it. This function should be used to end the wait state of a query thread waiting for a lock or a stored procedure completion.

Returns
the query thread that needs to be released.
Parameters
trxin: transaction with que_state in QUE_THR_LOCK_WAIT

Definition at line 200 of file que0que.cc.

Here is the caller graph for this function:

UNIV_INLINE void que_thr_init_command ( que_thr_t thr)

Inits a query thread for a command.

Parameters
thrin: query thread

Definition at line 237 of file que0que.cc.

Here is the caller graph for this function:

UNIV_INTERN 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. Increments the n_active_thrs counters of the query graph and transaction if thr was not active.

Parameters
thrin: an query thread
trxin: transaction

Definition at line 861 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE que_thr_t* que_thr_step ( que_thr_t thr)

Performs an execution step on a query thread.

Returns
query thread to run next: it may differ from the input parameter if, e.g., a subprocedure call is made
Parameters
thrin: query thread

Definition at line 1022 of file que0que.cc.

Here is the call graph for this function:

UNIV_INTERN ibool que_thr_stop ( que_thr_t thr)

Stops a query thread if graph or trx is in a state requiring it. The conditions are tested in the order (1) graph, (2) trx.

Returns
TRUE if stopped
Parameters
thrin: query thread

Definition at line 701 of file que0que.cc.

Here is the call graph for this function:

UNIV_INTERN void que_thr_stop_for_mysql ( que_thr_t thr)

A patch for MySQL used to 'stop' a dummy query thread used in MySQL. The query thread is stopped and made inactive, except in the case where it was put to the lock wait state in lock0lock.cc, but the lock has already been granted or the transaction chosen as a victim in deadlock resolution.

Parameters
thrin: query thread

Definition at line 812 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN 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 lock wait.

Parameters
thrin: query thread
trxin: transaction

Definition at line 893 of file que0que.cc.

Here is the call graph for this function:

Here is the caller graph for this function: