Skip to content

Commit 5d23b72

Browse files
author
Shlomi Noach
authored
Merge pull request #107 from github/throttle-control-replicas
fix to throttle-control-replicas check
2 parents 0fb045d + 034ea76 commit 5d23b72

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

go/logic/migrator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ func (this *Migrator) shouldThrottle() (result bool, reason string) {
153153
if time.Duration(lag) > time.Duration(maxLagMillisecondsThrottleThreshold)*time.Millisecond {
154154
return true, fmt.Sprintf("lag=%fs", time.Duration(lag).Seconds())
155155
}
156-
if (this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica) && (atomic.LoadInt64(&this.allEventsUpToLockProcessedInjectedFlag) == 0) {
156+
checkThrottleControlReplicas := true
157+
if (this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica) && (atomic.LoadInt64(&this.allEventsUpToLockProcessedInjectedFlag) > 0) {
158+
checkThrottleControlReplicas = false
159+
}
160+
if checkThrottleControlReplicas {
157161
replicationLag, err := mysql.GetMaxReplicationLag(this.migrationContext.InspectorConnectionConfig, this.migrationContext.ThrottleControlReplicaKeys, this.migrationContext.ReplictionLagQuery)
158162
if err != nil {
159163
return true, err.Error()

0 commit comments

Comments
 (0)