pt-deadlock-logger: InnoDB timestamps have a different format in 5.6

This commit is contained in:
Brian Fraser
2012-12-19 13:48:24 -03:00
parent 42484ecd10
commit 3ebf56db1f

View File

@@ -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;