summaryrefslogtreecommitdiff
path: root/sql/sql_handler.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2003-09-09 19:23:01 +0200
committerunknown <serg@serg.mylan>2003-09-09 19:23:01 +0200
commitb3e68622ba2e99a386a1c2fa9905cd588864f322 (patch)
tree504a9859771055dcaf296ec77491c35c7b2c4620 /sql/sql_handler.cc
parent07cacdcbe73670f9d2fde0adf68f5e2472d7c6bd (diff)
downloadmariadb-git-b3e68622ba2e99a386a1c2fa9905cd588864f322.tar.gz
fixed: thread lock-up on a FLASH TABLE when another thread has an open handler
Bug#1204
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index b0d8b18dd17..a19fcdc2d73 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -34,7 +34,7 @@
The second is to be freeed only on thread end. mysql_ha_open should
then do { handler_items=concat(handler_items, free_list); free_list=0; }
- But !!! do_cammand calls free_root at the end of every query and frees up
+ But !!! do_command calls free_root at the end of every query and frees up
all the sql_alloc'ed memory. It's harder to work around...
*/
@@ -73,7 +73,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
if (*ptr)
{
VOID(pthread_mutex_lock(&LOCK_open));
- close_thread_table(thd, ptr);
+ if (close_thread_table(thd, ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ }
VOID(pthread_mutex_unlock(&LOCK_open));
}
else
@@ -90,8 +94,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
int mysql_ha_closeall(THD *thd, TABLE_LIST *tables)
{
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->real_name, 0);
- if (*ptr)
- close_thread_table(thd, ptr);
+ if (*ptr && close_thread_table(thd, ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ }
return 0;
}