From 034ea7646a3257d055a5f51a500d468f97117da2 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 26 Jul 2016 11:51:24 +0200 Subject: [PATCH] fix to throttle-control-replicas check --- go/logic/migrator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/logic/migrator.go b/go/logic/migrator.go index e1bf7c6..cd805d3 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -153,7 +153,11 @@ func (this *Migrator) shouldThrottle() (result bool, reason string) { if time.Duration(lag) > time.Duration(maxLagMillisecondsThrottleThreshold)*time.Millisecond { return true, fmt.Sprintf("lag=%fs", time.Duration(lag).Seconds()) } - if (this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica) && (atomic.LoadInt64(&this.allEventsUpToLockProcessedInjectedFlag) == 0) { + checkThrottleControlReplicas := true + if (this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica) && (atomic.LoadInt64(&this.allEventsUpToLockProcessedInjectedFlag) > 0) { + checkThrottleControlReplicas = false + } + if checkThrottleControlReplicas { replicationLag, err := mysql.GetMaxReplicationLag(this.migrationContext.InspectorConnectionConfig, this.migrationContext.ThrottleControlReplicaKeys, this.migrationContext.ReplictionLagQuery) if err != nil { return true, err.Error()