diff options
author | heikki@hundin.mysql.fi <> | 2002-02-14 03:45:45 +0200 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2002-02-14 03:45:45 +0200 |
commit | c70be0113bc4e18ac6f651e9229164b2defb5d7b (patch) | |
tree | f32bb2ad7ebdd965d44679b120a0f8422fcf673a /sql/sql_db.cc | |
parent | d76fcdc5e923c280e8ba11cf9b94a5ad6ed9f2f4 (diff) | |
download | mariadb-git-c70be0113bc4e18ac6f651e9229164b2defb5d7b.tar.gz |
row0mysql.c, sql_db.cc:
Try to make sure DROP DATABASE does not cause a deadlock because we now let InnoDB wait MySQL does not have open handles to tables we drop
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 358850dbd10..1e798a392b1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -164,8 +164,6 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) } remove_db_from_cache(db); - ha_drop_database(path); - if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0) { if (!thd->query) @@ -191,6 +189,14 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) exit: VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); + + /* It seems MySQL may call this function when there still are queries + running on tables of the database. Since InnoDB waits until the + queries have ended, we have to call ha_drop_database outside + the above two mutexes to avoid deadlocks. */ + + ha_drop_database(path); + DBUG_VOID_RETURN; } |