diff options
author | heikki@hundin.mysql.fi <> | 2002-07-16 03:29:02 +0300 |
---|---|---|
committer | heikki@hundin.mysql.fi <> | 2002-07-16 03:29:02 +0300 |
commit | dfc866b30e604188df2b4771999bb3c5656f0625 (patch) | |
tree | f279bf8d0fcbf32db89b6591bd8c2ee1d781ebf8 | |
parent | 3258f23d9925fe2f4405e5ffbcb3527e2ec07b21 (diff) | |
download | mariadb-git-dfc866b30e604188df2b4771999bb3c5656f0625.tar.gz |
sql_db.cc:
On Monty's suggestion move ha_drop_database back inside LOCK_mysql_create_db, but we release LOCK_open during it to let possible running queries complete. I tested this and it seemed to work also in complex concurrent DELETE, SELECT, DROP DATABASE, and CREATE DATABASE situations
-rw-r--r-- | sql/sql_db.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index a3829aae073..688a6055a7b 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -166,6 +166,15 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) if ((deleted=mysql_rm_known_files(thd, dirp, path,0)) >= 0) { + /* 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 with LOCK_open released. */ + + VOID(pthread_mutex_unlock(&LOCK_open)); + ha_drop_database(path); + VOID(pthread_mutex_lock(&LOCK_open)); + if (!thd->query) { thd->query = path; @@ -190,16 +199,6 @@ 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; } |