mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-28 08:51:44 +00:00
Fix for 1047335: SchemaIterator fails when it encounters a crashed table
This commit is contained in:
@@ -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 {
|
||||
|
@@ -82,18 +82,12 @@ sub get_create_table {
|
||||
PTDEBUG && _d($show_sql);
|
||||
my $href;
|
||||
eval { $href = $dbh->selectrow_hashref($show_sql); };
|
||||
if ( $EVAL_ERROR ) {
|
||||
# TODO: I think we fail silently for tools which may try to call
|
||||
# this on temp tables, or don't care if the table goes away. We
|
||||
# should warn $EVAL_ERROR and require callers to eval us and do
|
||||
# what they want with the warning.
|
||||
PTDEBUG && _d($EVAL_ERROR);
|
||||
|
||||
if ( my $e = $EVAL_ERROR ) {
|
||||
# Restore old SQL mode.
|
||||
PTDEBUG && _d($old_sql_mode);
|
||||
$dbh->do($old_sql_mode);
|
||||
|
||||
return;
|
||||
die $e;
|
||||
}
|
||||
|
||||
# Restore old SQL mode.
|
||||
|
Reference in New Issue
Block a user