From 12db5ab0d674015930d952888fb7ff1a97a1dd83 Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Wed, 18 Jun 2008 21:09:30 +0200 Subject: [PATCH 1/3] Bug#21226 FLUSH PRIVILEGES does not provided feedback when it fails. If during a FLUSH PRIVILEGES the server fails to load the new privilege tables, the error message is lost. This patch is a back port from 5.1 which adresses this issue by setting the server in an error state if a failure occurrs. This patch also corrects an incorrect variable assignment which might cause an error state to be reverted by coincidence. sql/sql_parse.cc: * Set error state if acl_reload or grant_reload fails. * Fix bad variable assignment which cancels previous error status. --- sql/sql_parse.cc | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 98e04e45bdd..a192bcc38f2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7054,11 +7054,23 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, thd->thread_stack= (char*) &tmp_thd; thd->store_globals(); } + if (thd) { - (void)acl_reload(thd); - (void)grant_reload(thd); + bool reload_acl_failed= acl_reload(thd); + bool reload_grants_failed= grant_reload(thd); + + if (reload_acl_failed || reload_grants_failed) + { + result= 1; + /* + When an error is returned, my_message may have not been called and + the client will hang waiting for a response. + */ + my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed"); + } } + if (tmp_thd) { delete tmp_thd; @@ -7144,8 +7156,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, tmp_write_to_binlog= 0; if (lock_global_read_lock(thd)) return 1; // Killed - result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, - tables); + if (close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, + tables)) + result= 1; + if (make_global_read_lock_block_commit(thd)) // Killed { /* Don't leave things in a half-locked state */ @@ -7154,7 +7168,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, } } else - result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables); + { + if (close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables)) + result= 1; + } my_dbopt_cleanup(); } if (options & REFRESH_HOSTS) @@ -7178,8 +7195,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, #ifdef OPENSSL if (options & REFRESH_DES_KEY_FILE) { - if (des_key_file) - result=load_des_key_file(des_key_file); + if (des_key_file && load_des_key_file(des_key_file)) + result= 1; } #endif #ifdef HAVE_REPLICATION From f0dfb82fcb1df0379c296bd0bb72f029130331ba Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Tue, 29 Jul 2008 15:37:09 +0200 Subject: [PATCH 2/3] Bug#37781 mysql_drop_user calls get_current_user() twice for no reason Fixed typo and removed duplicate call to get_current_user. --- sql/sql_acl.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index e12fbb9843a..df5e844749f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5430,7 +5430,6 @@ bool mysql_drop_user(THD *thd, List &list) while ((tmp_user_name= user_list++)) { - user_name= get_current_user(thd, tmp_user_name); if (!(user_name= get_current_user(thd, tmp_user_name))) { result= TRUE; From 0a415f62fdf4c0698a04b97b3b3208455bf9c834 Mon Sep 17 00:00:00 2001 From: Kristofer Pettersson Date: Tue, 29 Jul 2008 15:58:15 +0200 Subject: [PATCH 3/3] Bug#29738 Error message not properly translated to Serbian Community contribution fix for Serbian translation in error message list. --- sql/share/errmsg.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 7d345d633c6..0916ad56cef 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -4737,7 +4737,7 @@ ER_SLAVE_IGNORED_TABLE swe "Slav SQL tråden ignorerade frågan pga en replicate-*-table regel" ER_INCORRECT_GLOBAL_LOCAL_VAR eng "Variable '%-.64s' is a %s variable" - serbian "Incorrect foreign key definition for '%-.64s': %s" + serbian "Promenljiva '%-.64s' je %s promenljiva" ger "Variable '%-.64s' ist eine %s-Variable" spa "Variable '%-.64s' es una %s variable" swe "Variabel '%-.64s' är av typ %s"