summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-06-16 21:26:40 +0300
committerMichael Widenius <monty@askmonty.org>2013-06-16 21:26:40 +0300
commit8075b05b7dc03f67abc7c7a3d788dcf87b3483c9 (patch)
treee692658d2942b85bfcc7ca01eb6b61b06caf370e /sql/sql_base.cc
parent7c1abe151c88d0f1cf7bad0a856b554a2fdec83a (diff)
downloadmariadb-git-8075b05b7dc03f67abc7c7a3d788dcf87b3483c9.tar.gz
More merge fixes:
- mdl.cc and mdl.h merged completely - mysql_system_tables*.sql merged completely - Fixed wrong merge of lock_tables - Added some missing functions: - bool THD::notify_shared_lock() - Dynamic_array::pop, Dynamic_array::del - Added MDL_context_owner to THD - Added metadata_locks_hash_instances
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc41
1 files changed, 3 insertions, 38 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 28f4b7e0ef8..0680c8f1b23 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4860,55 +4860,20 @@ lock_table_names(THD *thd,
continue;
}
- /*
- Write lock on normal tables is not allowed in a read only transaction.
- */
+ /* Write lock on normal tables is not allowed in a read only transaction. */
if (thd->tx_read_only)
{
my_error(ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION, MYF(0));
DBUG_RETURN(true);
}
- if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) && schema_set.insert(table))
+ if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) &&
+ schema_set.insert(table))
DBUG_RETURN(TRUE);
mdl_requests.push_front(&table->mdl_request);
}
- if (! (flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK) &&
- ! mdl_requests.is_empty())
- {
- /*
- Scoped locks: Take intention exclusive locks on all involved
- schemas.
- */
- Hash_set<TABLE_LIST, schema_set_get_key>::Iterator it(schema_set);
- while ((table= it++))
- {
- MDL_request *schema_request= new (thd->mem_root) MDL_request;
- if (schema_request == NULL)
- return TRUE;
- schema_request->init(MDL_key::SCHEMA, table->db, "",
- MDL_INTENTION_EXCLUSIVE,
- MDL_TRANSACTION);
- mdl_requests.push_front(schema_request);
- }
-
- /*
- Protect this statement against concurrent global read lock
- by acquiring global intention exclusive lock with statement
- duration.
- */
- if (thd->global_read_lock.can_acquire_protection())
- return TRUE;
- global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
- MDL_STATEMENT);
- mdl_requests.push_front(&global_request);
- }
-
- if (thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout))
- return TRUE;
-
if (mdl_requests.is_empty())
DBUG_RETURN(FALSE);