mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Use new style Retry in CopyRowsInsertSelect.pm.
This commit is contained in:
@@ -85,24 +85,23 @@ sub copy {
|
||||
wait => sub { sleep 1; },
|
||||
tries => 3,
|
||||
try => sub {
|
||||
my ( %args ) = @_;
|
||||
eval {
|
||||
$dbh->do($sql);
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
MKDEBUG && _d($EVAL_ERROR);
|
||||
if ( $EVAL_ERROR =~ m/Lock wait timeout exceeded/ ) {
|
||||
$error = $EVAL_ERROR;
|
||||
if ( $args{tryno} > 1 ) {
|
||||
$msg->("Lock wait timeout exceeded; retrying $sql");
|
||||
}
|
||||
return;
|
||||
}
|
||||
die $EVAL_ERROR;
|
||||
}
|
||||
return 1;
|
||||
$dbh->do($sql);
|
||||
return;
|
||||
},
|
||||
fail => sub {
|
||||
my (%args) = @_;
|
||||
my $error = $args{error};
|
||||
MKDEBUG && _d($error);
|
||||
if ( $error =~ m/Lock wait timeout exceeded/ ) {
|
||||
$msg->("Lock wait timeout exceeded; retrying $sql");
|
||||
return 1; # call wait, call try
|
||||
}
|
||||
return 0; # call final_fail
|
||||
},
|
||||
final_fail => sub {
|
||||
my (%args) = @_;
|
||||
die $args{error};
|
||||
},
|
||||
on_failure => sub { die $error; },
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user