diff options
| author | Dmitry Lenev <dlenev@mysql.com> | 2010-09-09 18:29:14 +0400 |
|---|---|---|
| committer | Dmitry Lenev <dlenev@mysql.com> | 2010-09-09 18:29:14 +0400 |
| commit | 3326614df1d1dd01b3956a8f9c87003d839c485d (patch) | |
| tree | 35ae062995fedd4a7b4fba1376edd148d553926b /sql/sql_base.cc | |
| parent | 51a3375c98138cee6f51eec807c9a120a84da87a (diff) | |
| download | mariadb-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.cc')
| -rw-r--r-- | sql/sql_base.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8cd0ce4432a..e2eb836a958 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4522,13 +4522,15 @@ lock_table_names(THD *thd, ! (flags & MYSQL_OPEN_SKIP_TEMPORARY) && find_temporary_table(thd, table)))) { - if (schema_set.insert(table)) + if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) && + schema_set.insert(table)) return TRUE; mdl_requests.push_front(&table->mdl_request); } } - if (! mdl_requests.is_empty()) + if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) && + ! mdl_requests.is_empty()) { /* Scoped locks: Take intention exclusive locks on all involved |
