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

Create new cluster using plugin configuration but always get this error in replica pod.

Open sujitkagarwal opened this issue 1 year ago • 4 comments

{"level":"error","ts":"2025-08-08T02:41:53.322975793Z","msg":"Error while handling GRPC request","logging_pod":"cluster-example-1","info":{"Server":{"Client":{"Client":{}},"InstanceName":"cluster-example-1","SpoolDirectory":"/controller/wal-restore-spool","PGDataPath":"/var/lib/postgresql/data/pgdata","PGWALPath":"/var/lib/postgresql/data/pgdata/pg_wal"},"FullMethod":"/cnpgi.wal.v1.WAL/Restore"},"error":"WAL file not found","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cnpg-i-machinery/pkg/pluginhelper/http.(*Server).Start.logFailedRequestsUnaryServerInterceptor.func2\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/pluginhelper/http/grpc.go:51\ngoogle.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1208\ngithub.com/cloudnative-pg/cnpg-i/pkg/wal._WAL_Restore_Handler\n\t/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/wal/wal_grpc.pb.go:214\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1405\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1815\ngoogle.golang.org/grpc.(*Server).serveStreams.func2.1\n\t/go/pkg/mod/google.golang.org/[email protected]/server.go:1035"}

sujitkagarwal avatar Aug 08 '25 02:08 sujitkagarwal

The "WAL file not found" error in your replica pod usually means the required WAL segments are missing from your object store. This is often caused by WAL archiving not working or being misconfigured on the primary. Common causes include: missing or incorrect isWALArchiver: true in your plugin config, a typo in the object store destinationPath (e.g., gcs:// instead of gs://), missing secrets, or S3/MinIO compatibility issues (like missing required environment variables for checksum validation) [source].

A recent fix (PR #458, merged 2025-08-06) ensures the plugin checks for an empty WAL archive both after restore and when archiving the first WAL file, which helps prevent this kind of issue [source]. If you're not running a version with this fix, you may encounter problems during replica startup if the WAL archive is empty or incomplete.

To troubleshoot:

  • Check your plugin-barman-cloud version and make sure it includes the fix from PR #458.
  • Double-check your cluster and ObjectStore configuration for typos, missing isWALArchiver: true, and that all secrets are in the same namespace as your cluster.
  • For MinIO/S3, ensure AWS_REQUEST_CHECKSUM_CALCULATION and AWS_RESPONSE_CHECKSUM_VALIDATION are set to when_required in your config.
  • Look at the primary pod logs for WAL archiving errors and confirm WAL files are present in the object store under the expected path.
  • Review the replica pod logs for any additional context.

If you share your (redacted) cluster and ObjectStore YAML, I can help spot any config issues.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about plugin-barman-cloud with Dosu Add Dosu to your team

dosubot[bot] avatar Aug 08 '25 03:08 dosubot[bot]

I have used below yaml and created fresh cluster

apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: cluster-example namespace: single spec: instances: 2 imageName: ghcr.io/cloudnative-pg/postgresql:15.3 imagePullPolicy: Always plugins: - name: barman-cloud.cloudnative-pg.io isWALArchiver: true parameters: barmanObjectName: s3-store storage: size: 1Gi enableSuperuserAccess: true monitoring: enablePodMonitor: true superuserSecret: name: superuser-secret

apiVersion: barmancloud.cnpg.io/v1 kind: ObjectStore metadata: name: s3-store spec: retentionPolicy: "30d" configuration: destinationPath: s3://dbaasreplicas3bkt/pgopen/testdemo2/ endpointURL: http://10.63.52.92:10443 s3Credentials: accessKeyId: name: cluster-example-secret-s3 key: ACCESS_KEY_ID secretAccessKey: name: cluster-example-secret-s3 key: ACCESS_SECRET_KEY wal: compression: gzip encryption: AES256 maxParallel: 8

sujitkagarwal avatar Aug 08 '25 03:08 sujitkagarwal

Your Cluster YAML looks correct, but the "WAL file not found" error almost always means the required WAL segments are missing from your S3 bucket—usually because WAL archiving isn't working or the ObjectStore config is incomplete.

Please check the following:

  1. Make sure you have an ObjectStore resource named s3-store in the single namespace, and that it includes a spec.configuration section with at least destinationPath (like s3://your-bucket/path), endpointURL (if using S3-compatible storage), and s3Credentials referencing a secret with ACCESS_KEY_ID and ACCESS_SECRET_KEY keys. Both the ObjectStore and the secret must be in the single namespace. docs

  2. If you're using MinIO or another S3-compatible provider, add these environment variables to your ObjectStore's instanceSidecarConfiguration.env:

    - name: AWS_REQUEST_CHECKSUM_CALCULATION
      value: when_required
    - name: AWS_RESPONSE_CHECKSUM_VALIDATION
      value: when_required
    

    For some providers, you may also need region: us-east-1 and usePathStyle: true under s3Credentials source.

  3. Check the primary pod logs for WAL archiving errors or S3-related errors (like x-amz-content-sha256 must be UNSIGNED-PAYLOAD, MissingContentLength, or XAmzContentSHA256Mismatch). These indicate S3 compatibility or credential issues.

  4. Confirm that WAL files are actually present in your S3 bucket under the expected path (usually in a wals/ subdirectory).

  5. Make sure your plugin-barman-cloud version includes the fix from PR #458 (merged 2025-08-06), which addresses issues with empty WAL archives during replica startup details.

If you can share your ObjectStore YAML and the referenced secret (with sensitive data redacted), I can help spot any config issues.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about plugin-barman-cloud with Dosu Add Dosu to your team

dosubot[bot] avatar Aug 08 '25 03:08 dosubot[bot]

I am using netapp S3 object storage ... earlier also I used the same for cluster but without plugin and it is working as expected.

Uploaded the screen shot of S3 object storage.

Image

sujitkagarwal avatar Aug 08 '25 03:08 sujitkagarwal