summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-06-03 10:34:41 -0700
committerIgor Babaev <igor@askmonty.org>2018-06-03 10:34:41 -0700
commitcab1d6382623f0611335caf2cd056aa7ee04d7cd (patch)
treec33b8118a77a78d87d8fb01e908dbfa6a67ca9a2 /sql/mysqld.cc
parentffe83e8e7bef32eb2a80aad2d382f0b023dd3a44 (diff)
parentee5124d714ea01f4e1bd6decf6da38b05c1009ad (diff)
downloadmariadb-git-cab1d6382623f0611335caf2cd056aa7ee04d7cd.tar.gz
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc72
1 files changed, 33 insertions, 39 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 4309748fe06..2205538f2d3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -304,7 +304,6 @@ static TYPELIB tc_heuristic_recover_typelib=
const char *first_keyword= "first";
const char *my_localhost= "localhost", *delayed_user= "DELAYED";
-const char *quoted_string= "%`s";
bool opt_large_files= sizeof(my_off_t) > 4;
static my_bool opt_autocommit; ///< for --autocommit command-line option
@@ -535,6 +534,7 @@ ulonglong slave_skipped_errors;
ulong feature_files_opened_with_delayed_keys= 0, feature_check_constraint= 0;
ulonglong denied_connections;
my_decimal decimal_zero;
+long opt_secure_timestamp;
/*
Maximum length of parameter value which can be set through
@@ -1957,10 +1957,11 @@ void kill_mysql(THD *thd)
pthread_t tmp;
int error;
abort_loop=1;
- if ((error= mysql_thread_create(0, /* Not instrumented */
- &tmp, &connection_attrib,
- kill_server_thread, (void*) 0)))
- sql_print_error("Can't create thread to kill server (errno= %d).", error);
+ if (unlikely((error= mysql_thread_create(0, /* Not instrumented */
+ &tmp, &connection_attrib,
+ kill_server_thread, (void*) 0))))
+ sql_print_error("Can't create thread to kill server (errno= %d).",
+ error);
}
#endif
DBUG_VOID_RETURN;
@@ -2191,7 +2192,8 @@ static void mysqld_exit(int exit_code)
if (opt_endinfo && global_status_var.global_memory_used)
fprintf(stderr, "Warning: Memory not freed: %ld\n",
(long) global_status_var.global_memory_used);
- if (!opt_debugging && !my_disable_leak_check && exit_code == 0)
+ if (!opt_debugging && !my_disable_leak_check && exit_code == 0 &&
+ debug_assert_on_not_freed_memory)
{
#ifdef SAFEMALLOC
sf_report_leaked_memory(0);
@@ -2240,14 +2242,14 @@ void clean_up(bool print_message)
lex_free(); /* Free some memory */
item_create_cleanup();
tdc_start_shutdown();
+#ifdef HAVE_REPLICATION
+ semi_sync_master_deinit();
+#endif
plugin_shutdown();
udf_free();
ha_end();
if (tc_log)
tc_log->close();
-#ifdef HAVE_REPLICATION
- semi_sync_master_deinit();
-#endif
xid_cache_free();
tdc_deinit();
mdl_destroy();
@@ -2569,7 +2571,7 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
my_snprintf(port_buf, NI_MAXSERV, "%d", port);
error= getaddrinfo(real_bind_addr_str, port_buf, &hints, &ai);
- if (error != 0)
+ if (unlikely(error != 0))
{
DBUG_PRINT("error",("Got error: %d from getaddrinfo()", error));
@@ -3485,8 +3487,9 @@ static void start_signal_handler(void)
(void) my_setstacksize(&thr_attr,my_thread_stack_size);
mysql_mutex_lock(&LOCK_start_thread);
- if ((error= mysql_thread_create(key_thread_signal_hand,
- &signal_thread, &thr_attr, signal_hand, 0)))
+ if (unlikely((error= mysql_thread_create(key_thread_signal_hand,
+ &signal_thread, &thr_attr,
+ signal_hand, 0))))
{
sql_print_error("Can't create interrupt-thread (error %d, errno: %d)",
error,errno);
@@ -3588,10 +3591,10 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
PSI_CALL_delete_current_thread();
#ifdef USE_ONE_SIGNAL_HAND
pthread_t tmp;
- if ((error= mysql_thread_create(0, /* Not instrumented */
- &tmp, &connection_attrib,
- kill_server_thread,
- (void*) &sig)))
+ if (unlikely((error= mysql_thread_create(0, /* Not instrumented */
+ &tmp, &connection_attrib,
+ kill_server_thread,
+ (void*) &sig))))
sql_print_error("Can't create thread to kill server (errno= %d)",
error);
#else
@@ -3683,9 +3686,9 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
func= sql_print_error;
}
- if (thd)
+ if (likely(thd))
{
- if (MyFlags & ME_FATALERROR)
+ if (unlikely(MyFlags & ME_FATALERROR))
thd->is_fatal_error= 1;
(void) thd->raise_condition(error, NULL, level, str);
}
@@ -3695,7 +3698,7 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
/* When simulating OOM, skip writing to error log to avoid mtr errors */
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_VOID_RETURN;);
- if (!thd || thd->log_all_errors || (MyFlags & ME_NOREFRESH))
+ if (unlikely(!thd) || thd->log_all_errors || (MyFlags & ME_NOREFRESH))
(*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
DBUG_VOID_RETURN;
}
@@ -4101,7 +4104,7 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
thd->status_var.local_memory_used);
if (size > 0 &&
thd->status_var.local_memory_used > (int64)thd->variables.max_mem_used &&
- !thd->killed && !thd->get_stmt_da()->is_set())
+ likely(!thd->killed) && !thd->get_stmt_da()->is_set())
{
/* Ensure we don't get called here again */
char buf[50], *buf2;
@@ -5377,7 +5380,7 @@ static int init_server_components()
init_global_index_stats();
/* Allow storage engine to give real error messages */
- if (ha_init_errors())
+ if (unlikely(ha_init_errors()))
DBUG_RETURN(1);
tc_log= 0; // ha_initialize_handlerton() needs that
@@ -5564,7 +5567,7 @@ static int init_server_components()
error= mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0, 0,
WRITE_CACHE, max_binlog_size, 0, TRUE);
mysql_mutex_unlock(log_lock);
- if (error)
+ if (unlikely(error))
unireg_abort(1);
}
@@ -5598,7 +5601,7 @@ static int init_server_components()
else
error= mlockall(MCL_CURRENT);
- if (error)
+ if (unlikely(error))
{
if (global_system_variables.log_warnings)
sql_print_warning("Failed to lock memory. Errno: %d\n",errno);
@@ -5630,9 +5633,9 @@ static void create_shutdown_thread()
hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
pthread_t hThread;
int error;
- if ((error= mysql_thread_create(key_thread_handle_shutdown,
- &hThread, &connection_attrib,
- handle_shutdown, 0)))
+ if (unlikely((error= mysql_thread_create(key_thread_handle_shutdown,
+ &hThread, &connection_attrib,
+ handle_shutdown, 0))))
sql_print_warning("Can't create thread to handle shutdown requests"
" (errno= %d)", error);
@@ -8566,8 +8569,10 @@ SHOW_VAR status_vars[]= {
{"Feature_fulltext", (char*) offsetof(STATUS_VAR, feature_fulltext), SHOW_LONG_STATUS},
{"Feature_gis", (char*) offsetof(STATUS_VAR, feature_gis), 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},
{"Feature_subquery", (char*) offsetof(STATUS_VAR, feature_subquery), SHOW_LONG_STATUS},
+ {"Feature_system_versioning", (char*) offsetof(STATUS_VAR, feature_system_versioning), SHOW_LONG_STATUS},
{"Feature_timezone", (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS},
{"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
{"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS},
@@ -9011,7 +9016,7 @@ static int mysql_init_variables(void)
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
have_ssl=SHOW_OPTION_YES;
-#if HAVE_YASSL
+#if defined(HAVE_YASSL)
have_openssl= SHOW_OPTION_NO;
#else
have_openssl= SHOW_OPTION_YES;
@@ -9563,7 +9568,7 @@ mysql_getopt_value(const char *name, uint length,
case OPT_KEY_CACHE_CHANGED_BLOCKS_HASH_SIZE:
{
KEY_CACHE *key_cache;
- if (!(key_cache= get_or_create_key_cache(name, length)))
+ if (unlikely(!(key_cache= get_or_create_key_cache(name, length))))
{
if (error)
*error= EXIT_OUT_OF_MEMORY;
@@ -9693,17 +9698,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
global_system_variables.max_allowed_packet);
}
-#if MYSQL_VERSION_ID > 101001
- /*
- TIMESTAMP columns get implicit DEFAULT values when
- --explicit_defaults_for_timestamp is not set.
- */
- if (!opt_help && !opt_explicit_defaults_for_timestamp)
- sql_print_warning("TIMESTAMP with implicit DEFAULT value is deprecated. "
- "Please use --explicit_defaults_for_timestamp server "
- "option (see documentation for more details).");
-#endif
-
if (log_error_file_ptr != disabled_my_option)
opt_error_log= 1;
else