[Feature / Bug]: ERROR: WAL archive check failed for server restore: Expected empty archive · Issue #350 · cloudnative-pg/plugin-barman-cloud · GitHub
Skip to content

[Feature / Bug]: ERROR: WAL archive check failed for server restore: Expected empty archive #350

Closed

Description

@smiyc

During restore tests

...
    recovery:
      source: restore
      database: app
      secret:
        name: restore-app       
      # recoveryTarget:
      #   targetTime: "2025-05-16 10:21:25.723492+02"

  externalClusters:
  - name: restore
    plugin:
      name: barman-cloud.cloudnative-pg.io
      parameters:
        barmanObjectName: restore-c800
        serverName: restore
...

I disabled the plugin by setting enabled and isWALArchiver to false

...
  plugins:
  - name: barman-cloud.cloudnative-pg.io
    enabled: false    
    isWALArchiver: false
    parameters:
      barmanObjectName: restore-c800        
...
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
  name: restore-c800
spec:
  retentionPolicy: "7d"
  configuration:
    destinationPath: "s3://xxx"     
    endpointURL: "https://sxxx"
    endpointCA:
       name: xxx-ca
       key: tls.crt     
    s3Credentials:
      accessKeyId:
        name: xxx-creds
        key: ACCESS_KEY_ID
      secretAccessKey:
        name: xxx-creds
        key: ACCESS_SECRET_KEY
    wal:
      compression: gzip # bzip2;gzip;snappy
      maxParallel: 2
    data:
      compression: gzip # bzip2;gzip;snappy
      immediateCheckpoint: true  
      jobs: 2         

but the plugin still complains about

ERROR: WAL archive check failed for server restore: Expected empty archive

As a workaround, I commented out the plugin

...
  # plugins:
  # - name: barman-cloud.cloudnative-pg.io
  #   enabled: false    
  #   isWALArchiver: false
  #   parameters:
  #     barmanObjectName: restore-c800      
...

After that, the restore is working.

Then comment it in (not enabled)

  plugins:
  - name: barman-cloud.cloudnative-pg.io
    enabled: false
    isWALArchiver: false
    parameters:
      barmanObjectName: restore-c800

no error

enabling it

  plugins:
  - name: barman-cloud.cloudnative-pg.io
    enabled: true    
    isWALArchiver: true
    parameters:
      barmanObjectName: restore-c800

no error

select pg_switch_wal();

no error, the not empty archive is being used.

IMO if the plugin is disabled and not used as WALArchiver, it should not check for an empty archive but during enabling it should.
But I the plugin would behave like this, what should be the consequence during enabling on an not empty archive?
Shutting it down the cluster is maybe also not an elegant way...

What do you think?

Activity

  1. sxd commented on Aug 21, 2025

    @sxd
    Contributor

    Closing fixed here #457

  2. magnus-longva-bouvet commented on Jul 3, 2026

    @magnus-longva-bouvet

    I've read the issue description and the PR which fixes it, and I'm a bit confused. The PR is about correcting the behaviour of the skipEmptyWalArchiveCheck annotation, but that annotation is not used at all in @smiyc 's example.

    I can still reproduce the behaviour in this issue in v1.30.0. Even if isWALArchiver is set to false, creation of the cluster fails with "Expected empty archive".

    I believe the example in this issue surfaces another bug - or at least, another type of unexpected behaviour. If you create a cluster without barman plugin, and then modify that cluster to have barman plugin, then the .check-empty-wal-archive file has already been deleted before we add the plugin, and the plugin's CheckBackupDestination is never invoked. This happens regardless of what the skipEmptyWalArchiveCheck annotation is set to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions