summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2002-07-15 15:47:53 +0300
committerheikki@hundin.mysql.fi <>2002-07-15 15:47:53 +0300
commitc620486287474966db38e44f8be891622e9af495 (patch)
tree37d634795f76f6cd463850c4b656bc684ffa69b4 /sql/sql_db.cc
parent8c827e2800e91197245b5c49c79bd84fcebfb2d5 (diff)
downloadmariadb-git-c620486287474966db38e44f8be891622e9af495.tar.gz
sql_db.cc:
Revert Monty's change to the positioning of ha_drop_database(): otherwise a running query on a table to be dropped in DROP DATABASE always causes the server to hang
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 5ce1929e90a..a3829aae073 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -166,7 +166,6 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0)
{
- ha_drop_database(path);
if (!thd->query)
{
thd->query = path;
@@ -190,6 +189,17 @@ 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));
+
+ /* If there are running queries on the tables, MySQL needs to get
+ access to LOCK_open to end them. InnoDB on the other hand waits
+ for the queries to end before dropping the database. That is why we
+ must do the dropping outside of the mutexes above, otherwise the server
+ always hangs if there are running queries. We only drop inside InnoDB
+ if deleted got value >= 0 which means that it was successful. */
+
+ if (deleted >= 0)
+ ha_drop_database(path);
+
DBUG_VOID_RETURN;
}