📄 que0que.h
字号:
/*======================*/ /* out: val buffer size, not defined if val.data == NULL in node */ que_node_t* node); /* in: graph node *//***************************************************************************Sets the value buffer size of a graph node. */UNIV_INLINEvoidque_node_set_val_buf_size(/*======================*/ que_node_t* node, /* in: graph node */ ulint size); /* in: size *//*************************************************************************Gets the next list node in a list of query graph nodes. */UNIV_INLINEque_node_t*que_node_get_next(/*==============*/ que_node_t* node); /* in: node in a list *//*************************************************************************Gets the parent node of a query graph node. */UNIV_INLINEque_node_t*que_node_get_parent(/*================*/ /* out: parent node or NULL */ que_node_t* node); /* in: node *//*************************************************************************Catenates a query graph node to a list of them, possible empty list. */UNIV_INLINEque_node_t*que_node_list_add_last(/*===================*/ /* out: one-way list of nodes */ que_node_t* node_list, /* in: node list, or NULL */ que_node_t* node); /* in: node *//*************************************************************************Gets a query graph node list length. */UNIV_INLINEulintque_node_list_get_len(/*==================*/ /* out: length, for NULL list 0 */ que_node_t* node_list); /* in: node list, or NULL *//**************************************************************************Checks if graph, trx, or session is in a state where the query thread shouldbe stopped. */UNIV_INLINEiboolque_thr_peek_stop(/*==============*/ /* out: TRUE if should be stopped; NOTE that if the peek is made without reserving the kernel mutex, then another peek with the mutex reserved is necessary before deciding the actual stopping */ que_thr_t* thr); /* in: query thread *//***************************************************************************Returns TRUE if the query graph is for a SELECT statement. */UNIV_INLINEiboolque_graph_is_select(/*================*/ /* out: TRUE if a select */ que_t* graph); /* in: graph *//**************************************************************************Prints info of an SQL query graph node. */voidque_node_print_info(/*================*/ que_node_t* node); /* in: query graph node *//* Query graph query thread node: the fields are protected by the kernelmutex with the exceptions named below */struct que_thr_struct{ que_common_t common; /* type: QUE_NODE_THR */ ulint magic_n; /* magic number to catch memory corruption */ que_node_t* child; /* graph child node */ que_t* graph; /* graph where this node belongs */ ibool is_active; /* TRUE if the thread has been set to the run state in que_thr_move_to_run_state, but not deactivated in que_thr_dec_reference_count */ ulint state; /* state of the query thread */ UT_LIST_NODE_T(que_thr_t) thrs; /* list of thread nodes of the fork node */ UT_LIST_NODE_T(que_thr_t) trx_thrs; /* lists of threads in wait list of the trx */ UT_LIST_NODE_T(que_thr_t) queue; /* list of runnable thread nodes in the server task queue */ /*------------------------------*/ /* The following fields are private to the OS thread executing the query thread, and are not protected by the kernel mutex: */ que_node_t* run_node; /* pointer to the node where the subgraph down from this node is currently executed */ que_node_t* prev_node; /* pointer to the node from which the control came */ ulint resource; /* resource usage of the query thread thus far */ ulint lock_state; /* lock state of thread (table or row) */};#define QUE_THR_MAGIC_N 8476583#define QUE_THR_MAGIC_FREED 123461526/* Query graph fork node: its fields are protected by the kernel mutex */struct que_fork_struct{ que_common_t common; /* type: QUE_NODE_FORK */ que_t* graph; /* query graph of this node */ ulint fork_type; /* fork type */ 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_run_state but for which que_thr_dec_refer_count has not yet been called */ trx_t* trx; /* transaction: this is set only in the root node */ ulint state; /* state of the fork node */ que_thr_t* caller; /* pointer to a possible calling query thread */ UT_LIST_BASE_NODE_T(que_thr_t) thrs; /* list of query threads */ /*------------------------------*/ /* The fields in this section are defined only in the root node */ sym_tab_t* sym_tab; /* symbol table of the query, generated by the parser, or NULL if the graph was created 'by hand' */ /* The following cur_... fields are relevant only in a select graph */ ulint cur_end; /* QUE_CUR_NOT_DEFINED, QUE_CUR_START, QUE_CUR_END */ ulint cur_pos; /* if there are n rows in the result set, values 0 and n + 1 mean before first row, or after last row, depending on cur_end; values 1...n mean a row index */ ibool cur_on_row; /* TRUE if cursor is on a row, i.e., it is not before the first row or after the last row */ dulint n_inserts; /* number of rows inserted */ dulint n_updates; /* number of rows updated */ dulint n_deletes; /* number of rows deleted */ sel_node_t* last_sel_node; /* last executed select node, or NULL if none */ UT_LIST_NODE_T(que_fork_t) graphs; /* list of query graphs of a session or a stored procedure */ /*------------------------------*/ mem_heap_t* heap; /* memory heap where the fork was created */ };/* Query fork (or graph) types */#define QUE_FORK_SELECT_NON_SCROLL 1 /* forward-only cursor */#define QUE_FORK_SELECT_SCROLL 2 /* scrollable cursor */#define QUE_FORK_INSERT 3#define QUE_FORK_UPDATE 4#define QUE_FORK_ROLLBACK 5 /* This is really the undo graph used in rollback, no signal-sending roll_node in this graph */#define QUE_FORK_PURGE 6#define QUE_FORK_EXECUTE 7#define QUE_FORK_PROCEDURE 8#define QUE_FORK_PROCEDURE_CALL 9#define QUE_FORK_MYSQL_INTERFACE 10#define QUE_FORK_RECOVERY 11/* Query fork (or graph) states */#define QUE_FORK_ACTIVE 1#define QUE_FORK_COMMAND_WAIT 2#define QUE_FORK_INVALID 3#define QUE_FORK_BEING_FREED 4/* Flag which is ORed to control structure statement node types */#define QUE_NODE_CONTROL_STAT 1024/* Query graph node types */#define QUE_NODE_LOCK 1#define QUE_NODE_INSERT 2#define QUE_NODE_UPDATE 4#define QUE_NODE_CURSOR 5#define QUE_NODE_SELECT 6#define QUE_NODE_AGGREGATE 7#define QUE_NODE_FORK 8#define QUE_NODE_THR 9#define QUE_NODE_UNDO 10#define QUE_NODE_COMMIT 11#define QUE_NODE_ROLLBACK 12#define QUE_NODE_PURGE 13#define QUE_NODE_CREATE_TABLE 14#define QUE_NODE_CREATE_INDEX 15#define QUE_NODE_SYMBOL 16#define QUE_NODE_RES_WORD 17#define QUE_NODE_FUNC 18#define QUE_NODE_ORDER 19#define QUE_NODE_PROC (20 + QUE_NODE_CONTROL_STAT)#define QUE_NODE_IF (21 + QUE_NODE_CONTROL_STAT)#define QUE_NODE_WHILE (22 + QUE_NODE_CONTROL_STAT)#define QUE_NODE_ASSIGNMENT 23#define QUE_NODE_FETCH 24#define QUE_NODE_OPEN 25#define QUE_NODE_COL_ASSIGNMENT 26#define QUE_NODE_FOR (27 + QUE_NODE_CONTROL_STAT)#define QUE_NODE_RETURN 28#define QUE_NODE_ROW_PRINTF 29#define QUE_NODE_ELSIF 30#define QUE_NODE_CALL 31/* Query thread states */#define QUE_THR_RUNNING 1#define QUE_THR_PROCEDURE_WAIT 2#define QUE_THR_COMPLETED 3 /* in selects this means that the thread is at the end of its result set (or start, in case of a scroll cursor); in other statements, this means the thread has done its task */#define QUE_THR_COMMAND_WAIT 4#define QUE_THR_LOCK_WAIT 5#define QUE_THR_SIG_REPLY_WAIT 6#define QUE_THR_SUSPENDED 7#define QUE_THR_ERROR 8/* Query thread lock states */#define QUE_THR_LOCK_NOLOCK 0#define QUE_THR_LOCK_ROW 1#define QUE_THR_LOCK_TABLE 2/* From where the cursor position is counted */#define QUE_CUR_NOT_DEFINED 1#define QUE_CUR_START 2#define QUE_CUR_END 3#ifndef UNIV_NONINL#include "que0que.ic"#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -