Skip to content

[Feat]: check empty WAL destination when bootstrap method is pg_basebackup #8897

@mnencia

Description

@mnencia

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new issue.

What problem is this feature going to solve? Why should it be added?

When bootstrapping a PostgreSQL instance using the pg_basebackup bootstrap method, the validation that ensures the empty WAL archive destination doesn't run. That validation runs for other bootstrap methods (initdb, recovery) but is skipped for pg_basebackup. As a result, users can supply a configuration that points to an archive containing unrelated files, which can cause issues that are very hard to debug.

Describe the solution you'd like

Ensure that the archive destination path is empty also when the bootstrap method is pg_basebackup

Cluster resource

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-replica
spec:
  instances: 3
  imagePullPolicy: Always
  backup:
    barmanObjectStore:
      destinationPath: s3://backups/
      endpointURL: https://minio:9000
      endpointCA:
        key: ca.crt
        name: my-minio-server-cert
      s3Credentials:
        accessKeyId:
          name: minio
          key: ACCESS_KEY_ID
        secretAccessKey:
          name: minio
          key: ACCESS_SECRET_KEY
      wal:
        compression: zstd
      data:
        immediateCheckpoint: true
  bootstrap:
    pg_basebackup:
      source: source
  replica:
    enabled: true
    source: source
  externalClusters:
  - name: source
    connectionParameters:
      host: cluster-example-rw.default.svc
      user: streaming_replica
      sslmode: verify-full
      dbname: postgres
    sslKey:
      name: cluster-example-replication
      key: tls.key
    sslCert:
      name: cluster-example-replication
      key: tls.crt
    sslRootCert:
      name: cluster-example-ca
      key: ca.crt

  storage:
    size: 1Gi

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions