diff --git a/bin/pt-deadlock-logger b/bin/pt-deadlock-logger index a223fd50..74047860 100755 --- a/bin/pt-deadlock-logger +++ b/bin/pt-deadlock-logger @@ -3759,7 +3759,7 @@ my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address my $n = qr/([^`\s]+)/; # MySQL object name my $u = qr/(\S+)/; # Username. This is somewhat wrong, but # usernames with spaces are rare enough. -my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp +my $s = qr/((?:\d{6}|\d{4}-\d\d-\d\d) .\d:\d\d:\d\d)(?: \p{Hex}+)?/; # InnoDB timestamp # A thread's proc_info can be at least 98 different things I've found in the # source. Fortunately, most of them begin with a gerunded verb. These are @@ -4140,8 +4140,11 @@ sub parse_deadlocks { # Extract some miscellaneous data from the deadlock. my ( $ts ) = $dl_text =~ m/^$s$/m; - my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/; - $ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year + 2000, $mon, $day, $hour, $min, $sec); + my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^((?:\d\d)?\d\d)-?(\d\d)-?(\d\d) +(\d+):(\d+):(\d+)$/; + if ( length($year) == 2 ) { + $year += 2000; + } + $ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year, $mon, $day, $hour, $min, $sec); my ( $victim ) = $dl_text =~ m/^\*\*\* WE ROLL BACK TRANSACTION \((\d+)\)$/m; $victim ||= 0;