wire: revive the connection between ops, so a dead pg is not forever #108

Merged
PerishFire merged 1 commit from wire-revive into main 2026-07-21 14:17:32 +00:00
Owner
No description provided.
wire: revive the connection between ops, so a dead pg is not forever
All checks were successful
guard / guard (pull_request) Successful in 1m33s
208098d5a9
A restarted postgres left the engine holding a corpse. adapt/pg.rs owns a
single PgConnection and never re-established it, so every op after the
restart failed and stayed failing — on the cluster this read as a login
that returned 401 forever, and only an api restart cleared it.

Wire grows a defaulted revive(), called from Core::seize() at the same
entry that rolls back a dirty seat. Reviving only BETWEEN ops means no
statement is re-issued and no write is replayed; the op that meets the
dead connection still fails, correctly. sqlite takes the default no-op.

Postgres tracks whether its last call was sound and pings only when it
was not: a ping on every op cost +0.2ms per read (500 reads 232ms ->
339ms, +43%) to save one failed request per outage, which is a bad
trade. Healthy paths now pay nothing (measured 208ms).

tests/pulse/pg::revived terminates the engine's own backend from a
second connection and pins the contract: one op fails, the next runs
revived. It fails without seize()'s revive call.

Law: txn.md X-9 plus a must-not; vocabulary.md registers revive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PerishFire deleted branch wire-revive 2026-07-21 14:17:32 +00:00
PerishFire referenced this pull request from a commit 2026-07-21 15:21:57 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
PerishLab/keel!108
No description provided.