Skip to content

fix: idempotent pitr disable + honest archiver unknown state - #1059

Merged
paulocsanz merged 1 commit into
masterfrom
pcs/pitr-disable-idempotent-archiver-unknown
Aug 8, 2026
Merged

fix: idempotent pitr disable + honest archiver unknown state#1059
paulocsanz merged 1 commit into
masterfrom
pcs/pitr-disable-idempotent-archiver-unknown

Conversation

@paulocsanz

Copy link
Copy Markdown
Collaborator

Closes the two remaining findings from the postgres pitr adversarial review (follow-up to #1058).

What

  • pitr disable is now idempotent like enable. A second disable -y used to call templateRevert against 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.
  • The archiver health gate reports "unknown" instead of guessing. pg_stat_archiver timestamps 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 documented archiver_healthy: null / "unknown" rendering was unreachable code. Empty-vs-unparseable are now distinct; unparseable yields unknown.

Tests

  • 927/927 unit tests (new: unknown-state cases for both unparseable timestamp positions, plus failed-never-archived).
  • Hermetic mock flows: idempotent-disable case asserts no TemplateRevert mutation 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).

- `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.
@paulocsanz paulocsanz added release/minor Author minor release release/patch Author patch release and removed release/minor Author minor release labels Aug 8, 2026
@paulocsanz
paulocsanz merged commit f67ac69 into master Aug 8, 2026
9 of 10 checks passed
@paulocsanz
paulocsanz deleted the pcs/pitr-disable-idempotent-archiver-unknown branch August 8, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/patch Author patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant