mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
perfschema - various collateral cleanups and small changes
This commit is contained in:
parent
0ea717f51a
commit
2ac3121af2
25 changed files with 66 additions and 70 deletions
|
@ -153,7 +153,6 @@ typedef struct st_heap_share
|
|||
char * name; /* Name of "memory-file" */
|
||||
time_t create_time;
|
||||
THR_LOCK lock;
|
||||
mysql_mutex_t intern_lock; /* Locking for use with _locking */
|
||||
my_bool delete_on_close;
|
||||
my_bool internal; /* Internal temporary table */
|
||||
LIST open_list;
|
||||
|
|
|
@ -38,12 +38,6 @@
|
|||
#include <table.h>
|
||||
#include <sql_list.h>
|
||||
|
||||
/* Needed to get access to scheduler variables */
|
||||
void* thd_get_scheduler_data(THD *thd);
|
||||
void thd_set_scheduler_data(THD *thd, void *data);
|
||||
PSI_thread* thd_get_psi(THD *thd);
|
||||
void thd_set_psi(THD *thd, PSI_thread *psi);
|
||||
|
||||
/* Interface to THD variables and functions */
|
||||
void thd_set_killed(THD *thd);
|
||||
void thd_clear_errors(THD *thd);
|
||||
|
|
|
@ -83,7 +83,7 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
|
|||
void (*free_element)(void*), uint flags)
|
||||
{
|
||||
my_bool res;
|
||||
DBUG_ENTER("my_hash_init");
|
||||
DBUG_ENTER("my_hash_init2");
|
||||
DBUG_PRINT("enter",("hash:%p size: %u", hash, (uint) size));
|
||||
|
||||
hash->records=0;
|
||||
|
|
|
@ -3925,10 +3925,8 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
|
|||
}
|
||||
if ((alloc= (char *)my_malloc(bufflen, MYF(0))))
|
||||
{
|
||||
len= my_convert(alloc, bufflen, cs,
|
||||
from, (uint32)len,
|
||||
val->x.string.charset,
|
||||
&dummy_errors);
|
||||
len= my_convert(alloc, bufflen, cs, from, (uint32)len,
|
||||
val->x.string.charset, &dummy_errors);
|
||||
from= alloc;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
/* from my_init */
|
||||
char * home_dir=0;
|
||||
char *home_dir=0;
|
||||
char *mysql_data_home= (char*) ".";
|
||||
const char *my_progname= NULL, *my_progname_short= NULL;
|
||||
char curr_dir[FN_REFLEN]= {0},
|
||||
|
|
|
@ -1430,10 +1430,8 @@ Event_job_data::execute(THD *thd, bool drop)
|
|||
|
||||
if (parse_sql(thd, & parser_state, creation_ctx))
|
||||
{
|
||||
sql_print_error("Event Scheduler: "
|
||||
"%serror during compilation of %s.%s",
|
||||
thd->is_fatal_error ? "fatal " : "",
|
||||
(const char *) dbname.str, (const char *) name.str);
|
||||
sql_print_error("Event Scheduler: %serror during compilation of %s.%s",
|
||||
thd->is_fatal_error ? "fatal " : "", dbname.str, name.str);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -832,13 +832,12 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
|
|||
*/
|
||||
if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS)
|
||||
{
|
||||
DBUG_ASSERT(thd->lex->first_select_lex()->db.str);
|
||||
if (!is_infoschema_db(&thd->lex->first_select_lex()->db) && // There is no events in I_S
|
||||
check_access(thd, EVENT_ACL, thd->lex->first_select_lex()->db.str,
|
||||
NULL, NULL, 0, 0))
|
||||
LEX_CSTRING *lexdb= &thd->lex->first_select_lex()->db;
|
||||
DBUG_ASSERT(lexdb);
|
||||
if (!is_infoschema_db(lexdb) && !is_perfschema_db(lexdb) &&
|
||||
check_access(thd, EVENT_ACL, lexdb->str, NULL, NULL, 0, 0))
|
||||
DBUG_RETURN(1);
|
||||
db= normalize_db_name(thd->lex->first_select_lex()->db.str,
|
||||
db_tmp, sizeof(db_tmp));
|
||||
db= normalize_db_name(lexdb->str, db_tmp, sizeof(db_tmp));
|
||||
}
|
||||
ret= db_repository->fill_schema_events(thd, tables, db);
|
||||
|
||||
|
|
|
@ -1459,9 +1459,7 @@ int ha_commit_trans(THD *thd, bool all)
|
|||
thd->transaction.cleanup();
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_is_active(thd) && is_real_trans && !error)
|
||||
{
|
||||
wsrep_commit_empty(thd, all);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -4299,7 +4299,7 @@ static PSI_mutex_key key_LOCK_item_func_sleep;
|
|||
|
||||
static PSI_mutex_info item_func_sleep_mutexes[]=
|
||||
{
|
||||
{ &key_LOCK_item_func_sleep, "LOCK_user_locks", PSI_FLAG_GLOBAL}
|
||||
{ &key_LOCK_item_func_sleep, "LOCK_item_func_sleep", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
|
||||
|
@ -4682,8 +4682,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
|
|||
entry->value=0;
|
||||
entry->value= (char*) my_realloc(entry->value, length,
|
||||
MYF(MY_ALLOW_ZERO_PTR | MY_WME |
|
||||
ME_FATAL |
|
||||
MY_THREAD_SPECIFIC));
|
||||
ME_FATAL | MY_THREAD_SPECIFIC));
|
||||
if (!entry->value)
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1723,7 +1723,8 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
|
|||
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty());
|
||||
DBUG_ASSERT(cache_mngr->trx_cache.empty());
|
||||
DBUG_ASSERT(cache_mngr->stmt_cache.empty());
|
||||
cache_mngr->~binlog_cache_mngr();
|
||||
my_free(cache_mngr);
|
||||
DBUG_RETURN(0);
|
||||
|
|
|
@ -424,7 +424,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
|
|||
/** The instrumentation key to use for opening the log index file. */
|
||||
PSI_file_key m_key_file_log_index;
|
||||
|
||||
PSI_file_key m_key_COND_queue_busy;
|
||||
PSI_cond_key m_key_COND_queue_busy;
|
||||
/** The instrumentation key to use for LOCK_binlog_end_pos. */
|
||||
PSI_mutex_key m_key_LOCK_binlog_end_pos;
|
||||
#endif
|
||||
|
@ -675,7 +675,7 @@ public:
|
|||
PSI_cond_key key_bin_log_update,
|
||||
PSI_file_key key_file_log,
|
||||
PSI_file_key key_file_log_index,
|
||||
PSI_file_key key_COND_queue_busy,
|
||||
PSI_cond_key key_COND_queue_busy,
|
||||
PSI_mutex_key key_LOCK_binlog_end_pos)
|
||||
{
|
||||
m_key_LOCK_index= key_LOCK_index;
|
||||
|
|
|
@ -9180,10 +9180,10 @@ PSI_stage_info stage_invalidating_query_cache_entries_table= { 0, "Invalidating
|
|||
PSI_stage_info stage_invalidating_query_cache_entries_table_list= { 0, "Invalidating query cache entries (table list)", 0};
|
||||
PSI_stage_info stage_killing_slave= { 0, "Killing slave", 0};
|
||||
PSI_stage_info stage_logging_slow_query= { 0, "Logging slow query", 0};
|
||||
PSI_stage_info stage_making_temp_file_append_before_load_data= { 0, "Making temporary file (append) before replaying LOAD DATA INFILE.", 0};
|
||||
PSI_stage_info stage_making_temp_file_create_before_load_data= { 0, "Making temporary file (create) before replaying LOAD DATA INFILE.", 0};
|
||||
PSI_stage_info stage_making_temp_file_append_before_load_data= { 0, "Making temporary file (append) before replaying LOAD DATA INFILE", 0};
|
||||
PSI_stage_info stage_making_temp_file_create_before_load_data= { 0, "Making temporary file (create) before replaying LOAD DATA INFILE", 0};
|
||||
PSI_stage_info stage_manage_keys= { 0, "Manage keys", 0};
|
||||
PSI_stage_info stage_master_has_sent_all_binlog_to_slave= { 0, "Master has sent all binlog to slave; waiting for binlog to be updated", 0};
|
||||
PSI_stage_info stage_master_has_sent_all_binlog_to_slave= { 0, "Master has sent all binlog to slave; waiting for more updates", 0};
|
||||
PSI_stage_info stage_opening_tables= { 0, "Opening tables", 0};
|
||||
PSI_stage_info stage_optimizing= { 0, "Optimizing", 0};
|
||||
PSI_stage_info stage_preparing= { 0, "Preparing", 0};
|
||||
|
@ -9210,7 +9210,7 @@ PSI_stage_info stage_sending_cached_result_to_client= { 0, "Sending cached resul
|
|||
PSI_stage_info stage_sending_data= { 0, "Sending data", 0};
|
||||
PSI_stage_info stage_setup= { 0, "Setup", 0};
|
||||
PSI_stage_info stage_show_explain= { 0, "Show explain", 0};
|
||||
PSI_stage_info stage_slave_has_read_all_relay_log= { 0, "Slave has read all relay log; waiting for the slave I/O thread to update it", 0};
|
||||
PSI_stage_info stage_slave_has_read_all_relay_log= { 0, "Slave has read all relay log; waiting for more updates", 0};
|
||||
PSI_stage_info stage_sorting= { 0, "Sorting", 0};
|
||||
PSI_stage_info stage_sorting_for_group= { 0, "Sorting for group", 0};
|
||||
PSI_stage_info stage_sorting_for_order= { 0, "Sorting for order", 0};
|
||||
|
@ -9258,7 +9258,7 @@ PSI_stage_info stage_binlog_processing_checkpoint_notify= { 0, "Processing binlo
|
|||
PSI_stage_info stage_binlog_stopping_background_thread= { 0, "Stopping binlog background thread", 0};
|
||||
PSI_stage_info stage_waiting_for_work_from_sql_thread= { 0, "Waiting for work from SQL thread", 0};
|
||||
PSI_stage_info stage_waiting_for_prior_transaction_to_commit= { 0, "Waiting for prior transaction to commit", 0};
|
||||
PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit= { 0, "Waiting for prior transaction to start commit before starting next transaction", 0};
|
||||
PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit= { 0, "Waiting for prior transaction to start commit", 0};
|
||||
PSI_stage_info stage_waiting_for_room_in_worker_thread= { 0, "Waiting for room in worker thread event queue", 0};
|
||||
PSI_stage_info stage_waiting_for_workers_idle= { 0, "Waiting for worker threads to be idle", 0};
|
||||
PSI_stage_info stage_waiting_for_ftwrl= { 0, "Waiting due to global read lock", 0};
|
||||
|
@ -9266,7 +9266,7 @@ PSI_stage_info stage_waiting_for_ftwrl_threads_to_pause= { 0, "Waiting for worke
|
|||
PSI_stage_info stage_waiting_for_rpl_thread_pool= { 0, "Waiting while replication worker thread pool is busy", 0};
|
||||
PSI_stage_info stage_master_gtid_wait_primary= { 0, "Waiting in MASTER_GTID_WAIT() (primary waiter)", 0};
|
||||
PSI_stage_info stage_master_gtid_wait= { 0, "Waiting in MASTER_GTID_WAIT()", 0};
|
||||
PSI_stage_info stage_gtid_wait_other_connection= { 0, "Waiting for other master connection to process GTID received on multiple master connections", 0};
|
||||
PSI_stage_info stage_gtid_wait_other_connection= { 0, "Waiting for other master connection to process the same GTID", 0};
|
||||
PSI_stage_info stage_slave_background_process_request= { 0, "Processing requests", 0};
|
||||
PSI_stage_info stage_slave_background_wait_request= { 0, "Waiting for requests", 0};
|
||||
PSI_stage_info stage_waiting_for_deadlock_kill= { 0, "Waiting for parallel replication deadlock handling to complete", 0};
|
||||
|
|
|
@ -27,6 +27,8 @@ extern const LEX_CSTRING rpl_gtid_slave_state_table_name;
|
|||
|
||||
class String;
|
||||
|
||||
#define GTID_MAX_STR_LENGTH (10+1+10+1+20)
|
||||
|
||||
struct rpl_gtid
|
||||
{
|
||||
uint32 domain_id;
|
||||
|
|
|
@ -1570,6 +1570,8 @@ uint any_slave_sql_running(bool already_locked)
|
|||
|
||||
if (!already_locked)
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
else
|
||||
mysql_mutex_assert_owner(&LOCK_active_mi);
|
||||
if (unlikely(abort_loop || !master_info_index))
|
||||
count= 1;
|
||||
else
|
||||
|
|
|
@ -3444,7 +3444,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
|
|||
thd->mdl_context.release_statement_locks();
|
||||
}
|
||||
}
|
||||
//TODO: why is this here if log_slow_query is in sp_instr_stmt_execute?
|
||||
//TODO: why is this here if log_slow_query is in sp_instr_stmt::execute?
|
||||
delete_explain_query(m_lex);
|
||||
|
||||
if (m_lex->query_tables_own_last)
|
||||
|
|
|
@ -68,6 +68,15 @@ const uint max_hostname_length= 60;
|
|||
const uint max_dbname_length= 64;
|
||||
#endif
|
||||
|
||||
const char *safe_vio_type_name(Vio *vio)
|
||||
{
|
||||
int unused;
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
if (!vio) return "Internal";
|
||||
#endif
|
||||
return vio_type_name(vio_type(vio), &unused);
|
||||
}
|
||||
|
||||
#include "sql_acl_getsort.ic"
|
||||
|
||||
static LEX_CSTRING native_password_plugin_name= {
|
||||
|
@ -13994,17 +14003,9 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
|
|||
*/
|
||||
if (sctx->user)
|
||||
{
|
||||
if (strcmp(sctx->priv_user, sctx->user))
|
||||
{
|
||||
general_log_print(thd, command, "%s@%s as %s on %s",
|
||||
sctx->user, sctx->host_or_ip,
|
||||
sctx->priv_user[0] ? sctx->priv_user : "anonymous",
|
||||
safe_str(mpvio.db.str));
|
||||
}
|
||||
else
|
||||
general_log_print(thd, command, (char*) "%s@%s on %s",
|
||||
sctx->user, sctx->host_or_ip,
|
||||
safe_str(mpvio.db.str));
|
||||
general_log_print(thd, command, (char*) "%s@%s on %s using %s",
|
||||
sctx->user, sctx->host_or_ip,
|
||||
safe_str(mpvio.db.str), safe_vio_type_name(thd->net.vio));
|
||||
}
|
||||
|
||||
if (res > CR_OK && mpvio.status != MPVIO_EXT::SUCCESS)
|
||||
|
|
|
@ -170,6 +170,11 @@ public:
|
|||
return ((const Elem*)array.buffer) + array.elements - 1;
|
||||
}
|
||||
|
||||
const Elem *end() const
|
||||
{
|
||||
return back() + 1;
|
||||
}
|
||||
|
||||
/// @returns pointer to n-th element
|
||||
Elem *get_pos(size_t idx)
|
||||
{
|
||||
|
@ -182,7 +187,6 @@ public:
|
|||
return ((const Elem*)array.buffer) + idx;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@retval false ok
|
||||
@retval true OOM, @c my_error() has been called.
|
||||
|
@ -240,10 +244,16 @@ public:
|
|||
freeze_size(&array);
|
||||
}
|
||||
|
||||
bool reserve(size_t new_size)
|
||||
{
|
||||
return allocate_dynamic(&array, (uint)new_size);
|
||||
}
|
||||
|
||||
|
||||
bool resize(size_t new_size, Elem default_val)
|
||||
{
|
||||
size_t old_size= elements();
|
||||
if (unlikely(allocate_dynamic(&array, (uint)new_size)))
|
||||
if (reserve(new_size))
|
||||
return true;
|
||||
|
||||
if (new_size > old_size)
|
||||
|
|
|
@ -13495,8 +13495,7 @@ bool JOIN_TAB::preread_init()
|
|||
if ((!derived->get_unit()->executed ||
|
||||
derived->is_recursive_with_table() ||
|
||||
derived->get_unit()->uncacheable) &&
|
||||
mysql_handle_single_derived(join->thd->lex,
|
||||
derived, DT_CREATE | DT_FILL))
|
||||
mysql_handle_single_derived(join->thd->lex, derived, DT_CREATE | DT_FILL))
|
||||
return TRUE;
|
||||
|
||||
if (!(derived->get_unit()->uncacheable & UNCACHEABLE_DEPENDENT) ||
|
||||
|
|
|
@ -247,13 +247,13 @@ class SplM_opt_info;
|
|||
typedef struct st_join_table {
|
||||
TABLE *table;
|
||||
TABLE_LIST *tab_list;
|
||||
KEYUSE *keyuse; /**< pointer to first used key */
|
||||
KEYUSE *keyuse; /**< pointer to first used key */
|
||||
KEY *hj_key; /**< descriptor of the used best hash join key
|
||||
not supported by any index */
|
||||
not supported by any index */
|
||||
SQL_SELECT *select;
|
||||
COND *select_cond;
|
||||
COND *on_precond; /**< part of on condition to check before
|
||||
accessing the first inner table */
|
||||
accessing the first inner table */
|
||||
QUICK_SELECT_I *quick;
|
||||
/*
|
||||
The value of select_cond before we've attempted to do Index Condition
|
||||
|
|
|
@ -273,7 +273,7 @@ TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
|
|||
if (is_infoschema_db(db))
|
||||
return TABLE_CATEGORY_INFORMATION;
|
||||
|
||||
if (lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, db))
|
||||
if (is_perfschema_db(db))
|
||||
return TABLE_CATEGORY_PERFORMANCE;
|
||||
|
||||
if (lex_string_eq(&MYSQL_SCHEMA_NAME, db))
|
||||
|
|
|
@ -3060,9 +3060,12 @@ extern LEX_CSTRING MYSQL_PROC_NAME;
|
|||
|
||||
inline bool is_infoschema_db(const LEX_CSTRING *name)
|
||||
{
|
||||
return (INFORMATION_SCHEMA_NAME.length == name->length &&
|
||||
!my_strcasecmp(system_charset_info,
|
||||
INFORMATION_SCHEMA_NAME.str, name->str));
|
||||
return lex_string_eq(&INFORMATION_SCHEMA_NAME, name);
|
||||
}
|
||||
|
||||
inline bool is_perfschema_db(const LEX_CSTRING *name)
|
||||
{
|
||||
return lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, name);
|
||||
}
|
||||
|
||||
inline void mark_as_null_row(TABLE *table)
|
||||
|
|
|
@ -245,18 +245,12 @@ bool trans_commit(THD *thd)
|
|||
if res is non-zero, then ha_commit_trans has rolled back the
|
||||
transaction, so the hooks for rollback will be called.
|
||||
*/
|
||||
#ifdef HAVE_REPLICATION
|
||||
if (res)
|
||||
{
|
||||
#ifdef HAVE_REPLICATION
|
||||
repl_semisync_master.wait_after_rollback(thd, FALSE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_REPLICATION
|
||||
repl_semisync_master.wait_after_commit(thd, FALSE);
|
||||
#endif
|
||||
}
|
||||
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
|
||||
thd->transaction.all.reset();
|
||||
thd->lex->start_transaction_opt= 0;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
/***************************************************************************
|
||||
Handling of XA id cacheing
|
||||
Handling of XA id caching
|
||||
***************************************************************************/
|
||||
enum xa_states { XA_ACTIVE= 0, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY };
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ Created Nov 12, 2014 Vasil Dimov
|
|||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
|
||||
typedef void PSI_stage_progress;
|
||||
|
||||
/** Class used to report ALTER TABLE progress via performance_schema.
|
||||
The only user of this class is the ALTER TABLE code and it calls the methods
|
||||
in the following order
|
||||
|
|
|
@ -1740,6 +1740,7 @@ void pfs_register_stage_v1(const char *category,
|
|||
DBUG_ASSERT(info != NULL);
|
||||
DBUG_ASSERT(info->m_name != NULL);
|
||||
len= (int)strlen(info->m_name);
|
||||
DBUG_ASSERT(len <= 64); // see table_threads.cc near PROCESSLIST_STATE
|
||||
full_length= prefix_length + len;
|
||||
if (likely(full_length <= PFS_MAX_INFO_NAME_LENGTH))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue