diff options
author | Dmitry Lenev <dlenev@mysql.com> | 2010-01-21 23:43:03 +0300 |
---|---|---|
committer | Dmitry Lenev <dlenev@mysql.com> | 2010-01-21 23:43:03 +0300 |
commit | a63f8480dbc862db00fb8f76c74b1fb99fa4534a (patch) | |
tree | a808065b1c90ad675cd5e9f6c5dee65eedae7a56 /sql/ha_ndbcluster.cc | |
parent | c005126107d1c48c39c1b34996e1015b0bdc7d21 (diff) | |
download | mariadb-git-a63f8480dbc862db00fb8f76c74b1fb99fa4534a.tar.gz |
Patch that changes metadata locking subsystem to use mutex per lock and
condition variable per context instead of one mutex and one conditional
variable for the whole subsystem.
This should increase concurrency in this subsystem.
It also opens the way for further changes which are necessary to solve
such bugs as bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock"
and bug #37346 "innodb does not detect deadlock between update and alter
table".
Two other notable changes done by this patch:
- MDL subsystem no longer implicitly acquires global intention exclusive
metadata lock when per-object metadata lock is acquired. Now this has
to be done by explicit calls outside of MDL subsystem.
- Instead of using separate MDL_context for opening system tables/tables
for purposes of I_S we now create MDL savepoint in the main context
before opening tables and rollback to this savepoint after closing
them. This means that it is now possible to get ER_LOCK_DEADLOCK error
even not inside a transaction. This might happen in unlikely case when
one runs DDL on one of system tables while also running DDL on some
other tables. Cases when this ER_LOCK_DEADLOCK error is not justified
will be addressed by advanced deadlock detector for MDL subsystem which
we plan to implement.
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index b35746102c8..220e5c460db 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -7285,14 +7285,10 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, code below will try to obtain exclusive metadata lock on some table while holding shared meta-data lock on other tables. This might lead to a deadlock, and therefore is disallowed by assertions of the metadata - locking subsystem. In order to temporarily make the code work, we must - reset and backup the open tables state, thus hide the existing locks - from MDL asserts. But in the essence this is violation of metadata + locking subsystem. This is violation of metadata locking protocol which has to be closed ASAP. + XXX: the scenario described above is not covered with any test. */ - Open_tables_state open_tables_state_backup; - thd->reset_n_backup_open_tables_state(&open_tables_state_backup); - if (!global_read_lock) { // Delete old files @@ -7316,8 +7312,6 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, } } - thd->restore_backup_open_tables_state(&open_tables_state_backup); - /* Lock mutex before creating .FRM files. */ pthread_mutex_lock(&LOCK_open); /* Create new files. */ |