Skip to content

Do not wait for WAL receivers to stop before promoting a replica #11735

Closed as not planned

Description

@gbartolini

Before the primary lease, a failover or switchover could only select and promote a new primary once every WAL receiver in the cluster had reported itself down. That wait was the safeguard against two instances acting as primary. It also delayed failover and could leave it waiting indefinitely.

Proposal

The primary lease now guarantees that only one instance can act as primary at a time. The WAL receiver wait is therefore redundant and can be removed from the promotion path.

This takes away a source of delay and stuck-waiting states during failover and switchover. Promotion then depends only on the lease: the candidate acquires it, either when the previous holder releases it or when it expires, and then promotes.

This issue is being created after the PR (#11367), exceptionally. The aim is to group all the lease-related changes under the #11721 epic.

Activity

  1. added this to the 1.31.0 milestone on Oct 23, 2026
  2. added
    bug 🐛
    on Oct 23, 2026
  3. mnencia commented on Oct 28, 2026

    @mnencia
    Member

    Closing as not planned. The WAL receiver wait has to stay for now. The primary lease alone orders the promotion only after a former primary that stops on its own, and that needs an instance manager with the step-down, which 1.30 and older do not have. During an upgrade the former primary can still be on an older manager, keep running after its lease expires and keep streaming WAL, so the receiver wait is the only guard there.

    The wait is also bounded in practice. Once the failover is pending, the old primary gets a fast shutdown and then an immediate one, so its walsenders go away and the receivers drop. #11367 is closed.

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