![]() |
MySQL
8.0.12
Source Code Documentation
|
For each client connection we create a separate thread with THD serving as a thread/connection descriptor. More...
#include <sql_class.h>
Classes | |
class | 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 | Attachable_trx_rw |
A derived from THD::Attachable_trx class allows updates in the attachable transaction. More... | |
class | Query_plan |
Query plan for EXPLAINable commands, should be locked with LOCK_query_plan before using. More... | |
struct | Transaction_state |
An utility struct for Attachable_trx . More... | |
Public Types | |
enum | binlog_filter_state { BINLOG_FILTER_UNKNOWN, BINLOG_FILTER_CLEAR, BINLOG_FILTER_SET } |
enum | enum_reset_lex { RESET_LEX, DO_NOT_RESET_LEX } |
enum | Commit_error { CE_NONE = 0, CE_FLUSH_ERROR, CE_SYNC_ERROR, CE_COMMIT_ERROR, CE_ERROR_COUNT } |
enum | killed_state { NOT_KILLED = 0, KILL_CONNECTION = ER_SERVER_SHUTDOWN, KILL_QUERY = ER_QUERY_INTERRUPTED, KILL_TIMEOUT = ER_QUERY_TIMEOUT, KILLED_NO_VALUE } |
enum | enum_binlog_query_type { ROW_QUERY_TYPE, STMT_QUERY_TYPE, QUERY_TYPE_COUNT } |
![]() | |
enum | enum_state { STMT_INITIALIZED = 0, STMT_INITIALIZED_FOR_SP = 1, STMT_PREPARED = 2, STMT_CONVENTIONAL_EXECUTION = 3, STMT_EXECUTED = 4, STMT_ERROR = -1 } |
![]() | |
enum | enum_flags { BACKUPS_AVAIL = (1U << 0), SYSTEM_TABLES = (1U << 1) } |
Public Member Functions | |
dd::cache::Dictionary_client * | dd_client () const |
bool | is_binlog_applier () |
The function checks whether the thread is processing queries from binlog, as automatically generated by mysqlbinlog. More... | |
void | rpl_detach_engine_ha_data () |
When the thread is a binlog or slave applier it detaches the engine ha_data associated with it and memorizes the fact of that. More... | |
void | rpl_reattach_engine_ha_data () |
When the thread is a binlog or slave applier it reattaches the engine ha_data associated with it and memorizes the fact of that. More... | |
bool | rpl_unflag_detached_engine_ha_data () |
void | reset_for_next_command () |
void | clear_current_query_costs () |
Clear the query costs attributes for the current query. More... | |
void | save_current_query_costs () |
Save the current query costs attributes in the thread session status. More... | |
void | lock_query_plan () |
Locks the query plan of this THD. More... | |
void | unlock_query_plan () |
Security_context * | security_context () const |
void | set_security_context (Security_context *sctx) |
Protocol * | get_protocol () |
SSL_handle | get_ssl () const |
Protocol_classic * | get_protocol_classic () const |
Asserts that the protocol is of type text or binary and then returns the m_protocol casted to Protocol_classic. More... | |
const LEX_CSTRING & | catalog () const |
void | set_catalog (const LEX_CSTRING &catalog) |
void | enter_stage (const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *calling_func, const char *calling_file, const unsigned int calling_line) |
const char * | get_proc_info () const |
Ha_data * | get_ha_data (int slot) |
Retrieve Ha_data for a given slot. More... | |
void | backup_ha_data (Prealloced_array< Ha_data, PREALLOC_NUM_HA > *backup) |
Copy ha_data into the provided argument. More... | |
void | restore_ha_data (const Prealloced_array< Ha_data, PREALLOC_NUM_HA > &backup) |
Restore ha_data from the provided backup copy. More... | |
void | set_next_event_pos (const char *_filename, ulonglong _pos) |
void | clear_next_event_pos () |
int | binlog_setup_trx_data () |
int | binlog_write_table_map (TABLE *table, bool is_transactional, bool binlog_rows_query) |
This function writes a table map to the binary log. More... | |
int | binlog_write_row (TABLE *table, bool is_transactional, const uchar *new_data, const uchar *extra_row_info) |
int | binlog_delete_row (TABLE *table, bool is_transactional, const uchar *old_data, const uchar *extra_row_info) |
int | binlog_update_row (TABLE *table, bool is_transactional, const uchar *old_data, const uchar *new_data, const uchar *extra_row_info) |
void | binlog_prepare_row_images (TABLE *table) |
void | set_server_id (uint32 sid) |
template<class RowsEventT > | |
Rows_log_event * | binlog_prepare_pending_rows_event (TABLE *table, uint32 serv_id, size_t needed, bool is_transactional, RowsEventT *hint, const uchar *extra_row_info) |
Rows_log_event * | binlog_get_pending_rows_event (bool is_transactional) const |
This function retrieves a pending row event from a cache which is specified through the parameter is_transactional . More... | |
int | binlog_flush_pending_rows_event (bool stmt_end) |
int | binlog_flush_pending_rows_event (bool stmt_end, bool is_transactional) |
int | is_current_stmt_binlog_format_row () const |
Determine the binlog format of the current statement. More... | |
bool | is_current_stmt_binlog_disabled () const |
Determine if binlogging is disabled for this session. More... | |
bool | is_current_stmt_binlog_row_enabled_with_write_set_extraction () const |
Determine if binloging is enabled in row format and write set extraction is enabled for this session. More... | |
bool | optimizer_switch_flag (ulonglong flag) const |
Tells whether the given optimizer_switch flag is on. More... | |
void | reset_binlog_local_stmt_filter () |
void | clear_binlog_local_stmt_filter () |
void | set_binlog_local_stmt_filter () |
binlog_filter_state | get_binlog_local_stmt_filter () |
void | set_skip_readonly_check () |
bool | is_cmd_skip_readonly () |
void | reset_skip_readonly_check () |
void | issue_unsafe_warnings () |
Auxiliary method used by binlog_query() to raise warnings. More... | |
uint | get_binlog_table_maps () const |
void | clear_binlog_table_maps () |
List< char > * | get_binlog_accessed_db_names () |
void | add_to_binlog_accessed_dbs (const char *db) |
Transaction_ctx * | get_transaction () |
const Transaction_ctx * | get_transaction () const |
void | set_transaction (Transaction_ctx *transaction_ctx) |
Changes the Transaction_ctx instance within THD-object. More... | |
void | record_first_successful_insert_id_in_cur_stmt (ulonglong id_arg) |
ulonglong | read_first_successful_insert_id_in_prev_stmt (void) |
void | reset_first_successful_insert_id () |
void | force_one_auto_inc_interval (ulonglong next_id) |
longlong | get_row_count_func () const |
void | set_row_count_func (longlong row_count_func) |
void | set_user_connect (USER_CONN *uc) |
const USER_CONN * | get_user_connect () |
void | increment_user_connections_counter () |
void | decrement_user_connections_counter () |
void | increment_con_per_hour_counter () |
void | increment_updates_counter () |
void | increment_questions_counter () |
void | time_out_user_resource_limits () |
ha_rows | get_sent_row_count () const |
ha_rows | get_examined_row_count () const |
void | set_sent_row_count (ha_rows count) |
void | inc_sent_row_count (ha_rows count) |
void | inc_examined_row_count (ha_rows count) |
void | inc_status_created_tmp_disk_tables () |
void | inc_status_created_tmp_tables () |
void | inc_status_select_full_join () |
void | inc_status_select_full_range_join () |
void | inc_status_select_range () |
void | inc_status_select_range_check () |
void | inc_status_select_scan () |
void | inc_status_sort_merge_passes () |
void | inc_status_sort_range () |
void | inc_status_sort_rows (ha_rows count) |
void | inc_status_sort_scan () |
void | set_status_no_index_used () |
void | set_status_no_good_index_used () |
void | set_new_thread_id () |
Assign a value to m_thread_id by calling Global_THD_manager::get_new_thread_id(). More... | |
my_thread_id | thread_id () const |
bool | is_system_thread () const |
bool | is_dd_system_thread () const |
bool | is_initialize_system_thread () const |
bool | is_bootstrap_system_thread () const |
THD (bool enable_plugins=true) | |
~THD () | |
void | release_resources () |
Release most resources, prior to THD destruction. More... | |
bool | release_resources_done () const |
void | init_query_mem_roots () |
Initialize memory roots necessary for query processing and (!) pre-allocate memory for it. More... | |
void | cleanup_connection (void) |
void | cleanup_after_query () |
bool | store_globals () |
void | restore_globals () |
void | set_active_vio (Vio *vio) |
void | set_ssl (Vio *vio) |
void | clear_active_vio () |
enum_vio_type | get_vio_type () |
void | shutdown_active_vio () |
void | awake (THD::killed_state state_to_set) |
Awake a thread. More... | |
void | disconnect (bool server_shutdown=false) |
Disconnect the associated communication endpoint. More... | |
int | binlog_query (enum_binlog_query_type qtype, const char *query, size_t query_len, bool is_trans, bool direct, bool suppress_use, int errcode) |
Log the current query. More... | |
void | enter_cond (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) |
Enter a condition wait. More... | |
void | exit_cond (const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line) |
End a wait on a condition. More... | |
virtual int | is_killed () const final |
Has the owner thread been killed? More... | |
virtual THD * | get_thd () |
Within MDL subsystem this one is only used for DEBUG_SYNC. More... | |
virtual void | notify_shared_lock (MDL_context_owner *ctx_in_use, bool needs_thr_lock_abort) |
A callback to the server internals that is used to address special cases of the locking protocol. More... | |
virtual bool | notify_hton_pre_acquire_exclusive (const MDL_key *mdl_key, bool *victimized) |
Notify/get permission from interested storage engines before acquiring exclusive lock for the key. More... | |
virtual void | notify_hton_post_release_exclusive (const MDL_key *mdl_key) |
Notify interested storage engines that we have just released exclusive lock for the key. More... | |
virtual uint | get_rand_seed () |
Provide thread specific random seed for MDL_context's PRNG. More... | |
bool | is_strict_mode () const |
const CHARSET_INFO * | collation () |
Time_zone * | time_zone () |
time_t | query_start_in_secs () const |
timeval | query_start_timeval_trunc (uint decimals) |
void | set_time () |
void | set_time (const struct timeval *t) |
void | set_time_after_lock () |
bool | is_fsp_truncate_mode () const |
void | update_slow_query_status () |
Evaluate the current time, and if it exceeds the long-query-time setting, mark the query as slow. More... | |
ulonglong | found_rows (void) |
void | update_previous_found_rows () |
bool | in_multi_stmt_transaction_mode () const |
Returns true if session is in a multi-statement transaction mode. More... | |
bool | in_active_multi_stmt_transaction () const |
true if the session is in a multi-statement transaction mode ( More... | |
bool | fill_information_schema_tables () |
LEX_CSTRING * | make_lex_string (LEX_CSTRING *lex_str, const char *str, size_t length, bool allocate_lex_string) |
LEX_STRING * | make_lex_string (LEX_STRING *lex_str, const char *str, size_t length, bool allocate_lex_string) |
Create a LEX_STRING in this connection. More... | |
bool | convert_string (LEX_STRING *to, const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs) |
bool | convert_string (String *s, const CHARSET_INFO *from_cs, const CHARSET_INFO *to_cs) |
int | send_explain_fields (Query_result *result) |
void | clear_error () |
Clear the current error, if any. More... | |
bool | is_classic_protocol () |
virtual bool | is_connected () |
Return false if connection to client is broken. More... | |
void | fatal_error () |
Mark the current error as fatal. More... | |
bool | is_error () const |
true if there is an error in the error stack. More... | |
Diagnostics_area * | get_stmt_da () |
Returns first Diagnostics Area for the current statement. More... | |
const Diagnostics_area * | get_stmt_da () const |
Returns first Diagnostics Area for the current statement. More... | |
const Diagnostics_area * | get_stacked_da () const |
Returns the second Diagnostics Area for the current statement. More... | |
Diagnostics_area * | get_parser_da () |
Returns thread-local Diagnostics Area for parsing. More... | |
Diagnostics_area * | get_query_rewrite_plugin_da () |
Returns thread-local Diagnostics Area to be used by query rewrite plugins. More... | |
void | push_diagnostics_area (Diagnostics_area *da, bool copy_conditions=true) |
Push the given Diagnostics Area on top of the stack, making it the new first Diagnostics Area. More... | |
void | pop_diagnostics_area () |
Pop the top DA off the Diagnostics Area stack. More... | |
void | push_protocol (Protocol *protocol) |
Inserts the new protocol at the top of the protocol stack, and make it the current protocol for this thd. More... | |
void | pop_protocol () |
Pops the top protocol of the Protocol stack and sets the previous one as the current protocol. More... | |
const CHARSET_INFO * | charset () const |
void | update_charset () |
void | change_item_tree (Item **place, Item *new_value) |
void | nocheck_register_item_tree_change (Item **place, Item *new_value) |
Remember that place was updated with new_value so it can be restored by rollback_item_tree_changes(). More... | |
void | replace_rollback_place (Item **new_place) |
Find and update change record of an underlying item based on the new value for a place. More... | |
void | rollback_item_tree_changes () |
Restore locations set by calls to nocheck_register_item_tree_change(). More... | |
void | end_statement () |
void | send_kill_message () const |
void | reset_n_backup_open_tables_state (Open_tables_backup *backup, uint add_state_flags) |
void | restore_backup_open_tables_state (Open_tables_backup *backup) |
void | reset_sub_statement_state (Sub_statement_state *backup, uint new_state) |
void | restore_sub_statement_state (Sub_statement_state *backup) |
void | set_n_backup_active_arena (Query_arena *set, Query_arena *backup) |
void | restore_active_arena (Query_arena *set, Query_arena *backup) |
void | begin_attachable_ro_transaction () |
Start a read-only attachable transaction. More... | |
void | begin_attachable_transaction (enum_reset_lex reset_lex) |
void | begin_attachable_rw_transaction () |
Start a read-write attachable transaction. More... | |
void | begin_attachable_rw_i_s_transaction () |
Start a read-write attachable transaction to write to mysql.table_stats and mysql.index_stats. More... | |
void | end_attachable_transaction () |
End an active attachable transaction. More... | |
bool | is_attachable_ro_transaction_active () const |
bool | is_attachable_transaction_active () const |
bool | is_attachable_rw_transaction_active () const |
void | set_current_stmt_binlog_format_row_if_mixed () |
void | set_current_stmt_binlog_format_row () |
void | clear_current_stmt_binlog_format_row () |
void | reset_current_stmt_binlog_format_row () |
void | set_original_commit_timestamp_for_slave_thread () |
Copies variables.original_commit_timestamp to ((Slave_worker *)rli_slave)->original_commit_timestamp, if this is a slave thread. More... | |
Gtid_set * | get_gtid_next_list () |
Return the value of @gtid_next_list: either a Gtid_set or NULL. More... | |
const Gtid_set * | get_gtid_next_list_const () const |
Return the value of @gtid_next_list: either a Gtid_set or NULL. More... | |
bool | is_binlog_cache_empty (bool is_transactional) |
Return true if the statement/transaction cache is currently empty, false otherwise. More... | |
void | clear_owned_gtids () |
const LEX_CSTRING & | db () const |
bool | set_db (const LEX_CSTRING &new_db) |
Set the current database; use deep copy of C-string. More... | |
void | reset_db (const LEX_CSTRING &new_db) |
Set the current database; use shallow copy of C-string. More... | |
bool | copy_db_to (char const **p_db, size_t *p_db_length) const |
bool | copy_db_to (char **p_db, size_t *p_db_length) const |
resourcegroups::Resource_group_ctx * | resource_group_ctx () |
Get resource group context. More... | |
void | set_psi (PSI_thread *psi) |
Save the performance schema thread instrumentation associated with this user session. More... | |
PSI_thread * | get_psi () |
Read the performance schema thread instrumentation associated with this user session. More... | |
Internal_error_handler * | get_internal_handler () |
void | push_internal_handler (Internal_error_handler *handler) |
Add an internal error handler to the thread execution context. More... | |
bool | handle_condition (uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level *level, const char *msg) |
Handle a sql condition. More... | |
Internal_error_handler * | pop_internal_handler () |
Remove the error handler last pushed. More... | |
void | raise_error (uint code) |
Raise an exception condition. More... | |
void | raise_error_printf (uint code,...) |
Raise an exception condition, with a formatted message. More... | |
void | raise_warning (uint code) |
Raise a completion condition (warning). More... | |
void | raise_warning_printf (uint code,...) |
Raise a completion condition (warning), with a formatted message. More... | |
void | raise_note (uint code) |
Raise a completion condition (note), with a fixed message. More... | |
void | raise_note_printf (uint code,...) |
Raise an completion condition (note), with a formatted message. More... | |
void | set_command (enum enum_server_command command) |
enum enum_server_command | get_command () const |
void | debug_assert_query_locked () const |
For safe and protected access to the query string, the following rules should be followed: 1: Only the owner (current_thd) can set the query string. More... | |
const LEX_CSTRING & | query () const |
const String | normalized_query () |
The current query in normalized form. More... | |
void | set_query (const char *query_arg, size_t query_length_arg) |
Assign a new value to thd->m_query_string. More... | |
void | set_query (const LEX_CSTRING &query_arg) |
void | reset_query () |
void | set_query_id (query_id_t new_query_id) |
Assign a new value to thd->query_id. More... | |
void | set_open_tables (TABLE *open_tables_arg) |
Assign a new value to open_tables. More... | |
void | set_is_killable (bool is_killable_arg) |
Assign a new value to is_killable Protected with the LOCK_thd_data mutex. More... | |
void | enter_locked_tables_mode (enum_locked_tables_mode mode_arg) |
void | leave_locked_tables_mode () |
Leave explicit LOCK TABLES or prelocked mode and restore value of transaction sentinel in MDL subsystem. More... | |
int | decide_logging_format (TABLE_LIST *tables) |
Decide on logging format to use for the statement and issue errors or warnings as needed. More... | |
bool | is_dml_gtid_compatible (bool some_transactional_table, bool some_non_transactional_table, bool non_transactional_tables_are_tmp) |
is_dml_gtid_compatible() and is_ddl_gtid_compatible() check if the statement that is about to be processed will safely get a GTID. More... | |
bool | is_ddl_gtid_compatible () |
void | binlog_invoker () |
bool | need_binlog_invoker () |
void | get_definer (LEX_USER *definer) |
void | set_invoker (const LEX_STRING *user, const LEX_STRING *host) |
LEX_CSTRING | get_invoker_user () const |
LEX_CSTRING | get_invoker_host () const |
bool | has_invoker () |
void | mark_transaction_to_rollback (bool all) |
Mark transaction to rollback and mark error as fatal to a sub-statement. More... | |
void | init_cost_model () |
Initialize the optimizer cost model. More... | |
const Cost_model_server * | cost_model () const |
Retrieve the optimizer cost model for this connection. More... | |
void | syntax_error () |
void | syntax_error (const char *format,...) |
Push an error message into MySQL diagnostic area with line number and position. More... | |
void | syntax_error (int mysql_errno,...) |
Push an error message into MySQL diagnostic area with line number and position. More... | |
void | syntax_error_at (const YYLTYPE &location) |
void | syntax_error_at (const YYLTYPE &location, const char *format,...) |
Push a syntax error message into MySQL diagnostic area with line and position information. More... | |
void | syntax_error_at (const YYLTYPE &location, int mysql_errno,...) |
Push a syntax error message into MySQL diagnostic area with line and position information. More... | |
void | vsyntax_error_at (const YYLTYPE &location, const char *format, va_list args) |
void | vsyntax_error_at (const char *pos_in_lexer_raw_buffer, const char *format, va_list args) |
Push a syntax error message into MySQL diagnostic area with line number and position. More... | |
bool | send_result_metadata (List< Item > *list, uint flags) |
Send name and type of result to client. More... | |
bool | send_result_set_row (List< Item > *row_items) |
Send one result set row. More... | |
void | send_statement_status () |
void | claim_memory_ownership () |
Claim all the memory used by the THD object. More... | |
bool | is_a_srv_session () const |
void | mark_as_srv_session () |
uint | get_tmp_table_seq_id () |
void | set_tmp_table_seq_id (uint arg) |
bool | is_plugin_fake_ddl () const |
void | mark_plugin_fake_ddl (bool flag) |
void | set_waiting_for_disk_space (bool waiting) |
Set the waiting_for_disk_space flag. More... | |
bool | is_waiting_for_disk_space () const |
Returns the current waiting_for_disk_space flag value. More... | |
bool | sql_parser () |
Call parser to transform statement into a parse tree. More... | |
void | set_trans_pos (const char *file, my_off_t pos) |
Functions to set and get transaction position. More... | |
void | get_trans_pos (const char **file_var, my_off_t *pos_var) const |
void | get_trans_fixed_pos (const char **file_var, my_off_t *pos_var) const |
my_off_t | get_trans_pos () |
![]() | |
virtual | ~MDL_context_owner () |
![]() | |
Query_arena (MEM_ROOT *mem_root_arg, enum enum_state state_arg) | |
Query_arena () | |
virtual | ~Query_arena () |
bool | is_stmt_prepare () const |
bool | is_stmt_prepare_or_first_sp_execute () const |
bool | is_stmt_prepare_or_first_stmt_execute () const |
bool | is_conventional () const |
void * | alloc (size_t size) |
void * | mem_calloc (size_t size) |
template<typename T > | |
T * | alloc_typed () |
template<typename T > | |
T * | memdup_typed (const T *mem) |
char * | mem_strdup (const char *str) |
char * | strmake (const char *str, size_t size) const |
void * | memdup (const void *str, size_t size) |
void | set_query_arena (const Query_arena *set) |
Copies memory-managing members from set . More... | |
void | free_items () |
virtual void | cleanup_stmt () |
![]() | |
Reprepare_observer * | get_reprepare_observer () const |
void | push_reprepare_observer (Reprepare_observer *o) |
Reprepare_observer * | pop_reprepare_observer () |
void | reset_reprepare_observers () |
Open_tables_state () | |
This constructor initializes Open_tables_state instance which can only be used as backup storage. More... | |
void | set_open_tables_state (Open_tables_state *state) |
void | reset_open_tables_state () |
Static Public Member Functions | |
static bool | binlog_row_event_extra_data_eq (const uchar *a, const uchar *b) |
binlog_row_event_extra_data_eq More... | |
Static Public Attributes | |
static const char *const | DEFAULT_WHERE = "field list" |
static const int | OWNED_SIDNO_GTID_SET = -1 |
static const int | OWNED_SIDNO_ANONYMOUS = -2 |
Private Member Functions | |
bool | is_stmt_prepare () const |
bool | is_stmt_prepare_or_first_sp_execute () const |
bool | is_stmt_prepare_or_first_stmt_execute () const |
bool | is_conventional () const |
void | cleanup (void) |
void | init (void) |
Sql_condition * | raise_condition (uint sql_errno, const char *sqlstate, Sql_condition::enum_severity_level level, const char *msg, bool use_condition_handler=true) |
Raise a generic SQL condition. More... | |
Private Attributes | |
std::unique_ptr< LEX > | main_lex |
The lex to hold the parsed tree of conventional (non-prepared) queries. More... | |
std::unique_ptr< dd::cache::Dictionary_client > | m_dd_client |
LEX_CSTRING | m_query_string |
The query associated with this statement. More... | |
String | m_normalized_query |
LEX_CSTRING | m_catalog |
Currently selected catalog. More... | |
LEX_CSTRING | m_db |
Name of the current (default) database. More... | |
resourcegroups::Resource_group_ctx | m_resource_group_ctx |
Resource group context indicating the current resource group and the name of the resource group to switch to during execution of a query. More... | |
mysql_mutex_t | LOCK_query_plan |
Protects query plan (SELECT/UPDATE/DELETE's) from being freed/changed while another thread explains it. More... | |
Protocol * | m_protocol |
SSL_handle | m_SSL = {nullptr} |
SSL data attached to this connection. More... | |
unsigned int | m_current_stage_key |
enum enum_server_command | m_command |
Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. More... | |
Prealloced_array< Ha_data, PREALLOC_NUM_HA > | ha_data |
bool | skip_readonly_check |
binlog_filter_state | m_binlog_filter_state |
Indicate if the current statement should be discarded instead of written to the binlog. More... | |
enum_binlog_format | current_stmt_binlog_format |
Indicates the format in which the current statement will be logged. More... | |
uint32 | binlog_unsafe_warning_flags |
Bit field for the state of binlog warnings. More... | |
uint | binlog_table_maps |
List< char > * | binlog_accessed_db_names |
NET | net |
String | packet |
std::unique_ptr< Transaction_ctx > | m_transaction |
Attachable_trx * | m_attachable_trx |
longlong | m_row_count_func |
Stores the result of ROW_COUNT() function. More... | |
ha_rows | m_sent_row_count |
Number of rows we actually sent to the client, including "synthetic" rows in ROLLUP etc. More... | |
ha_rows | m_examined_row_count |
Number of rows read and/or evaluated for a statement. More... | |
USER_CONN * | m_user_connect |
my_thread_id | m_thread_id |
This counter is 32 bit because of the client protocol. More... | |
bool | m_release_resources_done |
bool | cleanup_done |
std::atomic< PSI_thread * > | m_psi |
Performance schema thread instrumentation for this session. More... | |
Internal_error_handler * | m_internal_handler |
The current internal error handler for this thread, or NULL. More... | |
MEM_ROOT | main_mem_root |
This memory root is used for two purposes: More... | |
Diagnostics_area | main_da |
Diagnostics_area | m_parser_da |
cf. More... | |
Diagnostics_area | m_query_rewrite_plugin_da |
Diagnostics_area * | m_query_rewrite_plugin_da_ptr |
Diagnostics_area * | m_stmt_da |
bool | m_binlog_invoker |
It will be set TURE if CURRENT_USER() is called in account management statements or default definer is set in CREATE/ALTER SP, SF, Event, TRIGGER or VIEW statements. More... | |
LEX_CSTRING | m_invoker_user |
It points to the invoker in the Query_log_event. More... | |
LEX_CSTRING | m_invoker_host |
Cost_model_server | m_cost_model |
Optimizer cost model for server operations. More... | |
bool | is_a_srv_session_thd |
Variable to mark if the object is part of a Srv_session object, which aggregates THD. More... | |
bool | m_is_plugin_fake_ddl |
Creating or dropping plugin native table through a plugin service. More... | |
uint | tmp_table_seq_id |
Sequential number of internal tmp table created in the statement. More... | |
bool | waiting_for_disk_space = false |
const char * | m_trans_log_file |
The binary log position of the transaction. More... | |
char * | m_trans_fixed_log_file |
my_off_t | m_trans_end_pos |
Friends | |
class | Sql_cmd_common_signal |
class | Sql_cmd_signal |
class | Sql_cmd_resignal |
class | Protocol_classic |
void | push_warning (THD *thd, Sql_condition::enum_severity_level severity, uint code, const char *message_text) |
Push the warning to error list if there is still room in the list. More... | |
void | my_message_sql (uint, const char *, myf) |
All global error messages are sent here where the first one is stored for the client. More... | |
For each client connection we create a separate thread with THD serving as a thread/connection descriptor.
enum THD::Commit_error |
enum THD::enum_reset_lex |
enum THD::killed_state |
THD::~THD | ( | ) |
void THD::awake | ( | THD::killed_state | state_to_set | ) |
Awake a thread.
[in] | state_to_set | value for THD::killed |
This is normally called from another thread's THD object.
|
inline |
Copy ha_data into the provided argument.
Used by Attachble_transaction.
void THD::begin_attachable_ro_transaction | ( | ) |
Start a read-only attachable transaction.
There must be no active attachable transactions (in other words, there can be only one active attachable transaction at a time).
void THD::begin_attachable_rw_i_s_transaction | ( | ) |
Start a read-write attachable transaction to write to mysql.table_stats and mysql.index_stats.
All the requirements and restrictions to Attachable_trx apply. Additional requirements are documented along the class declaration.
void THD::begin_attachable_rw_transaction | ( | ) |
Start a read-write attachable transaction.
All the read-only class' requirements apply. Additional requirements are documented along the class declaration.
void THD::begin_attachable_transaction | ( | enum_reset_lex | reset_lex | ) |
|
inline |
|
inline |
|
inline |
|
inline |
void THD::claim_memory_ownership | ( | ) |
Claim all the memory used by the THD object.
This method is to keep memory instrumentation statistics updated, when an object is transfered across threads.
|
private |
void THD::cleanup_after_query | ( | ) |
void THD::cleanup_connection | ( | void | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Clear the query costs attributes for the current query.
|
inline |
|
inline |
Clear the current error, if any.
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we assume this is never called if the fatal error is set.
void THD::clear_next_event_pos | ( | ) |
|
inline |
|
inline |
bool THD::convert_string | ( | LEX_STRING * | to, |
const CHARSET_INFO * | to_cs, | ||
const char * | from, | ||
size_t | from_length, | ||
const CHARSET_INFO * | from_cs | ||
) |
bool THD::convert_string | ( | String * | s, |
const CHARSET_INFO * | from_cs, | ||
const CHARSET_INFO * | to_cs | ||
) |
|
inline |
|
inline |
|
inline |
Retrieve the optimizer cost model for this connection.
|
inline |
|
inline |
void THD::debug_assert_query_locked | ( | ) | const |
For safe and protected access to the query string, the following rules should be followed: 1: Only the owner (current_thd) can set the query string.
This will be protected by LOCK_thd_query. 2: The owner (current_thd) can read the query string without locking LOCK_thd_query. 3: Other threads must lock LOCK_thd_query before reading the query string.
This means that write-write conflicts are avoided by LOCK_thd_query. Read(by owner or other thread)-write(other thread) are disallowed. Read(other thread)-write(by owner) conflicts are avoided by LOCK_thd_query. Read(by owner)-write(by owner) won't happen as THD=thread.
We want to keep current_thd out of header files, so the debug assert, is moved to the .cc file. In optimized mode, we want this getter to be fast, so we inline it.
void THD::decrement_user_connections_counter | ( | ) |
void THD::end_attachable_transaction | ( | ) |
End an active attachable transaction.
Applies to both the read-only and the read-write versions. Note, that the read-write attachable transaction won't be terminated inside this method. To invoke the function there must be active attachable transaction.
void THD::end_statement | ( | ) |
|
inlinevirtual |
Enter a condition wait.
For enter_cond()
/ exit_cond()
to work the mutex must be held before enter_cond()
; this mutex must then be released before exit_cond()
. Usage must be: lock mutex; enter_cond(); your code; unlock mutex; exit_cond().
cond | the condition to wait on | |
mutex | the associated mutex | |
[in] | stage | the stage to enter, or NULL |
[out] | old_stage | the previous stage, or NULL |
src_function | function name of the caller | |
src_file | file name of the caller | |
src_line | line number of the caller |
Implements MDL_context_owner.
|
inline |
void THD::enter_stage | ( | const PSI_stage_info * | stage, |
PSI_stage_info * | old_stage, | ||
const char * | calling_func, | ||
const char * | calling_file, | ||
const unsigned int | calling_line | ||
) |
|
inlinevirtual |
End a wait on a condition.
[in] | stage | the new stage to enter |
src_function | function name of the caller | |
src_file | file name of the caller | |
src_line | line number of the caller |
Implements MDL_context_owner.
|
inline |
Mark the current error as fatal.
Warning: this does not set any error, it sets a property of the error, so must be followed or prefixed with my_error().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void THD::get_definer | ( | LEX_USER * | definer | ) |
|
inline |
|
inline |
Return the value of @gtid_next_list: either a Gtid_set or NULL.
|
inline |
Return the value of @gtid_next_list: either a Gtid_set or NULL.
|
inline |
Retrieve Ha_data for a given slot.
Each handler has a fixed slot nr.
|
inline |
|
inline |
|
inline |
|
inline |
Returns thread-local Diagnostics Area for parsing.
We need to have a clean DA in case errors or warnings are thrown during parsing, but we can't just reset the main DA in case we have a diagnostic statement on our hand that needs the old DA to answer questions about the previous execution. Keeping a static per-thread DA for parsing is less costly than allocating a temporary one for each statement we parse.
|
inline |
|
inline |
|
inline |
Asserts that the protocol is of type text or binary and then returns the m_protocol casted to Protocol_classic.
This method is needed to prevent misuse of pluggable protocols by legacy code
|
inline |
Read the performance schema thread instrumentation associated with this user session.
This method is safe to use from a different thread.
|
inline |
Returns thread-local Diagnostics Area to be used by query rewrite plugins.
Query rewrite plugins use their own diagnostics area. The reason is that they are invoked right before and right after parsing, and we don't want conditions raised by plugins in either statement nor parser DA until we know which type of statement we have parsed.
|
inlinevirtual |
Provide thread specific random seed for MDL_context's PRNG.
Note that even if two connections will request seed during handling of statements which were started at exactly the same time, and thus will get the same values in PRNG at the start, they will naturally diverge soon, since calls to PRNG in MDL subsystem are affected by many factors making process quite random. OTOH the fact that we use time as a seed gives more randomness and thus better coverage in tests as opposed to using thread_id for the same purpose.
Implements MDL_context_owner.
|
inline |
|
inline |
|
inline |
|
inline |
Returns the second Diagnostics Area for the current statement.
|
inline |
Returns first Diagnostics Area for the current statement.
|
inline |
Returns first Diagnostics Area for the current statement.
|
inlinevirtual |
Within MDL subsystem this one is only used for DEBUG_SYNC.
Do not use it to peek/poke into other parts of THD from MDL. However it is OK to use this method in callbacks provided by SQL-layer to MDL subsystem (since SQL-layer has full access to THD anyway).
Implements MDL_context_owner.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
enum_vio_type THD::get_vio_type | ( | ) |
bool THD::handle_condition | ( | uint | sql_errno, |
const char * | sqlstate, | ||
Sql_condition::enum_severity_level * | level, | ||
const char * | msg | ||
) |
Handle a sql condition.
sql_errno | the condition error number |
sqlstate | the condition sqlstate |
level | the condition level |
msg | the condition message text |
|
inline |
|
inline |
true if the session is in a multi-statement transaction mode (
For example, these scenarios don't start an active transaction (even though the server is in multi-statement transaction mode):
set @@autocommit=0; select * from nontrans_table; set @var = true; flush tables;
Note, that even for a statement that starts a multi-statement transaction (i.e. select * from trans_table), this flag won't be set until we open the statement's tables and the engines register themselves for the transaction (see trans_register_ha()), hence this method is reliable to use only after open_tables() has completed.
We need to maintain a (at first glance redundant) session flag, rather than looking at thd->transaction.all.ha_list because of explicit start of a transaction with BEGIN.
I.e. in case of BEGIN; select * from nontrans_t1; <– in_active_multi_stmt_transaction() is true
|
inline |
Returns true if session is in a multi-statement transaction mode.
OPTION_NOT_AUTOCOMMIT: When autocommit is off, a multi-statement transaction is implicitly started on the first statement after a previous transaction has been ended.
OPTION_BEGIN: Regardless of the autocommit status, a multi-statement transaction can be explicitly started with the statements "START TRANSACTION", "BEGIN [WORK]", "[COMMIT | ROLLBACK] AND CHAIN", etc.
Note: this doesn't tell you whether a transaction is active. A session can be in multi-statement transaction mode, and yet have no active transaction, e.g., in case of: set @@autocommit=0; set @a= 3; <– these statements don't set transaction isolation level serializable; <– start an active flush tables; <– transaction
I.e. for the above scenario this function returns true, even though no active transaction has begun.
void THD::inc_examined_row_count | ( | ha_rows | count | ) |
void THD::inc_sent_row_count | ( | ha_rows | count | ) |
void THD::inc_status_created_tmp_disk_tables | ( | ) |
void THD::inc_status_created_tmp_tables | ( | ) |
void THD::inc_status_select_full_join | ( | ) |
void THD::inc_status_select_full_range_join | ( | ) |
void THD::inc_status_select_range | ( | ) |
void THD::inc_status_select_range_check | ( | ) |
void THD::inc_status_select_scan | ( | ) |
void THD::inc_status_sort_merge_passes | ( | ) |
void THD::inc_status_sort_range | ( | ) |
void THD::inc_status_sort_rows | ( | ha_rows | count | ) |
void THD::inc_status_sort_scan | ( | ) |
void THD::increment_con_per_hour_counter | ( | ) |
void THD::increment_questions_counter | ( | ) |
void THD::increment_updates_counter | ( | ) |
void THD::increment_user_connections_counter | ( | ) |
|
private |
|
inline |
Initialize the optimizer cost model.
This function should be called each time a new query is started.
void THD::init_query_mem_roots | ( | ) |
Initialize memory roots necessary for query processing and (!) pre-allocate memory for it.
We can't do that in THD constructor because there are use cases (acl_init, watcher threads, killing mysqld) where it's vital to not allocate excessive and not used memory. Note, that we still don't return error from init_query_mem_roots() if preallocation fails, we should notice that at the first call to alloc_root.
|
inline |
|
inline |
bool THD::is_attachable_rw_transaction_active | ( | ) | const |
|
inline |
|
inline |
The function checks whether the thread is processing queries from binlog, as automatically generated by mysqlbinlog.
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Return false if connection to client is broken.
Implements MDL_context_owner.
|
inlineprivate |
bool THD::is_current_stmt_binlog_disabled | ( | ) | const |
Determine if binlogging is disabled for this session.
0 | if the current statement binlogging is disabled (could be because of binlog closed/binlog option is set to false). |
1 | if the current statement will be binlogged |
|
inline |
Determine the binlog format of the current statement.
0 | if the current statement will be logged in statement format. |
nonzero | if the current statement will be logged in row format. |
bool THD::is_current_stmt_binlog_row_enabled_with_write_set_extraction | ( | ) | const |
Determine if binloging is enabled in row format and write set extraction is enabled for this session.
true | if is enable |
false | otherwise |
|
inline |
|
inline |
true if there is an error in the error stack.
Please use this method instead of direct access to net.report_error.
If true, the current (sub)-statement should be aborted. The main difference between this member and is_fatal_error is that a fatal error can not be handled by a stored procedure continue handler, whereas a normal error can.
To raise this flag, use my_error().
|
inline |
|
inline |
|
inlinefinalvirtual |
Has the owner thread been killed?
Implements MDL_context_owner.
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
Returns the current waiting_for_disk_space flag value.
void THD::leave_locked_tables_mode | ( | ) |
Leave explicit LOCK TABLES or prelocked mode and restore value of transaction sentinel in MDL subsystem.
|
inline |
Locks the query plan of this THD.
LEX_CSTRING * THD::make_lex_string | ( | LEX_CSTRING * | lex_str, |
const char * | str, | ||
size_t | length, | ||
bool | allocate_lex_string | ||
) |
LEX_STRING * THD::make_lex_string | ( | LEX_STRING * | lex_str, |
const char * | str, | ||
size_t | length, | ||
bool | allocate_lex_string | ||
) |
Create a LEX_STRING in this connection.
lex_str | pointer to LEX_STRING object to be initialized |
str | initializer to be copied into lex_str |
length | length of str, in bytes |
allocate_lex_string | if true, allocate new LEX_STRING object, instead of using lex_str value |
|
inline |
|
inline |
void THD::mark_transaction_to_rollback | ( | bool | all | ) |
Mark transaction to rollback and mark error as fatal to a sub-statement.
all | true <=> rollback main transaction. |
|
inline |
Remember that place was updated with new_value so it can be restored by rollback_item_tree_changes().
[in] | place | the location that will change, and whose old value we need to remember for restoration |
[in] | new_value | new value about to be inserted into *place, remember for associative lookup, see replace_rollback_place() |
const String THD::normalized_query | ( | ) |
The current query in normalized form.
The format is intended to be identical to the digest text of performance_schema, but not limited in size. In this case the parse tree is traversed as opposed to a (limited) token buffer. The string is allocated by this Statement and will be available until the next call to this function or this object is deleted.
|
virtual |
Notify interested storage engines that we have just released exclusive lock for the key.
Implements MDL_context_owner.
Notify/get permission from interested storage engines before acquiring exclusive lock for the key.
The returned argument 'victimized' specify reason for lock not granted. If 'true', lock was refused in an attempt to resolve a possible MDL->GSL deadlock. Locking may then be retried.
Implements MDL_context_owner.
|
virtual |
A callback to the server internals that is used to address special cases of the locking protocol.
Invoked when acquiring an exclusive lock, for each thread that has a conflicting shared metadata lock.
This function aborts waiting of the thread on a data lock, to make it notice the pending exclusive lock and back off.
ctx_in_use | The MDL context owner (thread) to wake up. |
needs_thr_lock_abort | Indicates that to wake up thread this call needs to abort its waiting on table-level lock. |
Implements MDL_context_owner.
Tells whether the given optimizer_switch flag is on.
|
inline |
Pop the top DA off the Diagnostics Area stack.
Internal_error_handler * THD::pop_internal_handler | ( | ) |
Remove the error handler last pushed.
|
inline |
Pops the top protocol of the Protocol stack and sets the previous one as the current protocol.
|
inline |
Push the given Diagnostics Area on top of the stack, making it the new first Diagnostics Area.
Conditions in the new second Diagnostics Area will be copied to the new first Diagnostics Area.
da | Diagnostics Area to be come the top of the Diagnostics Area stack. |
copy_conditions | Copy the conditions from the new second Diagnostics Area to the new first Diagnostics Area, as per SQL standard. |
void THD::push_internal_handler | ( | Internal_error_handler * | handler | ) |
Add an internal error handler to the thread execution context.
handler | the exception handler to add |
|
inline |
Inserts the new protocol at the top of the protocol stack, and make it the current protocol for this thd.
protocol | Protocol to be inserted. |
|
inline |
|
inline |
struct timeval THD::query_start_timeval_trunc | ( | uint | decimals | ) |
|
private |
Raise a generic SQL condition.
sql_errno | the condition error number |
sqlstate | the condition SQLSTATE |
level | the condition level |
msg | the condition message text |
use_condition_handler | Invoke the handle_condition. |
void THD::raise_error | ( | uint | code | ) |
Raise an exception condition.
code | the MYSQL_ERRNO error code of the error |
void THD::raise_error_printf | ( | uint | code, |
... | |||
) |
Raise an exception condition, with a formatted message.
code | the MYSQL_ERRNO error code of the error |
void THD::raise_note | ( | uint | code | ) |
Raise a completion condition (note), with a fixed message.
code | the MYSQL_ERRNO error code of the note |
void THD::raise_note_printf | ( | uint | code, |
... | |||
) |
Raise an completion condition (note), with a formatted message.
code | the MYSQL_ERRNO error code of the note |
void THD::raise_warning | ( | uint | code | ) |
Raise a completion condition (warning).
code | the MYSQL_ERRNO error code of the warning |
void THD::raise_warning_printf | ( | uint | code, |
... | |||
) |
Raise a completion condition (warning), with a formatted message.
code | the MYSQL_ERRNO error code of the warning |
|
inline |
|
inline |
void THD::release_resources | ( | ) |
Release most resources, prior to THD destruction.
|
inline |
void THD::replace_rollback_place | ( | Item ** | new_place | ) |
Find and update change record of an underlying item based on the new value for a place.
If we have already saved a position to rollback for new_value, forget that rollback position and register the new place instead, typically because a transformation has made the old place irrelevant. If not, a no-op.
new_place | The new location in which we have presumably saved the new value, but which need to be rolled back to the old value. This location must also contain the new value. |
|
inline |
|
inline |
|
inline |
Set the current database; use shallow copy of C-string.
new_db | the new database name. |
|
inline |
void THD::reset_n_backup_open_tables_state | ( | Open_tables_backup * | backup, |
uint | add_state_flags | ||
) |
|
inline |
|
inline |
void THD::reset_sub_statement_state | ( | Sub_statement_state * | backup, |
uint | new_state | ||
) |
|
inline |
Get resource group context.
void THD::restore_active_arena | ( | Query_arena * | set, |
Query_arena * | backup | ||
) |
void THD::restore_backup_open_tables_state | ( | Open_tables_backup * | backup | ) |
void THD::restore_globals | ( | ) |
|
inline |
Restore ha_data from the provided backup copy.
Used by Attachable_Transaction.
void THD::restore_sub_statement_state | ( | Sub_statement_state * | backup | ) |
void THD::rollback_item_tree_changes | ( | ) |
Restore locations set by calls to nocheck_register_item_tree_change().
The value to be restored depends on whether replace_rollback_place() has been called. If not, we restore the original value. If it has been called, we restore the one supplied by the latest call to replace_rollback_place()
void THD::rpl_detach_engine_ha_data | ( | ) |
When the thread is a binlog or slave applier it detaches the engine ha_data associated with it and memorizes the fact of that.
void THD::rpl_reattach_engine_ha_data | ( | ) |
When the thread is a binlog or slave applier it reattaches the engine ha_data associated with it and memorizes the fact of that.
bool THD::rpl_unflag_detached_engine_ha_data | ( | ) |
rpl_detach_engine_ha_data
.
|
inline |
Save the current query costs attributes in the thread session status.
Use this method only after the query execution is completed, so that
actually reports the previous query, not itself.
|
inline |
int THD::send_explain_fields | ( | Query_result * | result | ) |
void THD::send_kill_message | ( | ) | const |
Send name and type of result to client.
Sum fields has table name empty and field_name.
list | List of items to send to client |
flags | Bit mask with the following functions:
|
false | ok |
true | Error (Note that in this case the error is not sent to the client) |
Send one result set row.
row_items | a collection of column values for that row |
true | Error. |
false | Success. |
void THD::send_statement_status | ( | ) |
|
inline |
|
inline |
|
inline |
void THD::set_command | ( | enum enum_server_command | command | ) |
|
inline |
|
inline |
bool THD::set_db | ( | const LEX_CSTRING & | new_db | ) |
Set the current database; use deep copy of C-string.
new_db | the new database name. |
Initialize the current database from a NULL-terminated string with length. If we run out of memory, we free the current database and return true. This way the user will notice the error as there will be no current database selected (in addition to the error message set by malloc).
false | Success |
true | Out-of-memory error |
|
inline |
|
inline |
Assign a new value to is_killable Protected with the LOCK_thd_data mutex.
void THD::set_n_backup_active_arena | ( | Query_arena * | set, |
Query_arena * | backup | ||
) |
void THD::set_new_thread_id | ( | ) |
Assign a value to m_thread_id by calling Global_THD_manager::get_new_thread_id().
void THD::set_next_event_pos | ( | const char * | _filename, |
ulonglong | _pos | ||
) |
|
inline |
Assign a new value to open_tables.
Protected with the LOCK_thd_data mutex.
void THD::set_original_commit_timestamp_for_slave_thread | ( | ) |
Copies variables.original_commit_timestamp to ((Slave_worker *)rli_slave)->original_commit_timestamp, if this is a slave thread.
|
inline |
Save the performance schema thread instrumentation associated with this user session.
psi | Performance schema thread instrumentation |
|
inline |
Assign a new value to thd->m_query_string.
Protected with the LOCK_thd_query mutex.
void THD::set_query | ( | const LEX_CSTRING & | query_arg | ) |
|
inline |
Assign a new value to thd->query_id.
Protected with the LOCK_thd_data mutex.
|
inline |
|
inline |
void THD::set_sent_row_count | ( | ha_rows | count | ) |
|
inline |
|
inline |
|
inline |
void THD::set_status_no_good_index_used | ( | ) |
void THD::set_status_no_index_used | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Functions to set and get transaction position.
These functions are used to set the transaction position for the transaction written when committing this transaction.
void THD::set_transaction | ( | Transaction_ctx * | transaction_ctx | ) |
Changes the Transaction_ctx instance within THD-object.
The previous Transaction_ctx instance is destroyed.
transaction_ctx | new Transaction_ctx instance to be associated with the THD-object. |
void THD::set_user_connect | ( | USER_CONN * | uc | ) |
|
inline |
Set the waiting_for_disk_space flag.
waiting | The value to set in the flag. |
void THD::shutdown_active_vio | ( | ) |
bool THD::sql_parser | ( | ) |
Call parser to transform statement into a parse tree.
Then, transform the parse tree further into an AST, ready for resolving.
bool THD::store_globals | ( | ) |
|
inline |
void THD::syntax_error | ( | const char * | format, |
... | |||
) |
Push an error message into MySQL diagnostic area with line number and position.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the diagnostic area, which is normally produced only if a syntax error is discovered according to the Bison grammar. Unlike the syntax_error_at() function, the error position points to the last parsed token.
format | Error format message. NULL means ER(ER_SYNTAX_ERROR). |
void THD::syntax_error | ( | int | mysql_errno, |
... | |||
) |
Push an error message into MySQL diagnostic area with line number and position.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the diagnostic area, which is normally produced only if a syntax error is discovered according to the Bison grammar. Unlike the syntax_error_at() function, the error position points to the last parsed token.
mysql_errno | Error number to get a format string with ER_THD(). |
|
inline |
void THD::syntax_error_at | ( | const YYLTYPE & | location, |
const char * | format, | ||
... | |||
) |
Push a syntax error message into MySQL diagnostic area with line and position information.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the diagnostic area, which is normally produced only if a parse error is discovered internally by the Bison generated parser.
location | YYSTYPE object: error position. |
format | Error format message. NULL means ER(ER_SYNTAX_ERROR). |
void THD::syntax_error_at | ( | const YYLTYPE & | location, |
int | mysql_errno, | ||
... | |||
) |
Push a syntax error message into MySQL diagnostic area with line and position information.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the diagnostic area, which is normally produced only if a parse error is discovered internally by the Bison generated parser.
|
inline |
void THD::time_out_user_resource_limits | ( | ) |
|
inline |
|
inline |
void THD::update_charset | ( | ) |
|
inline |
|
inline |
Evaluate the current time, and if it exceeds the long-query-time setting, mark the query as slow.
|
inline |
void THD::vsyntax_error_at | ( | const char * | pos_in_lexer_raw_buffer, |
const char * | format, | ||
va_list | args | ||
) |
Push a syntax error message into MySQL diagnostic area with line number and position.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the error stack, which is normally produced only if a parse error is discovered internally by the Bison generated parser.
pos_in_lexer_raw_buffer | Pointer into LEX::m_buf or NULL. |
format | An error message format string. |
args | Arguments to the format string. |
All global error messages are sent here where the first one is stored for the client.
Reporting an error invokes audit API call that notifies the error to the plugin. Audit API that generate the error adds a protection (condition handler) that prevents entering infinite recursion, when a plugin signals error, when already handling the error.
handle_condition is normally invoked from within raise_condition, but we need to prevent recursion befere notifying error to the plugin.
Additionaly, handle_condition must be called once during reporting an error, so the raise_condition is called depending on the result of the handle_condition call.
|
friend |
|
friend |
Push the warning to error list if there is still room in the list.
thd | Thread handle |
severity | Severity of warning (note, warning) |
code | Error number |
message_text | Clear error message |
|
friend |
|
friend |
|
friend |
Vio* THD::active_vio = {nullptr} |
bool THD::arg_of_last_insert_id_function |
Prealloced_array<unsigned long, 11> THD::audit_class_mask |
Array of bits indicating which audit classes have already been added to the list of audit plugins which are currently in use.
Plugin_array THD::audit_class_plugins |
Array of active audit plugins which have been used by this THD.
This list is later iterated to invoke release_thd() on those plugins.
Discrete_intervals_list THD::auto_inc_intervals_forced |
Discrete_intervals_list THD::auto_inc_intervals_in_cur_stmt_for_binlog |
|
private |
struct { ... } THD::binlog_evt_union |
bool THD::binlog_need_explicit_defaults_ts |
The member is served for marking a query that CREATEs or ALTERs a table declared with a TIMESTAMP column as dependent on @session.explicit_defaults_for_timestamp.
Is set to true by parser, unset at the end of the query. Possible marking in checked by binary logger.
rpl_event_coordinates THD::binlog_next_event_pos |
uchar* THD::binlog_row_event_extra_data |
|
private |
|
private |
Bit field for the state of binlog warnings.
The first Lex::BINLOG_STMT_UNSAFE_COUNT bits list all types of unsafeness that the current statement has.
This must be a member of THD and not of LEX, because warnings are detected and issued in different places (decide_logging_format()
and binlog_query()
, respectively). Between these calls, the THD->lex object may change; e.g., if a stored routine is invoked. Only THD persists between the calls.
bool THD::bool_value |
Item_change_list THD::change_list |
bool THD::charset_is_character_set_filesystem |
bool THD::charset_is_collation_connection |
bool THD::charset_is_system_charset |
is set if a statement accesses a temporary table created through CREATE TEMPORARY TABLE.
enum_check_fields THD::check_for_truncated_fields |
|
private |
ulong THD::col_access |
enum THD::Commit_error THD::commit_error |
mysql_cond_t THD::COND_thr_lock |
Condition variable used for waiting by the THR_LOCK.c subsystem.
String THD::convert_buffer |
ulonglong THD::current_changed_rows |
Number of rows changed in currently executing statement.
Applicable for UPDATE statements only.
std::atomic<mysql_cond_t *> THD::current_cond |
Pointer to the condition variable the thread owning this THD is currently waiting for.
If the thread is not waiting, the value is NULL. Set by THD::enter_cond().
If this thread is killed (shutdown or KILL stmt), another thread will broadcast on this condition variable so that the thread can be unstuck.
ulonglong THD::current_found_rows |
Dynamic, collected and set also in subqueries.
Not stable throughout query. previous_found_rows is a snapshot of this take at query end making it stable throughout the next query, see update_previous_found_rows.
LOG_INFO* THD::current_linfo |
std::atomic<mysql_mutex_t *> THD::current_mutex |
The mutex used with current_cond.
|
private |
Indicates the format in which the current statement will be logged.
This can only be set from decide_logging_format()
.
const CHARSET_INFO* THD::db_charset |
uint THD::dbug_sentry |
XID THD::debug_binlog_xid_last |
|
static |
bool THD::derived_tables_processing |
bool THD::do_union |
double THD::double_value |
Field* THD::dup_field |
bool THD::duplicate_slave_id |
This is only used by master dump threads.
When the master receives a new connection from a slave with a UUID (for slave versions >= 5.6)/server_id(for slave versions < 5.6) that is already connected, it will set this flag true before killing the old slave connection.
enum durability_properties THD::durability_property |
bool THD::enable_slow_log |
uint32 THD::file_id |
uint THD::fill_status_recursion_level |
Used by fill_status() to avoid acquiring LOCK_status mutex twice when this function is called recursively (e.g.
queries that contains SELECT on I_S.GLOBAL_STATUS with subquery on the same I_S table). Incremented each time fill_status() function is entered and decremented each time before it returns from the function.
uint THD::fill_variables_recursion_level |
query_id_t THD::first_query_id |
ulonglong THD::first_successful_insert_id_in_cur_stmt |
ulonglong THD::first_successful_insert_id_in_prev_stmt |
ulonglong THD::first_successful_insert_id_in_prev_stmt_for_binlog |
Global_read_lock THD::global_read_lock |
bool THD::got_warning |
|
private |
collation_unordered_map<std::string, unique_ptr_my_free<TABLE_LIST> > THD::handler_tables_hash |
bool THD::has_gtid_consistency_violation |
bool THD::in_lock_tables |
uint THD::in_sub_stmt |
struct System_status_var* THD::initial_status_var |
thr_lock_type THD::insert_lock_default |
Type of lock to be used for INSERT statement if lock is not specified explicitly.
Set to TL_WRITE_CONCURRENT_INSERT or TL_WRITE_LOW_PRIORITY depending on whether low_priority_updates option is off or on.
|
private |
Variable to mark if the object is part of a Srv_session object, which aggregates THD.
bool THD::is_commit_in_middle_of_statement |
bool THD::is_fatal_error |
Set to true if execution of the current compound statement can not continue.
In particular, disables activation of CONTINUE or EXIT handlers of stored routines. Reset in the end of processing of the current user request, in
bool THD::is_fatal_sub_stmt_error |
true if we are in a sub-statement and the current error can not be safely recovered until we left the sub-statement mode.
In particular, disables activation of CONTINUE and EXIT handlers inside sub-statements. E.g. if it is a deadlock error and requires a transaction-wide rollback, this flag is raised (traditionally, MySQL first has to close all the reads via
bool THD::is_killable |
bool THD::is_operating_gtid_table_implicitly |
bool THD::is_operating_substatement_implicitly |
bool THD::is_slave_error |
True if a slave error.
Causes the slave to stop. Not the same as the statement execution error (is_error()), since a statement may be expected to return an error, e.g. because it returned an error on master, and this is OK on the slave.
dd::DD_kill_immunizer* THD::kill_immunizer |
std::atomic<killed_state> THD::killed |
LEX* THD::lex |
mysql_mutex_t THD::LOCK_current_cond |
Mutex protecting access to current_mutex and current_cond.
THR_LOCK_INFO THD::lock_info |
|
private |
Protects query plan (SELECT/UPDATE/DELETE's) from being freed/changed while another thread explains it.
Following structures are protected by this mutex: THD::Query_plan Modification_plan SELECT_LEX::join JOIN::plan_state Tree of SELECT_LEX_UNIT after THD::Query_plan was set till THD::Query_plan cleanup JOIN_TAB::select->quick Code that changes objects above should take this mutex. Explain code takes this mutex to block changes to named structures to avoid crashes in following functions: explain_single_table_modification explain_query Sql_cmd_explain_other_thread::execute When doing EXPLAIN CONNECTION: all explain code assumes that this mutex is already taken. When doing ordinary EXPLAIN: the mutex does need to be taken (no need to protect reading my own data, moreover EXPLAIN CONNECTION can't run on an ordinary EXPLAIN).
mysql_mutex_t THD::LOCK_thd_data |
mysql_mutex_t THD::LOCK_thd_protocol |
Protects THD::m_protocol when it gets removed in x plugin.
mysql_mutex_t THD::LOCK_thd_query |
Protects THD::m_query_string.
No other mutexes should be locked while having this mutex locked.
mysql_mutex_t THD::LOCK_thd_sysvar |
Protects THD::variables while being updated.
This should be taken inside of LOCK_thd_data and outside of LOCK_global_system_variables.
Locked_tables_list THD::locked_tables_list |
long THD::long_value |
|
private |
|
private |
Indicate if the current statement should be discarded instead of written to the binlog.
This is used to discard special statements, such as DML or DDL that affects only 'local' (non replicated) tables, such as performance_schema.*
|
private |
It will be set TURE if CURRENT_USER() is called in account management statements or default definer is set in CREATE/ALTER SP, SF, Event, TRIGGER or VIEW statements.
Current user will be binlogged into Query_log_event if current_user_used is true; It will be stored into m_invoker_host and m_invoker_user by SQL thread.
|
private |
Currently selected catalog.
|
private |
Type of current query: COM_STMT_PREPARE, COM_QUERY, etc.
Set from first byte of the packet in do_command()
|
private |
Optimizer cost model for server operations.
double THD::m_current_query_cost |
Current query cost.
ulonglong THD::m_current_query_partial_plans |
Current query partial plans.
|
private |
|
private |
Name of the current (default) database.
If there is the current (default) database, "db" contains its name. If there is no current (default) database, "db" is NULL and "db_length" is 0. In other words, "db", "db_length" must either be NULL, or contain a valid database name.
|
private |
sql_digest_state* THD::m_digest |
Current statement digest.
sql_digest_state THD::m_digest_state |
Top level statement digest.
bool THD::m_enable_plugins |
|
private |
Number of rows read and/or evaluated for a statement.
Used for slow log reporting.
An examined row is defined as a row that is read and/or evaluated according to a statement condition, including in create_sort_index(). Rows may be counted more than once, e.g., a statement including ORDER BY could possibly evaluate the row in filesort() before reading it for e.g. update.
PSI_idle_locker* THD::m_idle_psi |
Idle instrumentation.
PSI_idle_locker_state THD::m_idle_state |
Idle instrumentation state.
|
private |
The current internal error handler for this thread, or NULL.
|
private |
|
private |
It points to the invoker in the Query_log_event.
SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event, TRIGGER or VIEW statements or current user in account management statements if it is not NULL.
|
private |
Creating or dropping plugin native table through a plugin service.
This variable enables the DDL command execution from dd::create_native_table() to be executed without committing the transaction.
Security_context THD::m_main_security_ctx |
NET_SERVER THD::m_net_server_extension |
Aditional network instrumentation for the server only.
|
private |
|
private |
cf.
Parser_state* THD::m_parser_state |
Internal parser state.
Note that since the parser is not re-entrant, we keep only one parser state here. This member is valid only when executing code during parsing.
|
private |
|
private |
|
private |
|
private |
|
private |
The query associated with this statement.
|
private |
|
private |
Resource group context indicating the current resource group and the name of the resource group to switch to during execution of a query.
|
private |
Stores the result of ROW_COUNT() function.
ROW_COUNT() function is a MySQL extention, but we try to keep it similar to ROW_COUNT member of the GET DIAGNOSTICS stack of the SQL standard (see SQL99, part 2, search for ROW_COUNT). It's value is implementation defined for anything except INSERT, DELETE, UPDATE.
ROW_COUNT is assigned according to the following rules:
In my_eof(): to -1 to indicate that there was a result set.
We derive this semantics from the JDBC specification, where int java.sql.Statement.getUpdateCount() is defined to (sic) "return the current result as an update count; if the result is a ResultSet object or there are no more results, -1 is returned".
Security_context* THD::m_security_ctx |
|
private |
Number of rows we actually sent to the client, including "synthetic" rows in ROLLUP etc.
bool THD::m_server_idle |
True if the server code is IDLE for this connection.
|
private |
SSL data attached to this connection.
This is an opaque pointer, When building with SSL, this pointer is non NULL only if the connection is using SSL. When building without SSL, this pointer is always NULL. The SSL data can be inspected to read per thread status variables, and this can be inspected while the thread is running.
PSI_stage_progress* THD::m_stage_progress_psi |
Current stage progress instrumentation.
PSI_statement_locker* THD::m_statement_psi |
Current statement instrumentation.
PSI_statement_locker_state THD::m_statement_state |
Current statement instrumentation state.
|
private |
|
private |
This counter is 32 bit because of the client protocol.
real_id
for this.unsigned char* THD::m_token_array |
Current statement digest token array.
|
private |
|
private |
|
private |
The binary log position of the transaction.
The file and position are zero if the current transaction has not been written to the binary log.
|
private |
PSI_transaction_locker* THD::m_transaction_psi |
Current transaction instrumentation.
PSI_transaction_locker_state THD::m_transaction_state |
Current transaction instrumentation state.
|
private |
List<Security_context> THD::m_view_ctx_list |
|
private |
|
private |
The lex to hold the parsed tree of conventional (non-prepared) queries.
Whereas for prepared and stored procedure statements we use an own lex instance for each new query, for conventional statements we reuse the same lex. (
|
private |
This memory root is used for two purposes:
enum enum_mark_columns THD::mark_used_columns |
ulong THD::max_client_packet_length |
MDL_context THD::mdl_context |
|
private |
THD* THD::next_to_commit |
Used by MYSQL_BIN_LOG to maintain the commit queue for binary log group commit.
ha_rows THD::num_truncated_fields |
uint THD::open_options |
Opt_trace_context THD::opt_trace |
optimizer trace of current statement
Gtid THD::owned_gtid |
The GTID of the currently owned transaction.
==== Modes of ownership ====
The following modes of ownership are possible:
==== Life cycle of ownership ====
Generally, transaction ownership starts when the transaction is assigned its GTID and ends when the transaction commits or rolls back. On a master (GTID_NEXT=AUTOMATIC), the GTID is assigned just before binlog flush; on a slave (GTID_NEXT=UUID:NUMBER or GTID_NEXT=ANONYMOUS) it is assigned before starting the transaction.
A new client always starts with owned_gtid.sidno=0.
Ownership can be acquired in the following ways:
A1. If GTID_NEXT = 'AUTOMATIC' and GTID_MODE = OFF/OFF_PERMISSIVE: The thread acquires anonymous ownership in gtid_state->generate_automatic_gtid called from MYSQL_BIN_LOG::write_gtid.
A2. If GTID_NEXT = 'AUTOMATIC' and GTID_MODE = ON/ON_PERMISSIVE: The thread generates the GTID and acquires ownership in gtid_state->generate_automatic_gtid called from MYSQL_BIN_LOG::write_gtid.
A3. If GTID_NEXT = 'UUID:NUMBER': The thread acquires ownership in the following ways:
Note: if the GTID UUID:NUMBER is already included in GTID_EXECUTED, then the transaction must be skipped (the GTID auto-skip feature). Thus, ownership is not acquired in this case and owned_gtid.sidno==0.
A4. If GTID_NEXT = 'ANONYMOUS':
- In a client, the SET GTID_NEXT statement acquires ownership. - In a slave thread, Gtid_log_event::do_apply_event acquires ownership. - Contrary to the case of GTID_NEXT='UUID:NUMBER', it is allowed to execute two transactions in sequence without changing GTID_NEXT (cf. R1 and R2 below). Both transactions should be executed as anonymous transactions. But ownership is released when the first transaction commits. Therefore, when GTID_NEXT='ANONYMOUS', we also acquire anonymous ownership when starting to execute a statement, in gtid_reacquire_ownership_if_anonymous called from gtid_pre_statement_checks (usually called from mysql_execute_command).
A5. Slave applier threads start in a special mode, having GTID_NEXT='NOT_YET_DETERMINED'. This mode cannot be set in a regular client. When GTID_NEXT=NOT_YET_DETERMINED, the slave thread is postponing the decision of the value of GTID_NEXT until it has more information. There are three cases:
Ownership is released in the following ways:
R1. A thread that holds GTID ownership releases ownership at transaction commit or rollback. If GTID_NEXT=AUTOMATIC, all is fine. If GTID_NEXT=UUID:NUMBER, the UUID:NUMBER cannot be used for another transaction, since only one transaction can have any given GTID. To avoid the user mistake of forgetting to set back GTID_NEXT, on commit we set thd->variables.gtid_next.type=UNDEFINED_GTID. Then, any statement that user tries to execute other than SET GTID_NEXT will generate an error.
R2. A thread that holds anonymous ownership releases ownership at transaction commit or rollback. In this case there is no harm in leaving GTID_NEXT='ANONYMOUS', so thd->variables.gtid_next.type will remain ANONYMOUS_GTID and not UNDEFINED_GTID.
There are statements that generate multiple transactions in the binary log. This includes the following:
M1. DROP TABLE that is used with multiple tables, and the tables belong to more than one of the following groups: non-temporary table, temporary transactional table, temporary non-transactional table. DROP TABLE is split into one transaction for each of these groups of tables.
M2. DROP DATABASE that fails e.g. because rmdir fails. Then a single DROP TABLE is generated, which lists all tables that were dropped before the failure happened. But if the list of tables is big, and grows over a limit, the statement will be split into multiple statements.
M3. CREATE TABLE ... SELECT that is logged in row format. Then the server generates a single CREATE statement, followed by a BEGIN ... row events ... COMMIT transaction.
M4. A statement that updates both transactional and non-transactional tables in the same statement, and is logged in row format. Then it generates one transaction for the non-transactional row updates, followed by one transaction for the transactional row updates.
M5. CALL is executed as multiple transactions and logged as multiple transactions.
The general rules for multi-transaction statements are:
If GTID_NEXT=AUTOMATIC and GTID_MODE=OFF or OFF_PERMISSIVE, one Anonymous_gtid_log_event should be generated for each transaction within the statement. Similar to the case above, we call mysql_bin_log.commit() and release ownership between transactions within the statement.
This works for all the special cases M1-M5 except M4. When a statement writes both non-transactional and transactional updates to the binary log, both the transaction cache and the statement cache are flushed within the same call to flush_thread_caches(THD) from within the binary log group commit code. At that point we cannot use mysql_bin_log.commit(). Instead we release ownership using direct calls to gtid_state->release_anonymous_ownership() and thd->clear_owned_gtids() from binlog_cache_mngr::flush.
If GTID_NEXT=ANONYMOUS, anonymous ownership must be preserved between transactions within the statement, to prevent that a concurrent SET GTID_MODE=ON makes it impossible to log the statement. To avoid that ownership is released if mysql_bin_log.commit() is called, we set thd->is_commit_in_middle_of_statement before calling mysql_bin_log.commit. Note that we must set this flag only if GTID_NEXT=ANONYMOUS, not if the transaction is anonymous when GTID_NEXT=AUTOMATIC and GTID_MODE=OFF.
This works for all the special cases M1-M5 except M4. When a statement writes non-transactional updates in the middle of a transaction, but keeps some transactional updates in the transaction cache, then it is not easy to know at the time of calling mysql_bin_log.commit() whether anonymous ownership needs to be preserved or not. Instead, we directly check if the transaction cache is nonempty before releasing anonymous ownership inside Gtid_state::update_gtids_impl.
Finally, ownership release is suppressed in one more corner case:
C1. Administration statements including OPTIMIZE TABLE, REPAIR TABLE, or ANALYZE TABLE are written to the binary log even if they fail. This means that the thread first calls trans_rollack, and then writes the statement to the binlog. Rollback normally releases ownership. But ownership must be kept until writing the binlog. The solution is that these statements set thd->skip_gtid_rollback=true before calling trans_rollback, and Gtid_state::update_on_rollback does not release ownership if the flag is set.
rpl_sid THD::owned_sid |
For convenience, this contains the SID component of the GTID stored in owned_gtid.
|
static |
|
static |
|
private |
bool THD::parsing_system_view |
uchar THD::password |
uint16 THD::peer_port |
ulonglong THD::previous_found_rows |
Stores the result of the FOUND_ROWS() function.
Set at query end, stable throughout the query.
const char* THD::proc_info |
std::unique_ptr<PROFILING> THD::profiling |
Protocol_binary THD::protocol_binary |
Protocol_text THD::protocol_text |
query_id_t THD::query_id |
uint THD::query_name_consts |
number of name_const() substitutions, see sp_head.cc:subst_spvars()
class THD::Query_plan THD::query_plan |
bool THD::query_start_usec_used |
struct rand_struct THD::rand |
ulong THD::rand_saved_seed1 |
ulong THD::rand_saved_seed2 |
bool THD::rand_used |
my_thread_t THD::real_id |
String THD::rewritten_query |
In some cases, we may want to modify the query (i.e.
replace passwords with their hashes before logging the statement etc.).
In case the query was rewritten, the original query will live in m_query_string, while the rewritten query lives in rewritten_query. If rewritten_query is empty, m_query_string should be logged. If rewritten_query is non-empty, the rewritten query it contains should be used in logs (general log, slow query log, binary log).
Currently, password obfuscation is the only rewriting we do; more may follow at a later date, both pre- and post parsing of the query. Rewriting of binloggable statements must preserve all pertinent information.
Relay_log_info* THD::rli_fake |
Relay_log_info* THD::rli_slave |
Rpl_thd_context THD::rpl_thd_ctx |
thd_scheduler THD::scheduler |
char THD::scramble[SCRAMBLE_LENGTH+1] |
uint32 THD::server_id |
uint THD::server_status |
Session_sysvar_resource_manager THD::session_sysvar_res_mgr |
Session_tracker THD::session_tracker |
bool THD::skip_gtid_rollback |
|
private |
bool THD::slave_thread |
sp_cache* THD::sp_func_cache |
sp_cache* THD::sp_proc_cache |
sp_rcontext* THD::sp_runtime_ctx |
Current SP-runtime context.
struct timeval THD::start_time |
ulonglong THD::start_utime |
ulong THD::statement_id_counter |
struct System_status_var THD::status_var |
bool THD::status_var_aggregated |
Query_arena* THD::stmt_arena |
bool THD::stmt_depends_on_first_successful_insert_id_in_prev_stmt |
Prepared_statement_map THD::stmt_map |
All prepared statements of this connection.
bool THD::substitute_null_with_insert_id |
union { ... } THD::sys_var_tmp |
enum enum_thread_type THD::system_thread |
table_map THD::table_map_for_update |
int THD::thd_tx_priority |
bool THD::thread_specific_used |
is set if some thread specific value(s) used in a statement.
const char* THD::thread_stack |
bool THD::time_zone_used |
struct THD_timer_info* THD::timer |
Holds active timer object.
struct THD_timer_info* THD::timer_cache |
After resetting(cancelling) timer, current timer object is cached with timer_cache timer to reuse.
uint THD::tmp_table |
|
private |
Sequential number of internal tmp table created in the statement.
Useful for tracking tmp tables when number of them is involved in a query.
bool THD::transaction_rollback_request |
Set by a storage engine to request the entire transaction (that possibly spans multiple engines) to rollback.
Reset in ha_rollback.
enum_tx_isolation THD::tx_isolation |
int THD::tx_priority |
bool THD::tx_read_only |
malloc_unordered_map<std::string, User_level_lock *> THD::ull_hash |
ulong THD::ulong_value |
ulonglong THD::ulonglong_value |
bool THD::unioned_events |
bool THD::unioned_events_trans |
uint32 THD::unmasked_server_id |
thr_lock_type THD::update_lock_default |
Type of lock to be used for all DML statements, except INSERT, in cases when lock is not specified explicitly.
Set to TL_WRITE or TL_WRITE_LOW_PRIORITY depending on whether low_priority_updates option is off or on.
struct timeval THD::user_time |
Prealloced_array<Binlog_user_var_event *, 2> THD::user_var_events |
MEM_ROOT* THD::user_var_events_alloc |
collation_unordered_map<std::string, unique_ptr_with_deleter<user_var_entry> > THD::user_vars {system_charset_info, key_memory_user_var_entry} |
Hash for user variables.
User variables are per session, but can also be monitored outside of the session, so a lock is needed to prevent race conditions. Protected by LOCK_thd_data
.
ulonglong THD::utime_after_lock |
struct System_variables THD::variables |
ulong THD::want_privilege |
Used by Item::check_column_privileges() to tell which privileges to check for.
Set to ~0ULL before starting to resolve a statement. Set to desired privilege mask before calling a resolver function that will call Item::check_column_privileges(). After use, restore previous value as current value.
const char* THD::where |
partition_info* THD::work_part_info |