From 6d29b23b15cdb14e0f60804db4eaeb5718cec78a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Jul 2005 00:29:19 +0200 Subject: Bug #10600 remove_table_from_cache fails to signal other thread and gets blocked when other thread also gets blocked include/thr_lock.h: Report if any threads was signalled mysys/thr_lock.c: Report if any threads was signalled sql/lock.cc: Report if any threads was signalled Use new interface for remove_table_from_cache sql/mysql_priv.h: New interface for remove_table_from_cache + mysql_lock_abort_for_thread sql/sql_base.cc: Use new interface of remove_table_cache Rewrote remove_table_from_cache to fix bug sql/sql_table.cc: Use new interface of remove_table_from_cache --- sql/lock.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'sql/lock.cc') diff --git a/sql/lock.cc b/sql/lock.cc index 4c6d7c75ae2..dbd7748e104 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -333,20 +333,25 @@ void mysql_lock_abort(THD *thd, TABLE *table) /* Abort one thread / table combination */ -void mysql_lock_abort_for_thread(THD *thd, TABLE *table) +bool mysql_lock_abort_for_thread(THD *thd, TABLE *table) { MYSQL_LOCK *locked; TABLE *write_lock_used; + bool result= FALSE; DBUG_ENTER("mysql_lock_abort_for_thread"); if ((locked = get_lock_data(thd,&table,1,1,&write_lock_used))) { for (uint i=0; i < locked->lock_count; i++) - thr_abort_locks_for_thread(locked->locks[i]->lock, - table->in_use->real_id); + { + bool found; + found= thr_abort_locks_for_thread(locked->locks[i]->lock, + table->in_use->real_id); + result|= found; + } my_free((gptr) locked,MYF(0)); } - DBUG_VOID_RETURN; + DBUG_RETURN(result); } @@ -542,8 +547,15 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) my_free((gptr) table,MYF(0)); DBUG_RETURN(-1); } - if (remove_table_from_cache(thd, db, table_list->real_name)) - DBUG_RETURN(1); // Table is in use + + { + uint flags= 0; + if (remove_table_from_cache(thd, db, + table_list->real_name, flags)) + { + DBUG_RETURN(1); // Table is in use + } + } DBUG_RETURN(0); } -- cgit v1.2.1 From af1dfb613b7ce6343f461d6f4c3def6af9354814 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Jul 2005 21:19:01 +0200 Subject: Bug #10600 After review fixes sql/lock.cc: Used flags immediately in call sql/mysql_priv.h: Added RTFC (short for remove_table_from_cache) for constants and used hex syntax to clarify it is bits in the flags sql/sql_base.cc: Use flags parameter immediately and use flags immediately in call Change to other variant of eternal loop variant sql/sql_table.cc: Use flags immediately in call --- sql/lock.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sql/lock.cc') diff --git a/sql/lock.cc b/sql/lock.cc index dbd7748e104..eb49254215d 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -549,9 +549,8 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) } { - uint flags= 0; if (remove_table_from_cache(thd, db, - table_list->real_name, flags)) + table_list->real_name, RTFC_NO_FLAG)) { DBUG_RETURN(1); // Table is in use } -- cgit v1.2.1