summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2002-02-14 03:45:45 +0200
committerunknown <heikki@hundin.mysql.fi>2002-02-14 03:45:45 +0200
commit5c08b0fbabd600d54305462bf004845c2f5e7c68 (patch)
treef32bb2ad7ebdd965d44679b120a0f8422fcf673a /sql
parent01f1db421f3d8fca547500eff34feafe132d6332 (diff)
downloadmariadb-git-5c08b0fbabd600d54305462bf004845c2f5e7c68.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 sql/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 innobase/row/row0mysql.c: 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')
-rw-r--r--sql/sql_db.cc10
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;
}