Merge lp:~laurynas-biveinis/percona-server/bug1328824 into lp:percona-server/5.6

Proposed by Laurynas Biveinis on 2014-08-22
Status: Merged
Approved by: Alexey Kopytov on 2014-08-26
Approved revision: no longer in the source branch.
Merged at revision: 652
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1328824
Merge into: lp:percona-server/5.6
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1328824
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) 2014-08-22 Approve on 2014-08-26
Review via email: mp+231833@code.launchpad.net

Description of the change

Fix bug 1328824 (SQL statement missing in SHOW ENGINE INNODB STATUS).

The problem is that thd_security_context only prints query text when
thd == current_thd, i.e. the query of the current thread. Queries of
other threads cannot be safely accessed without locking LOCK_thd_data
first, and locking that mutex indiscriminately may result in the
deadlock of http://bugs.mysql.com/bug.php?id=60682.

Fix by attempting to print query texts of other threads too, but only
if a corresponding LOCK_thd_data can be acquired. Otherwise a
placeholder text is printed.

Add testcases percona_bug_1328824, which verifies that the query texts
of all transactions are printed in the case of InnoDB transaction
deadlock, and percona_bug_1328824_debug, which simulates unavailable
LOCK_thd_data and verifies that a placeholder query text is printed
instead.

http://jenkins.percona.com/job/percona-server-5.6-param/692/

There were the following options for the fix:
- revert 60682 fix and allow deadlocks again;
- split up thd->query() locking out of LOCK_thd_data;
- Twitter fix of setting "thd_security_context is being called from the InnoDB deadlock print context" flag, indicating that it is safe to call thd->query() for other threads without locking;
- Facebook fix of locking LOCK_thd_data but breaking the deadlock by non-blocking locking attempt. A placeholder text is printed in case the locking attempt fails.

The Facebook fix was preferred over Twitter fix as it prints the query string in more cases.

Would be G2 for code changes only, but not sure about fix design, thus percona-core.

To post a comment you must log in.
Alexey Kopytov (akopytov) :
review: Approve

Diff calculation failed

Calculating the branch diff failed. You can manually schedule an update if required.

Subscribers

People subscribed via source and target branches