MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:konstantin Date:July 16 2007 6:34pm
Subject:bk commit into 5.1 tree (kostja:1.2552)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kostja. When kostja 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-07-16 22:34:36+04:00, kostja@bodhi.(none) +2 -0
  Fix ndb_cache* test failures in the -runtime tree.
  Do not try to acquire structure_guard_mutex for the second time
  when invalidating a table from send_result_to_client.

  sql/sql_cache.cc@stripped, 2007-07-16 22:34:33+04:00, kostja@bodhi.(none) +25 -8
    Do not try to acquire mutex when invalidating a table
    from send_result_to_client().
    A follow up patch for the patch for Bug#21074.
    Reuse code by moving locking-independent invalidation functionality
    into invalidate_table_internal.

  sql/sql_cache.h@stripped, 2007-07-16 22:34:33+04:00, kostja@bodhi.(none) +1 -0
    Add a new declaration.

diff -Nrup a/sql/sql_cache.cc b/sql/sql_cache.cc
--- a/sql/sql_cache.cc	2007-07-16 17:19:38 +04:00
+++ b/sql/sql_cache.cc	2007-07-16 22:34:33 +04:00
@@ -1347,7 +1347,9 @@ def_week_frmt: %lu",                    
                    ("Handler require invalidation queries of %s.%s %lu-%lu",
                     table_list.db, table_list.alias,
                     (ulong) engine_data, (ulong) table->engine_data()));
-        invalidate_table(thd, (uchar *) table->db(), table->key_length());
+        invalidate_table_internal(thd,
+                                  (uchar *) table->db(),
+                                  table->key_length());
       }
       else
         thd->lex->safe_to_cache_query= 0;       // Don't try to cache this
@@ -2468,13 +2470,8 @@ void Query_cache::invalidate_table(THD *
   m_cache_status= Query_cache::TABLE_FLUSH_IN_PROGRESS;
   STRUCT_UNLOCK(&structure_guard_mutex);
 
-  Query_cache_block *table_block=
-    (Query_cache_block*)hash_search(&tables, key, key_length);
-  if (query_cache_size > 0 && table_block)
-  {
-    Query_cache_block_table *list_root= table_block->table(0);
-    invalidate_query_block_list(thd, list_root);
-  }
+  if (query_cache_size > 0)
+    invalidate_table_internal(thd, key, key_length);
 
   STRUCT_LOCK(&structure_guard_mutex);
   m_cache_status= Query_cache::NO_FLUSH_IN_PROGRESS;
@@ -2487,6 +2484,26 @@ void Query_cache::invalidate_table(THD *
   STRUCT_UNLOCK(&structure_guard_mutex);
 }
 
+
+/**
+  Try to locate and invalidate a table by name.
+  The caller must ensure that no other thread is trying to work with
+  the query cache when this function is executed.
+
+  @pre structure_guard_mutex is acquired or TABLE_FLUSH_IN_PROGRESS is set.
+*/
+
+void
+Query_cache::invalidate_table_internal(THD *thd, uchar *key, uint32 key_length)
+{
+  Query_cache_block *table_block=
+    (Query_cache_block*)hash_search(&tables, key, key_length);
+  if (table_block)
+  {
+    Query_cache_block_table *list_root= table_block->table(0);
+    invalidate_query_block_list(thd, list_root);
+  }
+}
 
 /**
   @brief Invalidate a linked list of query cache blocks.
diff -Nrup a/sql/sql_cache.h b/sql/sql_cache.h
--- a/sql/sql_cache.h	2007-07-02 21:14:46 +04:00
+++ b/sql/sql_cache.h	2007-07-16 22:34:33 +04:00
@@ -279,6 +279,7 @@ private:
   Cache_status m_cache_status;
 
   void free_query_internal(Query_cache_block *point);
+  void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
 
 protected:
   /*
Thread
bk commit into 5.1 tree (kostja:1.2552)konstantin16 Jul