List:Internals« Previous MessageNext Message »
From:mikael Date:July 20 2005 9:19pm
Subject:bk commit into 4.0 tree (mronstrom:1.2124) BUG#10600
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of mikron. When mikron 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
  1.2124 05/07/20 21:19:01 mronstrom@stripped +4 -0
  Bug #10600 After review fixes

  sql/sql_table.cc
    1.198 05/07/20 21:18:57 mronstrom@stripped +6 -9
    Use flags immediately in call

  sql/sql_base.cc
    1.190 05/07/20 21:18:57 mronstrom@stripped +7 -15
    Use flags parameter immediately and use flags immediately in call
    Change to other variant of eternal loop variant

  sql/mysql_priv.h
    1.235 05/07/20 21:18:57 mronstrom@stripped +4 -3
    Added RTFC (short for remove_table_from_cache)
    for constants and used hex syntax to clarify it is bits
    in the flags

  sql/lock.cc
    1.53 05/07/20 21:18:57 mronstrom@stripped +1 -2
    Used flags immediately in call

# 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:	mronstrom
# Host:	c-ee08e253.1238-1-64736c10.cust.bredbandsbolaget.se
# Root:	/Users/mikron/clean-mysql-4.0

--- 1.52/sql/lock.cc	2005-07-19 00:29:11 +02:00
+++ 1.53/sql/lock.cc	2005-07-20 21:18:57 +02:00
@@ -549,9 +549,8 @@
   }
   
   {
-    uint flags= 0;
     if (remove_table_from_cache(thd, db,
-                                table_list->real_name, flags))
+                                table_list->real_name, RTFC_NO_FLAG))
     {
       DBUG_RETURN(1);				// Table is in use
     }

--- 1.234/sql/mysql_priv.h	2005-07-19 00:29:11 +02:00
+++ 1.235/sql/mysql_priv.h	2005-07-20 21:18:57 +02:00
@@ -606,9 +606,10 @@
 			    const char *table_name);
 void remove_db_from_cache(const my_string db);
 void flush_tables();
-#define OWNED_BY_THD_FLAG 1
-#define WAIT_OTHER_THREAD_FLAG 2
-#define CHECK_KILLED_FLAG 4
+#define RTFC_NO_FLAG                0x0000
+#define RTFC_OWNED_BY_THD_FLAG      0x0001
+#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
+#define RTFC_CHECK_KILLED_FLAG      0x0004
 bool remove_table_from_cache(THD *thd, const char *db, const char *table,
                              uint flags);
 bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);

--- 1.189/sql/sql_base.cc	2005-07-19 00:29:11 +02:00
+++ 1.190/sql/sql_base.cc	2005-07-20 21:18:57 +02:00
@@ -370,9 +370,8 @@
     bool found=0;
     for (TABLE_LIST *table=tables ; table ; table=table->next)
     {
-      uint flags= OWNED_BY_THD_FLAG;
       if (remove_table_from_cache(thd, table->db, table->real_name,
-                                  flags))
+                                  RTFC_OWNED_BY_THD_FLAG))
 	found=1;
     }
     if (!found)
@@ -2415,13 +2414,10 @@
   uint key_length;
   TABLE *table;
   bool result=0, signalled= 0;
-  bool return_if_owned_by_thd= flags & OWNED_BY_THD_FLAG;
-  bool wait_for_other_thread= flags & WAIT_OTHER_THREAD_FLAG;
-  bool check_killed_flag= flags & CHECK_KILLED_FLAG;
   DBUG_ENTER("remove_table_from_cache");
 
   key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
-  do
+  for (;;)
   {
     result= signalled= 0;
 
@@ -2465,21 +2461,17 @@
 	     thd_table= thd_table->next)
         {
 	  if (thd_table->db_stat)		// If table is open
-          {
-            bool found;
-	    found= mysql_lock_abort_for_thread(thd, thd_table);
-            signalled|= found;
-          }
+	    signalled|= mysql_lock_abort_for_thread(thd, thd_table);
         }
       }
       else
-        result= result || return_if_owned_by_thd;
+        result= result || (flags & RTFC_OWNED_BY_THD_FLAG);
     }
     while (unused_tables && !unused_tables->version)
       VOID(hash_delete(&open_cache,(byte*) unused_tables));
-    if (result && wait_for_other_thread)
+    if (result && (flags & RTFC_WAIT_OTHER_THREAD_FLAG))
     {
-      if (!check_killed_flag || !thd->killed)
+      if (!(flags & RTFC_CHECK_KILLED_FLAG) || !thd->killed)
       {
         if (likely(signalled))
         {
@@ -2508,7 +2500,7 @@
       }
     }
     break;
-  } while (1);
+  }
   DBUG_RETURN(result);
 }
 

--- 1.197/sql/sql_table.cc	2005-07-19 00:29:11 +02:00
+++ 1.198/sql/sql_table.cc	2005-07-20 21:18:57 +02:00
@@ -187,7 +187,7 @@
     }
 
     abort_locked_tables(thd,db,table->real_name);
-    flags= WAIT_OTHER_THREAD_FLAG | CHECK_KILLED_FLAG;
+    flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
     remove_table_from_cache(thd,db,table->real_name,flags);
     drop_locked_tables(thd,db,table->real_name);
     if (thd->killed)
@@ -976,7 +976,6 @@
 static void wait_while_table_is_used(THD *thd,TABLE *table,
 				     enum ha_extra_function function)
 {
-  uint flags;
   DBUG_PRINT("enter",("table: %s", table->real_name));
   DBUG_ENTER("wait_while_table_is_used");
   safe_mutex_assert_owner(&LOCK_open);
@@ -986,9 +985,8 @@
   mysql_lock_abort(thd, table);			// end threads waiting on lock
 
   /* Wait until all there are no other threads that has this table open */
-  flags= WAIT_OTHER_THREAD_FLAG;
   remove_table_from_cache(thd,table->table_cache_key,
-                          table->real_name,flags);
+                          table->real_name, RTFC_WAIT_OTHER_THREAD_FLAG);
   DBUG_VOID_RETURN;
 }
 
@@ -1305,7 +1303,7 @@
       const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
 					      "Waiting to get writelock");
       mysql_lock_abort(thd,table->table);
-      flags= WAIT_OTHER_THREAD_FLAG | CHECK_KILLED_FLAG;
+      flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
       remove_table_from_cache(thd, table->table->table_cache_key,
                               table->table->real_name, flags);
       thd->exit_cond(old_message);
@@ -1372,10 +1370,9 @@
       table->table->version=0;			// Force close of table
     else if (open_for_modify)
     {
-      uint flags= 0;
       pthread_mutex_lock(&LOCK_open);
       remove_table_from_cache(thd, table->table->table_cache_key,
-			      table->table->real_name, flags);
+			      table->table->real_name, RTFC_NO_FLAG);
       pthread_mutex_unlock(&LOCK_open);
       /* May be something modified consequently we have to invalidate cache */
       query_cache_invalidate3(thd, table->table, 0);
@@ -2099,9 +2096,9 @@
     */
     if (table)
     {
-      uint flags= 0;
       VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Use new file
-      remove_table_from_cache(thd,db,table_name,flags);// Mark in-use copies old
+      remove_table_from_cache(thd,db,table_name,RTFC_NO_FLAG);
+                                                 // Mark in-use copies old
       mysql_lock_abort(thd,table);		 // end threads waiting on lock
     }
     VOID(quick_rm_table(old_db_type,db,old_name));
Thread
bk commit into 4.0 tree (mronstrom:1.2124) BUG#10600mikael21 Jul