Skip to content

Add --no-started-backup-info to barman-cloud-backup - #1232

Open
Eyalm321 wants to merge 1 commit into
EnterpriseDB:REL_3_X_masterfrom
Eyalm321:no-started-backup-info
Open

Eyalm321 wants to merge 1 commit into
EnterpriseDB:REL_3_X_masterfrom
Eyalm321:no-started-backup-info

Conversation

@Eyalm321

@Eyalm321 Eyalm321 commented Oct 27, 2026 •

Copy link
Copy Markdown

Refs #1195.

Since 3.19.0 (BAR-1235), barman-cloud-backup uploads backup.info with status STARTED when the backup starts, and overwrites it with the final status when the backup ends. Object stores that refuse to overwrite an existing object reject that second upload, so every backup ends as FAILED even though all of its data was uploaded. Two examples: a Google Cloud Storage bucket with a retention policy (#1195), and a Cloudflare R2 bucket with a bucket lock rule. Neither versions objects, unlike S3 Object Lock, so the overwrite is refused rather than stored as a new version.

This adds an opt-in --no-started-backup-info flag that skips the STARTED upload, so backup.info is uploaded only once, when the backup ends, as in 3.18. The default is unchanged.

  • Applies to object store and snapshot backups. Hook-script mode never uploads a STARTED backup.info, so it is unaffected.
  • Docs: the barman-cloud-backup command reference describes the option and its trade-off: a running backup isn't listed in the catalog until it ends.
  • Tests: the flag is forwarded to CloudBackupUploader and CloudBackupSnapshot in both default and opt-out cases. A new coordinate_backup test runs against an in-memory store that refuses overwrites and asserts exactly one backup.info upload, with DONE on success and FAILED on failure. tests/test_barman_cloud_backup.py and tests/test_cloud.py pass (489 tests), and the full suite passed on the 3.20.1 tag.

We run this patch in production on CloudNativePG clusters that back up to an R2 bucket with a lock rule. With unpatched 3.20.1, every base backup to that bucket failed on the final backup.info upload. With the patch, a base backup to the same bucket completes, and WAL archiving is unaffected either way.

AI assistance disclosure (per AI_POLICY.md): this change was drafted with Claude (Anthropic) and is marked with an Assisted-by trailer. I reviewed the code, tests and docs, and I understand and stand behind the change.

Since 3.19.0, barman-cloud-backup uploads backup.info with status STARTED
when the backup starts, and overwrites it with the final status (DONE or
FAILED) when the backup ends. Object stores that refuse to overwrite an
existing object reject that second upload, so every backup ends as FAILED
even though all of its data was uploaded. Examples are a Google Cloud
Storage bucket with a retention policy and a Cloudflare R2 bucket with a
bucket lock rule. Neither versions objects, unlike S3 Object Lock, so the
overwrite is refused rather than stored as a new version.

The new --no-started-backup-info option skips the STARTED upload, so
backup.info is uploaded only once, when the backup ends, as in 3.18. The
default is unchanged. The option applies to both object store and
snapshot backups. It does not apply when barman-cloud-backup runs as a
hook script, which never uploads a STARTED backup.info.

References: EnterpriseDB#1195.

Assisted-by: Claude Opus 5.5
Signed-off-by: Eyal Mizrachi <eyal@casthook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant