From 72d56e3c19d86481195047791bbe7b7df619b479 Mon Sep 17 00:00:00 2001 From: Daniel Nichter Date: Mon, 14 May 2012 11:31:26 -0600 Subject: [PATCH] Catch Deadlock error and retry. --- bin/pt-online-schema-change | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index 321b078e..29c84834 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -4894,7 +4894,7 @@ use warnings FATAL => 'all'; use English qw(-no_match_vars); use constant PTDEBUG => $ENV{PTDEBUG} || 0; -use Time::HiRes qw(time); +use Time::HiRes qw(time sleep); use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; @@ -6585,7 +6585,7 @@ sub exec_nibble { return $retry->retry( tries => $o->get('retries'), - wait => sub { return; }, + wait => sub { sleep 0.25; return; }, try => sub { # ################################################################### # Start timing the query. @@ -6657,6 +6657,7 @@ sub exec_nibble { # The query failed/caused an error. If the error is one of these, # then we can possibly retry. if ( $error =~ m/Lock wait timeout exceeded/ + || $error =~ m/Deadlock found/ || $error =~ m/Query execution was interrupted/ ) { # These errors/warnings can be retried, so don't print