Bug #46272 | New MDL: unnecessary deadlock | ||
---|---|---|---|
Submitted: | 17 Jul 2009 17:54 | Modified: | 7 Mar 2010 2:07 |
Reporter: | Konstantin Osipov (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S3 (Non-critical) |
Version: | 6.0-codebase | OS: | Any |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
Tags: | regression |
[17 Jul 2009 17:54]
Konstantin Osipov
[18 Jul 2009 12:20]
Valeriy Kravchuk
Thank you for the bug report. Verified just as described: openxs@suse:/home2/openxs/dbs/azalea/mysql-test> ./mysql-test-run.pl bug46272 Logging: ./mysql-test-run.pl bug46272 091023 22:41:04 [Note] Plugin 'FEDERATED' is disabled. 091023 22:41:04 [Note] Plugin 'ndbcluster' is disabled. 091023 22:41:04 [Warning] Forcing shutdown of 2 plugins MySQL Version 5.4.4 Checking supported features... - using ndbcluster when necessary, mysqld supports it - SSL connections supported - binaries are debug compiled Collecting tests... vardir: /home2/openxs/dbs/azalea/mysql-test/var Removing old var directory... Creating var directory '/home2/openxs/dbs/azalea/mysql-test/var'... Installing system database... Using server port 32769 worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009 ============================================================================== TEST RESULT TIME (ms) ------------------------------------------------------------ main.bug46272 [ fail ] Test ended at 2009-10-23 22:41:15 CURRENT_TEST: main.bug46272 --- /home2/openxs/dbs/azalea/mysql-test/r/bug46272.result 2009-10-23 22:40:46.000000000 +0300 +++ /home2/openxs/dbs/azalea/mysql-test/r/bug46272.reject 2009-10-23 22:41:15.000000000 +0300 @@ -0,0 +1,13 @@ +drop table if exists t1; +create table t1 (c1 int primary key, c2 int, c3 int) engine=myisam; +insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0); +set autocommit=0; +begin; +update t1 set c3=c3+1 where c2=3; +alter table t1 add column e int; +update t1 set c3=c3+1 where c2=4; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +drop table t1; mysqltest: Result length mismatch ...
[18 Jul 2009 12:24]
Valeriy Kravchuk
We do not have deadlock in 5.1.38, so this is a regression.
[20 Jul 2009 7:31]
Konstantin Osipov
Valeriy, careful, more deadlocks - is a documented incompatible change of WL#4284. E.g. if one tried to use table t2 in connection 1, which was being altered by connection 2, a deadlock error would have been a documented result. But using the table that was already used in a transaction should be allowed, this is why it's a bug.
[27 Aug 2009 9:19]
Jon Olav Hauglid
Test case using sync points: --source include/have_debug_sync.inc --echo # --echo # Bug#46272 MySQL 5.4.4, new MDL: unnecessary deadlock --echo # --disable_warnings drop table if exists t1; --enable_warnings CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 INT); INSERT INTO t1 VALUES (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0); connect (con1,localhost,root,,test,,); --echo # Connection 1 connection default; SET autocommit=0; BEGIN; UPDATE t1 SET c3=c3+1 WHERE c2=3; --echo # Connection 2 connection con1; SET DEBUG_SYNC= 'mdl_upgrade_shared_lock_to_exclusive_wait SIGNAL lock_wait'; --send ALTER TABLE t1 ADD COLUMN e INT --echo # Connection 1 connection default; SET DEBUG_SYNC= 'now WAIT_FOR lock_wait'; --error ER_LOCK_DEADLOCK UPDATE t1 SET c3=c3+1 WHERE c2=4; ROLLBACK; connection con1; reap; connection default; disconnect con1; DROP TABLE t1; SET DEBUG_SYNC= 'RESET';
[27 Aug 2009 10:58]
Jon Olav Hauglid
ALTER TABLE calls wait_while_table_is_used() which sets TABLE_SHARE's version = 0. This happens before ALTER TABLE starts waiting for the shared lock to disappear inside upgrade_shared_lock_to_exclusive(). The following UPDATE will notice that share->version now is different from refresh_version and call Open_table_context::request_backoff_action() which triggers the DEADLOCK error.
[28 Aug 2009 8:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/81810 2803 Jon Olav Hauglid 2009-08-28 Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock The problem was that ALTER TABLE calls wait_while_table_is_used() which set TABLE_SHARE's version = 0. This happened before ALTER TABLE starts waiting for the shared lock to disappear inside upgrade_shared_lock_to_exclusive(). The following UPDATE noticed that share->version now was different from refresh_version and called Open_table_context::request_backoff_action() which triggered the DEADLOCK error. This patch removes the setting of TABLE_SHARE's version to 0 inside wait_while_table_is_used(), since this anyway will be done by close_all_tables_for_name() which is called right after the return from wait_while_table_is_used(). Test case added to mdl_sync.test.
[21 Dec 2009 14:12]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/95248 3628 Dmitry Lenev 2009-12-21 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". The first bug has manifested itself as unwarranted abort of transaction with ER_LOCK_DEADLOCK error in cases when transaction tried to use table being currently altered even although the same transaction has already used the same table in the same fashion. The second bug showed up as a deadlock between table-level locks and InnoDB row-locks, which was "detected" only after innodb_lock_wait_timeout timeout. The deadlock occured when ALTER TABLE tried to change table which was already updated by some transaction (and on which this transaction held X row-lock) and so had to wait for this transaction to complete while holding table-level lock preventing further updates on the table even those which were coming from the the transaction for which it was waiting. Both these bugs stemmed from inadequate solutions to problem of deadlocks occuring between different subsystems. In the first case we tried to avoid deadlocks between metadata locking and table-level locking subsystems, when upgrading shared metadata lock to exclusive one, and aborted transactions holding shared lock on table and waiting for some table-level lock too eagerly. We also allowed ALTER TABLE to proceed and acquire TL_WRITE_ALLOW_READ lock in cases when there were some transactions which already managed to update table which inevitably led to necessity to abort such transactions once they tried to perform yet another update on the table. The second bug occurred simply because we didn't have any means to handle deadlocks between table-level in the core server and row-level locks in InnoDB other than timeout. This patch tries to solve both this problems by moving all conflicts which are causing these deadlocks into metadata locking subsystem, thus making it possible to avoid or detect such deadlocks by its means. To do this we introduce new type-of-operation-aware metadata locks, which allow MDL subsystem to know not only the fact that transaction has used or going to use some object but also what kind of operation it has carried out or going to carry out on the object. This, along with addition of special kind of upgradable metadata lock, allows ALTER TABLE to wait before doing anything else until all transactions which has updated the table go away. This solves the the second issue. And along with addition of special kind of upgradable metadata lock to be acquired by LOCK TABLES WRITE it allows to solve the first issue as well, since aborting of table-level locks becomes unnecessary (see comment for sql/sql_base.cc for detailed explanation). Here are the list of incompatible changes introduced by this patch: - Now ALTER TABLE and CREATE/DROP TRIGGER statements (i.e. those which acquire TL_WRITE_ALLOW_READ lock) before doing anything else wait until all transactions which has updated the table being changed complete. - LOCK TABLES ... WRITE, REPAIR/OPTIMIZE TABLE (i.e. all statements which acquire upgradable metadata lock and TL_WRITE table-level lock) now wait before doing anything else untill all transactions which somehow used table to be locked or changed complete. As a consequence innodb_table_locks=0 option no longer applies to LOCK TABLES ... WRITE. - DROP TABLES/DATABASE and RENAME TABLE no longer abort statements or transactions which use tables being changed and are waiting for some table-level locks. - Transactions which try to change some table for the first time or use some table for the first time may fail with ER_LOCK_DEADLOCK error if there is a concurrent LOCK TABLES ... WRITE statement for this table and transaction is likely to create deadlock by waiting for it to go away (note that unlike before this also applies to transactions involving non-InnoDB tables or even using only non-InnoDB tables). - Finally, this patch temporarily disables support of LOW_PRIORITY option for LOCK TABLES ... WRITE. As usual questions for reviewer are marked by QQ. @ mysql-test/include/handler.inc Adjusted test case to trigger execution path on which bug 41110 "crash with handler command when used concurrently with alter table" and bug 41112 "crash in mysql_ha_close_table/get_lock_data with alter table" were originally discovered. Left old test case which no longer triggers this execution path for the sake of coverage. @ mysql-test/include/locktrans.inc Adjusted test case to take into account facts: - that now waiting for table locked by LOCK TABLES ... WRITE happens within metadata locking subsystem and therefore different status is shown in I_S.PROCESSLIST in this case. - that now LOCK TABLES ... WRITE has to wait until transactions using the table being locked are commited or rolled back. Also temporarily disabled part of the test which uses LOCK TABLES ... LOW_PRIORITY WRITE - feature which is not yet supported by this version of this patch. @ mysql-test/r/events_2.result Disabled part of the test which started to cause deadlocks after changing LOCK TABLES WRITE to be a metadata level lock. We need to make decision how to handle such situation. @ mysql-test/r/handler_innodb.result Adjusted test case to trigger execution path on which bug 41110 "crash with handler command when used concurrently with alter table" and bug 41112 "crash in mysql_ha_close_table/get_lock_data with alter table" were originally discovered. Left old test case which no longer triggers this execution path for the sake of coverage. @ mysql-test/r/handler_myisam.result Adjusted test case to trigger execution path on which bug 41110 "crash with handler command when used concurrently with alter table" and bug 41112 "crash in mysql_ha_close_table/get_lock_data with alter table" were originally discovered. Left old test case which no longer triggers this execution path for the sake of coverage. @ mysql-test/r/innodb-lock.result Disabled part of test case which uses innodb_table_locks=0 option. It is unlikely that we will be able to support this option with LOCK TABLES ... WRITE implemented on metadata locking level. @ mysql-test/r/innodb_mysql_lock.result Added test for bug #37346 "innodb does not detect deadlock between update and alter table". @ mysql-test/r/lock_multi.result Added test for bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock". Adjusted other test cases to take into account the fact that waiting for LOCK TABLES ... WRITE now happens within metadata locking subsystem. @ mysql-test/r/locktrans_innodb.result Adjusted test case to take into account fact that now LOCK TABLES ... WRITE has to wait until transactions using the table being locked are commited or rolled back. Also temporarily disabled part of the test which uses LOCK TABLES ... LOW_PRIORITY WRITE - feature which is not yet supported by this version of this patch. @ mysql-test/r/locktrans_myisam.result Adjusted test case to take into account fact that now LOCK TABLES ... WRITE has to wait until transactions using the table being locked are commited or rolled back. Also temporarily disabled part of the test which uses LOCK TABLES ... LOW_PRIORITY WRITE - feature which is not yet supported by this version of this patch. @ mysql-test/r/mdl_sync.result Added basic test coverage for type-of-operation aware metadata locks. Also covered with tests some use cases involving HANDLER statements in which deadlock might have arisen. @ mysql-test/r/merge-sync.result Use LOCK TABLES READ instead of LOCK TABLES WRITE in order to trigger the same execution patch as before. @ mysql-test/r/sp-threads.result SHOW PROCESSLIST has changed due to fact that waiting for LOCK TABLES WRITE now happens within metadata locking subsystem. @ mysql-test/r/truncate_coverage.result Adjusted test case after making LOCK TABLES WRITE to wait until transactions using the table to be locked are completed. @ mysql-test/suite/rpl/r/rpl_locktrans_innodb.result Adjusted test case to take into account fact that now LOCK TABLES ... WRITE has to wait until transactions using the table being locked are commited or rolled back. Also temporarily disabled part of the test which uses LOCK TABLES ... LOW_PRIORITY WRITE - feature which is not yet supported by this version of this patch. @ mysql-test/suite/rpl/r/rpl_locktrans_myisam.result Adjusted test case to take into account fact that now LOCK TABLES ... WRITE has to wait until transactions using the table being locked are commited or rolled back. Also temporarily disabled part of the test which uses LOCK TABLES ... LOW_PRIORITY WRITE - feature which is not yet supported by this version of this patch. @ mysql-test/t/events_2.test Disabled part of the test which started to cause deadlocks after changing LOCK TABLES WRITE to be a metadata level lock. We need to make decision how to handle such situation. @ mysql-test/t/innodb-lock.test Disabled part of test case which uses innodb_table_locks=0 option. It is unlikely that we will be able to support this option with LOCK TABLES ... WRITE implemented on metadata locking level. @ mysql-test/t/innodb_mysql_lock.test Added test for bug #37346 "innodb does not detect deadlock between update and alter table". @ mysql-test/t/lock_multi.test Added test for bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock". Adjusted other test cases to take into account the fact that waiting for LOCK TABLES ... WRITE now happens within metadata locking subsystem. @ mysql-test/t/mdl_sync.test Added basic test coverage for type-of-operation aware metadata locks. Also covered with tests some use cases involving HANDLER statements in which deadlock might have arisen. @ mysql-test/t/merge-sync.test Use LOCK TABLES READ instead of LOCK TABLES WRITE in order to trigger the same execution patch as before. @ mysql-test/t/multi_update.test Changed test case due to fact that waiting for LOCK TABLES WRITE now happens within metadata locking subsystem. @ mysql-test/t/truncate_coverage.test Adjusted test case after making LOCK TABLES WRITE to wait until transactions using the table to be locked are completed. @ sql/mdl.cc Introduced new type-of-operation-aware metadata locks. To do this: - Changed MDL_lock to use one list for waiting requests and one list for granted requests. Added auxiliary methods to manipulate with those lists while keeping the rest of the MDL_lock's state in sync with their content. - Adjusted compatibility matrices which are implemented by MDL_global_lock::is_lock_type_compatible() and MDL_lock::can_grant_lock() methods. - Adjusted rest of MDL subsystem implementation to take into account new types of locks (e.g. to the fact that now we have two types of upgradable locks). - Removed call to mysql_abort_transactions_with_shared_lock() from MDL_ticket::upgrade_shared_lock_to_exclusive() since with advent of new locks deadlocks between deadlocks between table-level locks and MDL subsystem should not be possible (since thread which has managed to acquire metadata lock compatible with UNW, should be able to acquire table-level lock without waiting, and thread which has lock compatible with UNRW lock should not acquire table-level locks at all (S lock acquired by HANDLER statement being an exception, which is handled through aborts of table-level locks)). @ sql/mdl.h Introduced new type-of-operation-aware metadata locks. Added MDL_context::m_needs_thr_lock_abort flag to be able to distinguish contexts used for opening HANDLERs. Got rid of mysql_abort_transactions_with_shared_lock() function which became unnecessary with advent of new locks. @ sql/mysql_priv.h Added MYSQL_OPEN_FORCE_SHARED_MDL flag which forces open_tables() to take MDL_SHARED on tables instead of metadata locks specified in parser. We use this to allow PREPARE statements not to wait for LOCK TABLES ... WRITE on tables used in the prepared statements. @ sql/sp_head.cc When creating table list elements for prelocking or system tables set type of request for metadata lock according to the type of table-level lock which we are going to acquire and thus operation we are going to perform on the table. @ sql/sql_base.cc wait_while_table_is_used()/mysql_notify_thread_having_shared_lock(): When upgrading metadata lock or acquiring an exclusive metadata lock we no longer abort threads which hold conflicting metadata lock and are waiting on table-level lock (in general case). Doing so led to aborts of transactions which were not causing deadlocks and should have continued their execution (see bug#46272). It became possible to remove these aborts without opening gap for deadlock situations after introduction of type-of-operation-aware metadata locks. Note that even before this change deadlock could have not arisen in cases when one tried to acquire X metadata lock, since in it all waiting happened within MDL subsystem and thus deadlocks were successfully detected and reported by our trivial, empiric-based deadlock detector. But this change helps to avoid deadlock in scenarios when shared metadata lock is upgraded to X lock. Particularly, in case when UNW lock is being upgraded there cannot be any threads waiting for thread performing upgrade due to table-level lock and therefore possible deadlocks limited to MDL subsystem and should be detected. This is because any thread which managed to acquire metadata lock compatible with UNW, i.e. SR lock, can request only read table-level locks which will be granted without any waiting (NB: this means that thread that acquires UNW locks should not mix them with any other kinds of metadata locks). In case when UNRW lock is upgraded to X lock, thread preventing upgrade can hold only S or SH types of lock on the table. The latter type is used only for filling of I_S tables during which no table-level locks are acquired so no deadlocks outside of MDL can occur. The former type is used in PREPARE statement which also does not aacquire table-level locks and by open HANDLERs for which we still abort table-level locks. open_table_get_mdl_lock(): Adjusted code to the fact that now we have two kind of upgradable metadata locks which exact type is determined according to type of table-level lock to be acquired (for TL_WRITE table-level lock we acquire UNRW metadata lock and for TL_WRITE_ALLOW_READ we acquire UNW lock). open_tables(): In order to avoid starvation pre-acquire upgradable metadata locks using acquire_exclusive_locks() method instead of acquiring them in one-by-one fashion using try_acquire_shared_lock(). mysql_abort_transactions_with_shared_lock(): We no longer need this function since after introduction of type-of-operation-aware metadata locks deadlocks between table-level locks and MDL subsystem should not be possible (since thread which has managed to acquire metadata lock compatible with UNW, should be able to acquire table-level lock without waiting, and thread which has lock compatible with UNRW lock should not acquire table-level locks at all (S lock acquired by HANDLER statement being an exception, which is handled through aborts of table-level locks)). @ sql/sql_class.h Mark MDL_context used for open HANDLERs as breaking metadata locking protocol and thus requiring aborting of waits on table-level locks. @ sql/sql_handler.cc Don't try flush HANDLERs for temporary tables. Such tables are not visible outside of this connection anyway. This is temporary fix which will go away once Kostja pushes his patch refactoring use of metadata locks for HANDLERs. @ sql/sql_parse.cc Don't take upgradable metadata locks when opening tables for CREATE TABLE ... SELECT statement. This is not needed until support for engine-agnostic foreign keys is implemented and creates problems with acquiring exclusive metadata lock on target table and with tables from SELECT part if FOR UPDATE clause is specified. When initializing metadata lock request for table list element set metadata lock type according to the type of table-level lock to be acquired and thus operation we are going to perform on the table. @ sql/sql_prepare.cc Use MYSQL_OPEN_FORCE_SHARED_MDL flag when calling open_tables() during PREPARE of prepared statement in order to not be blocked by concurrent LOCK TABLES WRITE. @ sql/sql_table.cc Don't take upgradable metadata locks when opening tables for CREATE TABLE statement. This is not needed until support for engine-agnostic foreign keys is implemented and creates problems with acquiring exclusive metadata lock on target table. @ sql/table.cc When initializing or resetting metadata lock request for table list element set metadata lock type according to the type of table-level lock to be acquired and thus operation we are going to perform on the table. @ sql/table.h When initializing metadata lock request for table list element set metadata lock type according to the type of table-level lock to be acquired and thus operation we are going to perform on the table.
[12 Jan 2010 19:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/96667 3049 Konstantin Osipov 2010-01-12 A prerequisite patch for the fix for Bug#46272 "Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock". Instead of a single global mutex that protects the MDL subsystem, use a mutex per one MDL lock. Commit the patch into the staging tree to be able to use work on review comments.
[15 Jan 2010 21:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97165 3050 Dmitry Lenev 2010-01-16 A prerequisite patch for the fix for Bug#46272 "Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock". Instead of a single global mutex that protects the MDL subsystem, use a mutex per one MDL lock. Work on after review comments in progress.
[16 Jan 2010 9:27]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97173 3051 Dmitry Lenev 2010-01-16 A prerequisite patch for the fix for Bug#46272 "Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock". Instead of a single global mutex that protects the MDL subsystem, use a mutex per one MDL lock. Work on after review comments in progress. Reduce critical sections by moving context-private assignments out of them.
[18 Jan 2010 20:04]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97298 3052 Dmitry Lenev 2010-01-18 A prerequisite patch for the fix for Bug#46272 "Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock". Instead of a single global mutex that protects the MDL subsystem, use a mutex per one MDL lock. Work on after review comments in progress.
[19 Jan 2010 21:07]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97447 3054 Dmitry Lenev 2010-01-20 A prerequisite patch for the fix for Bug#46272 "Bug #46272 MySQL 5.4.4, new MDL: unnecessary deadlock". Instead of a single global mutex that protects the MDL subsystem, use a mutex per one MDL lock. Work on after review comments in progress. Implemented Mikael's idea with reference counting variables which ensure that we can release LOCK_mdl_hash mutex before acquiring MDL_lock::lock in performance critical code.
[20 Jan 2010 10:18]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97520 3057 Konstantin Osipov 2010-01-20 Bug#46272/Bug#38924 review fixes in progress. Rename a few members, realign comments to fit 66 characters, update comments.
[20 Jan 2010 10:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97529 3058 Konstantin Osipov 2010-01-20 Bug#46272/Bug#38924 review fixes in progress. Update MDL_key class to be more compact. Simplify the comparison method, used when sorting MDL_keys.
[20 Jan 2010 11:20]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97535 3059 Konstantin Osipov 2010-01-20 Bug#46272/Bug#38924 review fixes in progress. Misc fixes.
[20 Jan 2010 12:31]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97548 3060 Konstantin Osipov 2010-01-20 Bug#46272/Bug#38924 review fixes in progress. Introduce class MDL_map to hold all MDL locks taken in the server.
[20 Jan 2010 13:44]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97578 3061 Konstantin Osipov 2010-01-20 Bug#46272/Bug#38924 review fixes in progress. Misc. fixes.
[21 Jan 2010 8:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97687 3062 Konstantin Osipov 2010-01-21 Apply the second patch for Bug#46272.
[21 Jan 2010 8:36]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97689 3062 Konstantin Osipov 2010-01-21 Apply the second patch for Bug#46272.
[21 Jan 2010 16:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97746 3063 Konstantin Osipov 2010-01-21 Bug#46272 review fixes: remove an unnecessary friend.
[21 Jan 2010 17:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97760 3064 Konstantin Osipov 2010-01-21 Bug#46272, review comments, remove an unused friend.
[22 Jan 2010 5:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97795 3055 Dmitry Lenev 2010-01-22 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". Commit to the tree to be used for review work.
[22 Jan 2010 9:34]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97814 3063 Konstantin Osipov 2010-01-22 Bug#46272 review fixes: remove an unnecessary friend. ****** Bug#46272, review comments, remove an unused friend. ****** Bug#46262 review comments: remove unnecessary friends. Bug#46272: change wait_for_locks() to wait for one lock only.
[22 Jan 2010 9:39]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97816 3056 Konstantin Osipov 2010-01-22 Bug#46272, review comments: remove unnecessary friends, change wait_for_locks() to wait_for_lock() (waits for only one lock).
[22 Jan 2010 11:54]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/97856 3057 Konstantin Osipov 2010-01-22 Bug#46272, a review comment: update a waiting state in processlist_val_no_prot.test to reflect the new value.
[25 Jan 2010 12:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98052 3058 Dmitry Lenev 2010-01-25 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After review fixes in progress. Changed metadata locking code to use compatibility matrices specified through bitmaps rather than hard-coded by switch() statements.
[25 Jan 2010 17:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98106 3059 Dmitry Lenev 2010-01-25 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After review fixes in progress. Changed metadata locking code to use compatibility matrices specified through bitmaps rather than hard-coded by switch() statements.
[25 Jan 2010 20:29]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98119 3059 Dmitry Lenev 2010-01-25 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After review fixes in progress. Changed metadata locking code to use compatibility matrices specified through bitmaps rather than hard-coded by switch() statements.
[25 Jan 2010 21:09]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98121 3060 Konstantin Osipov 2010-01-26 Bug#46272, code review, update a comment.
[26 Jan 2010 17:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98227 3061 Konstantin Osipov 2010-01-26 Bug#46272, review fixes. Check the life cycle of trans_sentinel, add more tests. Rename lt_or_ha_sentinel to trans-sentinel to reflect the fact that it can now also separate the global shared lock taken for the global read lock.
[26 Jan 2010 17:47]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98228 3060 Dmitry Lenev 2010-01-26 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After review fixes in progress. Disallowing DDL under LOCK TABLES on implicitly locked tables allows to simplify metadata locking.
[26 Jan 2010 18:22]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98233 3061 Konstantin Osipov 2010-01-26 Bug#46272, code review, update a comment. ****** Bug#46272, review fixes. Check the life cycle of trans_sentinel, add more tests. Rename lt_or_ha_sentinel to trans-sentinel to reflect the fact that it can now also separate the global shared lock taken for the global read lock.
[26 Jan 2010 19:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98240 3062 Konstantin Osipov 2010-01-26 Bug#46272, review fixes, a commit to save work.
[26 Jan 2010 20:00]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98242 3063 Konstantin Osipov 2010-01-26 Bug#46272, review fixes. Commit to save work (2).
[26 Jan 2010 20:41]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98244 3064 Konstantin Osipov 2010-01-26 Bug#46272, review fixes. Commit to save work (3).
[27 Jan 2010 8:52]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98283 3062 Dmitry Lenev 2010-01-27 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After review fixes in progress.
[27 Jan 2010 9:09]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98291 3065 Konstantin Osipov 2010-01-27 Bug#46272, review fixes (4).
[27 Jan 2010 10:15]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98301 3063 Dmitry Lenev 2010-01-27 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After-review fixes in progress.
[27 Jan 2010 13:16]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98330 3064 Konstantin Osipov 2010-01-27 Bug#46272, review fixes: remove an unused member.
[27 Jan 2010 16:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98373 3065 Dmitry Lenev 2010-01-27 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After-review fixes in progress.
[27 Jan 2010 21:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98414 3067 Konstantin Osipov 2010-01-28 Bug#46272, review fixes. Remove redundant methods.
[28 Jan 2010 9:36]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98430 3068 Konstantin Osipov 2010-01-28 Bug#46272, review fixes.
[28 Jan 2010 12:09]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98457 3069 Dmitry Lenev 2010-01-28 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". Work in progress. Implemented advanced deadlock detector inspired by mysys's waiting_threads.c. This step should decrease probability of unwarranted ER_LOCK_DEADLOCK errors which has increased in some situations after introduction of type-of-operation-aware metadata locks.
[28 Jan 2010 12:47]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98473 3070 Konstantin Osipov 2010-01-28 Bug#46272, review fixes.
[28 Jan 2010 13:20]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98475 3071 Dmitry Lenev 2010-01-28 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After-review fixes in progress. Do not rely on numeric values of enum_mdl_type elements in order to find out which lock type is stronger.
[28 Jan 2010 15:17]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98487 3072 Dmitry Lenev 2010-01-28 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After-review fixes in progress.
[28 Jan 2010 15:48]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98491 3073 Konstantin Osipov 2010-01-28 Bug#46272, review comments. Reuse code, remove HANDLER-related deadlock detection heuristics that is no longer needed with graph-based deadlock detector. Update comments.
[28 Jan 2010 17:46]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98497 3075 Dmitry Lenev 2010-01-28 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". After-review fixes in progress.
[29 Jan 2010 8:35]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98541 3076 Dmitry Lenev 2010-01-29 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". More after review fixes.
[29 Jan 2010 10:44]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98579 3077 Dmitry Lenev 2010-01-29 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". More after review fixes.
[29 Jan 2010 11:01]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98588 3075 Konstantin Osipov 2010-01-29 Bug#46272, review fixes.
[29 Jan 2010 11:02]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98590 3078 Konstantin Osipov 2010-01-29 Bug#46272, review fixes.
[29 Jan 2010 14:41]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98630 3079 Dmitry Lenev 2010-01-29 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". More after review fixes.
[29 Jan 2010 14:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98638 3080 Konstantin Osipov 2010-01-29 Bug#46272, review fixes. Now that we don't self-deadlock on incompatible locks, we no longer need to check for the global shared lock in MDL. Fix a merge bug in sql_view.cc when the global read lock API was misused.
[29 Jan 2010 15:00]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98650 3081 Konstantin Osipov 2010-01-29 [merge] Bug#46272, review comments. Simplify the MDL API by removing acquire_exclusive_locks(), acquire_global_intention_exclusive_lock().
[29 Jan 2010 15:10]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98655 3082 Konstantin Osipov 2010-01-29 Bug#46272, rename the sync point.
[29 Jan 2010 15:26]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98660 3083 Dmitry Lenev 2010-01-29 Tentative patch implementing new type-of-operation-aware metadata locks. Fixes bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table". More after review fixes.
[29 Jan 2010 15:38]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98663 3083 Konstantin Osipov 2010-01-29 Bug#46272, review comments: introduce MDL_lock::bitmap_t.
[29 Jan 2010 15:47]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98665 3084 Konstantin Osipov 2010-01-29 Bug#46272, review comments: introduce MDL_lock::bitmap_t.
[1 Feb 2010 14:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98826 3056 Dmitry Lenev 2010-02-01 Fix for sporadical crashes of lock_multi_bug38499.test caused by patch which implemented new type-of-operation-aware metadata locks and added a wait-for graph based deadlock detector to the MDL subsystem (this patch fixed bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table"). Crashes were caused by a race in MDL_context::try_acquire_lock(). This method added MDL_ticket to the list of granted tickets and released lock protecting list before setting MDL_ticket::m_lock. Thus some other thread was able to see ticket without properly set m_lock member for some short period of time. If this thread called method involving this member during this period crash happened. This fix ensures that MDL_ticket::m_lock is set in all cases when ticket is added to granted/pending lists in MDL_lock. @ sql/mdl.cc We must set MDL_ticket::m_lock member before adding ticket to the list of granted tickets, since such tickets can be accessed by other threads which might call methods using this member. Added assert which ensures that all MDL_tickets which are added to the granted/pending lists have properly set MDL_ticket::m_lock member. @ sql/mdl.h Adjusted comment describing MDL_ticket::m_lock member to reflect current reality. Added accessor method for this member.
[1 Feb 2010 14:39]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98827 3057 Dmitry Lenev 2010-02-01 Fix for sporadical crashes of lock_multi_bug38499.test caused by patch which implemented new type-of-operation-aware metadata locks and added a wait-for graph based deadlock detector to the MDL subsystem (this patch fixed bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table"). Crashes were caused by a race in MDL_context::try_acquire_lock(). This method added MDL_ticket to the list of granted tickets and released lock protecting list before setting MDL_ticket::m_lock. Thus some other thread was able to see ticket without properly set m_lock member for some short period of time. If this thread called method involving this member during this period crash happened. This fix ensures that MDL_ticket::m_lock is set in all cases when ticket is added to granted/pending lists in MDL_lock. @ sql/mdl.cc We must set MDL_ticket::m_lock member before adding ticket to the list of granted tickets, since such tickets can be accessed by other threads which might call methods using this member. Added assert which ensures that all MDL_tickets which are added to the granted/pending lists have properly set MDL_ticket::m_lock member. @ sql/mdl.h Adjusted comment describing MDL_ticket::m_lock member to reflect current reality. Added accessor method for this member.
[1 Feb 2010 18:00]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/98840 3058 Dmitry Lenev 2010-02-01 Fix for sporadical hangs of mdl_sync.test caused by patch which implemented new type-of-operation-aware metadata locks and added a wait-for graph based deadlock detector to the MDL subsystem (this patch fixed bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table"). These hangs were caused by missing include of wait_condition.inc. This fix simply adds them. @ mysql-test/t/mdl_sync.test Added missing include of wait_condition.inc.
[3 Feb 2010 19:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/99143 3070 Dmitry Lenev 2010-02-03 A follow-up for the patch which implemented new type-of-operation-aware metadata locks and added a wait-for graph based deadlock detector to the MDL subsystem (this patch fixed bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock" and bug #37346 "innodb does not detect deadlock between update and alter table"). Removed unused and redundant method.
[4 Feb 2010 10:33]
Jon Olav Hauglid
Bug#44836 was marked as a duplicate of this bug.
[15 Feb 2010 22:13]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/100451 3101 Konstantin Osipov 2010-02-16 Bug#46272, review comments: a preview of the patch that removes the infinite loops around thr_lock.c API and mysql_lock_tables().
[16 Feb 2010 16:45]
Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100216101445-2ofzkh48aq2e0e8o) (version source revid:kostja@sun.com-20100210211106-nq8ztcq2z9o4csit) (merge vers: 6.0.14-alpha) (pib:16)
[16 Feb 2010 16:55]
Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100216101208-33qkfwdr0tep3pf2) (version source revid:kostja@sun.com-20100203220607-r41c9nlz73rllxso) (pib:16)
[2 Mar 2010 1:02]
Paul DuBois
Not present in any released version. No changelog entry needed. Setting report to Need Merge pending push of Celosia into release tree.
[6 Mar 2010 11:00]
Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:vvaintroub@mysql.com-20100216221947-luyhph0txl2c5tc8) (merge vers: 5.5.99-m3) (pib:16)
[7 Mar 2010 2:07]
Paul DuBois
No changelog entry needed.
[30 Nov 2011 16:17]
Paul DuBois
Correction: A 5.5.3 changelog entry is needed. As part of this work, the LOW_PRIORITY modifier for LOCK TABLES ... WRITE now has no effect.