summaryrefslogtreecommitdiff
path: root/sql/mdl.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-06-15 18:32:08 +0300
committerMichael Widenius <monty@askmonty.org>2013-06-15 18:32:08 +0300
commit5f1f2fc0e443f098af24d21f7d1ec1a8166a4030 (patch)
tree7b870d0c390c05d6629f4813966e740ea073fcef /sql/mdl.h
parent3143ad589a24ac7581e2195ba0dc13576cb3c9da (diff)
downloadmariadb-git-5f1f2fc0e443f098af24d21f7d1ec1a8166a4030.tar.gz
Applied all changes from Igor and Sanja
Diffstat (limited to 'sql/mdl.h')
-rw-r--r--sql/mdl.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sql/mdl.h b/sql/mdl.h
index c778dbbc1d7..82d764bc66c 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -132,6 +132,15 @@ enum enum_mdl_type {
*/
MDL_SHARED_WRITE,
/*
+ An upgradable shared metadata lock for cases when there is an intention
+ to modify (and not just read) data in the table.
+ Can be upgraded to MDL_SHARED_NO_WRITE and MDL_EXCLUSIVE.
+ A connection holding SU lock can read table metadata and modify or read
+ table data (after acquiring appropriate table and row-level locks).
+ To be used for the first phase of ALTER TABLE.
+ */
+ MDL_SHARED_UPGRADABLE,
+ /*
An upgradable shared metadata lock which blocks all attempts to update
table data, allowing reads.
A connection holding this kind of lock can read table metadata and read
@@ -502,13 +511,14 @@ public:
MDL_context *get_ctx() const { return m_ctx; }
bool is_upgradable_or_exclusive() const
{
- return m_type == MDL_SHARED_NO_WRITE ||
+ return m_type == MDL_SHARED_UPGRADABLE ||
+ m_type == MDL_SHARED_NO_WRITE ||
m_type == MDL_SHARED_NO_READ_WRITE ||
m_type == MDL_EXCLUSIVE;
}
enum_mdl_type get_type() const { return m_type; }
MDL_lock *get_lock() const { return m_lock; }
- void downgrade_exclusive_lock(enum_mdl_type type);
+ void downgrade_lock(enum_mdl_type type);
bool has_stronger_or_equal_type(enum_mdl_type type) const;
@@ -660,8 +670,9 @@ public:
bool try_acquire_lock(MDL_request *mdl_request);
bool acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout);
bool acquire_locks(MDL_request_list *requests, ulong lock_wait_timeout);
- bool upgrade_shared_lock_to_exclusive(MDL_ticket *mdl_ticket,
- ulong lock_wait_timeout);
+ bool upgrade_shared_lock(MDL_ticket *mdl_ticket,
+ enum_mdl_type new_type,
+ ulong lock_wait_timeout);
bool clone_ticket(MDL_request *mdl_request);