Implement all MySQL log parsers. Add report sections, and --report.

This commit is contained in:
Daniel Nichter
2013-02-20 18:20:55 -07:00
parent 0fda528700
commit cb9fe1fac3
4 changed files with 2555 additions and 296 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -97,15 +97,19 @@ sub new {
$dsn = $dp->copy($prev_dsn, $dsn); $dsn = $dp->copy($prev_dsn, $dsn);
} }
my $dsn_name = $dp->as_string($dsn, [qw(h P S)])
|| $dp->as_string($dsn, [qw(F)])
|| '';
my $self = { my $self = {
dsn => $dsn, dsn => $dsn,
dbh => $args{dbh}, dbh => $args{dbh},
dsn_name => $dp->as_string($dsn, [qw(h P S)]), dsn_name => $dsn_name,
hostname => '', hostname => '',
set => $args{set}, set => $args{set},
NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1, NAME_lc => defined($args{NAME_lc}) ? $args{NAME_lc} : 1,
dbh_set => 0, dbh_set => 0,
OptionParser => $o, ask_pass => $o->get('ask-pass'),
DSNParser => $dp, DSNParser => $dp,
is_cluster_node => undef, is_cluster_node => undef,
}; };
@@ -117,12 +121,11 @@ sub connect {
my ( $self ) = @_; my ( $self ) = @_;
my $dsn = $self->{dsn}; my $dsn = $self->{dsn};
my $dp = $self->{DSNParser}; my $dp = $self->{DSNParser};
my $o = $self->{OptionParser};
my $dbh = $self->{dbh}; my $dbh = $self->{dbh};
if ( !$dbh || !$dbh->ping() ) { if ( !$dbh || !$dbh->ping() ) {
# Ask for password once. # Ask for password once.
if ( $o->get('ask-pass') && !$self->{asked_for_pass} ) { if ( $self->{ask_pass} && !$self->{asked_for_pass} ) {
$dsn->{p} = OptionParser::prompt_noecho("Enter MySQL password: "); $dsn->{p} = OptionParser::prompt_noecho("Enter MySQL password: ");
$self->{asked_for_pass} = 1; $self->{asked_for_pass} = 1;
} }

View File

@@ -322,6 +322,7 @@ sub report_class {
# for this header, util/update-modules will remove them from the code. # for this header, util/update-modules will remove them from the code.
# *facepalm* # *facepalm*
my $class_header_format = <<'EOF'; my $class_header_format = <<'EOF';
%s %s
%s %s
%s %s

View File

@@ -87,7 +87,12 @@ while ( my $sampleno = readdir $dh ) {
$output, $output,
"$sample/$sampleno/$basename.txt", "$sample/$sampleno/$basename.txt",
cmd_output => 1, cmd_output => 1,
($sed ? (sed => [ $sed ]) : ()), sed => [
q{'s/File: .*/File: .../'},
q{'s/ hostname: .*/ hostname: .../'},
q{'s/ MySQL: .*/ MySQL: .../'},
($sed ? $sed : ()),
],
), ),
"$sampleno: $basename.txt" "$sampleno: $basename.txt"
) or diag("\n\n---- DIFF ----\n\n", $test_diff, ) or diag("\n\n---- DIFF ----\n\n", $test_diff,