fix: idempotent pitr disable + honest archiver unknown state - #1059
Merged
Conversation
- `pitr disable` now mirrors enable's already-state check: a second run reports "already disabled" instead of reverting a non-applied overlay (confusing server error at best, a pointless database redeploy at worst) or kicking another rolling HA workflow. - The live-probe archiver gate no longer conflates "no failure recorded" with "timestamp present but unparseable": the latter now yields the documented "unknown" state (previously unreachable) instead of a false healthy/unhealthy guess.
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.
Closes the two remaining findings from the postgres pitr adversarial review (follow-up to #1058).
What
pitr disableis now idempotent like enable. A seconddisable -yused to calltemplateRevertagainst a non-applied overlay (standalone) or kick the entire rolling HA disable workflow again. It now short-circuits with "PITR is already disabled" (stderr note under--json, pure-JSON stdout preserved) and sends no mutation.pg_stat_archivertimestamps that are present but unparseable (e.g. non-ISO DateStyle) were treated the same as absent, producing a false "healthy" while a failure was recorded — and the documentedarchiver_healthy: null/ "unknown" rendering was unreachable code. Empty-vs-unparseable are now distinct; unparseable yieldsunknown.Tests
TemplateRevertmutation is sent; HA disable fixtures updated to carry WAL vars (the realistic PITR-enabled state — the old fixtures were only passing because disable never checked).