From 3135a25c1f5bf07ebc08be668a19a4640e579c72 Mon Sep 17 00:00:00 2001 From: Cathal Coffey Date: Sun, 7 Feb 2021 14:29:10 +0000 Subject: [PATCH] HeartbeatLag must be < than --max-lag-millis and --cut-over-lock-timeout-seconds to continue --- go/logic/migrator.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/go/logic/migrator.go b/go/logic/migrator.go index c64b8be..2a038a8 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -497,9 +497,10 @@ func (this *Migrator) cutOver() (err error) { this.sleepWhileTrue( func() (bool, error) { heartbeatLag := this.migrationContext.TimeSinceLastHeartbeatOnChangelog() - maxLagMillisecondsThrottleThreshold := atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold) - if heartbeatLag > time.Duration(maxLagMillisecondsThrottleThreshold)*time.Millisecond { - this.migrationContext.Log.Debugf("current HeartbeatLag (%.2fs) is too high, it needs to be less than --max-lag-millis (%.2fs) to continue", heartbeatLag.Seconds(), (time.Duration(maxLagMillisecondsThrottleThreshold) * time.Millisecond).Seconds()) + maxLagMillisecondsThrottle := time.Duration(atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold)) * time.Millisecond + cutOverLockTimeout := time.Duration(this.migrationContext.CutOverLockTimeoutSeconds) * time.Second + if heartbeatLag > maxLagMillisecondsThrottle || heartbeatLag > cutOverLockTimeout { + this.migrationContext.Log.Debugf("current HeartbeatLag (%.2fs) is too high, it needs to be less than both --max-lag-millis (%.2fs) and --cut-over-lock-timeout-seconds (%.2fs) to continue", heartbeatLag.Seconds(), maxLagMillisecondsThrottle.Seconds(), cutOverLockTimeout.Seconds()) return true, nil } if this.migrationContext.PostponeCutOverFlagFile == "" {