Skip to content

Commit

Permalink
Fix clock skew issue
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed May 20, 2024
1 parent ed10321 commit f45dc13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/planetscale/v2/vitessbackupschedule_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (vbsc *VitessBackupSchedule) GetSuccessfulJobsLimit() int32 {
// the VitessBackupSchedule will try catching up the missed scheduled runs one by one
// this can be extremely lengthy in the even of a big clock skew, if the number of missed scheduled
// jobs reaches either DefaultAllowedMissedRuns or the value specified by the user, the controller
// will give up looking for the previously missed run and simply wait until the next scheduled run.
// will give up looking for the previously missed run and error out.
// Setting the default to 100 is fair, catching up a up to 100 missed scheduled runs is not lengthy.
const DefaultAllowedMissedRuns = 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,9 @@ func getNextSchedule(vbsc planetscalev2.VitessBackupSchedule, now time.Time) (ti
lastMissed = t
missedRuns++

// If we have too many missed jobs, just bail out as given on the clock lag, looping over the schedule might take forever.
// If we have too many missed jobs, just bail out as the clock lag is too big
if missedRuns > vbsc.GetMissedRunsLimit() {
log.Warnf("too many missed runs, skipping all previous runs and forwarding to the next scheduled time")
return time.Time{}, sched.Next(now), nil
return time.Time{}, time.Time{}, fmt.Errorf("too many missed runs, check clock skew or increase .spec.allowedMissedRun")
}
}

Expand Down

0 comments on commit f45dc13

Please sign in to comment.