diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index 3fcd1eb0..cd6a9a97 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -1773,7 +1773,7 @@ my $dest_dsn; # Some common patterns and variables my $d = qr/(\d+)/; # Digit -my $t = qr/(\d+ \d+)/; # Transaction ID +my $t = qr/((?:\d+ \d+)|(?:[A-Fa-f0-9]+))/; # Transaction ID my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address my $n = qr/([^`\s]+)/; # MySQL object name my $w = qr/(\w+)/; # Words @@ -2030,6 +2030,7 @@ sub parse_deadlocks { while ( my ( $start, $name, $text, $end ) = splice(@matches, 0, 4) ) { next unless $name eq 'LATEST DETECTED DEADLOCK'; $dl_text = $text; + last; } return {} unless $dl_text; diff --git a/t/pt-deadlock-logger/basics.t b/t/pt-deadlock-logger/basics.t index 6a25e4eb..ab2c4d66 100644 --- a/t/pt-deadlock-logger/basics.t +++ b/t/pt-deadlock-logger/basics.t @@ -31,6 +31,8 @@ my $output; my $cnf = "/tmp/12345/my.sandbox.cnf"; my $cmd = "$trunk/bin/pt-deadlock-logger -F $cnf h=127.1"; +$dbh1->commit; +$dbh2->commit; $sb->wipe_clean($dbh1); $sb->create_dbs($dbh1, ['test']); @@ -38,6 +40,7 @@ $sb->create_dbs($dbh1, ['test']); $dbh1->do("create table test.dl(a int) engine=innodb"); $dbh1->do("insert into test.dl(a) values(0), (1)"); $dbh1->commit; +$dbh2->commit; $dbh1->{InactiveDestroy} = 1; $dbh2->{InactiveDestroy} = 1; @@ -79,6 +82,8 @@ foreach my $child ( 0..1 ) { foreach my $child ( keys %children ) { my $pid = waitpid($children{$child}, 0); } +$dbh1->commit; +$dbh2->commit; # Test that there is a deadlock $output = $dbh1->selectrow_hashref('show /*!40101 engine*/ innodb status')->{status}; @@ -160,6 +165,8 @@ ok( # ############################################################################# # Done. # ############################################################################# +$dbh1->commit; +$dbh2->commit; $sb->wipe_clean($dbh1); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); exit;