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

@@ -226,13 +226,11 @@ sub get_create_table {
PTDEBUG && _d($show_sql);
my $href;
eval { $href = $dbh->selectrow_hashref($show_sql); };
if ( $EVAL_ERROR ) {
PTDEBUG && _d($EVAL_ERROR);
if ( my $e = $EVAL_ERROR ) {
PTDEBUG && _d($old_sql_mode);
$dbh->do($old_sql_mode);
return;
die $e;
}
PTDEBUG && _d($old_sql_mode);
@@ -3138,7 +3136,18 @@ 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";
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 {