Skip to content

[Bug]: failoverQuorum requires more than 2 instances #8679

Closed

Description

@ardentperf

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

[email protected]

Version

1.27 (latest patch)

What version of Kubernetes are you using?

1.31

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

YAML manifest

What happened?

The Cluster "pg-eu" is invalid: spec.instances: Invalid value: 2: failoverQuorum requires more than 2 instances.

just now got this error, while trying to test if quorum failover prevents data loss with preferred dataDurability and 2 instances. we probably don't want that check. if we have ANY 1 then we need both replicas available to safely failover (N=2 means three instances). if we have ANY 2 (or first 2) then we can failover with a single replica.

this design should work great even with two instances. if the second instance isn't yet added back in then we want to block failover. once the second instance is in synchronous_standby_names then we can failover

Cluster resource

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pg-eu
  annotations:
    alpha.cnpg.io/failoverQuorum: "true"
spec:
  instances: 2
  imageName: ghcr.io/cloudnative-pg/postgresql:17-bookworm
...

Relevant log output

The Cluster "pg-eu" is invalid: spec.instances: Invalid value: 2: failoverQuorum requires more than 2 instances.

Code of Conduct

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

Activity

  1. added
    triage
    on Sep 29, 2025
  2. dosubot commented on Sep 29, 2025

    @dosubot

    The validation requiring more than 2 instances for failoverQuorum in CloudNativePG is intentional and not a bug. This restriction is a safeguard to prevent unsafe failover scenarios and potential data loss in small clusters, especially when using dataDurability: preferred with only 2 nodes. The underlying logic is based on distributed systems theory: with just 2 instances, it's not possible to guarantee safe automatic promotion without risking split-brain or data loss if one node is unavailable. The quorum check (R + W > N) is designed to ensure that failover only happens when it's provably safe, which is generally only possible with 3 or more nodes in the cluster [docs].

    CloudNativePG maintainers and documentation recommend deploying clusters with at least 3 nodes for synchronous replication and failover quorum. Two-node clusters are inherently risky for automatic failover and are not fully supported for this feature [discussion][discussion]. There are no official workarounds for enabling failoverQuorum with only 2 instances, and the restriction is enforced in the operator's validation logic [PR #8589].

    If you need high availability with strong data durability guarantees, the best practice is to use at least 3 instances. For more details and design rationale, see the failover quorum documentation and related design discussions.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about cloudnative-pg Share Dosu with your team

  3. added a commit that references this issue on Sep 29, 2025
    a7ec718
  4. added a commit that references this issue on Sep 29, 2025
    ad6078d
  5. added a commit that references this issue on Sep 29, 2025
    32d983a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions