From 79757865e36e2b0bf6ee214e10d77f0e2cc0982d Mon Sep 17 00:00:00 2001 From: Jakob Date: Thu, 9 Mar 2023 15:24:46 +0100 Subject: [PATCH] Only rollback destination if it's defined This change addresses https://jira.percona.com/browse/PT-2064 which causes PT-archiver to crash when hitting an error. We use pt-archiver to delete rows that shouldn't be moved to another destination, so `--dest` is not provided. In most places, we seem to check if `$dst` is actually defined before using it, so we might want to do the same in the `do_with_retries` function? --- bin/pt-archiver | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/pt-archiver b/bin/pt-archiver index 2cef0c15..070ef48a 100755 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -7287,9 +7287,11 @@ sub do_with_retries { $success = $OUT_OF_RETRIES; } $get_sth->finish; - trace('rollback', sub { - $dst->{dbh}->rollback; - }); + if ( $dst && $dst->{dbh} ) { + trace('rollback', sub { + $dst->{dbh}->rollback; + }); + } trace('rollback', sub { $src->{dbh}->rollback; });