MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Kristofer Pettersson Date:June 18 2008 7:09pm
Subject:bzr commit into mysql-5.0 branch (kpettersson:2636) Bug#21226
View as plain text  
#At file:///home/thek/Development/cpp/mysqlbzr/mysql-5.0-bug21226/

 2636 Kristofer Pettersson	2008-06-18
      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.
modified:
  sql/sql_parse.cc

per-file messages:
  sql/sql_parse.cc
    * Set error state if acl_reload or grant_reload fails.
    * Fix bad variable assignment which cancels previous error status.
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-03-21 15:23:17 +0000
+++ b/sql/sql_parse.cc	2008-06-18 19:09:30 +0000
@@ -7054,11 +7054,23 @@ bool reload_acl_and_cache(THD *thd, ulon
       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, ulon
       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, ulon
       }
     }
     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, ulon
 #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

Thread
bzr commit into mysql-5.0 branch (kpettersson:2636) Bug#21226Kristofer Pettersson18 Jun