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
Existing tests remain compatible. Now let me add regression tests for the bug and the new
IsExecuting/ oldest-pending selection behavior: - Assistant
Good,
BackupPhaseis a proper type. Now add regression tests for preemption and oldest-pending selection: - Assistant
Resource limits in the sandbox — retrying with reduced parallelism:
- Assistant
The gofmt fix only reformatted the doc-comment bullets. Re-running the tests to confirm everything still passes:
- Assistant
Fixed. Summary of the change:
Root cause
In
CanExecuteBackup(api/v1/backup_funcs.go), the concurrency gate usedIsInProgress(), which countspendingalongsidestarted/running. Because the list was iterated in alphabetical order, a pending backup whose name sorted before an actually executing backup was granted execution — preempting a backup that already held active resources (WAL switch, snapshots in flight, etc.).Fix (
api/v1/backup_funcs.go)- Added
Backup.IsExecuting()— returnstrueonly forBackupPhaseStartedorBackupPhaseRunning, i.e. backups that hold active resources and must not be preempted.
- Added
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.