Fix for 1047335: SchemaIterator fails when it encounters a crashed table

This commit is contained in:
Brian Fraser
2012-10-30 18:35:49 -03:00
parent d616a7e5e6
commit 35f5f8d1e4
18 changed files with 232 additions and 68 deletions

View File

@@ -352,7 +352,22 @@ sub _iterate_dbh {
}
while ( my $tbl = shift @{$self->{tbls}} ) {
my $ddl = $tp->get_create_table($dbh, $self->{db}, $tbl);
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";
# SHOW CREATE TABLE failed. This is a bit puzzling;
# maybe the table got dropped, or crashed. Not much we can
# do about it; If the table is missing, just PTDEBUG it, but
# otherwise, warn with the error.
if ( $e =~ /\QTable '$table_name' doesn't exist/ ) {
PTDEBUG && _d("Skipping $table_name because it no longer exists");
}
else {
warn "Skipping $table_name because SHOW CREATE TABLE failed: $e";
}
next;
}
my $tbl_struct = $tp->parse($ddl);
if ( $self->engine_is_allowed($tbl_struct->{engine}) ) {
return {