plugin-barman-cloud icon indicating copy to clipboard operation
plugin-barman-cloud copied to clipboard

base backup are not pruned (even though retention is set)

Open 0x366 opened this issue 9 months ago • 1 comments

hey, i’ve encountered a problem - retention policy works for wals, but not for base backups. Base backups are not pruned at all. Im using hetzner s3 if it matters, wals retention works fine

apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
  name: main-db-object-store
  namespace: main-db
spec:
  retentionPolicy: "7d"

  # needed for non-AWS S3-compatible object storages
  instanceSidecarConfiguration:
    env:
    - name: AWS_REQUEST_CHECKSUM_CALCULATION
      value: when_required
    - name: AWS_RESPONSE_CHECKSUM_VALIDATION
      value: when_required
    - name: AWS_MAX_ATTEMPTS
      value: "10"

  configuration:
    destinationPath: "...."
    endpointURL: "https://hel1.your-objectstorage.com/"
    s3Credentials:
      accessKeyId:
        name: hetzner-s3-creds
        key: ACCESS_KEY_ID
      secretAccessKey:
        name: hetzner-s3-creds
        key: ACCESS_SECRET_KEY
    wal:
      compression: gzip
      maxParallel: 4
      archiveAdditionalCommandArgs:
        - "--read-timeout=1200"
    data:
      compression: gzip
      jobs: 1
      additionalCommandArgs:
        - "--read-timeout=3600"
        - "--min-chunk-size=512MB"
---
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
  name: main-db-daily-backup
  namespace: main-db
spec:
  schedule: "0 0 2 * * *"
  backupOwnerReference: self
  cluster:
    name: main-db
  method: plugin
  pluginConfiguration:
    name: barman-cloud.cloudnative-pg.io

0x366 avatar Feb 18 '26 13:02 0x366

Hi @0x366! I'm Dosu and I’m helping the plugin-barman-cloud team.

This looks like it could be related to a known bug with concurrent status updates. When a backup completes at the same time retention policy enforcement runs, both try to update the ObjectStore status simultaneously, causing the retention enforcement to fail silently.

You can check your logs for errors like:

{"level":"error","msg":"Retention policy enforcement failed","error":"Operation cannot be fulfilled on objectstores.barmancloud.cnpg.io: the object has been modified; please apply your changes to the latest version and try again"}

If you see these errors, the retention policy is being skipped due to the race condition. PR #759 proposes a fix with retry logic but hasn't been merged yet.

Retention enforcement runs every 30 minutes on the primary pod, so if it keeps colliding with backup operations, base backups may never get pruned while WALs (which may be archived at different times) succeed.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about plugin-barman-cloud Share Dosu with your team

dosubot[bot] avatar Feb 18 '26 13:02 dosubot[bot]