Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
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 bug.
I have read the troubleshooting guide
- I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- I have read the troubleshooting guide and I think this is a new bug.
Contact Details
Version
1.28 (latest patch)
What version of Kubernetes are you using?
1.35
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
YAML manifest
What happened?
This can be recreated in the CNPG kind cluster test setup by doing: ./hack/setup-cluster.sh create load deploy and applying the cluster configuration provided.
The problem happens if you have a cluster with dataDurability: preferred and failoverQuorum: true and also have a streaming startup probe. In this case the cluster never becomes ready since the replica instance cannot connect to the primary.
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-example
spec:
imageName: ghcr.io/cloudnative-pg/postgresql:15.15-202512080807-system-bullseye
storage:
size: 1Gi
instances: 2
replicationSlots:
highAvailability:
enabled: true
slotPrefix: _cnpg_
synchronizeLogicalDecoding: true
synchronizeReplicas:
enabled: true
updateInterval: 30
postgresql:
parameters:
pg_failover_slots.synchronize_slot_names: "name_like:%"
hot_standby_feedback: "on"
shared_preload_libraries:
- pg_failover_slots
synchronous:
method: any
number: 1
dataDurability: preferred
failoverQuorum: true
syncReplicaElectionConstraint:
enabled: false
primaryUpdateMethod: switchover
primaryUpdateStrategy: unsupervised
probes:
liveness:
isolationCheck:
connectionTimeout: 1000
enabled: true
requestTimeout: 1000
startup:
maximumLag: 64Mi
type: streamingRelevant log output
postgres {"level":"info","ts":"2026-04-24T07:10:04.753762899Z","logger":"postgres","msg":"record","logging_pod":"cluster-example-1","record":{"log_time":"2026-04-24 07:10:04.753 UTC","user_name":"postgres","database_name":"postgres","process_id":"84","connection_from":"[local]","session_id":"69eb174c.54","session_line_num":"1","command_tag":"PARSE","session_start_time":"2026-04-24 07:10:04 UTC","virtual_transaction_id":"21/2","transaction_id":"0","error_severity":"ERROR","sql_state_code":"42704","message":"unrecognized configuration parameter \"cnpg.synchronous_standby_names_metadata\"","query":"SHOW cnpg.synchronous_standby_names_metadata","application_name":"cnpg-instance-manager","backend_type":"client backend","query_id":"0"}}
postgres {"level":"error","ts":"2026-04-24T07:10:04.753789025Z","msg":"Reconciler error","logger":"instance-manager","logging_pod":"cluster-example-1","controller":"instance-cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"cluster-example","namespace":"default"},"namespace":"default","name":"cluster-example","reconcileID":"b22574d4-5601-4ddc-970a-c1b93ee02ddf","error":"ERROR: unrecognized configuration parameter \"cnpg.synchronous_standby_names_metadata\" (SQLSTATE 42704)","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...[]).reconcileHandler\n\t/Users/augusto.ribeiro/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:495\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...[]).processNextWorkItem\n\t/Users/augusto.ribeiro/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:438\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func1.1\n\t/Users/augusto.ribeiro/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:313"}Code of Conduct
- I agree to follow this project's Code of Conduct
Reacted by dosubot
Activity
dosubot commentedon Apr 24, 2026
Hi @augustoribeiro! I'm Dosu and I’m helping the cloudnative-pg team.
@augustoribeiro, this looks like a timing/race condition bug. The
cnpg.synchronous_standby_names_metadatacustom parameter is written to PostgreSQL'scustom.confonly when there are actual synchronous standby names to configure [1]. However, whenfailoverQuorum: trueis set, the instance manager on the primary tries to read this parameter viaSHOW cnpg.synchronous_standby_names_metadataregardless of whether it has been written yet [2] [3].In your 2-instance cluster with
dataDurability: preferred, here's the likely sequence:synchronous_standby_namesis empty (as designed bydataDurability: preferred— it disables sync replication when no replicas are available) [4]synchronous_standby_namesis empty,cnpg.synchronous_standby_names_metadatais never written tocustom.confSHOW cnpg.synchronous_standby_names_metadata→ PostgreSQL returns the "unrecognized configuration parameter" errorThis appears to be a genuine bug — the failover quorum code path doesn't handle the case where the metadata parameter hasn't been written yet because there are no synchronous standbys.
As a workaround, you could try temporarily removing
failoverQuorum: trueto let the cluster bootstrap, and then re-enable it once all instances are streaming. Alternatively, removing the streaming startup probe should also break the deadlock cycle.There are several related issues worth referencing: #8371 covers a similar parameter recognition problem during upgrades [5], and #8790 tracks a race condition where
synchronous_standby_namesis applied before replicas are ready [6].To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
drybalka-s commentedon Aug 12, 2026
We hit this on CloudNativePG 1.29.1 and can add a bit of detail on the mechanism,
because the visible symptom ("instance is never ready") is a consequence of something
that also blocks HA replication slot management.
What we observed
Fresh cluster bootstrap, 3 instances,
replicationSlots.highAvailability.enabled: true,synchronous: {method: any, number: 1, dataDurability: preferred, failoverQuorum: true},probes.startup.type: streaming.Primary comes up, the replica clones successfully, and then loops forever:
FATAL could not start WAL streaming: ERROR: replication slot "_cnpg_platform_2" does not exist
LOG waiting for WAL to become available at 0/4000018
info startup probe failing err="replica not connected via streaming replication"
On the primary,
SELECT count(*) FROM pg_replication_slotsreturns 0 — the operatornever created the HA slot. The instance manager errors out on every reconcile loop:
{"level":"error","logger":"instance-manager","controller":"instance-cluster",
"error":"ERROR: unrecognized configuration parameter "cnpg.synchronous_standby_names_metadata" (SQLSTATE 42704)"}
Why it is a deadlock, not just a noisy error
pkg/postgres/configuration.gowritescnpg.synchronous_standby_names_metadataonlywhen
synchronous_standby_namesis non-empty.dataDurability: preferred,synchronous_standby_namesis derived from healthyreplicas only. On a fresh cluster there are none, so neither GUC is written — we
confirmed
custom.confcontains onlycnpg.config_sha256.updateFailoverQuorumObjectruns atinternal/management/controller/instance_controller.go:275and calls
GetSynchronousReplicationMetadata, which doesSHOW cnpg.synchronous_standby_names_metadataand returns the 42704 error verbatim(
pkg/management/postgres/instance.go:1156; thelen(metadata) == 0 → nil, nilbranchonly covers "parameter exists but empty").
ReconcileReplicationSlotsat line 289 isnever reached — no
_cnpg_*slots are ever created.primary_slot_name, the slot does not exist, so it cannever stream, so
synchronous_standby_namesstays empty, so the GUC is never written.The cluster cannot recover on its own.
Manual workaround, and what it proves
Running on the primary:
mzwettler2 commentedon Aug 20, 2026
I ran into the same bug. However, I only changed
probes.readinessSame issue. The deployment gets stuck with an error message when the two instances are joined:
Running
SELECT pg_create_physical_replication_slot('_cnpg_smpg_pg_eng002_2');manually unblocks everything.This is for CNPG 1.30.0
Cluster.yaml
github-actions commentedon Oct 21, 2026
This issue is stale because it has been open for 60 days with no activity.
github-actions commentedon Nov 5, 2026
This issue was closed because it has been inactive for 14 days since being marked as stale.