MySQL 9.1.0
Source Code Documentation
sql_admin.cc File Reference
#include "sql/sql_admin.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "keycache.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_dir.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_sys.h"
#include "myisam.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/psi/mysql_file.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "nulls.h"
#include "scope_guard.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/clone_handler.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/dd/dd_table.h"
#include "sql/dd/impl/sdi_utils.h"
#include "sql/dd/info_schema/table_stats.h"
#include "sql/dd/string_type.h"
#include "sql/dd/types/abstract_table.h"
#include "sql/dd/types/table.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/handler.h"
#include "sql/histograms/histogram.h"
#include "sql/histograms/table_histograms.h"
#include "sql/item.h"
#include "sql/key.h"
#include "sql/keycaches.h"
#include "sql/lock.h"
#include "sql/log.h"
#include "sql/log_event.h"
#include "sql/mdl.h"
#include "sql/mem_root_array.h"
#include "sql/mysqld.h"
#include "sql/partition_element.h"
#include "sql/protocol.h"
#include "sql/protocol_classic.h"
#include "sql/rpl_group_replication.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_replica_commit_order_manager.h"
#include "sql/sp.h"
#include "sql/sp_rcontext.h"
#include "sql/sql_alter.h"
#include "sql/sql_alter_instance.h"
#include "sql/sql_backup_lock.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_parse.h"
#include "sql/sql_partition.h"
#include "sql/sql_table.h"
#include "sql/ssl_acceptor_context_operator.h"
#include "sql/ssl_init_callback.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/table_trigger_dispatcher.h"
#include "sql/thd_raii.h"
#include "sql/transaction.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "strxmov.h"
#include "thr_lock.h"
#include "violite.h"

Classes

class  Alter_instance_reload_tls
 

Typedefs

using Check_result = std::pair< bool, int >
 

Functions

static int send_check_errmsg (THD *thd, Table_ref *table, const char *operator_name, const char *errmsg)
 
static int prepare_for_repair (THD *thd, Table_ref *table_list, HA_CHECK_OPT *check_opt)
 
static bool table_not_corrupt_error (uint sql_errno)
 Check if a given error is something that could occur during open_and_lock_tables() that does not indicate table corruption. More...
 
static bool send_analyze_table_errors (THD *thd, const char *operator_name, const char *table_name)
 Send any errors from the ANALYZE TABLE statement to the client. More...
 
template<typename CHECK_FUNC >
static Check_result check_for_upgrade (THD *thd, dd::String_type &sname, dd::String_type &tname, CHECK_FUNC &&cf)
 
static bool mysql_admin_table (THD *thd, Table_ref *tables, HA_CHECK_OPT *check_opt, const char *operator_name, thr_lock_type lock_type, bool open_for_modify, bool repair_table_use_frm, uint extra_open_options, int(*prepare_func)(THD *, Table_ref *, HA_CHECK_OPT *), int(handler::*operator_func)(THD *, HA_CHECK_OPT *), int check_view, Alter_info *alter_info, bool need_to_acquire_shared_backup_lock)
 
static bool open_table_and_lock_histograms (THD *thd, Table_ref *table, histograms::results_map &results)
 Opens a table (acquiring an MDL_SHARED_READ metadata lock in the process) and acquires exclusive metadata locks on column statistics for all columns. More...
 
static bool check_optimize_table_access (THD *thd)
 

Typedef Documentation

◆ Check_result

using Check_result = std::pair<bool, int>

Function Documentation

◆ check_for_upgrade()

template<typename CHECK_FUNC >
static Check_result check_for_upgrade ( THD thd,
dd::String_type sname,
dd::String_type tname,
CHECK_FUNC &&  cf 
)
static

◆ check_optimize_table_access()

static bool check_optimize_table_access ( THD thd)
static

◆ mysql_admin_table()

static bool mysql_admin_table ( THD thd,
Table_ref tables,
HA_CHECK_OPT check_opt,
const char *  operator_name,
thr_lock_type  lock_type,
bool  open_for_modify,
bool  repair_table_use_frm,
uint  extra_open_options,
int(*)(THD *, Table_ref *, HA_CHECK_OPT *)  prepare_func,
int(handler::*)(THD *, HA_CHECK_OPT *)  operator_func,
int  check_view,
Alter_info alter_info,
bool  need_to_acquire_shared_backup_lock 
)
static

◆ open_table_and_lock_histograms()

static bool open_table_and_lock_histograms ( THD thd,
Table_ref table,
histograms::results_map results 
)
static

Opens a table (acquiring an MDL_SHARED_READ metadata lock in the process) and acquires exclusive metadata locks on column statistics for all columns.

Parameters
thdThread object for the statement.
[in,out]tableTable to be opened.
[in,out]resultsError and status messages for the user.
Returns
True if error, false if success.

◆ prepare_for_repair()

static int prepare_for_repair ( THD thd,
Table_ref table_list,
HA_CHECK_OPT check_opt 
)
static

◆ send_analyze_table_errors()

static bool send_analyze_table_errors ( THD thd,
const char *  operator_name,
const char *  table_name 
)
static

Send any errors from the ANALYZE TABLE statement to the client.

This function sends any errors stored in the diagnostics area as a result set to the client instead of a "normal" error. It will also clear the diagnostics area before returning.

Parameters
thdThe thread handler.
operator_nameThe name of the ANALYZE TABLE operation that will be printed in the column "Op" of the result set. This is usually either "analyze" or "histogram".
table_nameThe name of the table that ANALYZE TABLE operated on.
Return values
trueAn error occurred while sending the result set to the client.
falseThe result set was sent to the client.

◆ send_check_errmsg()

static int send_check_errmsg ( THD thd,
Table_ref table,
const char *  operator_name,
const char *  errmsg 
)
static

◆ table_not_corrupt_error()

static bool table_not_corrupt_error ( uint  sql_errno)
inlinestatic

Check if a given error is something that could occur during open_and_lock_tables() that does not indicate table corruption.

Parameters
sql_errnoError number to check.
Return values
trueError does not indicate table corruption.
falseError could indicate table corruption.