summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-02-15 18:25:57 +0100
committerSergei Golubchik <serg@mariadb.org>2020-03-10 19:24:23 +0100
commit7af733a5a2cb7f79ffb5ff0129cad6db6f3cc359 (patch)
treef8f9cab2cd92e43b5fd20c9ac77f9487ece4e5a7 /sql
parent81cffda2e68ea5a155b74f24ae4345388afa963c (diff)
downloadmariadb-git-7af733a5a2cb7f79ffb5ff0129cad6db6f3cc359.tar.gz
perfschema compilation, test and misc fixes
Diffstat (limited to 'sql')
-rw-r--r--sql/event_data_objects.cc4
-rw-r--r--sql/event_queue.cc4
-rw-r--r--sql/events.cc2
-rw-r--r--sql/ha_partition.cc4
-rw-r--r--sql/handle_connections_win.cc2
-rw-r--r--sql/log.h2
-rw-r--r--sql/mdl.cc2
-rw-r--r--sql/mysqld.cc222
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/semisync_master_ack_receiver.cc2
-rw-r--r--sql/slave.cc4
-rw-r--r--sql/sp.cc6
-rw-r--r--sql/sp_head.cc37
-rw-r--r--sql/sp_head.h38
-rw-r--r--sql/sql_acl.cc14
-rw-r--r--sql/sql_acl.h2
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_plugin.cc1
-rw-r--r--sql/sql_trigger.cc12
-rw-r--r--sql/sys_vars.cc186
22 files changed, 297 insertions, 260 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 0067e1f414c..7d4afb2e9c5 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1480,8 +1480,8 @@ Event_job_data::execute(THD *thd, bool drop)
sphead->optimize();
sphead->m_sp_share= MYSQL_GET_SP_SHARE(SP_TYPE_EVENT,
- dbname.str, dbname.length,
- name.str, name.length);
+ dbname.str, static_cast<uint>(dbname.length),
+ name.str, static_cast<uint>(name.length));
ret= sphead->execute_procedure(thd, &empty_item_list);
/*
There is no pre-locking and therefore there should be no
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index 1530c4e7f0d..71d1d2c68ee 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -353,8 +353,8 @@ Event_queue::drop_matching_events(THD *thd, const LEX_CSTRING *pattern,
*/
queue_remove(&queue, i);
/* Drop statistics for this stored program from performance schema. */
- MYSQL_DROP_SP(SP_TYPE_EVENT, et->dbname.str, et->dbname.length,
- et->name.str, et->name.length);
+ MYSQL_DROP_SP(SP_TYPE_EVENT, et->dbname.str, static_cast<uint>(et->dbname.length),
+ et->name.str, static_cast<uint>(et->name.length));
delete et;
}
else
diff --git a/sql/events.cc b/sql/events.cc
index a2941d11ff2..76a6a31cad9 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -623,7 +623,7 @@ Events::drop_event(THD *thd, const LEX_CSTRING *dbname,
ret= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
/* Drop statistics for this stored program from performance schema. */
MYSQL_DROP_SP(SP_TYPE_EVENT,
- dbname->str, dbname->length, name->str, name->length);
+ dbname->str, static_cast<uint>(dbname->length), name->str, static_cast<uint>(name->length));
}
thd->restore_stmt_binlog_format(save_binlog_format);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index e1a1e4d45de..ce5038097f0 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -107,7 +107,7 @@ static PSI_memory_key key_memory_partition_sort_buffer;
static PSI_memory_key key_memory_Partition_admin;
static PSI_memory_key key_memory_ha_partition_file;
-static PSI_memory_key key_memory_ha_partition_engine_array;
+//static PSI_memory_key key_memory_ha_partition_engine_array;
static PSI_memory_key key_memory_ha_partition_part_ids;
#ifdef HAVE_PSI_INTERFACE
@@ -123,7 +123,7 @@ static PSI_memory_info all_partitioning_memory[]=
{ &key_memory_partition_sort_buffer, "partition_sort_buffer", 0},
{ &key_memory_Partition_admin, "Partition_admin", 0},
{ &key_memory_ha_partition_file, "ha_partition::file", 0},
- { &key_memory_ha_partition_engine_array, "ha_partition::engine_array", 0},
+// { &key_memory_ha_partition_engine_array, "ha_partition::engine_array", 0},
{ &key_memory_ha_partition_part_ids, "ha_partition::part_ids", 0} };
static PSI_file_info all_partition_file[]=
{ { &key_file_ha_partition_par, "ha_partition::parfile", 0} };
diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc
index 5db10c2fada..44ad8ddc865 100644
--- a/sql/handle_connections_win.cc
+++ b/sql/handle_connections_win.cc
@@ -360,7 +360,7 @@ struct Pipe_Listener : public Listener
{
sql_perror("Create named pipe failed");
sql_print_error("Aborting");
- exit(1);
+ unireg_abort(1);
}
first_instance= false;
return pipe_handle;
diff --git a/sql/log.h b/sql/log.h
index 8ac5de28053..e4424778111 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -412,7 +412,6 @@ struct wait_for_commit;
class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
{
-#ifdef HAVE_PSI_INTERFACE
/** The instrumentation key to use for @ LOCK_index. */
PSI_mutex_key m_key_LOCK_index;
/** The instrumentation key to use for @ COND_relay_log_updated */
@@ -427,7 +426,6 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
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
struct group_commit_entry
{
diff --git a/sql/mdl.cc b/sql/mdl.cc
index ee20c89c3cb..5f229f73b2f 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -2355,7 +2355,7 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout)
mysql_prlock_unlock(&lock->m_rwlock);
- PSI_metadata_locker_state state;
+ PSI_metadata_locker_state state __attribute__((unused));
PSI_metadata_locker *locker= NULL;
if (ticket->m_psi != NULL)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index aa4c3adff9f..42eb97fefbe 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -785,8 +785,8 @@ static struct my_option pfs_early_options[]=
{"performance_schema_consumer_events_statements_current", 0,
"Default startup value for the events_statements_current consumer.",
&pfs_param.m_consumer_events_statements_current_enabled,
- &pfs_param.m_consumer_events_statements_current_enabled, 0,
- GET_BOOL, OPT_ARG, TRUE, 0, 0, 0, 0, 0},
+ &pfs_param.m_consumer_events_statements_current_enabled, 0, GET_BOOL,
+ OPT_ARG, FALSE, 0, 0, 0, 0, 0},
{"performance_schema_consumer_events_statements_history", 0,
"Default startup value for the events_statements_history consumer.",
&pfs_param.m_consumer_events_statements_history_enabled,
@@ -797,6 +797,21 @@ static struct my_option pfs_early_options[]=
&pfs_param.m_consumer_events_statements_history_long_enabled,
&pfs_param.m_consumer_events_statements_history_long_enabled, 0,
GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0},
+ {"performance_schema_consumer_events_transactions_current", 0,
+ "Default startup value for the events_transactions_current consumer.",
+ &pfs_param.m_consumer_events_transactions_current_enabled,
+ &pfs_param.m_consumer_events_transactions_current_enabled, 0,
+ GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0},
+ {"performance_schema_consumer_events_transactions_history", 0,
+ "Default startup value for the events_transactions_history consumer.",
+ &pfs_param.m_consumer_events_transactions_history_enabled,
+ &pfs_param.m_consumer_events_transactions_history_enabled, 0,
+ GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0},
+ {"performance_schema_consumer_events_transactions_history_long", 0,
+ "Default startup value for the events_transactions_history_long consumer.",
+ &pfs_param.m_consumer_events_transactions_history_long_enabled,
+ &pfs_param.m_consumer_events_transactions_history_long_enabled, 0,
+ GET_BOOL, OPT_ARG, FALSE, 0, 0, 0, 0, 0},
{"performance_schema_consumer_events_waits_current", 0,
"Default startup value for the events_waits_current consumer.",
&pfs_param.m_consumer_events_waits_current_enabled,
@@ -834,6 +849,19 @@ static struct my_option pfs_early_options[]=
NO_ARG, 1, 0, 1, 0, 0, 0}
};
+PSI_file_key key_file_binlog, key_file_binlog_cache, key_file_binlog_index,
+ key_file_binlog_index_cache, key_file_casetest,
+ key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
+ key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
+ key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
+ key_file_master_info, key_file_misc, key_file_partition_ddl_log,
+ key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
+ key_file_trg, key_file_trn, key_file_init;
+PSI_file_key key_file_query_log, key_file_slow_log;
+PSI_file_key key_file_relaylog, key_file_relaylog_index,
+ key_file_relaylog_cache, key_file_relaylog_index_cache;
+PSI_file_key key_file_binlog_state;
+
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_MMAP
PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active, key_LOCK_pool,
@@ -1106,19 +1134,6 @@ static PSI_thread_info all_server_threads[]=
PSI_file_key key_file_map;
#endif /* HAVE_MMAP */
-PSI_file_key key_file_binlog, key_file_binlog_cache, key_file_binlog_index,
- key_file_binlog_index_cache, key_file_casetest,
- key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
- key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
- key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_partition_ddl_log,
- key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
- key_file_trg, key_file_trn, key_file_init;
-PSI_file_key key_file_query_log, key_file_slow_log;
-PSI_file_key key_file_relaylog, key_file_relaylog_index,
- key_file_relaylog_cache, key_file_relaylog_index_cache;
-PSI_file_key key_file_binlog_state;
-
#endif /* HAVE_PSI_INTERFACE */
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -5346,6 +5361,9 @@ int mysqld_main(int argc, char **argv)
exit(1);
#ifndef _WIN32
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+ pre_initialize_performance_schema();
+#endif /*WITH_PERFSCHEMA_STORAGE_ENGINE */
// For windows, my_init() is called from the win specific mysqld_main
if (my_init()) // init my_sys library & pthreads
{
@@ -5725,7 +5743,7 @@ int mysqld_main(int argc, char **argv)
mysql_cond_broadcast(&COND_server_started);
mysql_mutex_unlock(&LOCK_server_started);
- MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
+ (void)MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
/* Memory used when everything is setup */
start_memory_used= global_status_var.global_memory_used;
@@ -5910,6 +5928,10 @@ int mysqld_main(int argc, char **argv)
/* Must be initialized early for comparison of service name */
system_charset_info= &my_charset_utf8mb3_general_ci;
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+ pre_initialize_performance_schema();
+#endif /*WITH_PERFSCHEMA_STORAGE_ENGINE */
+
if (my_init())
{
fprintf(stderr, "my_init() failed.");
@@ -9081,6 +9103,11 @@ void refresh_status(THD *thd)
{
mysql_mutex_lock(&LOCK_status);
+#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
+ /* Reset aggregated status counters. */
+ reset_pfs_status_stats();
+#endif
+
/* Add thread's status variabes to global status */
add_to_status(&global_status_var, &thd->status_var);
@@ -9293,6 +9320,87 @@ PSI_stage_info stage_slave_background_wait_request= { 0, "Waiting for requests",
PSI_stage_info stage_waiting_for_deadlock_kill= { 0, "Waiting for parallel replication deadlock handling to complete", 0};
PSI_stage_info stage_starting= { 0, "starting", 0};
+PSI_memory_key key_memory_DATE_TIME_FORMAT;
+PSI_memory_key key_memory_DDL_LOG_MEMORY_ENTRY;
+PSI_memory_key key_memory_Event_queue_element_for_exec_names;
+PSI_memory_key key_memory_Event_scheduler_scheduler_param;
+PSI_memory_key key_memory_Filesort_info_merge;
+PSI_memory_key key_memory_Filesort_info_record_pointers;
+PSI_memory_key key_memory_Gis_read_stream_err_msg;
+PSI_memory_key key_memory_JOIN_CACHE;
+PSI_memory_key key_memory_MPVIO_EXT_auth_info;
+PSI_memory_key key_memory_MYSQL_BIN_LOG_basename;
+PSI_memory_key key_memory_MYSQL_BIN_LOG_index;
+PSI_memory_key key_memory_MYSQL_LOCK;
+PSI_memory_key key_memory_MYSQL_LOG_name;
+PSI_memory_key key_memory_MYSQL_RELAY_LOG_basename;
+PSI_memory_key key_memory_MYSQL_RELAY_LOG_index;
+PSI_memory_key key_memory_NAMED_ILINK_name;
+PSI_memory_key key_memory_PROFILE;
+PSI_memory_key key_memory_QUICK_RANGE_SELECT_mrr_buf_desc;
+PSI_memory_key key_memory_Query_cache;
+PSI_memory_key key_memory_Relay_log_info_group_relay_log_name;
+PSI_memory_key key_memory_Row_data_memory_memory;
+PSI_memory_key key_memory_Rpl_info_file_buffer;
+PSI_memory_key key_memory_SLAVE_INFO;
+PSI_memory_key key_memory_ST_SCHEMA_TABLE;
+PSI_memory_key key_memory_Sort_param_tmp_buffer;
+PSI_memory_key key_memory_Sys_var_charptr_value;
+PSI_memory_key key_memory_TABLE;
+PSI_memory_key key_memory_TABLE_RULE_ENT;
+PSI_memory_key key_memory_TC_LOG_MMAP_pages;
+PSI_memory_key key_memory_THD_db;
+PSI_memory_key key_memory_THD_handler_tables_hash;
+PSI_memory_key key_memory_THD_variables;
+PSI_memory_key key_memory_Table_trigger_dispatcher;
+PSI_memory_key key_memory_Unique_merge_buffer;
+PSI_memory_key key_memory_Unique_sort_buffer;
+PSI_memory_key key_memory_User_level_lock;
+PSI_memory_key key_memory_XID;
+PSI_memory_key key_memory_acl_cache;
+PSI_memory_key key_memory_acl_mem;
+PSI_memory_key key_memory_acl_memex;
+PSI_memory_key key_memory_binlog_cache_mngr;
+PSI_memory_key key_memory_binlog_pos;
+PSI_memory_key key_memory_binlog_recover_exec;
+PSI_memory_key key_memory_binlog_statement_buffer;
+PSI_memory_key key_memory_binlog_ver_1_event;
+PSI_memory_key key_memory_bison_stack;
+PSI_memory_key key_memory_blob_mem_storage;
+PSI_memory_key key_memory_dboptions_hash;
+PSI_memory_key key_memory_errmsgs;
+PSI_memory_key key_memory_frm_string;
+PSI_memory_key key_memory_gdl;
+PSI_memory_key key_memory_global_system_variables;
+PSI_memory_key key_memory_handler_errmsgs;
+PSI_memory_key key_memory_handlerton;
+PSI_memory_key key_memory_hash_index_key_buffer;
+PSI_memory_key key_memory_host_cache_hostname;
+PSI_memory_key key_memory_ignored_db;
+PSI_memory_key key_memory_locked_table_list;
+PSI_memory_key key_memory_locked_thread_list;
+PSI_memory_key key_memory_my_str_malloc;
+PSI_memory_key key_memory_native_functions;
+PSI_memory_key key_memory_prepared_statement_main_mem_root;
+PSI_memory_key key_memory_prepared_statement_map;
+PSI_memory_key key_memory_queue_item;
+PSI_memory_key key_memory_quick_range_select_root;
+PSI_memory_key key_memory_rpl_filter;
+PSI_memory_key key_memory_sp_cache;
+PSI_memory_key key_memory_sp_head_call_root;
+PSI_memory_key key_memory_sp_head_execute_root;
+PSI_memory_key key_memory_sp_head_main_root;
+PSI_memory_key key_memory_table_mapping_root;
+PSI_memory_key key_memory_table_share;
+PSI_memory_key key_memory_table_triggers_list;
+PSI_memory_key key_memory_thd_main_mem_root;
+PSI_memory_key key_memory_thd_transactions;
+PSI_memory_key key_memory_user_conn;
+PSI_memory_key key_memory_user_var_entry;
+PSI_memory_key key_memory_user_var_entry_value;
+
+PSI_memory_key key_memory_String_value;
+
#ifdef HAVE_PSI_INTERFACE
PSI_stage_info *all_server_stages[]=
@@ -9441,88 +9549,6 @@ static PSI_socket_info all_server_sockets[]=
{ &key_socket_client_connection, "client_connection", 0}
};
-
-PSI_memory_key key_memory_DATE_TIME_FORMAT;
-PSI_memory_key key_memory_DDL_LOG_MEMORY_ENTRY;
-PSI_memory_key key_memory_Event_queue_element_for_exec_names;
-PSI_memory_key key_memory_Event_scheduler_scheduler_param;
-PSI_memory_key key_memory_Filesort_info_merge;
-PSI_memory_key key_memory_Filesort_info_record_pointers;
-PSI_memory_key key_memory_Gis_read_stream_err_msg;
-PSI_memory_key key_memory_JOIN_CACHE;
-PSI_memory_key key_memory_MPVIO_EXT_auth_info;
-PSI_memory_key key_memory_MYSQL_BIN_LOG_basename;
-PSI_memory_key key_memory_MYSQL_BIN_LOG_index;
-PSI_memory_key key_memory_MYSQL_LOCK;
-PSI_memory_key key_memory_MYSQL_LOG_name;
-PSI_memory_key key_memory_MYSQL_RELAY_LOG_basename;
-PSI_memory_key key_memory_MYSQL_RELAY_LOG_index;
-PSI_memory_key key_memory_NAMED_ILINK_name;
-PSI_memory_key key_memory_PROFILE;
-PSI_memory_key key_memory_QUICK_RANGE_SELECT_mrr_buf_desc;
-PSI_memory_key key_memory_Query_cache;
-PSI_memory_key key_memory_Relay_log_info_group_relay_log_name;
-PSI_memory_key key_memory_Row_data_memory_memory;
-PSI_memory_key key_memory_Rpl_info_file_buffer;
-PSI_memory_key key_memory_SLAVE_INFO;
-PSI_memory_key key_memory_ST_SCHEMA_TABLE;
-PSI_memory_key key_memory_Sort_param_tmp_buffer;
-PSI_memory_key key_memory_Sys_var_charptr_value;
-PSI_memory_key key_memory_TABLE;
-PSI_memory_key key_memory_TABLE_RULE_ENT;
-PSI_memory_key key_memory_TC_LOG_MMAP_pages;
-PSI_memory_key key_memory_THD_db;
-PSI_memory_key key_memory_THD_handler_tables_hash;
-PSI_memory_key key_memory_THD_variables;
-PSI_memory_key key_memory_Table_trigger_dispatcher;
-PSI_memory_key key_memory_Unique_merge_buffer;
-PSI_memory_key key_memory_Unique_sort_buffer;
-PSI_memory_key key_memory_User_level_lock;
-PSI_memory_key key_memory_XID;
-PSI_memory_key key_memory_acl_cache;
-PSI_memory_key key_memory_acl_mem;
-PSI_memory_key key_memory_acl_memex;
-PSI_memory_key key_memory_binlog_cache_mngr;
-PSI_memory_key key_memory_binlog_pos;
-PSI_memory_key key_memory_binlog_recover_exec;
-PSI_memory_key key_memory_binlog_statement_buffer;
-PSI_memory_key key_memory_binlog_ver_1_event;
-PSI_memory_key key_memory_bison_stack;
-PSI_memory_key key_memory_blob_mem_storage;
-PSI_memory_key key_memory_dboptions_hash;
-PSI_memory_key key_memory_errmsgs;
-PSI_memory_key key_memory_frm_string;
-PSI_memory_key key_memory_gdl;
-PSI_memory_key key_memory_global_system_variables;
-PSI_memory_key key_memory_handler_errmsgs;
-PSI_memory_key key_memory_handlerton;
-PSI_memory_key key_memory_hash_index_key_buffer;
-PSI_memory_key key_memory_host_cache_hostname;
-PSI_memory_key key_memory_ignored_db;
-PSI_memory_key key_memory_locked_table_list;
-PSI_memory_key key_memory_locked_thread_list;
-PSI_memory_key key_memory_my_str_malloc;
-PSI_memory_key key_memory_native_functions;
-PSI_memory_key key_memory_prepared_statement_main_mem_root;
-PSI_memory_key key_memory_prepared_statement_map;
-PSI_memory_key key_memory_queue_item;
-PSI_memory_key key_memory_quick_range_select_root;
-PSI_memory_key key_memory_rpl_filter;
-PSI_memory_key key_memory_sp_cache;
-PSI_memory_key key_memory_sp_head_call_root;
-PSI_memory_key key_memory_sp_head_execute_root;
-PSI_memory_key key_memory_sp_head_main_root;
-PSI_memory_key key_memory_table_mapping_root;
-PSI_memory_key key_memory_table_share;
-PSI_memory_key key_memory_table_triggers_list;
-PSI_memory_key key_memory_thd_main_mem_root;
-PSI_memory_key key_memory_thd_transactions;
-PSI_memory_key key_memory_user_conn;
-PSI_memory_key key_memory_user_var_entry;
-PSI_memory_key key_memory_user_var_entry_value;
-
-PSI_memory_key key_memory_String_value;
-
static PSI_memory_info all_server_memory[]=
{
{ &key_memory_locked_table_list, "Locked_tables_list::m_locked_tables_root", 0},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 5f07b2d4b8a..5c16140c3b7 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -305,7 +305,6 @@ extern my_bool disconnect_on_expired_password;
enum secure_timestamp { SECTIME_NO, SECTIME_SUPER, SECTIME_REPL, SECTIME_YES };
-#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_MMAP
extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
key_LOCK_pool, key_LOCK_pending_checkpoint;
@@ -405,6 +404,7 @@ extern PSI_socket_key key_socket_tcpip, key_socket_unix,
key_socket_client_connection;
extern PSI_file_key key_file_binlog_state;
+#ifdef HAVE_PSI_INTERFACE
void init_server_psi_keys();
#endif /* HAVE_PSI_INTERFACE */
diff --git a/sql/semisync_master_ack_receiver.cc b/sql/semisync_master_ack_receiver.cc
index e189fc5f631..6340b4bd661 100644
--- a/sql/semisync_master_ack_receiver.cc
+++ b/sql/semisync_master_ack_receiver.cc
@@ -164,7 +164,7 @@ void Ack_receiver::remove_slave(THD *thd)
inline void Ack_receiver::set_stage_info(const PSI_stage_info &stage)
{
- MYSQL_SET_STAGE(stage.m_key, __FILE__, __LINE__);
+ (void)MYSQL_SET_STAGE(stage.m_key, __FILE__, __LINE__);
}
inline void Ack_receiver::wait_for_slave_connection()
diff --git a/sql/slave.cc b/sql/slave.cc
index fc27227a36b..f57015169a7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -57,6 +57,9 @@
#include "wsrep_trans_observer.h"
#endif
+class Master_info_index;
+Master_info_index *master_info_index;
+
#ifdef HAVE_REPLICATION
#include "rpl_tblmap.h"
@@ -81,7 +84,6 @@ char slave_transaction_retry_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
char* slave_load_tmpdir = 0;
Master_info *active_mi= 0;
-Master_info_index *master_info_index;
my_bool replicate_same_server_id;
ulonglong relay_log_space_limit = 0;
ulonglong opt_read_binlog_speed_limit = 0;
diff --git a/sql/sp.cc b/sql/sp.cc
index 67b6b6a1887..5ea7a0ab4ba 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1108,8 +1108,8 @@ Sp_handler::sp_drop_routine_internal(THD *thd,
if ((sp= sp_cache_lookup(spc, name)))
sp_cache_flush_obsolete(spc, &sp);
/* Drop statistics for this stored program from performance schema. */
- MYSQL_DROP_SP(type(), name->m_db.str, name->m_db.length,
- name->m_name.str, name->m_name.length);
+ MYSQL_DROP_SP(type(), name->m_db.str, static_cast<uint>(name->m_db.length),
+ name->m_name.str, static_cast<uint>(name->m_name.length));
DBUG_RETURN(SP_OK);
}
@@ -1857,7 +1857,7 @@ sp_drop_db_routines(THD *thd, const char *db)
enum_sp_type sp_type= (enum_sp_type) table->field[MYSQL_PROC_MYSQL_TYPE]->ptr[0];
/* Drop statistics for this stored program from performance schema. */
- MYSQL_DROP_SP(sp_type, db, db_length, name->ptr(), name->length());
+ MYSQL_DROP_SP(sp_type, db, static_cast<uint>(db_length), name->ptr(), name->length());
#endif
}
else
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 53e4029d82d..6853d392a8c 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -90,6 +90,18 @@ void init_sp_psi_keys()
}
#endif
+#ifdef HAVE_PSI_SP_INTERFACE
+#define MYSQL_RUN_SP(SP,CODE) \
+ do { \
+ PSI_sp_locker_state psi_state; \
+ PSI_sp_locker *locker= MYSQL_START_SP(&psi_state, (SP)->m_sp_share); \
+ CODE; \
+ MYSQL_END_SP(locker); \
+ } while(0)
+#else
+#define MYSQL_RUN_SP(SP, CODE) do { CODE; } while(0)
+#endif
+
extern "C" uchar *sp_table_key(const uchar *ptr, size_t *plen, my_bool first);
/**
@@ -801,8 +813,8 @@ sp_head::init_sp_name(const sp_name *spname)
void
sp_head::init_psi_share()
{
- m_sp_share= MYSQL_GET_SP_SHARE(m_handler->type(), m_db.str, m_db.length,
- m_name.str, m_name.length);
+ m_sp_share= MYSQL_GET_SP_SHARE(m_handler->type(), m_db.str, static_cast<uint>(m_db.length),
+ m_name.str, static_cast<uint>(m_name.length));
}
@@ -1895,12 +1907,7 @@ sp_head::execute_trigger(THD *thd,
thd->spcont= nctx;
- {
- PSI_sp_locker_state psi_state;
- PSI_sp_locker *locker= MYSQL_START_SP(&psi_state, m_sp_share);
- err_status= execute(thd, FALSE);
- MYSQL_END_SP(locker);
- }
+ MYSQL_RUN_SP(this, err_status= execute(thd, FALSE));
err_with_cleanup:
thd->restore_active_arena(&call_arena, &backup_arena);
@@ -2150,12 +2157,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
*/
thd->set_n_backup_active_arena(call_arena, &backup_arena);
- {
- PSI_sp_locker_state psi_state;
- PSI_sp_locker *locker= MYSQL_START_SP(&psi_state, m_sp_share);
- err_status= execute(thd, TRUE);
- MYSQL_END_SP(locker);
- }
+ MYSQL_RUN_SP(this, err_status= execute(thd, TRUE));
thd->restore_active_arena(call_arena, &backup_arena);
@@ -2437,11 +2439,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
opt_trace_disable_if_no_stored_proc_func_access(thd, this);
- PSI_sp_locker_state psi_state;
- PSI_sp_locker *locker= MYSQL_START_SP(&psi_state, m_sp_share);
if (!err_status)
- err_status= execute(thd, TRUE);
- MYSQL_END_SP(locker);
+ MYSQL_RUN_SP(this, err_status= execute(thd, TRUE));
if (save_log_general)
thd->variables.option_bits &= ~OPTION_LOG_OFF;
@@ -3643,7 +3642,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
DBUG_ENTER("sp_instr_stmt::execute");
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
- MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, m_query.str, m_query.length);
+ MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, m_query.str, static_cast<uint>(m_query.length));
#if defined(ENABLED_PROFILING)
/* This s-p instr is profilable and will be captured. */
diff --git a/sql/sp_head.h b/sql/sp_head.h
index fb490e40375..913be1aace7 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -1299,11 +1299,9 @@ private:
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_stmt : public sp_instr
@@ -1340,11 +1338,9 @@ protected:
Item *m_value;
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_set : public sp_instr
@@ -1454,11 +1450,9 @@ private:
Item *value;
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_trigger_field : public sp_instr
@@ -1545,11 +1539,9 @@ public:
m_dest= new_dest;
}
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_jump : public sp_instr_opt_meta
@@ -1601,11 +1593,9 @@ private:
Item *m_expr; ///< The condition
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_jump_if_not : public sp_instr_jump
@@ -1633,11 +1623,9 @@ public:
return UINT_MAX;
}
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_preturn : public sp_instr
@@ -1675,11 +1663,9 @@ protected:
const Type_handler *m_type_handler;
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_freturn : public sp_instr
@@ -1745,11 +1731,9 @@ private:
// debug version only). It's used in print().
uint m_frame;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_hpush_jump : public sp_instr_jump
@@ -1780,11 +1764,9 @@ private:
uint m_count;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_hpop : public sp_instr
@@ -1819,11 +1801,9 @@ private:
uint m_frame;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_hreturn : public sp_instr_jump
@@ -1857,11 +1837,9 @@ private:
sp_lex_keeper m_lex_keeper;
uint m_cursor; /**< Frame offset (for debugging) */
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_cpush : public sp_instr
@@ -1892,11 +1870,9 @@ private:
uint m_count;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_cpop : public sp_instr
@@ -1924,11 +1900,9 @@ private:
uint m_cursor; ///< Stack index
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_copen : public sp_instr_stmt
@@ -1957,11 +1931,9 @@ public:
virtual int exec_core(THD *thd, uint *nextp);
virtual void print(String *str);
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
};
@@ -1987,11 +1959,9 @@ private:
uint m_cursor;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_cclose : public sp_instr
@@ -2026,11 +1996,9 @@ private:
List<sp_variable> m_varlist;
bool m_error_on_no_data;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_cfetch : public sp_instr
/*
@@ -2056,11 +2024,9 @@ public:
virtual void print(String *str);
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_agg_cfetch : public sp_instr
@@ -2094,11 +2060,9 @@ private:
int m_errcode;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_error : public sp_instr
@@ -2138,11 +2102,9 @@ private:
Item *m_case_expr;
sp_lex_keeper m_lex_keeper;
-#ifdef HAVE_PSI_INTERFACE
public:
virtual PSI_statement_info* get_psi_info() { return & psi_info; }
static PSI_statement_info psi_info;
-#endif
}; // class sp_instr_set_case_expr : public sp_instr_opt_meta
bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 827d983a134..a91d4cfb078 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7997,15 +7997,7 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables,
switch(access->check(orig_want_access, &t_ref->grant.privilege))
{
case ACL_INTERNAL_ACCESS_GRANTED:
- /*
- Currently,
- - the information_schema does not subclass ACL_internal_table_access,
- there are no per table privilege checks for I_S,
- - the performance schema does use per tables checks, but at most
- returns 'CHECK_GRANT', and never 'ACCESS_GRANTED'.
- so this branch is not used.
- */
- DBUG_ASSERT(0);
+ continue;
case ACL_INTERNAL_ACCESS_DENIED:
goto err;
case ACL_INTERNAL_ACCESS_CHECK_GRANT:
@@ -14273,8 +14265,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
my_ok(thd);
PSI_CALL_set_thread_account
- (thd->main_security_ctx.user, strlen(thd->main_security_ctx.user),
- thd->main_security_ctx.host_or_ip, strlen(thd->main_security_ctx.host_or_ip));
+ (thd->main_security_ctx.user, static_cast<uint>(strlen(thd->main_security_ctx.user)),
+ thd->main_security_ctx.host_or_ip, static_cast<uint>(strlen(thd->main_security_ctx.host_or_ip)));
/* Ready to handle queries */
DBUG_RETURN(0);
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 000228945f4..2cf1637c8db 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -167,8 +167,6 @@ enum ACL_internal_access_result
/**
Access granted for all the requested privileges,
do not use the grant tables.
- This flag is used only for the INFORMATION_SCHEMA privileges,
- for compatibility reasons.
*/
ACL_INTERNAL_ACCESS_GRANTED,
/** Access denied, do not use the grant tables. */
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 56f2cad24ad..8ea71b7bd8e 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -632,7 +632,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0), rgi_fake(0), rgi_slave(NULL),
- protocol_text(this), protocol_binary(this),
+ protocol_text(this), protocol_binary(this), initial_status_var(0),
m_current_stage_key(0), m_psi(0),
in_sub_stmt(0), log_all_errors(0),
binlog_unsafe_warning_flags(0),
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0af1734df82..acd304e24ea 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2410,12 +2410,12 @@ public:
void set_psi(PSI_thread *psi)
{
- my_atomic_storeptr(&m_psi, psi);
+ my_atomic_storeptr((void*volatile*)&m_psi, psi);
}
PSI_thread* get_psi()
{
- return static_cast<PSI_thread*>(my_atomic_loadptr(&m_psi));
+ return static_cast<PSI_thread*>(my_atomic_loadptr((void*volatile*)&m_psi));
}
private:
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 962bf23c0a0..fa5da2cf23d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5624,8 +5624,8 @@ mysql_execute_command(THD *thd)
DBUG_ASSERT(thd->in_sub_stmt == 0);
sp->m_sql_mode= thd->variables.sql_mode;
sp->m_sp_share= MYSQL_GET_SP_SHARE(sp->m_handler->type(),
- sp->m_db.str, sp->m_db.length,
- sp->m_name.str, sp->m_name.length);
+ sp->m_db.str, static_cast<uint>(sp->m_db.length),
+ sp->m_name.str, static_cast<uint>(sp->m_name.length));
if (do_execute_sp(thd, lex->sphead))
goto error;
break;
@@ -6188,6 +6188,7 @@ execute_show_status(THD *thd, TABLE_LIST *all_tables)
UINT_MAX, FALSE)))
res= execute_sqlcom_select(thd, all_tables);
+ thd->initial_status_var= NULL;
/* Don't log SHOW STATUS commands to slow query log */
thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED |
SERVER_QUERY_NO_GOOD_INDEX_USED);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 468dbe9b999..1555755bb36 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -2242,6 +2242,7 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
+ DEBUG_SYNC(thd, "acquired_LOCK_plugin");
error= plugin_add(thd->mem_root, thd->lex->create_info.if_not_exists(),
name, &dl, MYF(0));
if (unlikely(error != INSTALL_GOOD))
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 27d89b630e3..cb10d8ecb3b 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -629,8 +629,8 @@ end:
my_ok(thd);
/* Drop statistics for this stored program from performance schema. */
MYSQL_DROP_SP(SP_TYPE_TRIGGER,
- thd->lex->spname->m_db.str, thd->lex->spname->m_db.length,
- thd->lex->spname->m_name.str, thd->lex->spname->m_name.length);
+ thd->lex->spname->m_db.str, static_cast<uint>(thd->lex->spname->m_db.length),
+ thd->lex->spname->m_name.str, static_cast<uint>(thd->lex->spname->m_name.length));
}
DBUG_RETURN(result);
@@ -1562,8 +1562,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db,
}
sp->m_sp_share= MYSQL_GET_SP_SHARE(SP_TYPE_TRIGGER,
- sp->m_db.str, sp->m_db.length,
- sp->m_name.str, sp->m_name.length);
+ sp->m_db.str, static_cast<uint>(sp->m_db.length),
+ sp->m_name.str, static_cast<uint>(sp->m_name.length));
#ifndef DBUG_OFF
/*
@@ -1858,8 +1858,8 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db,
result= 1;
}
/* Drop statistics for this stored program from performance schema. */
- MYSQL_DROP_SP(SP_TYPE_TRIGGER, db->str, db->length,
- trigger->name.str, trigger->name.length);
+ MYSQL_DROP_SP(SP_TYPE_TRIGGER, db->str, static_cast<uint>(db->length),
+ trigger->name.str, static_cast<uint>(trigger->name.length));
}
}
}
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 0025d23725f..9177cd9d1a1 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -81,8 +81,7 @@
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
static Sys_var_mybool Sys_pfs_enabled(
- "performance_schema",
- "Enable the performance schema.",
+ "performance_schema", "Enable the performance schema.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
CMD_LINE(OPT_ARG), DEFAULT(FALSE));
@@ -90,10 +89,9 @@ static Sys_var_long Sys_pfs_events_waits_history_long_size(
"performance_schema_events_waits_history_long_size",
"Number of rows in EVENTS_WAITS_HISTORY_LONG."
" Use 0 to disable, -1 for automated sizing.",
- PARSED_EARLY READ_ONLY
- GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_waits_history_size(
"performance_schema_events_waits_history_size",
@@ -101,7 +99,7 @@ static Sys_var_long Sys_pfs_events_waits_history_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_cond_classes(
"performance_schema_max_cond_classes",
@@ -116,7 +114,23 @@ static Sys_var_long Sys_pfs_max_cond_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_cond_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_program_instances(
+ "performance_schema_max_program_instances",
+ "Maximum number of instrumented programs."
+ " Use 0 to disable, -1 for automated scaling.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_program_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_prepared_stmt_instances(
+ "performance_schema_max_prepared_statements_instances",
+ "Maximum number of instrumented prepared statements."
+ " Use 0 to disable, -1 for automated scaling.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_prepared_stmt_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_classes(
"performance_schema_max_file_classes",
@@ -138,7 +152,7 @@ static Sys_var_long Sys_pfs_max_file_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_sockets(
"performance_schema_max_socket_instances",
@@ -146,16 +160,14 @@ static Sys_var_long Sys_pfs_max_sockets(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_socket_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_socket_classes(
"performance_schema_max_socket_classes",
"Maximum number of socket instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_socket_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_SOCKET_CLASS),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_MAX_SOCKET_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_mutex_classes(
"performance_schema_max_mutex_classes",
@@ -170,7 +182,7 @@ static Sys_var_long Sys_pfs_max_mutex_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_rwlock_classes(
"performance_schema_max_rwlock_classes",
@@ -185,7 +197,7 @@ static Sys_var_long Sys_pfs_max_rwlock_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_table_handles(
"performance_schema_max_table_handles",
@@ -193,7 +205,7 @@ static Sys_var_long Sys_pfs_max_table_handles(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_table_instances(
"performance_schema_max_table_instances",
@@ -201,7 +213,23 @@ static Sys_var_long Sys_pfs_max_table_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_share_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_table_lock_stat(
+ "performance_schema_max_table_lock_stat",
+ "Maximum number of lock statistics for instrumented tables."
+ " Use 0 to disable, -1 for automated scaling.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_lock_stat_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_index_stat(
+ "performance_schema_max_index_stat",
+ "Maximum number of index statistics for instrumented tables."
+ " Use 0 to disable, -1 for automated scaling.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_index_stat_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_thread_classes(
"performance_schema_max_thread_classes",
@@ -216,23 +244,21 @@ static Sys_var_long Sys_pfs_max_thread_instances(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_thread_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1), BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
-static Sys_var_ulong Sys_pfs_setup_actors_size(
+static Sys_var_long Sys_pfs_setup_actors_size(
"performance_schema_setup_actors_size",
"Maximum number of rows in SETUP_ACTORS.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_setup_actor_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
- DEFAULT(PFS_MAX_SETUP_ACTOR),
- BLOCK_SIZE(1));
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
-static Sys_var_ulong Sys_pfs_setup_objects_size(
+static Sys_var_long Sys_pfs_setup_objects_size(
"performance_schema_setup_objects_size",
"Maximum number of rows in SETUP_OBJECTS.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_setup_object_sizing),
- CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_SETUP_OBJECT),
- BLOCK_SIZE(1));
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_accounts_size(
"performance_schema_accounts_size",
@@ -240,8 +266,7 @@ static Sys_var_long Sys_pfs_accounts_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_account_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_hosts_size(
"performance_schema_hosts_size",
@@ -249,8 +274,7 @@ static Sys_var_long Sys_pfs_hosts_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_host_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_users_size(
"performance_schema_users_size",
@@ -258,16 +282,14 @@ static Sys_var_long Sys_pfs_users_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_user_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_stage_classes(
"performance_schema_max_stage_classes",
"Maximum number of stage instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_stage_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_STAGE_CLASS),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_MAX_STAGE_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_stages_history_long_size(
"performance_schema_events_stages_history_long_size",
@@ -275,8 +297,7 @@ static Sys_var_long Sys_pfs_events_stages_history_long_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_stages_history_size(
"performance_schema_events_stages_history_size",
@@ -284,26 +305,27 @@ static Sys_var_long Sys_pfs_events_stages_history_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_stages_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
/**
Variable performance_schema_max_statement_classes.
The default number of statement classes is the sum of:
+ - SQLCOM_END for all regular "statement/sql/...",
+ - SP_PSI_STATEMENT_INFO_COUNT for "statement/sp/...".
- (COM_END - mariadb gap) for all regular "statement/com/...",
- 1 for "statement/com/new_packet", for unknown enum_server_command
- 1 for "statement/com/Error", for invalid enum_server_command
- - SQLCOM_END for all regular "statement/sql/...",
- 1 for "statement/sql/error", for invalid enum_sql_command
- 1 for "statement/rpl/relay_log", for replicated statements.
+ - 1 for "statement/scheduler/event", for scheduled events.
*/
static Sys_var_ulong Sys_pfs_max_statement_classes(
"performance_schema_max_statement_classes",
"Maximum number of statement instruments.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_statement_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT((ulong) SQLCOM_END +
- (ulong) (COM_END -(COM_MDB_GAP_END - COM_MDB_GAP_BEG + 1)) + 4),
+ DEFAULT((ulong) SQLCOM_END + SP_PSI_STATEMENT_INFO_COUNT +
+ (ulong) (COM_END -(COM_MDB_GAP_END - COM_MDB_GAP_BEG + 1)) + 5),
BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_statements_history_long_size(
@@ -312,8 +334,7 @@ static Sys_var_long Sys_pfs_events_statements_history_long_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_events_statements_history_size(
"performance_schema_events_statements_history_size",
@@ -321,8 +342,21 @@ static Sys_var_long Sys_pfs_events_statements_history_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_statements_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_pfs_statement_stack_size(
+ "performance_schema_max_statement_stack",
+ "Number of rows per thread in EVENTS_STATEMENTS_CURRENT.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_statement_stack_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(1, 256),
+ DEFAULT(PFS_STATEMENTS_STACK_SIZE), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_pfs_max_memory_classes(
+ "performance_schema_max_memory_classes",
+ "Maximum number of memory pool instruments.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_memory_class_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
+ DEFAULT(PFS_MAX_MEMORY_CLASS), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_digest_size(
"performance_schema_digests_size",
@@ -330,16 +364,30 @@ static Sys_var_long Sys_pfs_digest_size(
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_digest_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 200),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_events_transactions_history_long_size(
+ "performance_schema_events_transactions_history_long_size",
+ "Number of rows in EVENTS_TRANSACTIONS_HISTORY_LONG."
+ " Use 0 to disable, -1 for automated sizing.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_transactions_history_long_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024*1024),
+ DEFAULT(PFS_AUTOSIZE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_events_transactions_history_size(
+ "performance_schema_events_transactions_history_size",
+ "Number of rows per thread in EVENTS_TRANSACTIONS_HISTORY."
+ " Use 0 to disable, -1 for automated sizing.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_transactions_history_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024),
+ DEFAULT(PFS_AUTOSIZE_VALUE), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_max_digest_length(
"performance_schema_max_digest_length",
"Maximum length considered for digest text, when stored in performance_schema tables.",
PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_max_digest_length),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
- DEFAULT(1024),
- BLOCK_SIZE(1));
+ DEFAULT(1024), BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_connect_attrs_size(
"performance_schema_session_connect_attrs_size",
@@ -348,8 +396,22 @@ static Sys_var_long Sys_pfs_connect_attrs_size(
PARSED_EARLY READ_ONLY
GLOBAL_VAR(pfs_param.m_session_connect_attrs_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
- DEFAULT(-1),
- BLOCK_SIZE(1));
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_metadata_locks(
+ "performance_schema_max_metadata_locks",
+ "Maximum number of metadata locks."
+ " Use 0 to disable, -1 for automated scaling.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_metadata_lock_sizing),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 100*1024*1024),
+ DEFAULT(PFS_AUTOSCALE_VALUE), BLOCK_SIZE(1));
+
+static Sys_var_long Sys_pfs_max_sql_text_length(
+ "performance_schema_max_sql_text_length",
+ "Maximum length of displayed sql text.",
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_max_sql_text_length),
+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024 * 1024),
+ DEFAULT(1024), BLOCK_SIZE(1));
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
@@ -1517,24 +1579,21 @@ static Sys_var_ulong Sys_slave_max_allowed_packet(
"The maximum packet length to sent successfully from the master to slave.",
GLOBAL_VAR(slave_max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, MAX_MAX_ALLOWED_PACKET),
- DEFAULT(MAX_MAX_ALLOWED_PACKET),
- BLOCK_SIZE(1024));
+ DEFAULT(MAX_MAX_ALLOWED_PACKET), BLOCK_SIZE(1024));
static Sys_var_ulonglong Sys_max_binlog_cache_size(
"max_binlog_cache_size",
"Sets the total size of the transactional cache",
GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX),
- DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE),
- BLOCK_SIZE(IO_SIZE));
+ DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE), BLOCK_SIZE(IO_SIZE));
static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
"max_binlog_stmt_cache_size",
"Sets the total size of the statement cache",
GLOBAL_VAR(max_binlog_stmt_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, SIZE_T_MAX),
- DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE),
- BLOCK_SIZE(IO_SIZE));
+ DEFAULT((SIZE_T_MAX/IO_SIZE)*IO_SIZE), BLOCK_SIZE(IO_SIZE));
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
{
@@ -3869,8 +3928,7 @@ static Sys_var_ulonglong Sys_tmp_disk_table_size(
"Max size for data for an internal temporary on-disk MyISAM or Aria table.",
SESSION_VAR(tmp_disk_table_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, (ulonglong)~(intptr)0),
- DEFAULT((ulonglong)~(intptr)0),
- BLOCK_SIZE(1));
+ DEFAULT((ulonglong)~(intptr)0), BLOCK_SIZE(1));
static Sys_var_charptr Sys_version(
"version", "Server version number. It may also include a suffix "
@@ -3977,7 +4035,8 @@ static Sys_var_plugin Sys_enforce_storage_engine(
"enforce_storage_engine", "Force the use of a storage engine for new tables",
SESSION_VAR(enforced_table_plugin),
NO_CMD_LINE, MYSQL_STORAGE_ENGINE_PLUGIN,
- DEFAULT(&enforced_storage_engine), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
+ DEFAULT(&enforced_storage_engine), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(check_has_super));
#ifdef HAVE_REPLICATION
@@ -4157,7 +4216,8 @@ static Sys_var_bit Sys_log_off(
"query log is done for the client. Only clients with the SUPER privilege "
"can update this variable.",
NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_LOG_OFF,
- DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super));
+ DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
+ ON_CHECK(check_has_super));
/**
This function sets the session variable thd->variables.sql_log_bin
@@ -5814,8 +5874,7 @@ static Sys_var_ulong Sys_host_cache_size(
"How many host names should be cached to avoid resolving.",
AUTO_SET GLOBAL_VAR(host_cache_size),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 65536),
- DEFAULT(HOST_CACHE_SIZE),
- BLOCK_SIZE(1),
+ DEFAULT(HOST_CACHE_SIZE), BLOCK_SIZE(1),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_host_cache_size));
@@ -6302,8 +6361,7 @@ static Sys_var_ulong Sys_log_tc_size(
READ_ONLY GLOBAL_VAR(opt_tc_log_size),
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(my_getpagesize() * 3, ULONG_MAX),
- DEFAULT(my_getpagesize() * 6),
- BLOCK_SIZE(my_getpagesize()));
+ DEFAULT(my_getpagesize() * 6), BLOCK_SIZE(my_getpagesize()));
#endif
static Sys_var_ulonglong Sys_max_thread_mem(