summaryrefslogtreecommitdiff
path: root/sql/event_db_repository.cc
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/event_db_repository.cc
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/event_db_repository.cc')
-rw-r--r--sql/event_db_repository.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index e9ee54ff8aa..134c8059e13 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -555,7 +555,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
DBUG_ENTER("Event_db_repository::open_event_table");
tables.init_one_table("mysql", 5, "event", 5, "event", lock_type);
- alloc_mdl_locks(&tables, thd->mem_root);
+ alloc_mdl_requests(&tables, thd->mem_root);
if (simple_open_n_lock_tables(thd, &tables))
{
@@ -1110,7 +1110,7 @@ Event_db_repository::check_system_tables(THD *thd)
/* Check mysql.db */
tables.init_one_table("mysql", 5, "db", 2, "db", TL_READ);
- alloc_mdl_locks(&tables, thd->mem_root);
+ alloc_mdl_requests(&tables, thd->mem_root);
if (simple_open_n_lock_tables(thd, &tables))
{
@@ -1128,7 +1128,7 @@ Event_db_repository::check_system_tables(THD *thd)
}
/* Check mysql.user */
tables.init_one_table("mysql", 5, "user", 4, "user", TL_READ);
- alloc_mdl_locks(&tables, thd->mem_root);
+ alloc_mdl_requests(&tables, thd->mem_root);
if (simple_open_n_lock_tables(thd, &tables))
{
@@ -1149,7 +1149,7 @@ Event_db_repository::check_system_tables(THD *thd)
}
/* Check mysql.event */
tables.init_one_table("mysql", 5, "event", 5, "event", TL_READ);
- alloc_mdl_locks(&tables, thd->mem_root);
+ alloc_mdl_requests(&tables, thd->mem_root);
if (simple_open_n_lock_tables(thd, &tables))
{