summaryrefslogtreecommitdiff
path: root/sql/sql_base.h
diff options
context:
space:
mode:
authorDmitry Lenev <dlenev@mysql.com>2010-09-09 18:29:14 +0400
committerDmitry Lenev <dlenev@mysql.com>2010-09-09 18:29:14 +0400
commit3326614df1d1dd01b3956a8f9c87003d839c485d (patch)
tree35ae062995fedd4a7b4fba1376edd148d553926b /sql/sql_base.h
parent51a3375c98138cee6f51eec807c9a120a84da87a (diff)
downloadmariadb-git-3326614df1d1dd01b3956a8f9c87003d839c485d.tar.gz
Fix for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge
table causes assert failure". Attempting to use FLUSH TABLE table_list WITH READ LOCK statement for a MERGE table led to an assertion failure if one of its children was not present in the list of tables to be flushed. The problem was not visible in non-debug builds. The assertion failure was caused by the fact that in such situations FLUSH TABLES table_list WITH READ LOCK implementation tried to use (e.g. lock) such child tables without acquiring metadata lock on them. This happened because when opening tables we assumed metadata locks on all tables were already acquired earlier during statement execution and a such assumption was false for MERGE children. This patch fixes the problem by ensuring at open_tables() time that we try to acquire metadata locks on all tables to be opened. For normal tables such requests are satisfied instantly since locks are already acquired for them. For MERGE children metadata locks are acquired in normal fashion. Note that FLUSH TABLES merge_table WITH READ LOCK will lock for read both the MERGE table and its children but will flush only the MERGE table. To flush children one has to mention them in table list explicitly. This is expected behavior and it is consistent with usage patterns for this statement (e.g. in mysqlhotcopy script).
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r--sql/sql_base.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h
index a21850355b4..b1a730ad277 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -122,6 +122,11 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
(LONG_TIMEOUT = 1 year) rather than the user-supplied timeout value.
*/
#define MYSQL_LOCK_IGNORE_TIMEOUT 0x0800
+/**
+ When acquiring "strong" (SNW, SNRW, X) metadata locks on tables to
+ be open do not acquire global and schema-scope IX locks.
+*/
+#define MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK 0x1000
/** Please refer to the internals manual. */
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\