Commit 10582e2a authored by Dmitry Lenev's avatar Dmitry Lenev

A follow-up for 5.5 version of fix for bug#54360 "Deadlock

DROP/ALTER/CREATE DATABASE with open HANDLER".

Remove wait_for_condition() which became unused after 
database locks were replaced with MDL scoped locks.
If one needs functionality provided by this call one can 
always use THD::enter_cond()/exit_cond() methods.

Also removed an unused include from sql_db.cc and updated 
comment describing one of used includes to reflect current
situation.
parent 9ff272fb
...@@ -2412,51 +2412,6 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name, ...@@ -2412,51 +2412,6 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
} }
/*
Wait for condition but allow the user to send a kill to mysqld
SYNOPSIS
wait_for_condition()
thd Thread handler
mutex mutex that is currently hold that is associated with condition
Will be unlocked on return
cond Condition to wait for
*/
void wait_for_condition(THD *thd, mysql_mutex_t *mutex, mysql_cond_t *cond)
{
/* Wait until the current table is up to date */
const char *proc_info;
thd->mysys_var->current_mutex= mutex;
thd->mysys_var->current_cond= cond;
proc_info=thd->proc_info;
thd_proc_info(thd, "Waiting for table");
DBUG_ENTER("wait_for_condition");
DEBUG_SYNC(thd, "waiting_for_table");
if (!thd->killed)
mysql_cond_wait(cond, mutex);
/*
We must unlock mutex first to avoid deadlock becasue conditions are
sent to this thread by doing locks in the following order:
lock(mysys_var->mutex)
lock(mysys_var->current_mutex)
One by effect of this that one can only use wait_for_condition with
condition variables that are guranteed to not disapper (freed) even if this
mutex is unlocked
*/
mysql_mutex_unlock(mutex);
mysql_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
thd_proc_info(thd, proc_info);
mysql_mutex_unlock(&thd->mysys_var->mutex);
DBUG_VOID_RETURN;
}
/** /**
Check that table exists in table definition cache, on disk Check that table exists in table definition cache, on disk
or in some storage engine. or in some storage engine.
......
...@@ -203,8 +203,6 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, ...@@ -203,8 +203,6 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves,
COND **conds); COND **conds);
int setup_ftfuncs(SELECT_LEX* select); int setup_ftfuncs(SELECT_LEX* select);
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
void wait_for_condition(THD *thd, mysql_mutex_t *mutex,
mysql_cond_t *cond);
bool lock_table_names(THD *thd, TABLE_LIST *table_list, bool lock_table_names(THD *thd, TABLE_LIST *table_list,
TABLE_LIST *table_list_end, ulong lock_wait_timeout, TABLE_LIST *table_list_end, ulong lock_wait_timeout,
uint flags); uint flags);
......
...@@ -21,14 +21,12 @@ ...@@ -21,14 +21,12 @@
#include "unireg.h" #include "unireg.h"
#include "sql_db.h" #include "sql_db.h"
#include "sql_cache.h" // query_cache_* #include "sql_cache.h" // query_cache_*
#include "lock.h" // wait_if_global_read_lock, #include "lock.h" // lock_schema_name
// start_waiting_global_read_lock
#include "sql_table.h" // build_table_filename, #include "sql_table.h" // build_table_filename,
// filename_to_tablename // filename_to_tablename
#include "sql_rename.h" // mysql_rename_tables #include "sql_rename.h" // mysql_rename_tables
#include "sql_acl.h" // SELECT_ACL, DB_ACLS, #include "sql_acl.h" // SELECT_ACL, DB_ACLS,
// acl_get, check_grant_db // acl_get, check_grant_db
#include "sql_base.h" // wait_for_condition
#include "log_event.h" // Query_log_event #include "log_event.h" // Query_log_event
#include <mysys_err.h> #include <mysys_err.h>
#include "sp.h" #include "sp.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment