summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
commite0a6b02c5d0a311e7167295494786077009743d1 (patch)
tree72c934fe42261ad5de3139961e092f57e9d147df /sql/sql_db.cc
parentd2f8b7d04503478ab6b6998194a2070891f0c2bb (diff)
parent6ad06b15222300e4eed4fe3972d1ad249c4c42a2 (diff)
downloadmariadb-git-e0a6b02c5d0a311e7167295494786077009743d1.tar.gz
Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index b4a0e5c4c7d..1dd659283ac 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -642,6 +642,18 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
goto exit2;
}
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/* Check directory */
@@ -788,6 +800,18 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if ((error=wait_if_global_read_lock(thd,0,1)))
goto exit2;
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
/*
@@ -886,6 +910,18 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
goto exit2;
}
+ /*
+ Close and mark for re-open all HANDLER tables which are marked for flush
+ or which there are pending conflicing locks against. This is needed to
+ prevent deadlocks.
+ */
+ if (thd->handler_tables_hash.records)
+ {
+ pthread_mutex_lock(&LOCK_open);
+ mysql_ha_flush(thd);
+ pthread_mutex_unlock(&LOCK_open);
+ }
+
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
length= build_table_filename(path, sizeof(path) - 1, db, "", "", 0);