Skip to content

Commit

Permalink
More robust section parsing of INNODB STATUS. closes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
Kjell-Magne Øierud committed May 10, 2011
1 parent 2e3e1ad commit 77c3f88
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mysql_
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ sub parse_innodb_status {

# Add a dummy section to the end in case the innodb status output
# has been truncated (Happens for status > 64K characters)
$_ .= "\n----------\nDUMMY\n";
$_ .= "\n----------\nDUMMY\n----------\n";

my %section_map = (

Expand Down Expand Up @@ -1560,7 +1560,12 @@ my $innodb_bigint_rx = qr{([[a-fA-F\d]+)(?: (\d+))?};
# ------------------
# ---TRANSACTION 1 2450838625, ACTIVE 831 sec, OS thread id 27 fetching rows, thread declared inside InnoDB 104

sub match_dashes { return m/\G-+\n(?!-)/gc; }
sub match_new_section {
return m/\G
-+\n # ---------------------------
(?= [A-Z\/ ]+\n # SECTION NAME
[=-]+\n)/gcx; # --------------------------- ('=' on end of output)
}


sub skip_line { return m/\G.*\n/gc; }
Expand All @@ -1579,7 +1584,7 @@ sub parse_section {

#warn substr($_, pos(), 10);
for (;;) {
return if match_dashes();
return if match_new_section;
next if $parser->();
skip_line();
}
Expand Down

0 comments on commit 77c3f88

Please sign in to comment.