Comments on: How I patched InnoDB to show locks held http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/ Stay curious! Thu, 02 May 2013 12:36:53 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14117 Xaprb Sat, 29 Dec 2007 23:28:57 +0000 http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14117 Dathan,

Sometimes, yes, but row locks are held until the transaction commits, so of course even short-running statements can block things. In most of the cases I’ve needed to track down, it’s usually something like “update table1 join client… set table1.clientname=client.nickname” and then the client table’s rows are locked until the transaction commits. Take a poorly-behaved program that doesn’t commit for a while, add 99 other things running at the same time, and it’s basically impossible to figure out who really has the lock you need to kill and un-freeze the works.

I’ve been spending some time in the InnoDB source trying to figure out if there’s a way to just see which transaction holds the lock, but I don’t know the code that well. (The locking code is pretty complicated). That would be my preferred solution.

]]>
By: Dathan Pattishall http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14116 Dathan Pattishall Fri, 28 Dec 2007 20:13:59 +0000 http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14116 Just showing the process list and looking for the longest running process on a table can also give information as to what connection is holding the lock.

Other then the cool show status variable that allows for easy graphing, what other information does this show? I’d like to get information as to why the table lock is established, and why it’s taking so long.

Some suggestions that may answer these questions:

What about showing the number of rows the lock needs to hold as an indicator to why the lock is across the entire table?

A page to row conversion, to see which processes are trying to operate on the same page/row, which could be an indicator as to why a lock across the table is needed.

This is some great work with a bunch of expandable information.

]]>
By: Xaprb http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14109 Xaprb Tue, 25 Dec 2007 14:19:23 +0000 http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14109 Hi Ben,

Thanks, and a merry Christmas to you as well!

]]>
By: Ben http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14108 Ben Tue, 25 Dec 2007 12:30:12 +0000 http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14108 ps. Merry Christmas and a prosperous new year!!!!

]]>
By: Ben http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14107 Ben Tue, 25 Dec 2007 12:28:58 +0000 http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/#comment-14107 This comment/request does not belong in this section but i couln’t trace your contacts so …..
first off…thanks for the great set of tools they make MySQL more bearable!!!!
My request – a tool that allows general and/or specific query logging on a per database and/or table basis
That would definately help troubleshoot source of corrupted data in a table, etc

]]>