3898 Dmitry Lenev 2012-05-16
WL#5772 "Add partitioned Table Definition Cache to avoid
using LOCK_open and its derivatives in DML queries".
Review change #10:
- Got rid of TABLE::cache_element pointer. Now we use
appropriate element of TABLE::s::cache_element[]
instead.
modified:
sql/sql_base.cc
sql/table.h
3897 Dmitry Lenev 2012-05-16
WL#5772 "Add partitioned Table Definition Cache to avoid
using LOCK_open and its derivatives in DML queries".
Review change #9:
- Move Table_cache::print_tables/print_tables_all() into sql_base.cc
- Make Table_cache_element auxiliary struct private to the same file.
modified:
sql/sql_base.cc
sql/sql_base.h
sql/sql_test.cc
sql/sql_test.h
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2012-05-16 07:52:08 +0000
+++ b/sql/sql_base.cc 2012-05-16 12:58:44 +0000
@@ -964,8 +964,6 @@ bool Table_cache::add_used_table(THD *th
m_table_count++;
- table->cache_element= el;
-
free_unused_tables_if_necessary(thd);
return false;
@@ -981,17 +979,19 @@ bool Table_cache::add_used_table(THD *th
void Table_cache::remove_table(TABLE *table)
{
+ Table_cache_element *el= table->s->cache_element[cache_index()];
+
mysql_mutex_assert_owner(&m_lock);
if (table->in_use)
{
/* Remove from per-table chain of used TABLE objects. */
- table->cache_element->used_tables.remove(table);
+ el->used_tables.remove(table);
}
else
{
/* Remove from per-table chain of unused TABLE objects. */
- table->cache_element->free_tables.remove(table);
+ el->free_tables.remove(table);
/* And per-cache unused chain. */
unlink_unused_table(table);
@@ -999,10 +999,9 @@ void Table_cache::remove_table(TABLE *ta
m_table_count--;
- if (table->cache_element->used_tables.is_empty() &&
- table->cache_element->free_tables.is_empty())
+ if (el->used_tables.is_empty() && el->free_tables.is_empty())
{
- (void) my_hash_delete(&m_cache, (uchar*) table->cache_element);
+ (void) my_hash_delete(&m_cache, (uchar*) el);
/*
Remove reference to deleted cache element from array
in the TABLE_SHARE.
@@ -1091,7 +1090,7 @@ TABLE* Table_cache::get_table(THD *thd,
void Table_cache::release_table(THD *thd, TABLE *table)
{
- Table_cache_element *el= table->cache_element;
+ Table_cache_element *el= table->s->cache_element[cache_index()];
mysql_mutex_assert_owner(&m_lock);
=== modified file 'sql/table.h'
--- a/sql/table.h 2012-05-15 19:36:12 +0000
+++ b/sql/table.h 2012-05-16 12:58:44 +0000
@@ -903,11 +903,6 @@ struct TABLE
virtual ~TABLE() {}
TABLE_SHARE *s;
- /**
- Element of table cache respresenting table and linking together
- all TABLE instances for the table in particular Table_cache.
- */
- Table_cache_element *cache_element;
handler *file;
TABLE *next, *prev;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (Dmitry.Lenev:3897 to 3898) WL#5772 | Dmitry Lenev | 16 May |