3877 Mikael Ronstrom 2012-04-05
Minor fix for LOCK_open release
modified:
sql/sql_base.cc
3876 Mikael Ronstrom 2012-04-05
Bug fixes of LOCK_open, lock where unlock should have been made, wrong order of locking table cache mutexes and LOCK_open, could lead to deadlock
modified:
sql/sql_base.cc
3875 Mikael Ronstrom 2012-04-02
More comments on split of mutex protection in WL#5772
modified:
sql/sql_base.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc revid:mikael.ronstrom@stripped
+++ b/sql/sql_base.cc revid:mikael.ronstrom@stripped
@@ -158,10 +158,6 @@ Repair_mrg_table_error_handler::handle_c
*/
/**
- Protects table_def_hash, used and unused lists in the
- TABLE_SHARE object, LRU lists of used TABLEs and used
- TABLE_SHAREs, refresh_version and the table id counter.
- RONM TODO: Update what LOCK_open is used for
LOCK_open protects the following variables:
1) The table_def_cache
This is the hash table mapping table name to a table
@@ -1249,6 +1245,7 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
TABLE *table;
MDL_context *src_ctx= wait_for_flush->get_ctx();
bool result= TRUE;
+ bool locked= FALSE;
uint i;
/*
@@ -1260,6 +1257,7 @@ bool TABLE_SHARE::visit_subgraph(Wait_fo
*/
if (gvisitor->m_lock_open_count++ == 0)
{
+ locked= TRUE;
lock_all_table_caches();
mysql_mutex_lock(&LOCK_open);
}
@@ -1313,10 +1311,12 @@ end_leave_node:
gvisitor->leave_node(src_ctx);
end:
- if (gvisitor->m_lock_open_count-- == 1)
+ gvisitor->m_lock_open_count--;
+ if (locked)
{
- unlock_all_table_caches();
+ assert(gvisitor->m_lock_open_count == 0);
mysql_mutex_unlock(&LOCK_open);
+ unlock_all_table_caches();
}
return result;
@@ -2012,7 +2012,7 @@ bool close_thread_table(THD *thd, TABLE
{
mysql_mutex_lock(&LOCK_open);
free_cache_entry(tc, tc->unused_tables);
- mysql_mutex_lock(&LOCK_open);
+ mysql_mutex_unlock(&LOCK_open);
}
}
unlock_table_cache(thd->thread_id);
@@ -9657,8 +9657,8 @@ void tdc_remove_table(THD *thd, enum_tdc
if (! has_lock)
{
- mysql_mutex_lock(&LOCK_open);
lock_all_table_caches();
+ mysql_mutex_lock(&LOCK_open);
}
else
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (mikael.ronstrom:3875 to 3877) | Mikael Ronstrom | 10 Apr |