From 7bd338faf75d6a501e7bcb3ede5df12c2640f415 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Thu, 20 Sep 2018 10:49:21 +0300 Subject: [PATCH] Fix to retry logic in row copy --- go/logic/migrator.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/go/logic/migrator.go b/go/logic/migrator.go index e9a8fa3..4178f19 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -1105,8 +1105,11 @@ func (this *Migrator) iterateChunks() error { // When hasFurtherRange is false, original table might be write locked and CalculateNextIterationRangeEndValues would hangs forever - hasFurtherRange, err := this.applier.CalculateNextIterationRangeEndValues() - if err != nil { + hasFurtherRange := false + if err := this.retryOperation(func() (e error) { + hasFurtherRange, e = this.applier.CalculateNextIterationRangeEndValues() + return e + }); err != nil { return terminateRowIteration(err) } if !hasFurtherRange { @@ -1128,7 +1131,7 @@ func (this *Migrator) iterateChunks() error { } _, rowsAffected, _, err := this.applier.ApplyIterationInsertQuery() if err != nil { - return terminateRowIteration(err) + return err // wrapping call will retry } atomic.AddInt64(&this.migrationContext.TotalRowsCopied, rowsAffected) atomic.AddInt64(&this.migrationContext.Iteration, 1)