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
parent 8c827e28
...@@ -166,7 +166,6 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) ...@@ -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) if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0)
{ {
ha_drop_database(path);
if (!thd->query) if (!thd->query)
{ {
thd->query = path; thd->query = path;
...@@ -190,6 +189,17 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) ...@@ -190,6 +189,17 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists)
exit: exit:
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); 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; DBUG_VOID_RETURN;
} }
......
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