Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions go/logic/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,16 @@ func (mgtr *Migrator) retryOperationWithExponentialBackoff(operation func() erro
// consumeRowCopyComplete blocks on the rowCopyComplete channel once, and then
// consumes and drops any further incoming events that may be left hanging.
func (mgtr *Migrator) consumeRowCopyComplete() {
if err := <-mgtr.rowCopyComplete; err != nil {
// Abort synchronously to ensure checkAbort() sees the error immediately
mgtr.abort(err)
// Don't mark row copy as complete if there was an error
select {
case err := <-mgtr.rowCopyComplete:
if err != nil {
// Abort synchronously to ensure checkAbort() sees the error immediately
mgtr.abort(err)
// Don't mark row copy as complete if there was an error
return
}
case <-mgtr.migrationContext.GetContext().Done():
// Abort cancelled the context
return
}
atomic.StoreInt64(&mgtr.rowCopyCompleteFlag, 1)
Expand Down
Loading