summaryrefslogtreecommitdiff
path: root/sql/table.h
diff options
context:
space:
mode:
authorKonstantin Osipov <kostja@sun.com>2009-12-04 02:29:40 +0300
committerKonstantin Osipov <kostja@sun.com>2009-12-04 02:29:40 +0300
commit911c673edf45616137d71f43f472be410ecb7511 (patch)
treeb92c9a920e36266d14745ea0ed62dc5e44025dd3 /sql/table.h
parent8582b4de5d2a44f64de2f6aaa15638d288953939 (diff)
downloadmariadb-git-911c673edf45616137d71f43f472be410ecb7511.tar.gz
Backport of:
------------------------------------------------------------ revno: 2617.23.18 committer: Davi Arnaut <Davi.Arnaut@Sun.COM> branch nick: 4284-6.0 timestamp: Mon 2009-03-02 18:18:26 -0300 message: Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order WL#4284: Transactional DDL locking This is a prerequisite patch: These changes are intended to split lock requests from granted locks and to allow the memory and lifetime of granted locks to be managed within the MDL subsystem. Furthermore, tickets can now be shared and therefore are used to satisfy multiple lock requests, but only shared locks can be recursive. The problem is that the MDL subsystem morphs lock requests into granted locks locks but does not manage the memory and lifetime of lock requests, and hence, does not manage the memory of granted locks either. This can be problematic because it puts the burden of tracking references on the users of the subsystem and it can't be easily done in transactional contexts where the locks have to be kept around for the duration of a transaction. Another issue is that recursive locks (when the context trying to acquire a lock already holds a lock on the same object) requires that each time the lock is granted, a unique lock request/granted lock structure structure must be kept around until the lock is released. This can lead to memory leaks in transactional contexts as locks taken during the transaction should only be released at the end of the transaction. This also leads to unnecessary wake ups (broadcasts) in the MDL subsystem if the context still holds a equivalent of the lock being released. These issues are exacerbated due to the fact that WL#4284 low-level design says that the implementation should "2) Store metadata locks in transaction memory root, rather than statement memory root" but this is not possible because a memory root, as implemented in mysys, requires all objects allocated from it to be freed all at once. This patch combines review input and significant code contributions from Konstantin Osipov (kostja) and Dmitri Lenev (dlenev).
Diffstat (limited to 'sql/table.h')
-rw-r--r--sql/table.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/table.h b/sql/table.h
index 918fb8dfff0..3b125217338 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -30,7 +30,8 @@ class st_select_lex;
class partition_info;
class COND_EQUAL;
class Security_context;
-struct MDL_LOCK_DATA;
+struct MDL_LOCK_REQUEST;
+struct MDL_LOCK_TICKET;
/*************************************************************************/
@@ -813,7 +814,7 @@ public:
partition_info *part_info; /* Partition related information */
bool no_partitions_used; /* If true, all partitions have been pruned away */
#endif
- MDL_LOCK_DATA *mdl_lock_data;
+ MDL_LOCK_TICKET *mdl_lock_ticket;
bool fill_item_list(List<Item> *item_list) const;
void reset_item_list(List<Item> *item_list) const;
@@ -1416,7 +1417,7 @@ struct TABLE_LIST
uint table_open_method;
enum enum_schema_table_state schema_table_state;
- MDL_LOCK_DATA *mdl_lock_data;
+ MDL_LOCK_REQUEST *mdl_lock_request;
void calc_md5(char *buffer);
void set_underlying_merge();
@@ -1785,6 +1786,6 @@ static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set,
size_t max_row_length(TABLE *table, const uchar *data);
-void alloc_mdl_locks(TABLE_LIST *table_list, MEM_ROOT *root);
+void alloc_mdl_requests(TABLE_LIST *table_list, MEM_ROOT *root);
#endif /* TABLE_INCLUDED */