diff options
author | Alexey Botchkov <holyfoot@mysql.com> | 2010-09-02 23:37:04 +0500 |
---|---|---|
committer | Alexey Botchkov <holyfoot@mysql.com> | 2010-09-02 23:37:04 +0500 |
commit | c6024dfc4e09d5eed076230a8645a8f4dae0d2f8 (patch) | |
tree | 118ad3b6cdad8674425315bda73619e5783bc743 /sql | |
parent | 7e8d74505e2334db76a20360168e650149c99cc5 (diff) | |
download | mariadb-git-c6024dfc4e09d5eed076230a8645a8f4dae0d2f8.tar.gz |
Bug#53251 mysql_library_init fails on second execution with embedded library
thread-specific variables weren't set when we load error message files.
per-file comments:
libmysqld/lib_sql.cc
Bug#53251 mysql_library_init fails on second execution with embedded library
we need to call my_thread_init() once more. Normally it's called at the my_init()
stage but that doesn't happen on the second my_init() call.
sql/derror.cc
Bug#53251 mysql_library_init fails on second execution with embedded library
use default errors for the embedded server.
sql/mysqld.cc
Bug#53251 mysql_library_init fails on second execution with embedded library
unregister server errors in clean_up(). Without it the error list contains
that on the second mysql_server_init() which is not good.
sql/set_var.cc
Bug#53251 mysql_library_init fails on second execution with embedded library
sys_var::cleanup() call instead of the destructor
sql/set_var.h
Bug#53251 mysql_library_init fails on second execution with embedded library
sys_var::cleanup() introduced instead of the destructor
sql/sys_vars.h
Bug#53251 mysql_library_init fails on second execution with embedded library
Sys_var_charptr::cleanup() implemented
Diffstat (limited to 'sql')
-rw-r--r-- | sql/derror.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 1 | ||||
-rw-r--r-- | sql/set_var.cc | 2 | ||||
-rw-r--r-- | sql/set_var.h | 5 | ||||
-rw-r--r-- | sql/sys_vars.h | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/sql/derror.cc b/sql/derror.cc index bf8c589a65f..db9cd3c0c58 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -35,6 +35,8 @@ static void init_myfunc_errs(void); C_MODE_START static const char **get_server_errmsgs() { + if (!current_thd) + return DEFAULT_ERRMSGS; return CURRENT_THD_ERRMSGS; } C_MODE_END diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 6dd74eb299a..840616e0e7c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1486,6 +1486,7 @@ void clean_up(bool print_message) cleanup_errmsgs(); MYSQL_CALLBACK(thread_scheduler, end, ()); finish_client_errs(); + (void) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST); // finish server errs DBUG_PRINT("quit", ("Error messages freed")); /* Tell main we are ready */ logger.cleanup_end(); diff --git a/sql/set_var.cc b/sql/set_var.cc index 501c6382056..34b66dea319 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -108,7 +108,7 @@ void sys_var_end() my_hash_free(&system_variable_hash); for (sys_var *var=all_sys_vars.first; var; var= var->next) - var->~sys_var(); + var->cleanup(); DBUG_VOID_RETURN; } diff --git a/sql/set_var.h b/sql/set_var.h index 5f1f889c4ce..ece3b80edb4 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -92,10 +92,9 @@ public: on_check_function on_check_func, on_update_function on_update_func, uint deprecated_version, const char *substitute, int parse_flag); /** - The instance should only be destroyed on shutdown, as it doesn't unlink - itself from the chain. + All the cleanup procedures should be performed here */ - virtual ~sys_var() {} + virtual void cleanup() {} /** downcast for sys_var_pluginvar. Returns this if it's an instance of sys_var_pluginvar, and 0 otherwise. diff --git a/sql/sys_vars.h b/sql/sys_vars.h index ee6b429b04a..740c4f03e3e 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -385,7 +385,7 @@ public: DBUG_ASSERT(scope() == GLOBAL); DBUG_ASSERT(size == sizeof(char *)); } - ~Sys_var_charptr() + void cleanup() { if (flags & ALLOCATED) my_free(global_var(char*)); |