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
Now let me check other usages of
IsInProgressand related helpers to gauge impact: - Assistant
Now add the
SortByCreationTimehelper next to the other sort functions: - Assistant
Now run the existing tests and add coverage for the new behavior. First, let me see the beginning of the test file:
- Assistant
Now add
CanExecuteBackuptests for the preemption fix and oldest-pending selection: - Assistant
All green. Run vet just on the changed package to be sure:
- Assistant
Everything checks out. Summary of the fix:
Problem
In
CanExecuteBackup(api/v1/backup_funcs.go), the scheduling loop usedIsInProgress(), which includesBackupPhasePending. Since the list was sorted alphabetically, a pending backup whose name sorted before an actively executing (Started/Running) backup would win the loop — the executing backup was returnedfalseand demoted back to pending by the controller, i.e. preempted mid-execution. Pending selection was also name-ordered rather than oldest-first.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.