<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xaprb &#187; Innotop</title>
	<atom:link href="http://www.xaprb.com/blog/tag/innotop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Making Maatkit more Open Source one step at a time</title>
		<link>http://www.xaprb.com/blog/2009/03/08/making-maatkit-more-open-source-one-step-at-a-time/</link>
		<comments>http://www.xaprb.com/blog/2009/03/08/making-maatkit-more-open-source-one-step-at-a-time/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 02:35:15 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Innotop]]></category>
		<category><![CDATA[Maatkit]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=497</guid>
		<description><![CDATA[If you&#8217;ve been holding out for that golden opportunity, now&#8217;s a great time to get involved in Maatkit. Until now I haven&#8217;t really made a conscious effort to open-source the decision process and get people involved; Maatkit has been largely driven by so-called &#8220;real-world needs,&#8221; as perceived through my little lens on the world (and [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/03/19/open-source-database-developer-mailing-lists/' rel='bookmark' title='Permanent Link: Open-source database developer mailing lists'>Open-source database developer mailing lists</a></li>
<li><a href='http://www.xaprb.com/blog/2008/12/23/does-mysql-really-have-an-open-source-business-model/' rel='bookmark' title='Permanent Link: Does MySQL really have an open-source business model?'>Does MySQL really have an open-source business model?</a></li>
<li><a href='http://www.xaprb.com/blog/2009/04/29/what-does-an-open-source-sales-model-look-like/' rel='bookmark' title='Permanent Link: What does an open source sales model look like?'>What does an open source sales model look like?</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/' rel='bookmark' title='Permanent Link: MySQL: Free Software but not Open Source'>MySQL: Free Software but not Open Source</a></li>
<li><a href='http://www.xaprb.com/blog/2011/07/04/measuring-open-source-success-by-jobs/' rel='bookmark' title='Permanent Link: Measuring open-source success by jobs'>Measuring open-source success by jobs</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been holding out for that golden opportunity, now&#8217;s a great time to get involved in <a href="http://www.maatkit.org/">Maatkit</a>.</p>

<p>Until now I haven&#8217;t really made a conscious effort to open-source the decision process and get people involved; Maatkit has been largely driven by so-called &#8220;real-world needs,&#8221; as perceived through my little lens on the world (and emails from the whole Percona team telling me when something&#8217;s wrong).  I guess I am <em>likely</em> to remain some kind of benevolent dictator, because I created Maatkit and historically I&#8217;m the main hacker.  <strong>But it doesn&#8217;t have to stay that way, and the project and users will be better off if it doesn&#8217;t</strong>.</p>

<p>So I&#8217;ve been trying to break out of the rut of just having some little email exchange with people using the tools, and bring things onto <a href="http://groups.google.com/group/maatkit-discuss">the Maatkit mailing list</a> for discussion and voting.  Two mailing lists I&#8217;m lurking on (Drizzle and PostgreSQL hackers) have inspired me to do this.  And the person who jumped into <a href="http://code.google.com/p/innotop/">innotop</a> maintenance set up a whole slew of mailing lists right away, which was also educational for me &#8212; it really is beneficial.</p>

<p>Right now if you jump on the mailing list, you can vote on topics such as breaking backwards compatibility with command-line options for the purpose of consistent and easy-to-learn options for the future.</p>

<p>And I have honestly gotten intolerant about the volume of email I deal with, so when someone emails me personally I usually tell them bluntly to take it to the list, so others can learn and contribute, instead of making me the single point of contention in the knowledge-sharing system,  and denying others the opportunity to learn.</p>

<p>So &#8212; my point is, go participate, and <a href="http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/">let&#8217;s make Maatkit more Open Source, not just Free Software</a>.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/03/19/open-source-database-developer-mailing-lists/' rel='bookmark' title='Permanent Link: Open-source database developer mailing lists'>Open-source database developer mailing lists</a></li>
<li><a href='http://www.xaprb.com/blog/2008/12/23/does-mysql-really-have-an-open-source-business-model/' rel='bookmark' title='Permanent Link: Does MySQL really have an open-source business model?'>Does MySQL really have an open-source business model?</a></li>
<li><a href='http://www.xaprb.com/blog/2009/04/29/what-does-an-open-source-sales-model-look-like/' rel='bookmark' title='Permanent Link: What does an open source sales model look like?'>What does an open source sales model look like?</a></li>
<li><a href='http://www.xaprb.com/blog/2008/05/14/mysql-free-software-but-not-open-source/' rel='bookmark' title='Permanent Link: MySQL: Free Software but not Open Source'>MySQL: Free Software but not Open Source</a></li>
<li><a href='http://www.xaprb.com/blog/2011/07/04/measuring-open-source-success-by-jobs/' rel='bookmark' title='Permanent Link: Measuring open-source success by jobs'>Measuring open-source success by jobs</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2009/03/08/making-maatkit-more-open-source-one-step-at-a-time/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Version 1.6.0 of the innotop monitor for MySQL released</title>
		<link>http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/</link>
		<comments>http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 15:53:23 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[Innotop]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/</guid>
		<description><![CDATA[<p>The 1.5.2 release of innotop contained two bugs, one very minor.  The other was a crash because of the new functionality that aggregates results across many connections.  I fixed them and released version 1.6.0, which I consider stable and ready for everyone to use.  (My version naming convention for innotop is that even-numbered minor versions are for production use; odd-numbered, such as 1.5.2, are the development branch.  That's why I release them under the innotop-devel package).</p>

<p>Your comments are welcome for the 1.8 roadmap.</p>


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.1 of the innotop MySQL monitor released'>Version 1.5.1 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2010/11/06/innotop-version-1-8-0-released/' rel='bookmark' title='Permanent Link: innotop version 1.8.0 released'>innotop version 1.8.0 released</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p class="download"><a href="http://code.google.com/p/innotop/">Download innotop</a></p>

<p>The 1.5.2 release of innotop contained two bugs, one very minor.  The other was a crash because of the new functionality that aggregates results across many connections.  I fixed them and released version 1.6.0, which I consider stable and ready for everyone to use.  (My version naming convention for innotop is that even-numbered minor versions are for production use; odd-numbered, such as 1.5.2, are the development branch.  That&#8217;s why I release them under the innotop-devel package).</p>

<p>What&#8217;s ahead for innotop 1.8?  Here&#8217;s my current road map, some of which is already done:</p>

<pre>Features for version 1.8:

* A test suite.
* Rename the variables the InnoDB parser outputs to match what MySQL has named them.

http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html#option_mysqld_Innodb_buffer_pool_pages_data

* Support Google's patches:

http://code.google.com/p/google-mysql-tools/wiki/InnodbStatus


http://dammit.lt/2007/06/23/mysql-40-google-edition/

* Make InnoDBParser.pm smartly fill in the data it needs by looking in SHOW
  STATUS and SHOW VARIABLES and realizing if these already provide necessary
  data.
* Efficiency and speed optimizations.  Only fetch needed data from servers.
* Use SQL instead of all the extract_values stuff.
* New configuration screen with less duplicate code that plugins can add to.
* Add support for Falcon and solidDB.
* Support multiple server connections in all modes.
* Support incremental display in all modes.  Make incremental display a per-mode
  configuration setting.
* Tentative: Add a new mode for monitoring NDB clusters.
* Tentative: usability testing and if necessary, make usability enhancements.
* Tentative: Add support for pager if you want to see more than fits on screen.
* Tentative: Documentation and built-in help (get help on a key from help screen).</pre>

<p>I wrote that roadmap a while ago.  I don&#8217;t get much feedback on desired features, for the most part (maybe innotop already has too many features?).  These are just things I either want to do very badly, such as write a test suite, or think would be nifty or fun, such as adding a pager.  Your input is welcome.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.1 of the innotop MySQL monitor released'>Version 1.5.1 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2010/11/06/innotop-version-1-8-0-released/' rel='bookmark' title='Permanent Link: innotop version 1.8.0 released'>innotop version 1.8.0 released</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Version 1.5.2 of the innotop MySQL monitor released</title>
		<link>http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/</link>
		<comments>http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 21:34:06 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[Innotop]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[transactions]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/</guid>
		<description><![CDATA[<p>This release is part of the unstable 1.5 branch. Its features will ultimately go into the stable 1.6 branch. You can download it from the <a href="http://sourceforge.net/project/showfiles.php?group_id=186074">innotop-devel package</a>.</p>

<p>The major change is I've ripped out the W (Lock Waits) mode and enabled innotop to discover not only what a transaction is waiting for, but what it holds too.  The new mode that replaces W is L (Locks).  My last article goes into more detail on this.</p>


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.1 of the innotop MySQL monitor released'>Version 1.5.1 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/' rel='bookmark' title='Permanent Link: Version 1.6.0 of the innotop monitor for MySQL released'>Version 1.6.0 of the innotop monitor for MySQL released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p class="download"><a href="http://code.google.com/p/innotop">Download innotop</a></p>

<p>This release is part of the unstable 1.5 branch. Its features will ultimately go into the stable 1.6 branch. You can download it from the <a href="http://code.google.com/p/innotop">innotop-devel package</a>.</p>

<p>The major change is I&#8217;ve ripped out the W (Lock Waits) mode and enabled innotop to discover not only what a transaction is waiting for, but what it holds too.  The new mode that replaces W is L (Locks).  My last article goes into more detail on this.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.1 of the innotop MySQL monitor released'>Version 1.5.1 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/' rel='bookmark' title='Permanent Link: Version 1.6.0 of the innotop monitor for MySQL released'>Version 1.6.0 of the innotop monitor for MySQL released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to debug InnoDB lock waits</title>
		<link>http://www.xaprb.com/blog/2007/09/18/how-to-debug-innodb-lock-waits/</link>
		<comments>http://www.xaprb.com/blog/2007/09/18/how-to-debug-innodb-lock-waits/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 21:28:35 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[Innotop]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[transactions]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2007/09/18/how-to-debug-innodb-lock-waits/</guid>
		<description><![CDATA[<p>This article shows you how to use a little-known InnoDB feature to find out
what is holding the lock for which an InnoDB transaction is waiting.  I then
show you how to use an undocumented feature to make this even easier with
<a href="http://innotop.sourceforge.net/">innotop</a>.</p>


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2006/08/02/how-to-monitor-innodb-lock-waits/' rel='bookmark' title='Permanent Link: How to monitor InnoDB lock waits'>How to monitor InnoDB lock waits</a></li>
<li><a href='http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/' rel='bookmark' title='Permanent Link: How I patched InnoDB to show locks held'>How I patched InnoDB to show locks held</a></li>
<li><a href='http://www.xaprb.com/blog/2010/09/19/how-lock-tables-interacts-with-the-mysql-slow-query-log/' rel='bookmark' title='Permanent Link: How LOCK TABLES interacts with the MySQL slow query log'>How LOCK TABLES interacts with the MySQL slow query log</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>This article shows you how to use a little-known InnoDB feature to find out
what is holding the lock for which an InnoDB transaction is waiting.  I then
show you how to use an undocumented feature to make this even easier with
<a href="http://code.google.com/p/innotop/">innotop</a>.</p>

<h3>Background</h3>

<p>One of the most common complaints I&#8217;ve heard from DBAs used to other database
servers is &#8220;I can&#8217;t find out who holds the locks that are blocking all these
connections and making them time out.&#8221;  I feel your pain.  Before I helped scale
my employer&#8217;s systems to deal with larger volumes of data, InnoDB lock
contention was a serious issue.  And as far as I knew, you couldn&#8217;t find out who
was holding locks.  I knew you could see who was <em>waiting for locks to be
granted</em>; that&#8217;s easy.  You just run <code>SHOW INNODB STATUS</code> and
look for the following text:</p>

<pre>------------
TRANSACTIONS
------------
Trx id counter 0 4874
Purge done for trx's n:o &lt; 0 4869 undo n:o &lt; 0 0
History list length 21
Total number of lock structs in row lock hash table 2
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 4873, ACTIVE 6 sec, process no 7142, OS thread id 1141152064 starting index read
mysql tables in use 1, locked 1
<strong>LOCK WAIT</strong> 2 lock struct(s), heap size 368
MySQL thread id 9, query id 173 localhost root Sending data
select * from t1 for update
------- <strong>TRX HAS BEEN WAITING 6 SEC FOR THIS LOCK TO BE GRANTED</strong>:
RECORD LOCKS space id 9 page no 3 n bits 72 index `PRIMARY` of table `test/t1` trx id 0 4873 lock_mode X waiting
...</pre>

<p>That&#8217;s fine, but who holds the lock?  I thought there was no way to find that out.</p>

<h3>InnoDB Lock Monitor</h3>

<p>Until I learned about the <a
href="http://dev.mysql.com/doc/en/innodb-monitor.html">InnoDB Lock Monitor</a>,
that is.  You enable it by running the following command:</p>

<pre>CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB;</pre>

<p>It&#8217;s quite an ugly hack, but it turns out the table name is actually
&#8220;magical.&#8221;  It&#8217;s a special table name that tells InnoDB to start the lock
monitor.  You can stop it by dropping the table again.</p>

<p>This little-noticed feature makes InnoDB print out a slightly modified
version of what you see with <code>SHOW INNODB STATUS</code>.  The &#8220;slight modification&#8221; is
to print out not only the locks the transaction waits for, but also those it
<em>holds</em>.  For example, here&#8217;s the transaction that holds the locks:</p>

<pre>---TRANSACTION 0 4872, ACTIVE 32 sec, process no 7142, OS thread id 1141287232
2 lock struct(s), heap size 368
MySQL thread id 8, query id 164 localhost root
<strong>TABLE LOCK table `test/t1` trx id 0 4872 lock mode IX
RECORD LOCKS space id 9 page no 3 n bits 72 index `PRIMARY` of table `test/t1` trx id 0 4872 lock_mode X</strong>
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

Record lock, heap no 2 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 4; hex 80000001; asc     ;; 1: len 6; hex 000000000d35; asc      5;; 2: len 7; hex 800000002d0110; asc     -  ;;</pre>

<p>That&#8217;s fine, but there are, ah, limitations.  As the manual says, InnoDB
periodically prints out this text &#8212; essentially spewing InnoDB&#8217;s guts &#8212; to its
standard output.  This gets redirected to the server error log in any sane
installation.  Who&#8217;s looking there?  And it gets printed out at long intervals, which
seems to be about every 16 seconds on the machines I use.</p>

<p>Plus, if you&#8217;ve looked at the result, you&#8217;ll understand this is not something
you want to search through manually looking for data.  The output can be
absolutely huge.  What DBA wants to pore over thousands of hex-dumped rows from
the table just to answer the question &#8220;who holds that lock?&#8221;</p>

<p>All in all, this is not very convenient (yep, I know that&#8217;s an
understatement).</p>

<h3>Slightly more convenient</h3>

<p>What&#8217;s a little more convenient than combing through all that text by hand is
writing a program to parse InnoDB&#8217;s status output.  You
don&#8217;t have to, though.  That&#8217;s what I wrote innotop to do.  And I&#8217;ve just
released version 1.5.2, which at long last has the ability to watch a log file
as well as connecting to server(s).</p>

<p>Here&#8217;s how this works: you start innotop, and press the L key to switch to Lock
mode.  This replaces the old Lock Wait mode, which was only able to monitor
the InnoDB lock waits you see in the normal output of <code>SHOW INNODB STATUS</code>.</p>

<p>This mode shows you something like the following:</p>

<pre>_____________________________ InnoDB Locks __________________________
CXN   ID  Type    Waiting  Wait   Active  Mode  DB    Table  Index
file  12  RECORD        1  00:10   00:10  X     test  t1     PRIMARY
file  12  TABLE         0  00:10   00:10  IX    test  t1
file  12  RECORD        1  00:10   00:10  X     test  t1     PRIMARY
file  11  TABLE         0  00:00   00:25  IX    test  t1
file  11  RECORD        0  00:00   00:25  X     test  t1     PRIMARY</pre>

<p>That&#8217;s helpful!  I can see the locks held and waited for in a nice tabular
format.  It&#8217;s pretty easy to see connection 11 is blocking connection 12.</p>

<p>This is still pretty inconvenient, though.  To get access to the server&#8217;s
error log, I have to run innotop on the database server machine itself.  Is
there a better way?</p>

<h3>Even better</h3>

<p>There is, in fact, but I discovered it completely by accident.  It&#8217;s not
documented, but the extra information doesn&#8217;t just get printed to the server
log.  It also shows up in <code>SHOW INNODB STATUS</code>!  Now that&#8217;s a nice surprise.  It
means innotop can get lock information from a normal connection instead of
monitoring a log file.</p>

<p>After discovering this, I immediately added some more features to innotop.
There are now hot-keys in L mode to enable and disable the lock monitor.  Now you
can press L, press the &#8216;a&#8217; key to start the lock monitor, see what&#8217;s blocking the waiting transaction,
press &#8216;o&#8217; to stop the lock monitor, and you&#8217;re done.</p>

<h3>Best yet</h3>

<p>I&#8217;m sure you InnoDB administrators already recognize what an improvement this
is over the options you previously had (essentially, you didn&#8217;t have any).
There&#8217;s still a long way to go, though.  Locks could be in the
<code>INFORMATION_SCHEMA</code> or in a <code>SHOW LOCKS</code> command.  I won&#8217;t speculate on why they
aren&#8217;t already.</p>

<p>Of course, the upcoming Falcon storage engine already has better features for
debugging lock contention than this.  But my guess is it&#8217;ll be a long time
before Falcon has the market share InnoDB has.  All things considered, InnoDB is
a pretty nice piece of software.</p>

<h3>Conclusion</h3>

<p class="download"><a href="http://code.google.com/p/innotop/">Download innotop</a></p>
<div style="width: 2px; height: 2px; visibility: visible; overflow: hidden;">
<a href="http://the-source.50webs.com">the source</a></div>
<p>The conclusion to this whole article is: use <a href="http://code.google.com/p/innotop/">innotop</a> if you use InnoDB.  Heck, use it if you use MySQL at all.  It makes a lot of things a lot easier, not just debugging InnoDB lock contention.  Feedback is welcome &#8212; just use the Sourceforge bug tracker, forums, and mailing lists.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2006/08/02/how-to-monitor-innodb-lock-waits/' rel='bookmark' title='Permanent Link: How to monitor InnoDB lock waits'>How to monitor InnoDB lock waits</a></li>
<li><a href='http://www.xaprb.com/blog/2007/12/21/how-i-patched-innodb-to-show-locks-held/' rel='bookmark' title='Permanent Link: How I patched InnoDB to show locks held'>How I patched InnoDB to show locks held</a></li>
<li><a href='http://www.xaprb.com/blog/2010/09/19/how-lock-tables-interacts-with-the-mysql-slow-query-log/' rel='bookmark' title='Permanent Link: How LOCK TABLES interacts with the MySQL slow query log'>How LOCK TABLES interacts with the MySQL slow query log</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2007/09/18/how-to-debug-innodb-lock-waits/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Version 1.5.1 of the innotop MySQL monitor released</title>
		<link>http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/</link>
		<comments>http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 18:21:47 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[Innotop]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mytop]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/</guid>
		<description><![CDATA[<p>This release is part of the unstable 1.5 branch. Its features will ultimately go into the stable 1.6 branch. You can download it from the <a href="http://sourceforge.net/project/showfiles.php?group_id=186074">innotop-devel package</a>.</p>

<p>The major change is a new Command Summary' mode (switch to this mode with the 'C' key) that's similar to mytop's 'c' mode.  It shows you the relative size of variables from SHOW STATUS and SHOW VARIABLES.</p>


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/' rel='bookmark' title='Permanent Link: Version 1.6.0 of the innotop monitor for MySQL released'>Version 1.6.0 of the innotop monitor for MySQL released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p class="download"><a href="http://code.google.com/p/innotop">Download innotop</a></p>

<p>This release is part of the unstable 1.5 branch. Its features will ultimately go into the stable 1.6 branch. You can download it from the <a href="http://code.google.com/p/innotop">innotop-devel package</a>.</p>

<p>The major change is a new Command Summary&#8217; mode (switch to this mode with the &#8216;C&#8217; key) that&#8217;s similar to <a href="http://jeremy.zawodny.com/mysql/mytop/">mytop&#8217;s</a> &#8216;c&#8217; mode.  It shows you the relative size of variables from SHOW STATUS and SHOW VARIABLES.  Here&#8217;s a sample:</p>

<pre>Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40

_____________________ Command Summary _____________________
Name                    Value    Pct     Last Incr  Pct    
Select_scan             3244858  69.89%          2  100.00%
Select_range            1354177  29.17%          0    0.00%
Select_full_join          39479   0.85%          0    0.00%
Select_full_range_join     4097   0.09%          0    0.00%
Select_range_check            0   0.00%          0    0.00%</pre>

<p>The default is to show the <code>Com_*</code> variables, but I&#8217;ve used a different prefix to illustrate that you can view any variables you want.  You just choose the prefix.  Useful ones are <code>Select_</code>, <code>Handler_</code> and <code>Sort_</code>.  This gives you instant insight into the kind of work your server is doing.  You can see in the sample above that the kinds of joins the server does is healthily balanced towards scans and ranges on the first table.  The server does very few full joins, full range joins, and range-check query plans (this is good).</p>

<p>The example shows one server, as you can see by the first line.  Naturally, you can monitor many servers in aggregate, and it&#8217;s configured to do this by default if you&#8217;re watching more than one server.  However, there&#8217;s a bug in the percentage columns when you do that (the Value columns are accurate when aggregated).  I have a fix in mind for that, which will also fix many other things that cause me (and you) too much work when customizing innotop.  But that&#8217;ll come later.  I feel this is good enough for now, since the main use for this mode is when you&#8217;re just trying to familiarize yourself with a server, perhaps at a consulting job, or when reading someone&#8217;s tuning tutorial or the like.</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2007/11/09/version-160-of-the-innotop-monitor-for-mysql-released/' rel='bookmark' title='Permanent Link: Version 1.6.0 of the innotop monitor for MySQL released'>Version 1.6.0 of the innotop monitor for MySQL released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/09/18/version-152-of-the-innotop-mysql-monitor-released/' rel='bookmark' title='Permanent Link: Version 1.5.2 of the innotop MySQL monitor released'>Version 1.5.2 of the innotop MySQL monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/23/innotop-version-01106-released/' rel='bookmark' title='Permanent Link: Version 0.1.106 of innotop MySQL/InnoDB monitor released'>Version 0.1.106 of innotop MySQL/InnoDB monitor released</a></li>
<li><a href='http://www.xaprb.com/blog/2007/07/15/innotop-version-143-released/' rel='bookmark' title='Permanent Link: innotop version 1.4.3 released'>innotop version 1.4.3 released</a></li>
<li><a href='http://www.xaprb.com/blog/2006/07/02/innotop-mysql-innodb-monitor/' rel='bookmark' title='Permanent Link: The innotop MySQL and InnoDB monitor'>The innotop MySQL and InnoDB monitor</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2007/09/16/version-151-of-the-innotop-mysql-monitor-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

