Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Former primary stuck at 1/2 after failover due to barman-cloud-check-wal-archive "Expected empty archive"

Aperta
#828 7 commenti 7 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, kubernetes, postgresql
Ambito
databases, devops

Direzione di ricerca

Riproducete il problema con un cluster initdb a tre istanze, con il plugin plugin-barman-cloud e isWALArchiver abilitati, quindi seguite la chiamata WAL Archive gRPC e il comportamento di barman-cloud-check-wal-archive sul Primary precedente. Verificate il percorso di Failover in cui un pod retrocesso attiva l’archiviazione nonostante la presenza di file WAL appartenenti a timeline precedenti. Il lavoro è completato quando tutti i pod tornano a 2/2 dopo uno Switchover o un Failover senza l’errore Expected empty archive.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Description

After a failover/switchover on a running cluster (bootstrapped with initdb, not a recovery/restore), the plugin-barman-cloud sidecar on replica pods keeps failing with "WAL archive check failed: Expected empty archive". This prevents the replica from becoming fully ready (1/2 containers).

The root cause is that barman-cloud-check-wal-archive is executed on every WAL Archive gRPC call, including on replica pods, and it fails because the S3 bucket already contains WAL files from previous timelines (which is expected after a switchover).

Environment
  • CloudNativePG operator: v1.28.1
  • plugin-barman-cloud: v0.11.0
  • PostgreSQL: 18.3 (ghcr.io/cloudnative-pg/postgresql:18.3)
  • Kubernetes: v1.31
  • Object storage: Ceph RGW (S3-compatible, via Rook)
Cluster configuration

The cluster is bootstrapped with initdb (no recovery, no externalClusters):

spec:
  instances: 3
  bootstrap:
    initdb:
      database: system
      encoding: UTF8
      owner: app
  plugins:
    - name: barman-cloud.cloudnative-pg.io
      enabled: true
      isWALArchiver: true
      parameters:
        barmanObjectName: my-object-store
Steps to reproduce
  1. Create a 3-instance CNPG cluster with initdb bootstrap and plugin-barman-cloud with isWALArchiver: true
  2. Wait for all 3 pods to be 2/2 Running
  3. A failover or switchover occurs (automatic or manual), changing the timeline (e.g., timeline 1 → 2 → 3)
  4. After the failover, one or more replica pods get stuck at 1/2 — the plugin-barman-cloud sidecar blocks WAL archiving
What happens

After the switchover, the former primary is demoted to replica. The instance manager detects leftover WAL files and explicitly triggers archiving on the demoted pod:

{"msg":"Detected ready WAL files in a former primary, triggering WAL archiving"}

This causes the plugin-barman-cloud sidecar to attempt WAL archiving. However, the S3 bucket legitimately contains WAL files from previous timelines (archived by this same pod when it was primary). The plugin executes barman-cloud-check-wal-archive, finds the bucket is not empty, and fails:

barman-cloud-check-wal-archive: ERROR: WAL archive check failed for server <cluster-name>: Expected empty archive

plugin-barman-cloud sidecar log (replica pod):

{"level":"info","msg":"barman-cloud-check-wal-archive checking the first wal"}
{"level":"info","logger":"barman-cloud-check-wal-archive","msg":"ERROR: WAL archive check failed for server <name>: Expected empty archive","pipe":"stderr"}
{"level":"error","msg":"Error invoking barman-cloud-check-wal-archive",
  "options":["--endpoint-url","http://<ceph-rgw>","--cloud-provider","aws-s3","s3://<bucket>","<server-name>"],
  "exitCode":-1,"error":"exit status 1"}
Expected behavior

All the cluster pods are correctly running after a switchover/failover.

Lingua principale
Go
Stelle
198
Fork
81
Merge medio
2g 6h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudnative-pg/plugin-barman-cloud

Tutte le issue di cloudnative-pg/plugin-barman-cloud

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.