MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kpettersson Date:May 28 2007 11:50am
Subject:bk commit into 5.0 tree (thek:1.2489) BUG#24988
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of thek. When thek does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-05-28 13:50:33+02:00, thek@adventure.(none) +2 -0
  Bug#24988 FLUSH PRIVILEGES causes brief unavailability
  - A race condition caused brief unavailablility when trying to acccess
    a table.
  - The unprotected variable 'grant_option' wasn't intended to alternate
    during normal execution. Variable initialization moved to grant_init
    a lines responsible for the alternation are removed. 

  sql/mysqld.cc@stripped, 2007-05-28 13:50:31+02:00, thek@adventure.(none) +9 -1
    - Added documentation to describe grant_option flag.

  sql/sql_acl.cc@stripped, 2007-05-28 13:50:31+02:00, thek@adventure.(none) +4 -7
    - This patch removes lines which causes grant_option to alternate and moves
      variable initialization to the grant_init()-function.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	thek
# Host:	adventure.(none)
# Root:	/home/thek/Development/cpp/bug24988/my50-bug24988

--- 1.607/sql/mysqld.cc	2007-04-23 20:38:38 +02:00
+++ 1.608/sql/mysqld.cc	2007-05-28 13:50:31 +02:00
@@ -346,7 +346,15 @@ bool opt_endinfo, using_udf_functions;
 my_bool locked_in_memory;
 bool opt_using_transactions, using_update_log;
 bool volatile abort_loop;
-bool volatile shutdown_in_progress, grant_option;
+bool volatile shutdown_in_progress;
+/**
+   @brief 'grant_option' is used to indicate if privileges needs
+   to be checked, in which case the lock, LOCK_grant, is used
+   to protect access to the grant table.
+   @note This flag is dropped in 5.1 
+   @see grant_init()
+ */
+bool volatile grant_option;
 
 my_bool opt_skip_slave_start = 0; // If set, slave is not autostarted
 my_bool opt_reckless_slave = 0;

--- 1.219/sql/sql_acl.cc	2007-03-23 12:12:09 +01:00
+++ 1.220/sql/sql_acl.cc	2007-05-28 13:50:31 +02:00
@@ -2995,7 +2995,7 @@ bool mysql_table_grant(THD *thd, TABLE_L
       }
     }
   }
-  grant_option=TRUE;
+  
   thd->mem_root= old_root;
   pthread_mutex_unlock(&acl_cache->lock);
 
@@ -3162,7 +3162,7 @@ bool mysql_routine_grant(THD *thd, TABLE
       continue;
     }
   }
-  grant_option=TRUE;
+  
   thd->mem_root= old_root;
   pthread_mutex_unlock(&acl_cache->lock);
   if (!result && !no_error)
@@ -3338,6 +3338,8 @@ my_bool grant_init()
   delete thd;
   /* Remember that we don't have a THD */
   my_pthread_setspecific_ptr(THR_THD,  0);
+  /* Set the grant option flag so we will check grants */
+  grant_option= TRUE;
   DBUG_RETURN(return_val);
 }
 
@@ -3367,7 +3369,6 @@ static my_bool grant_load(TABLE_LIST *ta
                                                            THR_MALLOC);
   DBUG_ENTER("grant_load");
 
-  grant_option = FALSE;
   (void) hash_init(&column_priv_hash,system_charset_info,
 		   0,0,0, (hash_get_key) get_grant_table,
 		   (hash_free_key) free_grant_table,0);
@@ -3478,7 +3479,6 @@ static my_bool grant_load(TABLE_LIST *ta
     }
     while (!p_table->file->index_next(p_table->record[0]));
   }
-  grant_option= TRUE;
   return_val=0;					// Return ok
 
 end_unlock:
@@ -3511,7 +3511,6 @@ my_bool grant_reload(THD *thd)
 {
   TABLE_LIST tables[3];
   HASH old_column_priv_hash, old_proc_priv_hash, old_func_priv_hash;
-  bool old_grant_option;
   MEM_ROOT old_mem;
   my_bool return_val= 1;
   DBUG_ENTER("grant_reload");
@@ -3541,7 +3540,6 @@ my_bool grant_reload(THD *thd)
   old_column_priv_hash= column_priv_hash;
   old_proc_priv_hash= proc_priv_hash;
   old_func_priv_hash= func_priv_hash;
-  old_grant_option= grant_option;
   old_mem= memex;
 
   if ((return_val= grant_load(tables)))
@@ -3551,7 +3549,6 @@ my_bool grant_reload(THD *thd)
     column_priv_hash= old_column_priv_hash;	/* purecov: deadcode */
     proc_priv_hash= old_proc_priv_hash;
     func_priv_hash= old_func_priv_hash;
-    grant_option= old_grant_option;		/* purecov: deadcode */
     memex= old_mem;				/* purecov: deadcode */
   }
   else
Thread
bk commit into 5.0 tree (thek:1.2489) BUG#24988kpettersson28 May