Skip to content

fix(failover): say why no primary is elected when replicas diverged - #12028

Open
armru wants to merge 1 commit into
mainfrom
dev/12013
Open

armru wants to merge 1 commit into
mainfrom
dev/12013

Conversation

@armru

@armru armru commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

When the primary is lost and the only instances left have diverged from its timeline, the operator skips the election, as it never promotes a diverged instance. The cluster stays without a primary and nothing told why: the phase reason asked to wait for the instances to become active, and the ReplicasHealthy condition describes the replicas, not the missing primary.

The operator now sets the NoPromotableInstance condition on the Cluster while every active instance is recorded as diverged. Its message names the primary and the diverged instances. The condition is derived from the status of the instances, next to ReplicasHealthy, and is removed as soon as an instance that has not diverged is active again. The election is not changed.

The phase reason shown while the operator waits for the instances to become active now points to the conditions of the Cluster.

The documentation on diverged replicas mentions this case.

Closes #12013

@armru
armru requested a review from a team as a code owner November 25, 2026 10:47
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.28 release-1.30 labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@armru

armru commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

/test

@github-actions

Copy link
Copy Markdown
Contributor

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Nov 25, 2026
When the primary is lost and the only instances left have diverged from
its timeline, the operator skips the election, as it never promotes a
diverged instance. The cluster stays without a primary and nothing told
why: the phase reason asked to wait for the instances to become active,
and the `ReplicasHealthy` condition describes the replicas, not the
missing primary.

The operator now sets the `NoPromotableInstance` condition on the
Cluster while every active instance is recorded as diverged. Its message
names the primary and the diverged instances. The condition is derived
from the status of the instances, next to `ReplicasHealthy`, and is
removed as soon as an instance that has not diverged is active again.
The election is not changed.

The phase reason shown while the operator waits for the instances to
become active now points to the conditions of the Cluster.

The documentation on diverged replicas mentions this case.

Closes #12013

Signed-off-by: Armando Ruocco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases ok to merge 👌 This PR can be merged release-1.28 release-1.30

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants