Backport !8857 to 19-1: Fall back to full backup when previous step is non-existent

What does this MR do and why?

Backport of !8857 (merged) to 19-1-stable.

Fixes server-side incremental backups failing for repositories that were non-existent (existed in the database but had no commits) during a prior backup.

Related: #7207

Problem

When a full backup runs against an uninitialized repository, Manager.Create records the backup as non_existent and returns before writing any ref or bundle blob. The committed manifest still references a ref_path pointing at a blob that was never created.

Once that repository receives commits, the next incremental backup bases its increment on the previous step's ref_path. Reading that missing blob to compute the negated refs fails with doesn't exist, and every subsequent daily incremental keeps failing until the manifest TOML is edited by hand. This blocks the common monthly-full + daily-incremental cadence at scale.

Solution

In ManifestLocator.BeginIncremental, fall back to writing a full backup step instead of an incremental when:

  • the previous backup was recorded as non_existent, or
  • the previous ref blob is missing from the sink.

The non_existent check also heals manifests already corrupted in object storage, since those carry non_existent = true — no manual TOML remediation required.

Backport notes

Both commits cherry-picked with git cherry-pick -x, no conflicts and no adaptation of the original changes:

  • Fall back to full backup when previous step is non-existent
  • backup: reuse loader sink and clarify incremental fallback guards

Additionally cherry-picked d4d3d91b1 (ci: Bump macOS version) from master. The test:macos job on 19-1-stable still pins macos-14-xcode-15, which SaaS macOS runners have removed from their allowed images, so the job fails in prepare_executor with disallowed image before any code runs. The bump is required to get a green pipeline here.

How to set up and validate locally

go test ./internal/backup/ -run 'TestManifestLocator|TestManager_Create|TestManager_Restore' -count=1

Passes on this branch.

MR acceptance checklist

  • Tests added for the new behaviour (carried over from !8857 (merged)).
  • No manual remediation of existing manifests required.
  • Documentation reviewed (no user-facing doc changes needed).
Edited by Mustafa Bayar

Merge request reports

Loading
Loading