MySQL 8.4.3
Source Code Documentation
|
#include "my_config.h"
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <atomic>
#include <bitset>
#include <memory>
#include <new>
#include <stack>
#include <string>
#include <unordered_map>
#include "dur_prop.h"
#include "lex_string.h"
#include "map_helpers.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_command.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_psi_config.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "my_thread_local.h"
#include "my_time_t.h"
#include "mysql/components/services/bits/my_thread_bits.h"
#include "mysql/components/services/bits/mysql_cond_bits.h"
#include "mysql/components/services/bits/mysql_mutex_bits.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/bits/psi_idle_bits.h"
#include "mysql/components/services/bits/psi_stage_bits.h"
#include "mysql/components/services/bits/psi_statement_bits.h"
#include "mysql/components/services/bits/psi_thread_bits.h"
#include "mysql/components/services/bits/psi_transaction_bits.h"
#include "mysql/plugin_audit.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/mysql_statement.h"
#include "mysql/psi/mysql_thread.h"
#include "mysql/strings/m_ctype.h"
#include "mysql/thread_type.h"
#include "mysql_com_server.h"
#include "mysqld_error.h"
#include "pfs_thread_provider.h"
#include "prealloced_array.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/current_thd.h"
#include "sql/dd/string_type.h"
#include "sql/discrete_interval.h"
#include "sql/locked_tables_list.h"
#include "sql/mdl.h"
#include "sql/opt_costmodel.h"
#include "sql/opt_trace_context.h"
#include "sql/parse_location.h"
#include "sql/psi_memory_key.h"
#include "sql/query_options.h"
#include "sql/reference_caching_setup.h"
#include "sql/resourcegroups/resource_group_basic_types.h"
#include "sql/rpl_context.h"
#include "sql/rpl_gtid.h"
#include "sql/session_tracker.h"
#include "sql/sql_audit.h"
#include "sql/sql_connect.h"
#include "sql/sql_const.h"
#include "sql/sql_digest_stream.h"
#include "sql/sql_error.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sys_vars_resource_mgr.h"
#include "sql/system_variables.h"
#include "sql/transaction_info.h"
#include "sql/xa.h"
#include "sql_event_tracking_to_audit_event_mapping.h"
#include "sql_string.h"
#include "template_utils.h"
#include "thr_lock.h"
#include "violite.h"
Go to the source code of this file.
Classes | |
class | thd_scheduler |
To be used for pool-of-threads (implemented differently on various OSs) More... | |
class | Thd_mem_cnt |
struct | rpl_event_coordinates |
the struct aggregates two parameters that identify an event uniquely in scope of communication of a particular master and slave couple. More... | |
class | Query_arena |
class | Prepared_statement_map |
Container for all prepared statements created/used in a connection. More... | |
class | Item_change_record |
A registry for item tree transformations performed during query optimization. More... | |
class | Open_tables_state |
Class that holds information about tables which were opened and locked by the thread. More... | |
class | Open_tables_backup |
Storage for backup of Open_tables_state. More... | |
class | Sub_statement_state |
Used to save context when executing a function or trigger. More... | |
struct | Ha_data |
Storage engine specific thread local data. More... | |
class | Global_read_lock |
An instance of the global read lock in a connection. More... | |
class | Transactional_ddl_context |
This class keeps the context of transactional DDL statements. More... | |
class | Secondary_engine_statement_context |
Base class for secondary engine statement context objects. More... | |
class | THD |
For each client connection we create a separate thread with THD serving as a thread/connection descriptor. More... | |
class | THD::Query_plan |
Query plan for EXPLAINable commands, should be locked with LOCK_query_plan before using. More... | |
struct | THD::Transaction_state |
An utility struct for Attachable_trx . More... | |
class | THD::Attachable_trx |
Class representing read-only attachable transaction, encapsulates knowledge how to backup state of current transaction, start read-only attachable transaction in SE, finalize it and then restore state of original transaction back. More... | |
class | THD::Attachable_trx_rw |
A derived from THD::Attachable_trx class allows updates in the attachable transaction. More... | |
Namespaces | |
namespace | dd |
The version of the current data dictionary table definitions. | |
namespace | dd::cache |
Macros | |
#define | THD_STAGE_INFO(thd, stage) (thd)->enter_stage(&stage, NULL, __func__, __FILE__, __LINE__) |
#define | THD_SENTRY_MAGIC 0xfeedd1ff |
#define | THD_SENTRY_GONE 0xdeadbeef |
#define | THD_CHECK_SENTRY(thd) assert(thd->dbug_sentry == THD_SENTRY_MAGIC) |
#define | SUB_STMT_TRIGGER 1 |
#define | SUB_STMT_FUNCTION 2 |
#define | RETURN_NAME_AS_STRING(NAME) |
Typedefs | |
typedef struct user_conn | USER_CONN |
typedef struct rpl_event_coordinates | LOG_POS_COORD |
the struct aggregates two parameters that identify an event uniquely in scope of communication of a particular master and slave couple. More... | |
typedef I_List< Item_change_record > | Item_change_list |
using | Event_tracking_data = std::pair< Event_tracking_class, Event_tracking_information * > |
using | Event_tracking_data_stack = std::stack< Event_tracking_data > |
Enumerations | |
enum class | TDM { ANY , ON , ZERO , NOT_AVAILABLE } |
enum | enum_mem_cnt_mode { MEM_CNT_DEFAULT = 0U , MEM_CNT_UPDATE_GLOBAL_COUNTER = (1U << 0) , MEM_CNT_GENERATE_ERROR = (1U << 1) , MEM_CNT_GENERATE_LOG_ERROR = (1U << 2) } |
enum class | Secondary_engine_optimization { PRIMARY_ONLY , PRIMARY_TENTATIVELY , SECONDARY } |
Enum that represents which phase of secondary engine optimization the current statement is in. More... | |
Functions | |
void | thd_enter_cond (void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line) |
Set thread entering a condition. More... | |
void | thd_exit_cond (void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line) |
Set thread leaving a condition. More... | |
void | thd_enter_stage (void *opaque_thd, const PSI_stage_info *new_stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line) |
void | thd_set_waiting_for_disk_space (void *opaque_thd, const bool waiting) |
PSI_thread * | thd_get_psi (THD *thd) |
Get reference to Performance Schema object for THD object. More... | |
void | thd_set_psi (THD *thd, PSI_thread *psi) |
Set reference to Performance Schema object for THD object. More... | |
unsigned int | thd_get_current_thd_terminology_use_previous () |
Return @session.terminology_use_previous for the current THD. More... | |
char const * | show_system_thread (enum_thread_type thread) |
void | my_message_sql (uint error, const char *str, myf MyFlags) |
All global error messages are sent here where the first one is stored for the client. More... | |
bool | secondary_engine_lock_tables_mode (const THD &cthd) |
Return lock_tables_mode for secondary engine. More... | |
void | my_ok (THD *thd, ulonglong affected_rows=0, ulonglong id=0, const char *message=nullptr) |
A short cut for thd->get_stmt_da()->set_ok_status(). More... | |
void | my_eof (THD *thd) |
A short cut for thd->get_stmt_da()->set_eof_status(). More... | |
bool | add_item_to_list (THD *thd, Item *item) |
bool | is_engine_substitution_allowed (const THD *thd) |
Check if engine substitution is allowed in the current thread context. More... | |
bool | is_xa_tran_detached_on_prepare (const THD *thd) |
Returns true if xa transactions are detached as part of executing XA PREPARE. More... | |
Variables | |
char | empty_c_string [1] |
constexpr size_t | PREALLOC_NUM_HA = 15 |
thread_local TDM | expected_from_debug_flag = TDM::ANY |
#define RETURN_NAME_AS_STRING | ( | NAME | ) |
#define SUB_STMT_FUNCTION 2 |
#define SUB_STMT_TRIGGER 1 |
#define THD_CHECK_SENTRY | ( | thd | ) | assert(thd->dbug_sentry == THD_SENTRY_MAGIC) |
#define THD_SENTRY_GONE 0xdeadbeef |
#define THD_SENTRY_MAGIC 0xfeedd1ff |
#define THD_STAGE_INFO | ( | thd, | |
stage | |||
) | (thd)->enter_stage(&stage, NULL, __func__, __FILE__, __LINE__) |
using Event_tracking_data = std::pair<Event_tracking_class, Event_tracking_information *> |
typedef I_List<Item_change_record> Item_change_list |
typedef struct rpl_event_coordinates LOG_POS_COORD |
the struct aggregates two parameters that identify an event uniquely in scope of communication of a particular master and slave couple.
I.e there can not be 2 events from the same staying connected master which have the same coordinates.
enum enum_mem_cnt_mode |
|
strong |
Enum that represents which phase of secondary engine optimization the current statement is in.
|
strong |
|
inline |
Check if engine substitution is allowed in the current thread context.
thd | thread context |
true | if engine substitution is allowed |
false | otherwise |
|
inline |
Returns true if xa transactions are detached as part of executing XA PREPARE.
void my_eof | ( | THD * | thd | ) |
A short cut for thd->get_stmt_da()->set_eof_status().
void my_message_sql | ( | uint | error, |
const char * | str, | ||
myf | MyFlags | ||
) |
All global error messages are sent here where the first one is stored for the client.
void my_ok | ( | THD * | thd, |
ulonglong | affected_rows = 0 , |
||
ulonglong | id = 0 , |
||
const char * | message = nullptr |
||
) |
A short cut for thd->get_stmt_da()->set_ok_status().
|
inline |
Return lock_tables_mode for secondary engine.
cthd | thread context |
true | if lock_tables_mode is on |
false,otherwise |
|
inline |
void thd_enter_cond | ( | void * | opaque_thd, |
mysql_cond_t * | cond, | ||
mysql_mutex_t * | mutex, | ||
const PSI_stage_info * | stage, | ||
PSI_stage_info * | old_stage, | ||
const char * | src_function, | ||
const char * | src_file, | ||
int | src_line | ||
) |
Set thread entering a condition.
This function should be called before putting a thread to wait for a condition. mutex
should be held before calling this function. After being waken up, thd_exit_cond
should be called.
opaque_thd | The thread entering the condition, NULL means current thread |
cond | The condition the thread is going to wait for |
mutex | The mutex associated with the condition, this must be held before call this function |
stage | The new process message for the thread |
old_stage | The old process message for the thread |
src_function | The caller source function name |
src_file | The caller source file name |
src_line | The caller source line number |
void thd_enter_stage | ( | void * | opaque_thd, |
const PSI_stage_info * | new_stage, | ||
PSI_stage_info * | old_stage, | ||
const char * | src_function, | ||
const char * | src_file, | ||
int | src_line | ||
) |
void thd_exit_cond | ( | void * | opaque_thd, |
const PSI_stage_info * | stage, | ||
const char * | src_function, | ||
const char * | src_file, | ||
int | src_line | ||
) |
Set thread leaving a condition.
This function should be called after a thread being waken up for a condition.
opaque_thd | The thread entering the condition, NULL means current thread |
stage | The process message, usually this should be the old process message before calling thd_enter_cond |
src_function | The caller source function name |
src_file | The caller source file name |
src_line | The caller source line number |
unsigned int thd_get_current_thd_terminology_use_previous | ( | ) |
Return @session.terminology_use_previous for the current THD.
PSI_thread * thd_get_psi | ( | THD * | thd | ) |
Get reference to Performance Schema object for THD object.
thd | THD object |
Performance | schema object for thread on THD |
void thd_set_psi | ( | THD * | thd, |
PSI_thread * | psi | ||
) |
Set reference to Performance Schema object for THD object.
thd | THD object |
psi | Performance schema object for thread |
void thd_set_waiting_for_disk_space | ( | void * | opaque_thd, |
const bool | waiting | ||
) |
|
extern |
|
constexpr |