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 the controller usage and its tests:
- Assistant
Now add the
SortByCreationTimemethod with a deterministic tie-break: - Assistant
Now add the regression tests for preemption and oldest-pending selection:
- Assistant
Let me check other usages of
IsInProgressto make sure nothing else needs the executing/pending distinction: - Assistant
The fix is complete and all tests pass. Here's a summary:
The bug
CanExecuteBackupinapi/v1/backup_funcs.gosorted the backup list by name and treatedIsInProgress()— which includesBackupPhasePending— as "running". When the controller requeues a backup, it sets it topending(backup_controller.go:1077). So a pending backup whose name sorted before an actually executing backup was treated as the first in-progress backup and given the green light, preempting the backup already holding active resources.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.