Skip to content

[Bug]: no clear signal when the primary is lost and only diverged replicas are left #12013

In review

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 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

No response

Version

trunk (main)

What version of Kubernetes are you using?

1.37

What is your Kubernetes environment?

Self-managed: kind (evaluation)

How did you install the operator?

YAML manifest

What happened?

#11251 fences a replica that diverged from the primary's timeline and never promotes it. The fence stays until the replica is rebuilt.

This is a rare corner case that needs several failures in a row. A failover promotes a replica that was behind another one, so the other one diverges and is fenced. Then the new primary is lost for good (its node and its volume) before the diverged replica is rebuilt, and no healthy replica exists. I reproduced it on kind with 3 instances.

In that state there is nothing to promote and the cluster stays without a primary. Skipping the election is correct, but the cluster does not say why. The phase is "Waiting for the instances to become active", with the reason "Some instances are not yet active. Please wait.". The operator logs one Info line, about once per second: "No promotable candidate found, every instance is fenced, skipping the election". It does not mention the divergence. ReplicasHealthy stays False with reason ReplicasDiverged, but it describes the replica, not the missing primary. The fencing event tells the user to rebuild the replica with kubectl cnpg destroy, which needs a working primary.

failure_modes.md only covers rebuilding a diverged replica from a working primary.

It should be rare, but when it happens the cluster has no primary and nothing states the cause. I expected the cluster to say why it has no primary.

Related: #11251

Cluster resource

Relevant log output

Code of Conduct

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

Activity

  1. added
    bug 🐛
    on Nov 24, 2026
  2. assigned and unassigned on Nov 24, 2026
  3. added this to the 1.31.0 milestone on Nov 24, 2026
  4. added a commit that references this issue on Nov 25, 2026
    6aa6f28
  5. added a commit that references this issue on Nov 25, 2026
    4fb4932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions