Repository navigation
Description
Is there an existing issue already for this bug?
- I have searched for an existing issue, and could not find anything.
I have read the troubleshooting guide
- Yes.
I am running a supported version of CloudNativePG
- Yes.
Version
1.29.0
What version of Kubernetes are you using?
1.30
What is your Kubernetes environment?
Yandex Cloud Managed Kubernetes
How did you install the operator?
Helm
What happened?
After a supervised switchover the old primary ends up in CrashLoopBackOff with FATAL: recovery aborted because of insufficient parameter settings whenever an enforced parameter (max_connections etc.) was decreased in the spec before the switchover.
Related to #10395, but a distinct code path: there the parameter is removed from the spec; here it is present but decreased, and verifyParametersForFollower is skipped for a different reason — it short-circuits on IsPrimary(), and on the demoting pod IsPrimary() is still true when initialize() runs.
Reproduce
Reproduced cleanly on 1.29.0; the old primary loops every ~13 seconds with the FATAL below.
- Two-instance Cluster with
max_connections: "150"andprimaryUpdateStrategy: supervised. - Wait until both instances report
max_connections setting: 150inpg_controldata. - Decrease spec to
max_connections: "100". Replica restarts and picks up the new value; primary stays on 150, cluster goes tophase=Waiting for user action. - Trigger a supervised switchover.
- Old primary tries to rejoin as a standby and enters CrashLoopBackOff:
FATAL: recovery aborted because of insufficient parameter settings
DETAIL: max_connections = 100 is a lower setting than on the primary server, where its value was 150.
Root cause
initialize() (internal/management/controller/instance_controller.go) calls verifyParametersForFollower first and verifyPgDataCoherenceForPrimary second. The follower check short-circuits on the demoting pod:
if isPrimary, _ := r.instance.IsPrimary(); isPrimary {
return nil
}IsPrimary() is still true at this point — standby.signal hasn't been written yet. The check is skipped.
verifyPgDataCoherenceForPrimary (instance_startup.go) then runs the switchover branch: WaitForPrimaryAvailable → pg_rewind → Demote(). Demote() only writes standby.signal and primary_conninfo; it does not align the enforced parameters. initialize() returns and PostgreSQL starts with the lower value, hits XLOG_PARAMETER_CHANGE from its own previous WAL, and aborts startup.
Proposed fix
Either re-run verifyParametersForFollower after Demote(), or call the same alignment from Demote() itself before writing standby.signal. The underlying check already does the right thing — it just isn't reached on this path.
Relevant log output
{"level":"info","msg":"Starting up pg_rewind","logger":"instance-manager"}
{"level":"info","logger":"pg_controldata","msg":"... max_connections setting: 150 ..."}
LOG: entering standby mode
FATAL: recovery aborted because of insufficient parameter settings
DETAIL: max_connections = 100 is a lower setting than on the primary server, where its value was 150.
The old primary keeps looping; only deleting its PVC and letting CNPG re-bootstrap it via pg_basebackup from the new primary unblocks the cluster.
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
dosubot commentedon May 18, 2026
Your root cause analysis is accurate and well-documented. I verified it against the code:
The
IsPrimary()short-circuit —verifyParametersForFollowerbails out early becauseIsPrimary()is stilltruewhen the demoting pod'sinitialize()runs [1]. The status only flips tofalseafterDemote()writesstandby.signal[2], which happens later inverifyPgDataCoherenceForPrimary[3].The ordering in
initialize()—verifyParametersForFolloweris called beforeverifyPgDataCoherenceForPrimary[4], so the parameter safety check runs beforeDemote()is invoked — hence the gap.This is indeed distinct from #10395 [5], which covers the "parameter removed from spec" case (a double-skip in
LoadEnforcedParametersFromClusterandverifyParametersForFollower). Your scenario hits the same FATAL error but through theIsPrimary()timing path on the demoting pod specifically.The related PR #9952 fixed a parameter validation issue for replica clusters but doesn't address this standard-cluster supervised switchover path.
Your proposed fix of re-running
verifyParametersForFollowerafterDemote()(or aligning enforced parameters withinDemote()itself) looks like the right approach —Demote()currently only writesstandby.signalandprimary_conninfowithout touching the enforced parameters [6].To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
ardentperf commentedon May 28, 2026
this is straightforward. repro script that worked on my machine:
ubuntu@cnpg1:~$ cat projects/cloudnative-pg/hack/reproduce-10716.shfix(instance): align enforced parameters on the demotion path (cloudn…
github-actions commentedon Jul 28, 2026
This issue is stale because it has been open for 60 days with no activity.
ermakov-oleg commentedon Jul 28, 2026
still relevant
github-actions commentedon Oct 11, 2026
This issue is stale because it has been open for 60 days with no activity.
ardentperf commentedon Oct 12, 2026
i think this might still repro on 1.30.1