diff --git a/go/logic/coordinator.go b/go/logic/coordinator.go index 1921daffc..f3ee4942f 100644 --- a/go/logic/coordinator.go +++ b/go/logic/coordinator.go @@ -377,9 +377,11 @@ func (c *Coordinator) ProcessEventsUntilDrained() error { switch binlogEvent := ev.Event.(type) { case *replication.GTIDEvent: + c.mu.Lock() if c.lowWaterMark == 0 && binlogEvent.SequenceNumber > 0 { c.lowWaterMark = binlogEvent.SequenceNumber - 1 } + c.mu.Unlock() case *replication.RotateEvent: c.currentCoordinatesMutex.Lock() c.currentCoordinates.LogFile = string(binlogEvent.NextLogName) diff --git a/go/logic/migrator.go b/go/logic/migrator.go index 39c248009..d90598ddc 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -1319,7 +1319,9 @@ func (this *Migrator) executeWriteFuncs() error { // We give higher priority to event processing. // ProcessEventsUntilDrained will process all events in the queue, and then return once no more events are available. - this.trxCoordinator.ProcessEventsUntilDrained() + if err := this.trxCoordinator.ProcessEventsUntilDrained(); err != nil { + return this.migrationContext.Log.Errore(err) + } this.throttler.throttle(nil) diff --git a/script/test b/script/test index bec4f67f5..3f66288d1 100755 --- a/script/test +++ b/script/test @@ -14,4 +14,4 @@ script/build cd .gopath/src/github.com/github/gh-ost echo "Running unit tests" -go test -v -p 1 -covermode=atomic ./go/... +go test -v -p 1 -covermode=atomic -race ./go/...