diff --git a/bin/pt-duplicate-key-checker b/bin/pt-duplicate-key-checker index aa00d944..fc320f40 100755 --- a/bin/pt-duplicate-key-checker +++ b/bin/pt-duplicate-key-checker @@ -3136,7 +3136,6 @@ sub _iterate_dbh { } while ( my $tbl = shift @{$self->{tbls}} ) { - local $EVAL_ERROR; my $ddl = eval { $tp->get_create_table($dbh, $self->{db}, $tbl) }; if ( my $e = $EVAL_ERROR ) { my $table_name = "$self->{db}.$tbl"; diff --git a/bin/pt-index-usage b/bin/pt-index-usage index ea560667..8f8adfda 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -3966,7 +3966,6 @@ sub _iterate_dbh { } while ( my $tbl = shift @{$self->{tbls}} ) { - local $EVAL_ERROR; my $ddl = eval { $tp->get_create_table($dbh, $self->{db}, $tbl) }; if ( my $e = $EVAL_ERROR ) { my $table_name = "$self->{db}.$tbl"; diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index d82f5c8c..9a88b960 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -6782,7 +6782,6 @@ sub _iterate_dbh { } while ( my $tbl = shift @{$self->{tbls}} ) { - local $EVAL_ERROR; my $ddl = eval { $tp->get_create_table($dbh, $self->{db}, $tbl) }; if ( my $e = $EVAL_ERROR ) { my $table_name = "$self->{db}.$tbl"; diff --git a/lib/SchemaIterator.pm b/lib/SchemaIterator.pm index 4e44cd55..d4275339 100644 --- a/lib/SchemaIterator.pm +++ b/lib/SchemaIterator.pm @@ -352,7 +352,6 @@ sub _iterate_dbh { } while ( my $tbl = shift @{$self->{tbls}} ) { - local $EVAL_ERROR; my $ddl = eval { $tp->get_create_table($dbh, $self->{db}, $tbl) }; if ( my $e = $EVAL_ERROR ) { my $table_name = "$self->{db}.$tbl"; diff --git a/t/lib/SchemaIterator.t b/t/lib/SchemaIterator.t index 5dd72c0c..88f24d15 100644 --- a/t/lib/SchemaIterator.t +++ b/t/lib/SchemaIterator.t @@ -464,12 +464,49 @@ my $w = ''; like( $w, - qr/because SHOW CREATE TABLE failed:/, + qr/bug_1047335.crashed_table because SHOW CREATE TABLE failed:/, "->next() gives a warning if ->get_create_table dies from a strange error", ); +$dbh3->do(q{DROP DATABASE IF EXISTS bug_1047335_2}); +$dbh3->do(q{CREATE DATABASE bug_1047335_2}); + +my $broken_frm = File::Spec->catfile($trunk, qw(t lib samples broken_tbl.frm)); +my $db_dir_2 = File::Spec->catdir($master_basedir, "data", "bug_1047335_2"); + +use File::Copy qw(copy); + +copy($broken_frm, $db_dir_2); + +$dbh3->do("FLUSH TABLES"); + +$tmp_si = new SchemaIterator( + dbh => $dbh3, + OptionParser => $o, + Quoter => $q, + TableParser => $tp, + # This is needed because the way we corrupt tables + # accidentally removes the database from SHOW DATABASES + db => 'bug_1047335_2', + ); + +$w = ''; +{ + local $SIG{__WARN__} = sub { $w .= shift }; + 1 while $tmp_si->next(); +} + +like( + $w, + qr/\QSkipping bug_1047335_2.broken_tbl because SHOW CREATE TABLE failed:/, + "...same as above, but using t/lib/samples/broken_tbl.frm", +); + # This might fail. Doesn't matter -- stop_sandbox will just rm -rf the folder -eval { $dbh3->do("DROP DATABASE IF EXISTS bug_1047335") }; +eval { + $dbh3->do("DROP DATABASE IF EXISTS bug_1047335"); + $dbh3->do("DROP DATABASE IF EXISTS bug_1047335_2"); +}; diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);