Repository navigation
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
The isolation check only failed the liveness probe, leaving the shutdown to the kubelet's ordinary termination path. That is a smart shutdown: it lets already-open sessions keep committing for up to smartShutdownTimeout (180s default), while a replacement primary may already be promoting. On the first isolation failure, request an immediate shutdown of PostgreSQL directly, instead of waiting for the kubelet's SIGTERM. Immediate shutdown skips the checkpoint and the fast phase, so nothing delays it. The instance is already headed for a rewind, so the crash recovery this costs on the next start is free. Reuses the non-blocking request PR #11347 added for the same reason, a primary that can't be trusted to shut down cleanly. Firing on the first failure, rather than matching the kubelet's own failureThreshold, means a transient blip a retry would have cleared can trigger a shutdown too. Accepted trade-off: a truly isolated primary should stop immediately. This does not order detection against replica promotion. Detection follows the kubelet's probe cadence; promotion follows the primary lease's LeaseDuration on branches that have one (1.30+), with no time floor at all on branches that don't (1.28/1.29). At the defaults the two are roughly a tie, not a guaranteed order. Only PR #11357 closes that gap, by detecting isolation off the lease's own renewal clock instead of the probe. PR #11283 took the same approach as this patch. It was closed as partially superseded by #11357 on main. This is a backport-sized version for the release branches #11357 won't reach. Closes #11280 Signed-off-by: Marco Nenciarini <[email protected]>
mnencia
force-pushed
the
dev/11280-minimal
branch
from
September 18, 2026 12:35
782a61d to
7b67197
Compare
Member
Author
|
/test |
Contributor
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/35371475194 |
Member
Author
|
Not merging this. CI found it can shut down the primary on an ordinary transient connectivity blip, not just a real isolation event, which makes it unsafe to backport. Superseded by the primary-lease mechanism landing in 1.31. |
Closed
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The isolation check only failed the liveness probe, leaving the shutdown to the kubelet's ordinary termination path. That is a smart shutdown: it lets already-open sessions keep committing for up to smartShutdownTimeout (180s default), while a replacement primary may already be promoting.
On the first isolation failure, request an immediate shutdown of PostgreSQL directly, instead of waiting for the kubelet's SIGTERM. Immediate shutdown skips the checkpoint and the fast phase, so nothing delays it. The instance is already headed for a rewind, so the crash recovery this costs on the next start is free. Reuses the non-blocking request PR #11347 added for the same reason, a primary that can't be trusted to shut down cleanly.
Firing on the first failure, rather than matching the kubelet's own failureThreshold, means a transient blip a retry would have cleared can trigger a shutdown too. Accepted trade-off: a truly isolated primary should stop immediately.
This does not order detection against replica promotion. Detection follows the kubelet's probe cadence; promotion follows the primary lease's LeaseDuration on branches that have one (1.30+), with no time floor at all on branches that don't (1.28/1.29). At the defaults the two are roughly a tie, not a guaranteed order. Only PR #11357 closes that gap, by detecting isolation off the lease's own renewal clock instead of the probe.
PR #11283 took the same approach as this patch. It was closed as partially superseded by #11357 on main. This is a backport-sized version for the release branches #11357 won't reach.
Closes #11280