1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge backport of WL#3771 with mysql-next-mr.

This commit is contained in:
Sergey Vojtovich
2010-01-19 17:30:55 +04:00
25 changed files with 1228 additions and 280 deletions

View File

@ -26,6 +26,7 @@
#include "mysqld_suffix.h"
#include "mysys_err.h"
#include "events.h"
#include "sql_audit.h"
#include "probes_mysql.h"
#include "debug_sync.h"
@ -954,6 +955,7 @@ static void close_server_sock();
static void clean_up_mutexes(void);
static void wait_for_signal_thread_to_end(void);
static void create_pid_file();
static void mysqld_exit(int exit_code) __attribute__((noreturn));
static void end_ssl();
#endif
@ -1364,6 +1366,7 @@ void unireg_end(void)
#endif
}
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
@ -1374,15 +1377,25 @@ extern "C" void unireg_abort(int exit_code)
sql_print_error("Aborting\n");
clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
mysqld_exit(exit_code);
}
static void mysqld_exit(int exit_code)
{
/*
Important note: we wait for the signal thread to end,
but if a kill -15 signal was sent, the signal thread did
spawn the kill_server_thread thread, which is running concurrently.
*/
wait_for_signal_thread_to_end();
mysql_audit_finalize();
clean_up_mutexes();
clean_up_error_log_mutex();
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */
}
#endif /*EMBEDDED_LIBRARY*/
#endif /* !EMBEDDED_LIBRARY */
void clean_up(bool print_message)
{
@ -3023,6 +3036,8 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
error= ER_UNKNOWN_ERROR;
}
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_ERROR, error, str);
if (thd)
{
if (MyFlags & ME_FATALERROR)
@ -4568,6 +4583,9 @@ int main(int argc, char **argv)
thr_kill_signal= SIGINT;
#endif
/* Initialize audit interface globals. Audit plugins are inited later. */
mysql_audit_initialize();
/*
Perform basic logger initialization logger. Should be called after
MY_INIT, as it initializes mutexes. Log tables are inited later.
@ -4860,14 +4878,6 @@ int main(int argc, char **argv)
}
#endif
clean_up(1);
/*
Important note: we wait for the signal thread to end,
but if a kill -15 signal was sent, the signal thread did
spawn the kill_server_thread thread, which is running concurrently.
*/
wait_for_signal_thread_to_end();
clean_up_mutexes();
clean_up_error_log_mutex();
#ifdef HAVE_PSI_INTERFACE
/*
Disable the instrumentation, to avoid recording events
@ -4880,13 +4890,10 @@ int main(int argc, char **argv)
}
shutdown_performance_schema();
#endif
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(0);
return(0); /* purecov: deadcode */
mysqld_exit(0);
}
#endif /* EMBEDDED_LIBRARY */
#endif /* !EMBEDDED_LIBRARY */
/****************************************************************************