diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 476d3f4c..0c3f7858 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -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"; diff --git a/sandbox/servers/5.5/data.tar.gz b/sandbox/servers/5.5/data.tar.gz index d8d9507c..d4152496 100644 Binary files a/sandbox/servers/5.5/data.tar.gz and b/sandbox/servers/5.5/data.tar.gz differ diff --git a/t/pt-table-checksum/bugs.t b/t/pt-table-checksum/bugs.t index c4a10401..a8082926 100644 --- a/t/pt-table-checksum/bugs.t +++ b/t/pt-table-checksum/bugs.t @@ -38,7 +38,7 @@ elsif ( !$slave_dbh ) { plan skip_all => 'Cannot connect to sandbox slave1'; } else { - plan tests => 5; + plan tests => 7; } # The sandbox servers run with lock_wait_timeout=3 and it's not dynamic @@ -114,6 +114,28 @@ is_deeply( "Bug 987393 (empty table): checksums" ) or print STDERR Dumper($rows); +# ############################################################################# +# https://bugs.launchpad.net/percona-toolkit/+bug/919499 +# MySQL error 1592 with MySQL 5.5.18+ and Perl 5.8 +# ############################################################################# +$output = output( + sub { + print `$trunk/bin/pt-table-checksum $master_dsn -t sakila.country 2>&1`; + } +); + +is( + PerconaTest::count_checksum_results($output, 'errors'), + 0, + "Bug 987393 (Perl 5.8 scoping): no errors" +); + +is( + PerconaTest::count_checksum_results($output, 'rows'), + 109, + "Bug 987393 (Perl 5.8 scoping): checksummed table" +); + # ############################################################################# # Done. # #############################################################################