mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
The ObjectStore a Postgres Cluster archives its WAL to is shared by every backup of the app, yet each running BackupJob server-side applied its own strategy's destination onto it every five seconds with forced ownership. Two BackupJobs of one app with different BackupClasses flipped the destination back and forth until the healthy backup failed too, and a webhook or apiserver blip during that apply failed the BackupJob at once. A BackupJob now writes the destination only before its cnpg.io/Backup exists, and waits, with a WaitingForOtherBackup condition, while another running BackupJob of the app has a Backup in flight. The check reads the informer cache, so jobs released together, or one created while another's Backup is not yet cached, can still both proceed; an atomic per-application claim is a separate change. Write errors that cannot succeed on retry (invalid, bad request, forbidden) still fail the job at once. Any other is retried for the backup deadline counted from its first failure since the job last left the queue, recorded in a DestinationApplied condition. Once the Backup exists the Cluster is only read, and a failed read is returned for a controller retry instead of failing the running backup. The plugin rollout deadline counts from the attach rather than from the job's start, so queueing before the attach no longer shortens it. Assisted-by: LLM Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>