Pending backups can preempt a backup that is already executing Backup scheduling must…
- User
Pending backups can preempt a backup that is already executing
Backup scheduling must not select a pending backup while another backup is already executing. When none is executing, select the oldest pending backup, using a deterministic tie-break for equal creation times.
Interface
Type: Function Name: IsExecuting Path: api/v1/backup_funcs.go Input: () Output: bool Description: Returns true if the backup has started or is running. Use this to determine whether a backup holds active resources and should not be preempted.
- Assistant
I'll explore the backup scheduling code and implement
IsExecutingso pending backups can't preempt an active one. - Assistant
Identifying the bug:
CanExecuteBackuptreats pending backups as in-progress viaIsInProgress(), so a pending backup can run while another is executing. AddingIsExecuting()and updating scheduling logic. - Assistant
Adding tests for the new behavior and running the backup_funcs tests.
- Assistant
Updating the
CanExecuteBackupdoc comment to match the new behavior. - Assistant
Fixed the backup scheduling bug where pending backups could preempt an already-executing backup.
Root cause
CanExecuteBackupusedIsInProgress(), which treatspendingthe same asstarted/running. A pending backup that sorted first alphabetically could be selected even while another backup was actively executing.Changes in
api/v1/backup_funcs.go-
IsExecuting()— returnstrueonly forstartedandrunningphases, indicating a backup holds active resources. -
CanExecuteBackup()— usesIsExecuting()instead ofIsInProgress()when checking for active backups, so pending backups cannot preempt executing ones. -
GetPendingBackupNames()— collects backups that are not done and not executing (including explicitpendingphase), sorted by oldest creation time with name as a deterministic tie-break.
Scheduling behavior
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.