summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc993
1 files changed, 512 insertions, 481 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c33dc566f04..387482ef6f0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB Corporation.
+ Copyright (c) 2008, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -113,7 +113,7 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
#include "sql_reload.h" // reload_acl_and_cache
-#include "pcre.h"
+#include "sp_head.h" // init_sp_psi_keys
#ifdef HAVE_POLL_H
#include <poll.h>
@@ -322,10 +322,6 @@ static PSI_rwlock_key key_rwlock_openssl;
#endif
#endif /* HAVE_PSI_INTERFACE */
-#ifdef HAVE_NPTL
-volatile sig_atomic_t ld_assume_kernel_is_set= 0;
-#endif
-
/**
Statement instrumentation key for replication.
*/
@@ -335,14 +331,12 @@ PSI_statement_info stmt_info_rpl;
/* the default log output is log tables */
static bool lower_case_table_names_used= 0;
-static bool max_long_data_size_used= false;
static bool volatile select_thread_in_use, signal_thread_in_use;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_short_log_format= 0, opt_silent_startup= 0;
bool my_disable_leak_check= false;
uint kill_cached_threads;
-static uint wake_thread;
ulong max_used_connections;
volatile ulong cached_thread_count= 0;
static char *mysqld_user, *mysqld_chroot;
@@ -424,6 +418,7 @@ my_bool use_temp_pool, relay_log_purge;
my_bool relay_log_recovery;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
+my_bool opt_require_secure_transport= 0;
char* opt_secure_file_priv;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
@@ -446,6 +441,7 @@ my_bool opt_noacl;
my_bool sp_automatic_privileges= 1;
ulong opt_binlog_rows_event_max_size;
+ulong binlog_row_metadata;
my_bool opt_master_verify_checksum= 0;
my_bool opt_slave_sql_verify_checksum= 1;
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
@@ -461,7 +457,7 @@ Atomic_counter<uint32_t> thread_count;
bool shutdown_wait_for_slaves;
int32 slave_open_temp_tables;
ulong thread_created;
-ulong back_log, connect_timeout, concurrency, server_id;
+ulong back_log, connect_timeout, server_id;
ulong what_to_log;
ulong slow_launch_time;
ulong open_files_limit, max_binlog_size;
@@ -507,12 +503,6 @@ long opt_secure_timestamp;
uint default_password_lifetime;
my_bool disconnect_on_expired_password;
-/*
- Maximum length of parameter value which can be set through
- mysql_send_long_data() call.
-*/
-ulong max_long_data_size;
-
bool max_user_connections_checking=0;
/**
Limit of the total number of prepared statements in the server.
@@ -544,7 +534,7 @@ ulong stored_program_cache_size= 0;
ulong opt_slave_parallel_threads= 0;
ulong opt_slave_domain_parallel_threads= 0;
-ulong opt_slave_parallel_mode= SLAVE_PARALLEL_CONSERVATIVE;
+ulong opt_slave_parallel_mode;
ulong opt_binlog_commit_wait_count= 0;
ulong opt_binlog_commit_wait_usec= 0;
ulong opt_slave_parallel_max_queued= 131072;
@@ -701,7 +691,7 @@ mysql_mutex_t
LOCK_crypt,
LOCK_global_system_variables,
LOCK_user_conn,
- LOCK_connection_count, LOCK_error_messages, LOCK_slave_background;
+ LOCK_error_messages, LOCK_slave_background;
mysql_mutex_t LOCK_stats, LOCK_global_user_client_stats,
LOCK_global_table_stats, LOCK_global_index_stats;
@@ -796,8 +786,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,
@@ -808,6 +798,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,
@@ -845,6 +850,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,
@@ -859,7 +877,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_BINLOG_LOCK_binlog_background_thread,
key_LOCK_binlog_end_pos,
key_delayed_insert_mutex, key_hash_filo_lock, key_LOCK_active_mi,
- key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
+ key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_system_variables,
key_LOCK_manager,
@@ -924,7 +942,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_delayed_insert_mutex, "Delayed_insert::mutex", 0},
{ &key_hash_filo_lock, "hash_filo::lock", 0},
{ &key_LOCK_active_mi, "LOCK_active_mi", PSI_FLAG_GLOBAL},
- { &key_LOCK_connection_count, "LOCK_connection_count", PSI_FLAG_GLOBAL},
{ &key_LOCK_thread_id, "LOCK_thread_id", PSI_FLAG_GLOBAL},
{ &key_LOCK_crypt, "LOCK_crypt", PSI_FLAG_GLOBAL},
{ &key_LOCK_delayed_create, "LOCK_delayed_create", PSI_FLAG_GLOBAL},
@@ -1118,17 +1135,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_index, 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,
- 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;
-PSI_file_key key_file_binlog_state;
-
#endif /* HAVE_PSI_INTERFACE */
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -1176,9 +1182,9 @@ void net_after_header_psi(struct st_net *net, void *user_data,
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
stmt_info_new_packet.m_key,
thd->get_db(), thd->db.length,
- thd->charset());
+ thd->charset(), NULL);
- THD_STAGE_INFO(thd, stage_init);
+ THD_STAGE_INFO(thd, stage_starting);
}
/*
@@ -1304,7 +1310,7 @@ private:
void Buffered_logs::init()
{
- init_alloc_root(&m_root, "Buffered_logs", 1024, 0, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &m_root, 1024, 0, MYF(0));
}
void Buffered_logs::cleanup()
@@ -1467,10 +1473,10 @@ struct st_VioSSLFd *ssl_acceptor_fd;
#endif /* HAVE_OPENSSL */
/**
- Number of currently active user connections. The variable is protected by
- LOCK_connection_count.
+ Number of currently active user connections.
*/
-uint connection_count= 0, extra_connection_count= 0;
+Atomic_counter<uint> connection_count;
+static Atomic_counter<uint> extra_connection_count;
my_bool opt_gtid_strict_mode= FALSE;
@@ -1482,7 +1488,7 @@ static int mysql_init_variables(void);
static int get_options(int *argc_ptr, char ***argv_ptr);
static bool add_terminator(DYNAMIC_ARRAY *options);
static bool add_many_options(DYNAMIC_ARRAY *, my_option *, size_t);
-extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
+extern "C" my_bool mysqld_get_one_option(const struct my_option *, char *, const char *);
static int init_thread_environment();
static char *get_relative_path(const char *path);
static int fix_paths(void);
@@ -1684,7 +1690,7 @@ void kill_mysql(THD *thd)
make_user_name(thd, user_host_buff);
- if ((user= my_strdup(user_host_buff, MYF(0))) &&
+ if ((user= my_strdup(PSI_NOT_INSTRUMENTED, user_host_buff, MYF(0))) &&
!shutdown_user.compare_exchange_strong(expected_shutdown_user,
user,
std::memory_order_relaxed,
@@ -2003,9 +2009,7 @@ static void clean_up(bool print_message)
sp_cache_end();
free_status_vars();
end_thr_alarm(1); /* Free allocated memory */
-#ifndef EMBEDDED_LIBRARY
end_thr_timer();
-#endif
my_free_open_file_info();
if (defaults_argv)
free_defaults(defaults_argv);
@@ -2100,7 +2104,6 @@ static void clean_up_mutexes()
mysql_mutex_destroy(&LOCK_delayed_create);
mysql_mutex_destroy(&LOCK_crypt);
mysql_mutex_destroy(&LOCK_user_conn);
- mysql_mutex_destroy(&LOCK_connection_count);
mysql_mutex_destroy(&LOCK_thread_id);
mysql_mutex_destroy(&LOCK_stats);
mysql_mutex_destroy(&LOCK_global_user_client_stats);
@@ -2592,20 +2595,6 @@ extern "C" sig_handler end_mysqld_signal(int sig __attribute__((unused)))
}
#endif /* EMBEDDED_LIBRARY */
-/*
- Decrease number of connections
-
- SYNOPSIS
- dec_connection_count()
-*/
-
-void dec_connection_count(scheduler_functions *scheduler)
-{
- mysql_mutex_lock(&LOCK_connection_count);
- (*scheduler->connection_count)--;
- mysql_mutex_unlock(&LOCK_connection_count);
-}
-
/*
Unlink thd from global list of available connections
@@ -2631,7 +2620,7 @@ void unlink_thd(THD *thd)
*/
if (!thd->wsrep_applier)
#endif /* WITH_WSREP */
- dec_connection_count(thd->scheduler);
+ --*thd->scheduler->connection_count;
thd->free_connection();
@@ -2656,134 +2645,57 @@ void unlink_thd(THD *thd)
*/
-static bool cache_thread(THD *thd)
+CONNECT *cache_thread(THD *thd)
{
struct timespec abstime;
+ CONNECT *connect;
+ bool flushed= false;
DBUG_ENTER("cache_thread");
DBUG_ASSERT(thd);
+ set_timespec(abstime, THREAD_CACHE_TIMEOUT);
+
+ /*
+ Delete the instrumentation for the job that just completed,
+ before parking this pthread in the cache (blocked on COND_thread_cache).
+ */
+ PSI_CALL_delete_current_thread();
+
+#ifndef DBUG_OFF
+ while (_db_is_pushed_())
+ _db_pop_();
+#endif
mysql_mutex_lock(&LOCK_thread_cache);
- if (cached_thread_count < thread_cache_size &&
- ! abort_loop && !kill_cached_threads)
+ if ((connect= thread_cache.get()))
+ cached_thread_count++;
+ else if (cached_thread_count < thread_cache_size && !kill_cached_threads)
{
/* Don't kill the thread, just put it in cache for reuse */
DBUG_PRINT("info", ("Adding thread to cache"));
cached_thread_count++;
-
- /*
- Delete the instrumentation for the job that just completed,
- before parking this pthread in the cache (blocked on COND_thread_cache).
- */
- PSI_CALL_delete_current_thread();
-
-#ifndef DBUG_OFF
- while (_db_is_pushed_())
- _db_pop_();
-#endif
-
- set_timespec(abstime, THREAD_CACHE_TIMEOUT);
- while (!abort_loop && ! wake_thread && ! kill_cached_threads)
+ for (;;)
{
int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache,
&abstime);
- if (error == ETIMEDOUT || error == ETIME)
+ flushed= kill_cached_threads;
+ if ((connect= thread_cache.get()))
+ break;
+ else if (flushed || error == ETIMEDOUT || error == ETIME)
{
/*
If timeout, end thread.
- If a new thread is requested (wake_thread is set), we will handle
+ If a new thread is requested, we will handle
the call, even if we got a timeout (as we are already awake and free)
*/
+ cached_thread_count--;
break;
}
}
- cached_thread_count--;
- if (kill_cached_threads)
- mysql_cond_signal(&COND_flush_thread_cache);
- if (wake_thread)
- {
- CONNECT *connect;
-
- wake_thread--;
- connect= thread_cache.get();
- mysql_mutex_unlock(&LOCK_thread_cache);
-
- if (!(connect->create_thd(thd)))
- {
- /* Out of resources. Free thread to get more resources */
- connect->close_and_delete();
- DBUG_RETURN(0);
- }
- delete connect;
-
- /*
- We have to call store_globals to update mysys_var->id and lock_info
- with the new thread_id
- */
- thd->store_globals();
-
- /*
- Create new instrumentation for the new THD job,
- and attach it to this running pthread.
- */
- PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection,
- thd, thd->thread_id));
-
- /* reset abort flag for the thread */
- thd->mysys_var->abort= 0;
- thd->thr_create_utime= microsecond_interval_timer();
- thd->start_utime= thd->thr_create_utime;
-
- server_threads.insert(thd);
- DBUG_RETURN(1);
- }
}
mysql_mutex_unlock(&LOCK_thread_cache);
- DBUG_RETURN(0);
-}
-
-
-/*
- End thread for the current connection
-
- SYNOPSIS
- one_thread_per_connection_end()
- thd Thread handler. This may be null if we run out of resources.
- put_in_cache Store thread in cache, if there is room in it
- Normally this is true in all cases except when we got
- out of resources initializing the current thread
-
- NOTES
- If thread is cached, we will wait until thread is scheduled to be
- reused and then we will return.
- If thread is not cached, we end the thread.
-
- RETURN
- 0 Signal to handle_one_connection to reuse connection
-*/
-
-bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
-{
- DBUG_ENTER("one_thread_per_connection_end");
-
- if (thd)
- {
- const bool wsrep_applier= IF_WSREP(thd->wsrep_applier, false);
-
- unlink_thd(thd);
- if (!wsrep_applier && put_in_cache && cache_thread(thd))
- DBUG_RETURN(0); // Thread is reused
- delete thd;
- }
-
- DBUG_PRINT("info", ("killing thread"));
- DBUG_LEAVE; // Must match DBUG_ENTER()
-#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
- ERR_remove_state(0);
-#endif
- my_thread_end();
-
- pthread_exit(0);
- return 0; // Avoid compiler warnings
+ if (flushed)
+ mysql_cond_signal(&COND_flush_thread_cache);
+ DBUG_RETURN(connect);
}
@@ -2974,75 +2886,6 @@ extern "C" char *my_demangle(const char *mangled_name, int *status)
#endif
-/*
- pthread_attr_setstacksize() without so much platform-dependency
-
- Return: The actual stack size if possible.
-*/
-
-#ifndef EMBEDDED_LIBRARY
-static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize)
-{
- size_t guard_size __attribute__((unused))= 0;
-
-#if defined(__ia64__) || defined(__ia64)
- /*
- On IA64, half of the requested stack size is used for "normal stack"
- and half for "register stack". The space measured by check_stack_overrun
- is the "normal stack", so double the request to make sure we have the
- caller-expected amount of normal stack.
-
- NOTE: there is no guarantee that the register stack can't grow faster
- than normal stack, so it's very unclear that we won't dump core due to
- stack overrun despite check_stack_overrun's efforts. Experimentation
- shows that in the execution_constants test, the register stack grows
- less than half as fast as normal stack, but perhaps other scenarios are
- less forgiving. If it turns out that more space is needed for the
- register stack, that could be forced (rather inefficiently) by using a
- multiplier higher than 2 here.
- */
- stacksize *= 2;
-#endif
-
- /*
- On many machines, the "guard space" is subtracted from the requested
- stack size, and that space is quite large on some platforms. So add
- it to our request, if we can find out what it is.
- */
-#ifdef HAVE_PTHREAD_ATTR_GETGUARDSIZE
- if (pthread_attr_getguardsize(attr, &guard_size))
- guard_size = 0; /* if can't find it out, treat as 0 */
-#endif
-
- pthread_attr_setstacksize(attr, stacksize + guard_size);
-
- /* Retrieve actual stack size if possible */
-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
- {
- size_t real_stack_size= 0;
- /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */
- if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 &&
- real_stack_size > guard_size)
- {
- real_stack_size -= guard_size;
- if (real_stack_size < stacksize)
- {
- if (global_system_variables.log_warnings)
- sql_print_warning("Asked for %zu thread stack, but got %zu",
- stacksize, real_stack_size);
- stacksize= real_stack_size;
- }
- }
- }
-#endif /* !EMBEDDED_LIBRARY */
-
-#if defined(__ia64__) || defined(__ia64)
- stacksize /= 2;
-#endif
- return stacksize;
-}
-#endif
-
#ifdef DBUG_ASSERT_AS_PRINTF
extern "C" void
mariadb_dbug_assert_failed(const char *assert_expr, const char *file,
@@ -3082,7 +2925,7 @@ void init_signals(void)
sigemptyset(&sa.sa_mask);
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
- my_init_stacktrace();
+ my_init_stacktrace(0);
#if defined(__amiga__)
sa.sa_handler=(void(*)())handle_fatal_signal;
#else
@@ -3124,8 +2967,7 @@ void init_signals(void)
sa.sa_flags = 0;
sa.sa_handler = print_signal_warning;
sigaction(SIGHUP, &sa, (struct sigaction*) 0);
- if (thd_lib_detected != THD_LIB_LT)
- sigaddset(&set,THR_SERVER_ALARM);
+ sigaddset(&set,THR_SERVER_ALARM);
if (test_flags & TEST_SIGINT)
{
/* Allow SIGINT to break mysqld. This is for debugging with --gdb */
@@ -3382,10 +3224,18 @@ extern "C" void *my_str_malloc_mysqld(size_t size);
void *my_str_malloc_mysqld(size_t size)
{
- return my_malloc(size, MYF(MY_FAE));
+ return my_malloc(key_memory_my_str_malloc, size, MYF(MY_FAE));
}
+#if 0
+extern "C" void *my_str_realloc_mysqld(void *ptr, size_t size);
+void *my_str_realloc_mysqld(void *ptr, size_t size)
+{
+ return my_realloc(key_memory_my_str_malloc, ptr, size, MYF(MY_FAE));
+}
+#endif
+
#include <mysqld_default_groups.h>
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
@@ -3431,20 +3281,6 @@ static void init_libstrings()
#endif
}
-ulonglong my_pcre_frame_size;
-
-static void init_pcre()
-{
- pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
- pcre_free= pcre_stack_free= my_free;
- pcre_stack_guard= check_enough_stack_size_slow;
- /* See http://pcre.org/original/doc/html/pcrestack.html */
- my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0);
- // pcre can underestimate its stack usage. Use a safe value, as in the manual
- set_if_bigger(my_pcre_frame_size, 500);
- my_pcre_frame_size += 16; // Again, safety margin, see the manual
-}
-
/**
Initialize one of the global date/time format variables.
@@ -3608,7 +3444,7 @@ SHOW_VAR com_status_vars[]= {
{"show_generic", STMT_STATUS(SQLCOM_SHOW_GENERIC)},
{"show_grants", STMT_STATUS(SQLCOM_SHOW_GRANTS)},
{"show_keys", STMT_STATUS(SQLCOM_SHOW_KEYS)},
- {"show_master_status", STMT_STATUS(SQLCOM_SHOW_MASTER_STAT)},
+ {"show_binlog_status", STMT_STATUS(SQLCOM_SHOW_BINLOG_STAT)},
{"show_open_tables", STMT_STATUS(SQLCOM_SHOW_OPEN_TABLES)},
{"show_package_status", STMT_STATUS(SQLCOM_SHOW_STATUS_PACKAGE)},
#ifndef DBUG_OFF
@@ -3822,10 +3658,8 @@ int json_unescape_json(const char *json_str, const char *json_end,
@returns Pointer to string containing the full file path, or NULL if
it was not possible to create the path.
*/
-static inline const char *
-rpl_make_log_name(const char *opt,
- const char *def,
- const char *ext)
+static const char *rpl_make_log_name(PSI_memory_key key, const char *opt,
+ const char *def, const char *ext)
{
DBUG_ENTER("rpl_make_log_name");
DBUG_PRINT("enter", ("opt: %s, def: %s, ext: %s", opt, def, ext));
@@ -3843,7 +3677,7 @@ rpl_make_log_name(const char *opt,
mysql_real_data_home_ptr= mysql_real_data_home;
if (fn_format(buff, base, mysql_real_data_home_ptr, ext, options))
- DBUG_RETURN(my_strdup(buff, MYF(MY_WME)));
+ DBUG_RETURN(my_strdup(key, buff, MYF(MY_WME)));
else
DBUG_RETURN(NULL);
}
@@ -3979,7 +3813,9 @@ static int init_common_variables()
key_BINLOG_COND_relay_log_updated,
key_BINLOG_COND_bin_log_updated,
key_file_binlog,
+ key_file_binlog_cache,
key_file_binlog_index,
+ key_file_binlog_index_cache,
key_BINLOG_COND_queue_busy,
key_LOCK_binlog_end_pos);
#endif
@@ -4309,7 +4145,6 @@ static int init_common_variables()
if (item_create_init())
return 1;
item_init();
- init_pcre();
/*
Process a comma-separated character set list and choose
the first available character set. This is mostly for
@@ -4528,8 +4363,6 @@ static int init_thread_environment()
&LOCK_error_messages, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_uuid_short_generator,
&LOCK_short_uuid_generator, MY_MUTEX_INIT_FAST);
- mysql_mutex_init(key_LOCK_connection_count,
- &LOCK_connection_count, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_id,
&LOCK_thread_id, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_stats, &LOCK_stats, MY_MUTEX_INIT_FAST);
@@ -4716,6 +4549,21 @@ void ssl_acceptor_stats_update(int sslaccept_ret)
static void init_ssl()
{
+/*
+ Not need to check require_secure_transport on the Linux,
+ because it always has Unix domain sockets that are secure:
+*/
+#ifdef _WIN32
+ if (opt_require_secure_transport &&
+ !opt_use_ssl &&
+ !opt_enable_named_pipe &&
+ !opt_bootstrap)
+ {
+ sql_print_error("Server is started with --require-secure-transport=ON "
+ "but no secure transport (SSL or PIPE) are configured.");
+ unireg_abort(1);
+ }
+#endif
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (opt_use_ssl)
{
@@ -4916,13 +4764,11 @@ static int init_server_components()
init_thr_lock();
backup_init();
-#ifndef EMBEDDED_LIBRARY
if (init_thr_timer(thread_scheduler->max_threads + extra_max_connections))
{
fprintf(stderr, "Can't initialize timers\n");
unireg_abort(1);
}
-#endif
my_uuid_init((ulong) (my_rnd(&sql_rand))*12345,12345);
wt_init();
@@ -5156,10 +5002,12 @@ static int init_server_components()
}
log_bin_basename=
- rpl_make_log_name(opt_bin_logname, pidfile_name,
+ rpl_make_log_name(key_memory_MYSQL_BIN_LOG_basename,
+ opt_bin_logname, pidfile_name,
opt_bin_logname ? "" : "-bin");
log_bin_index=
- rpl_make_log_name(opt_binlog_index_name, log_bin_basename, ".index");
+ rpl_make_log_name(key_memory_MYSQL_BIN_LOG_index,
+ opt_binlog_index_name, log_bin_basename, ".index");
if (log_bin_basename == NULL || log_bin_index == NULL)
{
sql_print_error("Unable to create replication path names:"
@@ -5177,10 +5025,12 @@ static int init_server_components()
if (opt_relay_logname)
{
relay_log_basename=
- rpl_make_log_name(opt_relay_logname, pidfile_name,
+ rpl_make_log_name(key_memory_MYSQL_RELAY_LOG_basename,
+ opt_relay_logname, pidfile_name,
opt_relay_logname ? "" : "-relay-bin");
relay_log_index=
- rpl_make_log_name(opt_relaylog_index_name, relay_log_basename, ".index");
+ rpl_make_log_name(key_memory_MYSQL_RELAY_LOG_index,
+ opt_relaylog_index_name, relay_log_basename, ".index");
if (relay_log_basename == NULL || relay_log_index == NULL)
{
sql_print_error("Unable to create replication path names:"
@@ -5235,8 +5085,20 @@ static int init_server_components()
if (remaining_argc > 1)
{
int ho_error;
- struct my_option no_opts[]=
+ struct my_option removed_opts[]=
{
+ /* All options in this list are accepted by the server for backwards
+ compatibility, but do not have any effect otherwise, they behave
+ as if supplied with --loose. Whenever a deprecated option is removed
+ it should be appended here. */
+ {"multi-range-count", OPT_DEPRECATED_OPTION, "",
+ 0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"skip-bdb", OPT_DEPRECATED_OPTION, "",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"thread-concurrency", OPT_DEPRECATED_OPTION, "",
+ 0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"timed-mutexes", OPT_DEPRECATED_OPTION, "",
+ 0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
/*
@@ -5245,7 +5107,7 @@ static int init_server_components()
*/
my_getopt_skip_unknown= 0;
- if ((ho_error= handle_options(&remaining_argc, &remaining_argv, no_opts,
+ if ((ho_error= handle_options(&remaining_argc, &remaining_argv, removed_opts,
mysqld_get_one_option)))
unireg_abort(ho_error);
/* Add back the program name handle_options removes */
@@ -5378,7 +5240,7 @@ static int init_server_components()
int error;
mysql_mutex_t *log_lock= mysql_bin_log.get_log_lock();
mysql_mutex_lock(log_lock);
- error= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
+ error= mysql_bin_log.open(opt_bin_logname, 0, 0,
WRITE_CACHE, max_binlog_size, 0, TRUE);
mysql_mutex_unlock(log_lock);
if (unlikely(error))
@@ -5470,13 +5332,13 @@ static void test_lc_time_sz()
for (const char **month= (*loc)->month_names->type_names; *month; month++)
{
set_if_bigger(max_month_len,
- my_numchars_mb(&my_charset_utf8_general_ci,
+ my_numchars_mb(&my_charset_utf8mb3_general_ci,
*month, *month + strlen(*month)));
}
for (const char **day= (*loc)->day_names->type_names; *day; day++)
{
set_if_bigger(max_day_len,
- my_numchars_mb(&my_charset_utf8_general_ci,
+ my_numchars_mb(&my_charset_utf8mb3_general_ci,
*day, *day + strlen(*day)));
}
if ((*loc)->max_month_name_length != max_month_len ||
@@ -5514,10 +5376,10 @@ int mysqld_main(int argc, char **argv)
if (init_early_variables())
exit(1);
-#ifdef HAVE_NPTL
- ld_assume_kernel_is_set= (getenv("LD_ASSUME_KERNEL") != 0);
-#endif
#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
{
@@ -5528,16 +5390,15 @@ int mysqld_main(int argc, char **argv)
orig_argc= argc;
orig_argv= argv;
- my_getopt_use_args_separator= TRUE;
+ my_defaults_mark_files= TRUE;
load_defaults_or_exit(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv);
- my_getopt_use_args_separator= FALSE;
defaults_argc= argc;
defaults_argv= argv;
remaining_argc= argc;
remaining_argv= argv;
/* Must be initialized early for comparison of options name */
- system_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
sys_var_init();
@@ -5618,6 +5479,7 @@ int mysqld_main(int argc, char **argv)
init_server_psi_keys();
/* Instrument the main thread */
PSI_thread *psi= PSI_CALL_new_thread(key_thread_main, NULL, 0);
+ PSI_CALL_set_thread_os_id(psi);
PSI_CALL_set_thread(psi);
/*
@@ -5680,7 +5542,13 @@ int mysqld_main(int argc, char **argv)
new_thread_stack_size= my_setstacksize(&connection_attrib,
(size_t)my_thread_stack_size);
if (new_thread_stack_size != my_thread_stack_size)
+ {
+ if ((new_thread_stack_size < my_thread_stack_size) &&
+ global_system_variables.log_warnings)
+ sql_print_warning("Asked for %llu thread stack, but got %llu",
+ my_thread_stack_size, new_thread_stack_size);
SYSVAR_AUTOSIZE(my_thread_stack_size, new_thread_stack_size);
+ }
(void) thr_setconcurrency(concurrency); // 10 by default
@@ -5792,6 +5660,7 @@ int mysqld_main(int argc, char **argv)
if (Events::init((THD*) 0, opt_noacl || opt_bootstrap))
unireg_abort(1);
+#ifdef WITH_WSREP
if (WSREP_ON)
{
if (opt_bootstrap)
@@ -5803,14 +5672,15 @@ int mysqld_main(int argc, char **argv)
wsrep_init_globals();
if (!wsrep_before_SE())
{
- wsrep_init_startup (false);
+ wsrep_init_startup(false);
}
-
+ wsrep_new_cluster= false;
WSREP_DEBUG("Startup creating %ld applier threads running %lu",
wsrep_slave_threads - 1, wsrep_running_applier_threads);
wsrep_create_appliers(wsrep_slave_threads - 1);
}
}
+#endif /* WITH_WSREP */
if (opt_bootstrap)
{
@@ -5889,7 +5759,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;
@@ -5918,10 +5788,12 @@ int mysqld_main(int argc, char **argv)
{
wsrep_shutdown_replication();
}
+ /* Release threads if they are waiting in WSREP_SYNC_WAIT_UPTO_GTID */
+ wsrep_gtid_server.signal_waiters(0, true);
#endif
close_connections();
-
+ ha_pre_shutdown();
clean_up(1);
sd_notify(0, "STATUS=MariaDB server is down");
@@ -6070,7 +5942,11 @@ int mysqld_main(int argc, char **argv)
"MySQLShutdown"), 10);
/* Must be initialized early for comparison of service name */
- system_charset_info= &my_charset_utf8_general_ci;
+ 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())
{
@@ -6201,8 +6077,7 @@ void inc_thread_created(void)
void handle_connection_in_main_thread(CONNECT *connect)
{
- thread_cache_size= 0; // Safety
- do_handle_one_connection(connect);
+ do_handle_one_connection(connect, false);
}
@@ -6212,37 +6087,32 @@ void handle_connection_in_main_thread(CONNECT *connect)
void create_thread_to_handle_connection(CONNECT *connect)
{
- char error_message_buff[MYSQL_ERRMSG_SIZE];
- int error;
DBUG_ENTER("create_thread_to_handle_connection");
- /* Check if we can get thread from the cache */
- if (cached_thread_count > wake_thread)
+ mysql_mutex_lock(&LOCK_thread_cache);
+ if (cached_thread_count)
{
- mysql_mutex_lock(&LOCK_thread_cache);
- /* Recheck condition when we have the lock */
- if (cached_thread_count > wake_thread)
- {
- /* Get thread from cache */
- thread_cache.push_back(connect);
- wake_thread++;
- mysql_cond_signal(&COND_thread_cache);
- mysql_mutex_unlock(&LOCK_thread_cache);
- DBUG_PRINT("info",("Thread created"));
- DBUG_VOID_RETURN;
- }
+ /* Get thread from cache */
+ thread_cache.push_back(connect);
+ cached_thread_count--;
mysql_mutex_unlock(&LOCK_thread_cache);
+ mysql_cond_signal(&COND_thread_cache);
+ DBUG_PRINT("info",("Thread created"));
+ DBUG_VOID_RETURN;
}
+ mysql_mutex_unlock(&LOCK_thread_cache);
/* Create new thread to handle connection */
inc_thread_created();
DBUG_PRINT("info",(("creating thread %lu"), (ulong) connect->thread_id));
connect->prior_thr_create_utime= microsecond_interval_timer();
- if ((error= mysql_thread_create(key_thread_one_connection,
- &connect->real_id, &connection_attrib,
- handle_one_connection, (void*) connect)))
+ pthread_t tmp;
+ if (auto error= mysql_thread_create(key_thread_one_connection,
+ &tmp, &connection_attrib,
+ handle_one_connection, (void*) connect))
{
+ char error_message_buff[MYSQL_ERRMSG_SIZE];
/* purecov: begin inspected */
DBUG_PRINT("error", ("Can't create thread to handle request (error %d)",
error));
@@ -6279,29 +6149,17 @@ void create_new_thread(CONNECT *connect)
Don't allow too many connections. We roughly check here that we allow
only (max_connections + 1) connections.
*/
-
- mysql_mutex_lock(&LOCK_connection_count);
-
- if (*connect->scheduler->connection_count >=
- *connect->scheduler->max_connections + 1|| abort_loop)
+ if ((*connect->scheduler->connection_count)++ >=
+ *connect->scheduler->max_connections + 1)
{
DBUG_PRINT("error",("Too many connections"));
-
- mysql_mutex_unlock(&LOCK_connection_count);
- statistic_increment(denied_connections, &LOCK_status);
- statistic_increment(connection_errors_max_connection, &LOCK_status);
- connect->close_with_error(0, NullS, abort_loop ? ER_SERVER_SHUTDOWN : ER_CON_COUNT_ERROR);
+ connect->close_with_error(0, NullS, ER_CON_COUNT_ERROR);
DBUG_VOID_RETURN;
}
- ++*connect->scheduler->connection_count;
-
- if (connection_count + extra_connection_count > max_used_connections)
- max_used_connections= connection_count + extra_connection_count;
-
- mysql_mutex_unlock(&LOCK_connection_count);
-
- connect->thread_count_incremented= 1;
+ uint sum= connection_count + extra_connection_count;
+ if (sum > max_used_connections)
+ max_used_connections= sum;
/*
The initialization of thread_id is done in create_embedded_thd() for
@@ -6322,13 +6180,6 @@ void create_new_thread(CONNECT *connect)
void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock)
{
- CONNECT *connect;
- bool is_unix_sock;
-
-#ifdef FD_CLOEXEC
- (void) fcntl(mysql_socket_getfd(new_sock), F_SETFD, FD_CLOEXEC);
-#endif
-
#ifdef HAVE_LIBWRAP
{
if (mysql_socket_getfd(sock) == mysql_socket_getfd(base_ip_sock) ||
@@ -6374,53 +6225,46 @@ void handle_accepted_socket(MYSQL_SOCKET new_sock, MYSQL_SOCKET sock)
DBUG_PRINT("info", ("Creating CONNECT for new connection"));
- if ((connect= new CONNECT()))
- {
- is_unix_sock= (mysql_socket_getfd(sock) ==
- mysql_socket_getfd(unix_sock));
-
- if (!(connect->vio=
- mysql_socket_vio_new(new_sock,
- is_unix_sock ? VIO_TYPE_SOCKET :
- VIO_TYPE_TCPIP,
- is_unix_sock ? VIO_LOCALHOST : 0)))
- {
- delete connect;
- connect= 0; // Error handling below
- }
- }
-
- if (!connect)
+ if (auto connect= new CONNECT(new_sock,
+ mysql_socket_getfd(sock) ==
+ mysql_socket_getfd(unix_sock) ?
+ VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
+ mysql_socket_getfd(sock) ==
+ mysql_socket_getfd(extra_ip_sock) ?
+ extra_thread_scheduler : thread_scheduler))
+ create_new_thread(connect);
+ else
{
/* Connect failure */
(void)mysql_socket_close(new_sock);
statistic_increment(aborted_connects, &LOCK_status);
statistic_increment(connection_errors_internal, &LOCK_status);
- return;
}
+}
- if (is_unix_sock)
- connect->host= my_localhost;
-
- if (mysql_socket_getfd(sock) == mysql_socket_getfd(extra_ip_sock))
+#ifndef _WIN32
+static void set_non_blocking_if_supported(MYSQL_SOCKET sock)
+{
+#if !defined(NO_FCNTL_NONBLOCK)
+ if (!(test_flags & TEST_BLOCKING))
{
- connect->extra_port= 1;
- connect->scheduler= extra_thread_scheduler;
+ int flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0);
+#if defined(O_NONBLOCK)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NONBLOCK);
+#elif defined(O_NDELAY)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NDELAY);
+#endif
}
- create_new_thread(connect);
+#endif
}
-#ifndef _WIN32
+
void handle_connections_sockets()
{
MYSQL_SOCKET sock= mysql_socket_invalid();
- MYSQL_SOCKET new_sock= mysql_socket_invalid();
uint error_count=0;
struct sockaddr_storage cAddr;
- int ip_flags __attribute__((unused))=0;
- int socket_flags __attribute__((unused))= 0;
- int extra_ip_flags __attribute__((unused))=0;
- int flags=0,retval;
+ int retval;
#ifdef HAVE_POLL
int socket_count= 0;
struct pollfd fds[3]; // for ip_sock, unix_sock and extra_ip_sock
@@ -6442,16 +6286,16 @@ void handle_connections_sockets()
if (mysql_socket_getfd(base_ip_sock) != INVALID_SOCKET)
{
setup_fds(base_ip_sock);
- ip_flags = fcntl(mysql_socket_getfd(base_ip_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(base_ip_sock);
}
if (mysql_socket_getfd(extra_ip_sock) != INVALID_SOCKET)
{
setup_fds(extra_ip_sock);
- extra_ip_flags = fcntl(mysql_socket_getfd(extra_ip_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(extra_ip_sock);
}
#ifdef HAVE_SYS_UN_H
setup_fds(unix_sock);
- socket_flags=fcntl(mysql_socket_getfd(unix_sock), F_GETFL, 0);
+ set_non_blocking_if_supported(unix_sock);
#endif
sd_notify(0, "READY=1\n"
@@ -6493,79 +6337,44 @@ void handle_connections_sockets()
if (fds[i].revents & POLLIN)
{
sock= pfs_fds[i];
- flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0);
break;
}
}
#else // HAVE_POLL
if (FD_ISSET(mysql_socket_getfd(base_ip_sock),&readFDs))
- {
sock= base_ip_sock;
- flags= ip_flags;
- }
else
if (FD_ISSET(mysql_socket_getfd(extra_ip_sock),&readFDs))
- {
sock= extra_ip_sock;
- flags= extra_ip_flags;
- }
else
- {
sock = unix_sock;
- flags= socket_flags;
- }
#endif // HAVE_POLL
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
- {
-#if defined(O_NONBLOCK)
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NONBLOCK);
-#elif defined(O_NDELAY)
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NDELAY);
-#endif
- }
-#endif /* NO_FCNTL_NONBLOCK */
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
{
size_socket length= sizeof(struct sockaddr_storage);
+ MYSQL_SOCKET new_sock;
+
new_sock= mysql_socket_accept(key_socket_client_connection, sock,
(struct sockaddr *)(&cAddr),
&length);
- if (mysql_socket_getfd(new_sock) != INVALID_SOCKET ||
- (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
- break;
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
+ if (mysql_socket_getfd(new_sock) != INVALID_SOCKET)
+ handle_accepted_socket(new_sock, sock);
+ else if (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN)
{
- if (retry == MAX_ACCEPT_RETRY - 1)
- {
- // Try without O_NONBLOCK
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags);
- }
+ /*
+ accept(2) failed on the listening port.
+ There is not much details to report about the client,
+ increment the server global status variable.
+ */
+ statistic_increment(connection_errors_accept, &LOCK_status);
+ if ((error_count++ & 255) == 0) // This can happen often
+ sql_perror("Error in accept");
+ if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
+ sleep(1); // Give other threads some time
+ break;
}
-#endif
- }
-
- if (mysql_socket_getfd(new_sock) == INVALID_SOCKET)
- {
- /*
- accept(2) failed on the listening port, after many retries.
- There is not much details to report about the client,
- increment the server global status variable.
- */
- statistic_increment(connection_errors_accept, &LOCK_status);
- if ((error_count++ & 255) == 0) // This can happen often
- sql_perror("Error in accept");
- if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
- sleep(1); // Give other threads some time
- continue;
}
-#if !defined(NO_FCNTL_NONBLOCK)
- if (!(test_flags & TEST_BLOCKING))
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags);
-#endif
- handle_accepted_socket(new_sock, sock);
}
sd_notify(0, "STOPPING=1\n"
"STATUS=Shutdown in progress\n");
@@ -6598,12 +6407,12 @@ int handle_early_options()
int ho_error;
DYNAMIC_ARRAY all_early_options;
- my_getopt_register_get_addr(NULL);
/* Skip unknown options so that they may be processed later */
my_getopt_skip_unknown= TRUE;
/* prepare all_early_options array */
- my_init_dynamic_array(&all_early_options, sizeof(my_option), 100, 25, MYF(0));
+ my_init_dynamic_array(PSI_NOT_INSTRUMENTED, &all_early_options,
+ sizeof(my_option), 100, 25, MYF(0));
add_many_options(&all_early_options, pfs_early_options,
array_elements(pfs_early_options));
sys_var_add_options(&all_early_options, sys_var::PARSE_EARLY);
@@ -6637,6 +6446,10 @@ int handle_early_options()
{ option, OPT_MYSQL_COMPATIBILITY, \
0, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }
+#define MARIADB_REMOVED_OPTION(option) \
+ { option, OPT_REMOVED_OPTION, \
+ 0, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }
+
/**
System variables are automatically command-line options (few
@@ -6976,9 +6789,6 @@ struct my_option my_long_options[]=
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent-startup", OPT_SILENT, "Don't print [Note] to the error log during startup.",
&opt_silent_startup, &opt_silent_startup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip-bdb", OPT_DEPRECATED_OPTION,
- "Deprecated option; Exist only for compatibility with old my.cnf files",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DISABLE_GRANT_OPTIONS
{"skip-grant-tables", 0,
"Start without grant tables. This gives all users FULL ACCESS to all tables.",
@@ -7296,16 +7106,6 @@ static int show_table_definitions(THD *thd, SHOW_VAR *var, char *buff,
}
-static int show_flush_commands(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONGLONG;
- var->value= buff;
- *((longlong *) buff)= (longlong)tdc_refresh_version();
- return 0;
-}
-
-
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/*
@@ -7615,7 +7415,7 @@ static int debug_status_func(THD *thd, SHOW_VAR *var, char *buff,
#endif
#ifdef HAVE_POOL_OF_THREADS
-int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
+static int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
var->type= SHOW_INT;
@@ -7674,6 +7474,7 @@ SHOW_VAR status_vars[]= {
{"Feature_dynamic_columns", (char*) offsetof(STATUS_VAR, feature_dynamic_columns), SHOW_LONG_STATUS},
{"Feature_fulltext", (char*) offsetof(STATUS_VAR, feature_fulltext), SHOW_LONG_STATUS},
{"Feature_gis", (char*) offsetof(STATUS_VAR, feature_gis), SHOW_LONG_STATUS},
+ {"Feature_insert_returning", (char*)offsetof(STATUS_VAR, feature_insert_returning), SHOW_LONG_STATUS},
{"Feature_invisible_columns", (char*) offsetof(STATUS_VAR, feature_invisible_columns), SHOW_LONG_STATUS},
{"Feature_json", (char*) offsetof(STATUS_VAR, feature_json), SHOW_LONG_STATUS},
{"Feature_locale", (char*) offsetof(STATUS_VAR, feature_locale), SHOW_LONG_STATUS},
@@ -7684,7 +7485,6 @@ SHOW_VAR status_vars[]= {
{"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
{"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS},
{"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
- {"Flush_commands", (char*) &show_flush_commands, SHOW_SIMPLE_FUNC},
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS},
@@ -7931,7 +7731,7 @@ static int option_cmp(my_option *a, my_option *b)
static void print_help()
{
MEM_ROOT mem_root;
- init_alloc_root(&mem_root, "help", 4096, 4096, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &mem_root, 4096, 4096, MYF(0));
pop_dynamic(&all_options);
add_many_options(&all_options, pfs_early_options,
@@ -8038,8 +7838,8 @@ static int mysql_init_variables(void)
disable_log_notes= 0;
mqh_used= 0;
cleanup_done= 0;
- select_errors= dropping_tables= ha_open_options=0;
- thread_count= kill_cached_threads= wake_thread= 0;
+ test_flags= select_errors= dropping_tables= ha_open_options=0;
+ thread_count= kill_cached_threads= 0;
slave_open_temp_tables= 0;
cached_thread_count= 0;
opt_endinfo= using_udf_functions= 0;
@@ -8068,9 +7868,9 @@ static int mysql_init_variables(void)
key_map_full.set_all();
/* Character sets */
- system_charset_info= &my_charset_utf8_general_ci;
- files_charset_info= &my_charset_utf8_general_ci;
- national_charset_info= &my_charset_utf8_general_ci;
+ system_charset_info= &my_charset_utf8mb3_general_ci;
+ files_charset_info= &my_charset_utf8mb3_general_ci;
+ national_charset_info= &my_charset_utf8mb3_general_ci;
table_alias_charset= &my_charset_bin;
character_set_filesystem= &my_charset_bin;
@@ -8224,7 +8024,8 @@ static int mysql_init_variables(void)
}
my_bool
-mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
+mysqld_get_one_option(const struct my_option *opt, char *argument,
+ const char *filename)
{
if (opt->app_type)
{
@@ -8234,10 +8035,16 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
var->value_origin= sys_var::AUTO;
return 0;
}
- var->value_origin= sys_var::CONFIG;
+ if (*filename)
+ {
+ var->origin_filename= filename;
+ var->value_origin= sys_var::CONFIG;
+ }
+ else
+ var->value_origin= sys_var::COMMAND_LINE;
}
- switch(optid) {
+ switch(opt->id) {
case '#':
#ifndef DBUG_OFF
if (!argument)
@@ -8262,6 +8069,8 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
"for compatibility with old my.cnf files.",
opt->name);
break;
+ case OPT_REMOVED_OPTION:
+ break;
case OPT_MYSQL_COMPATIBILITY:
sql_print_warning("'%s' is MySQL 5.6 / 5.7 compatible option. Not used or "
"needed in MariaDB.", opt->name);
@@ -8562,9 +8371,6 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
case OPT_PLUGIN_LOAD_ADD:
opt_plugin_load_list_ptr->push_back(new i_string(argument));
break;
- case OPT_MAX_LONG_DATA_SIZE:
- max_long_data_size_used= true;
- break;
case OPT_PFS_INSTRUMENT:
{
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
@@ -8776,13 +8582,12 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
{
int ho_error;
- my_getopt_register_get_addr(mysql_getopt_value);
+ my_getopt_get_addr= mysql_getopt_value;
my_getopt_error_reporter= option_error_reporter;
/* prepare all_options array */
- my_init_dynamic_array(&all_options, sizeof(my_option),
- array_elements(my_long_options) +
- sys_var_elements(),
+ my_init_dynamic_array(PSI_INSTRUMENT_ME, &all_options, sizeof(my_option),
+ array_elements(my_long_options) + sys_var_elements(),
array_elements(my_long_options)/4, MYF(0));
add_many_options(&all_options, my_long_options, array_elements(my_long_options));
sys_var_add_options(&all_options, 0);
@@ -8980,14 +8785,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
opt_readonly= read_only;
- /*
- If max_long_data_size is not specified explicitly use
- value of max_allowed_packet.
- */
- if (!max_long_data_size_used)
- SYSVAR_AUTOSIZE(max_long_data_size,
- global_system_variables.max_allowed_packet);
-
/* Remember if max_user_connections was 0 at startup */
max_user_connections_checking= global_system_variables.max_user_connections != 0;
@@ -9127,11 +8924,10 @@ bool is_secure_file_path(char *path)
}
else
{
- if (files_charset_info->coll->strnncoll(files_charset_info,
- (uchar *) buff2, strlen(buff2),
- (uchar *) opt_secure_file_priv,
- opt_secure_file_priv_len,
- TRUE))
+ if (files_charset_info->strnncoll(buff2, strlen(buff2),
+ opt_secure_file_priv,
+ opt_secure_file_priv_len,
+ TRUE))
return FALSE;
}
return TRUE;
@@ -9222,7 +9018,7 @@ static int fix_paths(void)
sql_print_warning("Failed to normalize the argument for --secure-file-priv.");
DBUG_RETURN(1);
}
- char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
+ char *secure_file_real_path= (char *)my_malloc(PSI_INSTRUMENT_ME, FN_REFLEN, MYF(MY_FAE));
convert_dirname(secure_file_real_path, buff, NullS);
my_free(opt_secure_file_priv);
opt_secure_file_priv= secure_file_real_path;
@@ -9323,6 +9119,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);
@@ -9360,9 +9161,14 @@ static PSI_file_info all_server_files[]=
{ &key_file_map, "map", 0},
#endif /* HAVE_MMAP */
{ &key_file_binlog, "binlog", 0},
+ { &key_file_binlog_cache, "binlog_cache", 0},
{ &key_file_binlog_index, "binlog_index", 0},
+ { &key_file_binlog_index_cache, "binlog_index_cache", 0},
{ &key_file_relaylog, "relaylog", 0},
+ { &key_file_relaylog_cache, "relaylog_cache", 0},
{ &key_file_relaylog_index, "relaylog_index", 0},
+ { &key_file_relaylog_index_cache, "relaylog_index_cache", 0},
+ { &key_file_io_cache, "io_cache", 0},
{ &key_file_casetest, "casetest", 0},
{ &key_file_dbopt, "dbopt", 0},
{ &key_file_des_key_file, "des_key_file", 0},
@@ -9377,7 +9183,7 @@ static PSI_file_info all_server_files[]=
{ &key_file_log_event_info, "log_event_info", 0},
{ &key_file_master_info, "master_info", 0},
{ &key_file_misc, "misc", 0},
- { &key_file_partition, "partition", 0},
+ { &key_file_partition_ddl_log, "partition_ddl_log", 0},
{ &key_file_pid, "pid", 0},
{ &key_file_query_log, "query_log", 0},
{ &key_file_relay_log_info, "relay_log_info", 0},
@@ -9396,25 +9202,25 @@ PSI_stage_info stage_after_create= { 0, "After create", 0};
PSI_stage_info stage_after_opening_tables= { 0, "After opening tables", 0};
PSI_stage_info stage_after_table_lock= { 0, "After table lock", 0};
PSI_stage_info stage_allocating_local_table= { 0, "Allocating local table", 0};
-PSI_stage_info stage_alter_inplace_prepare= { 0, "Preparing for alter table", 0};
-PSI_stage_info stage_alter_inplace= { 0, "Altering table", 0};
+PSI_stage_info stage_alter_inplace_prepare= { 0, "preparing for alter table", 0};
+PSI_stage_info stage_alter_inplace= { 0, "altering table", 0};
PSI_stage_info stage_alter_inplace_commit= { 0, "Committing alter table to storage engine", 0};
PSI_stage_info stage_apply_event= { 0, "Apply log event", 0};
PSI_stage_info stage_changing_master= { 0, "Changing master", 0};
PSI_stage_info stage_checking_master_version= { 0, "Checking master version", 0};
-PSI_stage_info stage_checking_permissions= { 0, "Checking permissions", 0};
-PSI_stage_info stage_checking_privileges_on_cached_query= { 0, "Checking privileges on cached query", 0};
+PSI_stage_info stage_checking_permissions= { 0, "checking permissions", 0};
+PSI_stage_info stage_checking_privileges_on_cached_query= { 0, "checking privileges on cached query", 0};
PSI_stage_info stage_checking_query_cache_for_query= { 0, "Checking query cache for query", 0};
PSI_stage_info stage_cleaning_up= { 0, "Reset for next command", 0};
-PSI_stage_info stage_closing_tables= { 0, "Closing tables", 0};
+PSI_stage_info stage_closing_tables= { 0, "closing tables", 0};
PSI_stage_info stage_connecting_to_master= { 0, "Connecting to master", 0};
PSI_stage_info stage_converting_heap_to_myisam= { 0, "Converting HEAP to " TMP_ENGINE_NAME, 0};
PSI_stage_info stage_copying_to_group_table= { 0, "Copying to group table", 0};
PSI_stage_info stage_copying_to_tmp_table= { 0, "Copying to tmp table", 0};
-PSI_stage_info stage_copy_to_tmp_table= { 0, "Copy to tmp table", 0};
+PSI_stage_info stage_copy_to_tmp_table= { 0, "copy to tmp table", PSI_FLAG_STAGE_PROGRESS};
PSI_stage_info stage_creating_delayed_handler= { 0, "Creating delayed handler", 0};
PSI_stage_info stage_creating_sort_index= { 0, "Creating sort index", 0};
-PSI_stage_info stage_creating_table= { 0, "Creating table", 0};
+PSI_stage_info stage_creating_table= { 0, "creating table", 0};
PSI_stage_info stage_creating_tmp_table= { 0, "Creating tmp table", 0};
PSI_stage_info stage_deleting_from_main_table= { 0, "Deleting from main table", 0};
PSI_stage_info stage_deleting_from_reference_tables= { 0, "Deleting from reference tables", 0};
@@ -9432,17 +9238,17 @@ PSI_stage_info stage_freeing_items= { 0, "Freeing items", 0};
PSI_stage_info stage_fulltext_initialization= { 0, "Fulltext initialization", 0};
PSI_stage_info stage_got_handler_lock= { 0, "Got handler lock", 0};
PSI_stage_info stage_got_old_table= { 0, "Got old table", 0};
-PSI_stage_info stage_init= { 0, "Init", 0};
-PSI_stage_info stage_init_update= { 0, "Init for update", 0};
+PSI_stage_info stage_init= { 0, "init", 0};
+PSI_stage_info stage_init_update= { 0, "init for update", 0};
PSI_stage_info stage_insert= { 0, "Insert", 0};
PSI_stage_info stage_invalidating_query_cache_entries_table= { 0, "Invalidating query cache entries (table)", 0};
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};
@@ -9452,7 +9258,7 @@ PSI_stage_info stage_starting_cleanup= { 0, "Starting cleanup", 0};
PSI_stage_info stage_rollback= { 0, "Rollback", 0};
PSI_stage_info stage_rollback_implicit= { 0, "Rollback_implicit", 0};
PSI_stage_info stage_commit= { 0, "Commit", 0};
-PSI_stage_info stage_commit_implicit= { 0, "Commit_implicit", 0};
+PSI_stage_info stage_commit_implicit= { 0, "Commit implicit", 0};
PSI_stage_info stage_queueing_master_event_to_the_relay_log= { 0, "Queueing master event to the relay log", 0};
PSI_stage_info stage_reading_event_from_the_relay_log= { 0, "Reading event from the relay log", 0};
PSI_stage_info stage_recreating_table= { 0, "Recreating table", 0};
@@ -9467,9 +9273,9 @@ PSI_stage_info stage_searching_rows_for_update= { 0, "Searching rows for update"
PSI_stage_info stage_sending_binlog_event_to_slave= { 0, "Sending binlog event to slave", 0};
PSI_stage_info stage_sending_cached_result_to_client= { 0, "Sending cached result to client", 0};
PSI_stage_info stage_sending_data= { 0, "Sending data", 0};
-PSI_stage_info stage_setup= { 0, "Setup", 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};
@@ -9480,7 +9286,7 @@ PSI_stage_info stage_storing_result_in_query_cache= { 0, "Storing result in quer
PSI_stage_info stage_storing_row_into_queue= { 0, "Storing row into queue", 0};
PSI_stage_info stage_system_lock= { 0, "System lock", 0};
PSI_stage_info stage_unlocking_tables= { 0, "Unlocking tables", 0};
-PSI_stage_info stage_table_lock= { 0, "Table lock", 0};
+PSI_stage_info stage_table_lock= { 0, "table lock", 0};
PSI_stage_info stage_filling_schema_table= { 0, "Filling schema table", 0};
PSI_stage_info stage_update= { 0, "Update", 0};
PSI_stage_info stage_updating= { 0, "Updating", 0};
@@ -9510,14 +9316,13 @@ PSI_stage_info stage_waiting_for_query_cache_lock= { 0, "Waiting for query cache
PSI_stage_info stage_waiting_for_the_next_event_in_relay_log= { 0, "Waiting for the next event in relay log", 0};
PSI_stage_info stage_waiting_for_the_slave_thread_to_advance_position= { 0, "Waiting for the slave SQL thread to advance position", 0};
PSI_stage_info stage_waiting_to_finalize_termination= { 0, "Waiting to finalize termination", 0};
-PSI_stage_info stage_waiting_to_get_readlock= { 0, "Waiting to get readlock", 0};
PSI_stage_info stage_binlog_waiting_background_tasks= { 0, "Waiting for background binlog tasks", 0};
PSI_stage_info stage_binlog_write= { 0, "Writing to binlog", 0};
PSI_stage_info stage_binlog_processing_checkpoint_notify= { 0, "Processing binlog checkpoint notification", 0};
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};
@@ -9525,10 +9330,92 @@ 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};
+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
@@ -9657,7 +9544,6 @@ PSI_stage_info *all_server_stages[]=
& stage_waiting_for_the_slave_thread_to_advance_position,
& stage_waiting_for_work_from_sql_thread,
& stage_waiting_to_finalize_termination,
- & stage_waiting_to_get_readlock,
& stage_master_gtid_wait_primary,
& stage_master_gtid_wait,
& stage_gtid_wait_other_connection,
@@ -9666,7 +9552,8 @@ PSI_stage_info *all_server_stages[]=
& stage_waiting_for_semi_sync_ack_from_slave,
& stage_waiting_for_semi_sync_slave,
& stage_reading_semi_sync_ack,
- & stage_waiting_for_deadlock_kill
+ & stage_waiting_for_deadlock_kill,
+ & stage_starting
};
PSI_socket_key key_socket_tcpip, key_socket_unix, key_socket_client_connection;
@@ -9678,6 +9565,145 @@ static PSI_socket_info all_server_sockets[]=
{ &key_socket_client_connection, "client_connection", 0}
};
+static PSI_memory_info all_server_memory[]=
+{
+ { &key_memory_locked_table_list, "Locked_tables_list::m_locked_tables_root", 0},
+ { &key_memory_locked_thread_list, "display_table_locks", PSI_FLAG_THREAD},
+ { &key_memory_thd_transactions, "THD::transactions::mem_root", PSI_FLAG_THREAD},
+// { &key_memory_delegate, "Delegate::memroot", 0},
+ { &key_memory_acl_mem, "sql_acl_mem", PSI_FLAG_GLOBAL},
+ { &key_memory_acl_memex, "sql_acl_memex", PSI_FLAG_GLOBAL},
+ { &key_memory_acl_cache, "acl_cache", PSI_FLAG_GLOBAL},
+ { &key_memory_thd_main_mem_root, "thd::main_mem_root", PSI_FLAG_THREAD},
+// { &key_memory_help, "help", 0},
+// { &key_memory_new_frm_mem, "new_frm_mem", 0},
+ { &key_memory_table_share, "TABLE_SHARE::mem_root", PSI_FLAG_GLOBAL}, /* table definition cache */
+ { &key_memory_gdl, "gdl", 0},
+ { &key_memory_table_triggers_list, "Table_triggers_list", 0},
+// { &key_memory_servers, "servers", 0},
+ { &key_memory_prepared_statement_map, "Prepared_statement_map", PSI_FLAG_THREAD},
+ { &key_memory_prepared_statement_main_mem_root, "Prepared_statement::main_mem_root", PSI_FLAG_THREAD},
+// { &key_memory_protocol_rset_root, "Protocol_local::m_rset_root", PSI_FLAG_THREAD},
+// { &key_memory_warning_info_warn_root, "Warning_info::m_warn_root", PSI_FLAG_THREAD},
+ { &key_memory_sp_cache, "THD::sp_cache", 0},
+ { &key_memory_sp_head_main_root, "sp_head::main_mem_root", 0},
+ { &key_memory_sp_head_execute_root, "sp_head::execute_mem_root", PSI_FLAG_THREAD},
+ { &key_memory_sp_head_call_root, "sp_head::call_mem_root", PSI_FLAG_THREAD},
+ { &key_memory_table_mapping_root, "table_mapping::m_mem_root", 0},
+ { &key_memory_quick_range_select_root, "QUICK_RANGE_SELECT::alloc", PSI_FLAG_THREAD},
+// { &key_memory_quick_index_merge_root, "QUICK_INDEX_MERGE_SELECT::alloc", PSI_FLAG_THREAD},
+// { &key_memory_quick_ror_intersect_select_root, "QUICK_ROR_INTERSECT_SELECT::alloc", PSI_FLAG_THREAD},
+// { &key_memory_quick_ror_union_select_root, "QUICK_ROR_UNION_SELECT::alloc", PSI_FLAG_THREAD},
+// { &key_memory_quick_group_min_max_select_root, "QUICK_GROUP_MIN_MAX_SELECT::alloc", PSI_FLAG_THREAD},
+// { &key_memory_test_quick_select_exec, "test_quick_select", PSI_FLAG_THREAD},
+// { &key_memory_prune_partitions_exec, "prune_partitions::exec", 0},
+ { &key_memory_binlog_recover_exec, "MYSQL_BIN_LOG::recover", 0},
+ { &key_memory_blob_mem_storage, "Blob_mem_storage::storage", 0},
+ { &key_memory_NAMED_ILINK_name, "NAMED_ILINK::name", 0},
+ { &key_memory_String_value, "String::value", 0},
+ { &key_memory_Sys_var_charptr_value, "Sys_var_charptr::value", 0},
+ { &key_memory_queue_item, "Queue::queue_item", 0},
+ { &key_memory_THD_db, "THD::db", 0},
+ { &key_memory_user_var_entry, "user_var_entry", 0},
+// { &key_memory_Slave_job_group_group_relay_log_name, "Slave_job_group::group_relay_log_name", 0},
+ { &key_memory_Relay_log_info_group_relay_log_name, "Relay_log_info::group_relay_log_name", 0},
+ { &key_memory_binlog_cache_mngr, "binlog_cache_mngr", 0},
+ { &key_memory_Row_data_memory_memory, "Row_data_memory::memory", 0},
+// { &key_memory_Gtid_set_to_string, "Gtid_set::to_string", 0},
+// { &key_memory_Gtid_state_to_string, "Gtid_state::to_string", 0},
+// { &key_memory_Owned_gtids_to_string, "Owned_gtids::to_string", 0},
+// { &key_memory_log_event, "Log_event", 0},
+// { &key_memory_Incident_log_event_message, "Incident_log_event::message", 0},
+// { &key_memory_Rows_query_log_event_rows_query, "Rows_query_log_event::rows_query", 0},
+ { &key_memory_Sort_param_tmp_buffer, "Sort_param::tmp_buffer", 0},
+ { &key_memory_Filesort_info_merge, "Filesort_info::merge", 0},
+ { &key_memory_Filesort_info_record_pointers, "Filesort_info::record_pointers", 0},
+// { &key_memory_Filesort_buffer_sort_keys, "Filesort_buffer::sort_keys", 0},
+ { &key_memory_handler_errmsgs, "handler::errmsgs", 0},
+ { &key_memory_handlerton, "handlerton", 0},
+ { &key_memory_XID, "XID", 0},
+ { &key_memory_host_cache_hostname, "host_cache::hostname", 0},
+ { &key_memory_user_var_entry_value, "user_var_entry::value", 0},
+ { &key_memory_User_level_lock, "User_level_lock", 0},
+ { &key_memory_MYSQL_LOG_name, "MYSQL_LOG::name", 0},
+ { &key_memory_TC_LOG_MMAP_pages, "TC_LOG_MMAP::pages", 0},
+// { &key_memory_my_bitmap_map, "my_bitmap_map", 0},
+ { &key_memory_QUICK_RANGE_SELECT_mrr_buf_desc, "QUICK_RANGE_SELECT::mrr_buf_desc", 0},
+ { &key_memory_Event_queue_element_for_exec_names, "Event_queue_element_for_exec::names", 0},
+ { &key_memory_my_str_malloc, "my_str_malloc", 0},
+ { &key_memory_MYSQL_BIN_LOG_basename, "MYSQL_BIN_LOG::basename", 0},
+ { &key_memory_MYSQL_BIN_LOG_index, "MYSQL_BIN_LOG::index", 0},
+ { &key_memory_MYSQL_RELAY_LOG_basename, "MYSQL_RELAY_LOG::basename", 0},
+ { &key_memory_MYSQL_RELAY_LOG_index, "MYSQL_RELAY_LOG::index", 0},
+ { &key_memory_rpl_filter, "rpl_filter memory", 0},
+ { &key_memory_errmsgs, "errmsgs", 0},
+ { &key_memory_Gis_read_stream_err_msg, "Gis_read_stream::err_msg", 0},
+// { &key_memory_Geometry_objects_data, "Geometry::ptr_and_wkb_data", 0},
+ { &key_memory_MYSQL_LOCK, "MYSQL_LOCK", 0},
+// { &key_memory_NET_buff, "NET::buff", 0},
+// { &key_memory_NET_compress_packet, "NET::compress_packet", 0},
+ { &key_memory_Event_scheduler_scheduler_param, "Event_scheduler::scheduler_param", 0},
+// { &key_memory_Gtid_set_Interval_chunk, "Gtid_set::Interval_chunk", 0},
+// { &key_memory_Owned_gtids_sidno_to_hash, "Owned_gtids::sidno_to_hash", 0},
+// { &key_memory_Sid_map_Node, "Sid_map::Node", 0},
+// { &key_memory_Gtid_state_group_commit_sidno, "Gtid_state::group_commit_sidno_locks", 0},
+// { &key_memory_Mutex_cond_array_Mutex_cond, "Mutex_cond_array::Mutex_cond", 0},
+ { &key_memory_TABLE_RULE_ENT, "TABLE_RULE_ENT", 0},
+// { &key_memory_Rpl_info_table, "Rpl_info_table", 0},
+ { &key_memory_Rpl_info_file_buffer, "Rpl_info_file::buffer", 0},
+// { &key_memory_db_worker_hash_entry, "db_worker_hash_entry", 0},
+// { &key_memory_rpl_slave_check_temp_dir, "rpl_slave::check_temp_dir", 0},
+// { &key_memory_rpl_slave_command_buffer, "rpl_slave::command_buffer", 0},
+ { &key_memory_binlog_ver_1_event, "binlog_ver_1_event", 0},
+ { &key_memory_SLAVE_INFO, "SLAVE_INFO", 0},
+ { &key_memory_binlog_pos, "binlog_pos", 0},
+// { &key_memory_HASH_ROW_ENTRY, "HASH_ROW_ENTRY", 0},
+ { &key_memory_binlog_statement_buffer, "binlog_statement_buffer", 0},
+// { &key_memory_partition_syntax_buffer, "partition_syntax_buffer", 0},
+// { &key_memory_READ_INFO, "READ_INFO", 0},
+ { &key_memory_JOIN_CACHE, "JOIN_CACHE", 0},
+// { &key_memory_TABLE_sort_io_cache, "TABLE::sort_io_cache", 0},
+// { &key_memory_frm, "frm", 0},
+ { &key_memory_Unique_sort_buffer, "Unique::sort_buffer", 0},
+ { &key_memory_Unique_merge_buffer, "Unique::merge_buffer", 0},
+ { &key_memory_TABLE, "TABLE", PSI_FLAG_GLOBAL}, /* Table cache */
+// { &key_memory_frm_extra_segment_buff, "frm::extra_segment_buff", 0},
+// { &key_memory_frm_form_pos, "frm::form_pos", 0},
+ { &key_memory_frm_string, "frm::string", 0},
+// { &key_memory_LOG_name, "LOG_name", 0},
+ { &key_memory_DATE_TIME_FORMAT, "DATE_TIME_FORMAT", 0},
+ { &key_memory_DDL_LOG_MEMORY_ENTRY, "DDL_LOG_MEMORY_ENTRY", 0},
+ { &key_memory_ST_SCHEMA_TABLE, "ST_SCHEMA_TABLE", 0},
+ { &key_memory_ignored_db, "ignored_db", 0},
+ { &key_memory_PROFILE, "PROFILE", 0},
+ { &key_memory_global_system_variables, "global_system_variables", 0},
+ { &key_memory_THD_variables, "THD::variables", 0},
+// { &key_memory_Security_context, "Security_context", 0},
+// { &key_memory_shared_memory_name, "Shared_memory_name", 0},
+ { &key_memory_bison_stack, "bison_stack", 0},
+ { &key_memory_THD_handler_tables_hash, "THD::handler_tables_hash", 0},
+ { &key_memory_hash_index_key_buffer, "hash_index_key_buffer", 0},
+ { &key_memory_dboptions_hash, "dboptions_hash", 0},
+ { &key_memory_user_conn, "user_conn", 0},
+// { &key_memory_LOG_POS_COORD, "LOG_POS_COORD", 0},
+// { &key_memory_XID_STATE, "XID_STATE", 0},
+ { &key_memory_MPVIO_EXT_auth_info, "MPVIO_EXT::auth_info", 0},
+// { &key_memory_opt_bin_logname, "opt_bin_logname", 0},
+ { &key_memory_Query_cache, "Query_cache", PSI_FLAG_GLOBAL},
+// { &key_memory_READ_RECORD_cache, "READ_RECORD_cache", 0},
+// { &key_memory_Quick_ranges, "Quick_ranges", 0},
+// { &key_memory_File_query_log_name, "File_query_log::name", 0},
+ { &key_memory_Table_trigger_dispatcher, "Table_trigger_dispatcher::m_mem_root", 0},
+// { &key_memory_thd_timer, "thd_timer", 0},
+// { &key_memory_THD_Session_tracker, "THD::Session_tracker", 0},
+// { &key_memory_THD_Session_sysvar_resource_manager, "THD::Session_sysvar_resource_manager", 0},
+// { &key_memory_show_slave_status_io_gtid_set, "show_slave_status_io_gtid_set", 0},
+// { &key_memory_write_set_extraction, "write_set_extraction", 0},
+// { &key_memory_get_all_tables, "get_all_tables", 0},
+// { &key_memory_fill_schema_schemata, "fill_schema_schemata", 0},
+ { &key_memory_native_functions, "native_functions", PSI_FLAG_GLOBAL},
+};
+
/**
Initialise all the performance schema instrumentation points
used by the server.
@@ -9708,11 +9734,16 @@ void init_server_psi_keys(void)
count= array_elements(all_server_sockets);
mysql_socket_register(category, all_server_sockets, count);
+ count= array_elements(all_server_memory);
+ mysql_memory_register(category, all_server_memory, count);
+
#ifdef HAVE_PSI_STATEMENT_INTERFACE
init_sql_statement_info();
count= array_elements(sql_statement_info);
mysql_statement_register(category, sql_statement_info, count);
+ init_sp_psi_keys();
+
category= "com";
init_com_statement_info();