mirror of
https://github.com/MariaDB/server.git
synced 2026-04-27 18:55:31 +02:00
Added some missing mutex_locks() when manipulating the table cache.
This should fix some possible table cache corruptions when doing OPTIMIZE or REPAIR table when other threads are opening new tables. sql/sql_base.cc: Added missing mutex unlock on error condition sql/sql_insert.cc: Added TODO item sql/sql_show.cc: Added missing pthread_mutex_lock(&LOCK_open) when calling query_table_status(). sql/sql_table.cc: Added missing pthread_mutex_lock(&LOCK_open) when calling hash_delete(), unlock_table_name() and remove_table_from_cache(). BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
This commit is contained in:
parent
e2cf3f8e45
commit
7952914415
5 changed files with 43 additions and 7 deletions
|
|
@ -279,6 +279,16 @@ void intern_close_table(TABLE *table)
|
|||
VOID(closefrm(table)); // close file
|
||||
}
|
||||
|
||||
/*
|
||||
Remove table from the open table cache
|
||||
|
||||
SYNOPSIS
|
||||
free_cache_entry()
|
||||
table Table to remove
|
||||
|
||||
NOTE
|
||||
We need to have a lock on LOCK_open when calling this
|
||||
*/
|
||||
|
||||
static void free_cache_entry(TABLE *table)
|
||||
{
|
||||
|
|
@ -833,7 +843,10 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
|
|||
|
||||
/* make a new table */
|
||||
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
if (open_unireg_entry(thd, table,db,table_name,alias,1) ||
|
||||
!(table->table_cache_key=memdup_root(&table->mem_root,(char*) key,
|
||||
key_length)))
|
||||
|
|
@ -1181,7 +1194,6 @@ bool wait_for_tables(THD *thd)
|
|||
/* Now we can open all tables without any interference */
|
||||
thd->proc_info="Reopen tables";
|
||||
result=reopen_tables(thd,0,0);
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
thd->proc_info=0;
|
||||
|
|
@ -1372,9 +1384,9 @@ int open_tables(THD *thd,TABLE_LIST *start)
|
|||
}
|
||||
}
|
||||
*prev_table=0;
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
if (found)
|
||||
VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
goto restart;
|
||||
}
|
||||
result= -1; // Fatal error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue