Make %ignore_code and %warn_code global to "fix" Perl 5.8 scoping/closure issue.

This commit is contained in:
Daniel Nichter
2012-05-18 09:05:43 -06:00
parent d7b9ccf19b
commit a618a41894

View File

@@ -5886,6 +5886,30 @@ use sigtrap 'handler', \&sig_int, 'normal-signals';
my $oktorun = 1;
my $print_header = 1;
# The following two hashes are used in exec_nibble().
# They're static, so they do not need to be reset in main().
# See also https://bugs.launchpad.net/percona-toolkit/+bug/919499
# Completely ignore these error codes.
my %ignore_code = (
# Error: 1592 SQLSTATE: HY000 (ER_BINLOG_UNSAFE_STATEMENT)
# Message: Statement may not be safe to log in statement format.
# Ignore this warning because we have purposely set statement-based
# replication.
1592 => 1,
);
# Warn once per-table for these error codes if the error message
# matches the pattern.
my %warn_code = (
# Error: 1265 SQLSTATE: 01000 (WARN_DATA_TRUNCATED)
# Message: Data truncated for column '%s' at row %ld
1265 => {
# any pattern
# use MySQL's message for this warning
},
);
sub main {
# Reset global vars else tests will fail in strange ways.
@ARGV = @_;
@@ -6923,27 +6947,6 @@ sub ts {
return $msg ? "$ts $msg" : $ts;
}
{
# Completely ignore these error codes.
my %ignore_code = (
# Error: 1592 SQLSTATE: HY000 (ER_BINLOG_UNSAFE_STATEMENT)
# Message: Statement may not be safe to log in statement format.
# Ignore this warning because we have purposely set statement-based
# replication.
1592 => 1,
);
# Warn once per-table for these error codes if the error message
# matches the pattern.
my %warn_code = (
# Error: 1265 SQLSTATE: 01000 (WARN_DATA_TRUNCATED)
# Message: Data truncated for column '%s' at row %ld
1265 => {
# any pattern
# use MySQL's message for this warning
},
);
sub exec_nibble {
my (%args) = @_;
my @required_args = qw(Cxn tbl NibbleIterator Retry Quoter OptionParser);
@@ -7089,7 +7092,6 @@ sub exec_nibble {
}
);
}
}
{
my $line_fmt = "%14s %6s %6s %8s %7s %7s %7s %-s\n";