summaryrefslogtreecommitdiff
path: root/innobase
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 /innobase
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 'innobase')
-rw-r--r--innobase/row/row0mysql.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 7b036ca4e00..45c59ff2c38 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -1802,6 +1802,7 @@ row_drop_database_for_mysql(
char* name, /* in: database name which ends to '/' */
trx_t* trx) /* in: transaction handle */
{
+ dict_table_t* table;
char* table_name;
int err = DB_SUCCESS;
@@ -1812,12 +1813,27 @@ row_drop_database_for_mysql(
trx->op_info = "dropping database";
trx_start_if_not_started(trx);
-
+loop:
mutex_enter(&(dict_sys->mutex));
while (table_name = dict_get_first_table_name_in_db(name)) {
ut_a(memcmp(table_name, name, strlen(name)) == 0);
+ table = dict_table_get_low(table_name);
+
+ ut_a(table);
+
+ /* Wait until MySQL does not have any queries running on
+ the table */
+
+ if (table->n_mysql_handles_opened > 0) {
+ mutex_exit(&(dict_sys->mutex));
+
+ os_thread_sleep(100000);
+
+ goto loop;
+ }
+
err = row_drop_table_for_mysql(table_name, trx, TRUE);
mem_free(table_name);