From 75e0d123027b2a8fda1100eee1b624a404d081e6 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Thu, 18 Aug 2016 13:38:23 +0200 Subject: [PATCH] simplified error logic; fixed incorrect RowsEstimate handling on error --- go/logic/applier.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/go/logic/applier.go b/go/logic/applier.go index 7e526b9..10da785 100644 --- a/go/logic/applier.go +++ b/go/logic/applier.go @@ -880,15 +880,14 @@ func (this *Applier) ApplyDMLEventQuery(dmlEvent *binlog.BinlogDMLEvent) error { return nil }() - if err == nil { - atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1) + if err != nil { + err = fmt.Errorf("%s; query=%s; args=%+v", err.Error(), query, args) + return log.Errore(err) } + // no error + atomic.AddInt64(&this.migrationContext.TotalDMLEventsApplied, 1) if this.migrationContext.CountTableRows { atomic.AddInt64(&this.migrationContext.RowsEstimate, rowDelta) } - if err != nil { - err = fmt.Errorf("%s; query=%s; args=%+v", err.Error(), query, args) - log.Errore(err) - } - return err + return nil }