summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
committerKonstantin Osipov <kostja@sun.com>2010-02-06 13:28:06 +0300
commit9c030fe5081163babdc8ef24395d108a394107fe (patch)
tree16fe2efa0a3d5e40e00972a1dc3bc4e13f71170c /sql/mysqld.cc
parent0b2f51664d38ed24f3f8b237877520e45bfe83f6 (diff)
parent19df110369d4cef5303176a8aedca34cd0e2d271 (diff)
downloadmariadb-git-9c030fe5081163babdc8ef24395d108a394107fe.tar.gz
Merge next-mr -> next-4284.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc39
1 files changed, 23 insertions, 16 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5bb526795df..07a4c9317c4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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"
@@ -955,6 +956,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
@@ -1365,6 +1367,7 @@ void unireg_end(void)
#endif
}
+
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
@@ -1375,15 +1378,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)
{
@@ -2116,10 +2129,10 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
+ DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
mysql_cond_broadcast(&COND_thread_count);
- DBUG_LEAVE; // Must match DBUG_ENTER()
pthread_exit(0);
return 0; // Avoid compiler warnings
}
@@ -3025,6 +3038,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)
@@ -4584,6 +4599,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.
@@ -4876,14 +4894,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
@@ -4896,13 +4906,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 */
/****************************************************************************