Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Pending backups can preempt a backup that is already executing Backup scheduling must…

  1. 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.

  2. Assistant

    The build hit a fork resource limit; retrying with limited parallelism:

  3. Assistant

    Build and vet pass. Now run the unit tests for the affected packages:

  4. Assistant

    Tests pass; gofmt wants reformatting (the doc-comment list). Fix and re-check:

  5. Assistant

    Now run the controller test package and add regression tests for the new behavior. First look at the existing test structure:

  6. Assistant

    All checks pass. Summary of the fix:

    Bug

    In CanExecuteBackup (api/v1/backup_funcs.go), the scheduling loop used IsInProgress(), which treats pending the same as started/running. Since the list is sorted by name, a pending backup whose name sorted before an actually executing backup was granted execution — preempting a backup that already held active resources (WAL archiving session, snapshot in flight, etc.).

    Changes — api/v1/backup_funcs.go

    1. New IsExecuting() method on *Backup (api/v1/backup_funcs.go:148): returns true only for BackupPhaseStarted or BackupPhaseRunning — the phases where the backup holds active resources.

    2. CanExecuteBackup rewritten (api/v1/backup_funcs.go:178):

      • If any backup is executing, only that backup may proceed — pending backups can never preempt it. (With multiple executing backups from a race, the first in alphabetical order wins, preserving the existing tie-breaker.)
      • When none is executing, the oldest pending backup by creation time is selected, with the name-sorted list providing a deterministic tie-break for equal creation times (strict Before comparison keeps the alphabetically-first item).
    3. GetPendingBackupNames now uses IsExecuting(), so backups explicitly in the pending phase are correctly reported as pending (previously they vanished from the list because IsInProgress() excluded them).

    Tests

    • Added IsExecuting() assertions across all phases (including the previously untested started) in api/v1/backup_funcs_test.go.
    • Added regression cases: an older, alphabetically-first pending backup does not preempt a running one; and with no executing backup, the oldest pending backup is chosen even when its name sorts last.
    • go test ./api/v1/ and go test ./internal/controller/ pass; go vet and gofmt clean.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.