Skip to content

fix(failover): lower primary lease retry period default to 2s - #10950

Merged
mnencia merged 3 commits into
mainfrom
dev/primary-lease-retry-period
Jun 19, 2026
Merged

mnencia merged 3 commits into
mainfrom
dev/primary-lease-retry-period

Conversation

@mnencia

@mnencia mnencia commented Jun 19, 2026 •

Copy link
Copy Markdown
Member

The primary lease retry period sets how often a promoting replica polls for a cleanly released lease, so at the previous 5s default a switchover hand-over waited up to a full poll cycle and inflated switchover time in 5s steps. Adopt the conventional Kubernetes leader-election value of 2s, shortening the clean hand-over without shortening the lease-duration take-over wait that holds back a premature promotion.

The fast-failover e2e tests delete the primary abruptly, which SIGKILLs it before it can release the lease cleanly, so the promoting replica must wait out the full lease duration before taking over. That take-over window is part of the measured write outage and applies to every case, so the tests now budget it across all fast-failover scenarios rather than the sync case alone.

@mnencia
mnencia requested a review from a team June 19, 2026 09:47
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 19, 2026
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.28 labels Jun 19, 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

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 19, 2026
@leonardoce
leonardoce force-pushed the dev/primary-lease-retry-period branch from 0729313 to 4986ce3 Compare June 19, 2026 09:55
@mnencia

mnencia commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

/test ft=performance tl=4 d=main

@github-actions

Copy link
Copy Markdown
Contributor

@mnencia mnencia added do not backport This PR must not be backported - it will be in the next minor release and removed release-1.25 release-1.28 backport-requested ◀️ This pull request should be backported to all supported releases labels Jun 19, 2026
@leonardoce
leonardoce force-pushed the dev/primary-lease-retry-period branch from 4986ce3 to 90ae180 Compare June 19, 2026 10:28
@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Jun 19, 2026
@gbartolini
gbartolini force-pushed the dev/primary-lease-retry-period branch from 2d0dfd7 to 62c8e3b Compare June 19, 2026 10:57
@NiccoloFei

Copy link
Copy Markdown
Collaborator

/test ft=performance tl=4 d=main

@github-actions

Copy link
Copy Markdown
Contributor

@mnencia
mnencia force-pushed the dev/primary-lease-retry-period branch from 62c8e3b to 8d3d8d4 Compare June 19, 2026 11:53
@mnencia

mnencia commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

/test ft=performance tl=4 d=main

@github-actions

Copy link
Copy Markdown
Contributor

mnencia added 3 commits June 19, 2026 14:38
The primary lease retry period sets how often a promoting replica polls
for a cleanly released lease, so at the previous 5s default a switchover
hand-over waited up to a full poll cycle and inflated switchover time in
5s steps. Adopt the conventional Kubernetes leader-election value of 2s,
shortening the clean hand-over without shortening the lease-duration
take-over wait that holds back a premature promotion.

Signed-off-by: Marco Nenciarini <[email protected]>
The sync fast-failover test deletes the primary abruptly, so it never
releases the lease and the promoting replica must wait out the full
lease duration before taking over. Widen that case's budget by the
default lease duration; the async cases release within the grace period
and keep the tighter budget.

Signed-off-by: Marco Nenciarini <[email protected]>
The fast-failover tests delete the primary abruptly (quickDeletionPeriod).
It usually still releases the primary lease inside the grace period and a
replica promotes within a couple of seconds, but if the SIGKILL wins the
race the lease is left held and the promoting replica must observe it
unchanged for a full lease duration, then claim it on its next poll,
before it can promote. That take-over window is engine-independent and
dominates the failover when it happens, so bound the per-case budget by it
(lease duration plus one retry period, with a small promotion margin)
rather than adding it to the per-engine base. Apply it to every
fast-failover case, not the sync one alone.

Signed-off-by: Marco Nenciarini <[email protected]>
@mnencia
mnencia force-pushed the dev/primary-lease-retry-period branch from 8d3d8d4 to 49a715e Compare June 19, 2026 12:38
@mnencia
mnencia merged commit 7eb5fd7 into main Jun 19, 2026
35 of 38 checks passed
@mnencia
mnencia deleted the dev/primary-lease-retry-period branch June 19, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not backport This PR must not be backported - it will be in the next minor release lgtm This PR has been approved by a maintainer no-issue ok to merge 👌 This PR can be merged size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants