A customer opened a support issue to ask about some help
determining why they were seeing a lot of Lock Wait Timeouts. I
asked them to enable the InnoDB Lock Monitor so that I could get
a look at what was going on in their transactions and whether
there might be some locks held longer than necessary.
The customer sent in a 184MB MySQL error log with 4773836 lines.
I started looking through it, but I could tell I was going to
need a better way to get a better overview of the file than what
I'd be able to piece together trying to poke through it and look
for individual lines. I started piping the file through a variety
of UNIX tools to narrow down what I was seeing.
I ended up with this mess:
< mysqld.err grep ACTIVE | cut -d' ' -f 2,4 | sort -rn -k 2 | perl -F, -ane 'print "$F[0] $F[1]" if not $v{$F[0]}; $v{$F[0]} = $F[1];' | head
It's hideous, but it's pretty helpful. Here's the output:
1EC080F1 …
[Read more]