From 202a62deb0206b181ad6a7edd4fce7206c7e3381 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 11 Dec 2019 11:22:03 +0100 Subject: MDEV-11345 Compile english error messages into mysqld executable. Simplify loading messages into mariabackup. Do the same as server does We're forcing english, so there is no attempt to load errmsg.sys --- extra/mariabackup/xtrabackup.cc | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) (limited to 'extra') diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index ec53554e2d8..2ccd59ff13b 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -102,6 +102,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include #include #include +#include int sys_var_init(); @@ -5914,41 +5915,12 @@ extern void init_signals(void); #include -/* Messages . Avoid loading errmsg.sys file */ + void setup_error_messages() { - static const char *my_msgs[ERRORS_PER_RANGE]; - static const char **all_msgs[] = { my_msgs, my_msgs, my_msgs, my_msgs }; my_default_lc_messages = &my_locale_en_US; - my_default_lc_messages->errmsgs->errmsgs = all_msgs; - - /* Populate the necessary error messages */ - struct { - int id; - const char *fmt; - } - xb_msgs[] = - { - { ER_DATABASE_NAME,"Database" }, - { ER_TABLE_NAME,"Table"}, - { ER_PARTITION_NAME, "Partition" }, - { ER_SUBPARTITION_NAME, "Subpartition" }, - { ER_TEMPORARY_NAME, "Temporary"}, - { ER_RENAMED_NAME, "Renamed"}, - { ER_CANT_FIND_DL_ENTRY, "Can't find symbol '%-.128s' in library"}, - { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" }, - { ER_OUTOFMEMORY, "Out of memory; restart server and try again (needed %d bytes)" }, - { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" }, - { ER_UDF_NO_PATHS, "No paths allowed for shared library" }, - { ER_CANT_INITIALIZE_UDF,"Can't initialize function '%-.192s'; %-.80s"}, - { ER_PLUGIN_IS_NOT_LOADED,"Plugin '%-.192s' is not loaded" } - }; - - for (int i = 0; i < (int)array_elements(all_msgs); i++) - all_msgs[0][i] = "Unknown error"; - - for (int i = 0; i < (int)array_elements(xb_msgs); i++) - all_msgs[0][xb_msgs[i].id - ER_ERROR_FIRST] = xb_msgs[i].fmt; + if (init_errmessage()) + die("could not initialize error messages"); } void @@ -6220,6 +6192,8 @@ int main(int argc, char **argv) (void) pthread_key_delete(THR_THD); logger.cleanup_base(); + cleanup_errmsgs(); + free_error_messages(); mysql_mutex_destroy(&LOCK_error_log); if (status == EXIT_SUCCESS) { -- cgit v1.2.1