Skip to content

Commit 3135a25

Browse files
committed
HeartbeatLag must be < than --max-lag-millis and --cut-over-lock-timeout-seconds to continue
1 parent 503b7b0 commit 3135a25

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

go/logic/migrator.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,10 @@ func (this *Migrator) cutOver() (err error) {
497497
this.sleepWhileTrue(
498498
func() (bool, error) {
499499
heartbeatLag := this.migrationContext.TimeSinceLastHeartbeatOnChangelog()
500-
maxLagMillisecondsThrottleThreshold := atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold)
501-
if heartbeatLag > time.Duration(maxLagMillisecondsThrottleThreshold)*time.Millisecond {
502-
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())
500+
maxLagMillisecondsThrottle := time.Duration(atomic.LoadInt64(&this.migrationContext.MaxLagMillisecondsThrottleThreshold)) * time.Millisecond
501+
cutOverLockTimeout := time.Duration(this.migrationContext.CutOverLockTimeoutSeconds) * time.Second
502+
if heartbeatLag > maxLagMillisecondsThrottle || heartbeatLag > cutOverLockTimeout {
503+
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())
503504
return true, nil
504505
}
505506
if this.migrationContext.PostponeCutOverFlagFile == "" {

0 commit comments

Comments
 (0)