fix: a PostgreSQL server of a pair starts as a primary only on the proven holder (keel#156) #175
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/keel!175
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/pg-start-fenced-156"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #156. Stacked on #174.
A returned old primary started as a primary at boot and after a heal, and keel stopped it 3 to 4 s later. A client with
synchronous_commitset tolocaloroffgot its write acknowledged in that window.Change
keel installs a drop-in for
postgresql@.service(systemd/postgresql@.service.d/keel-guard.conf). It runskeel database guardas root before each start:standby.signalpresent, or no claim yetstandby.signalwritten and the follow drop-in removed firstkeel database followstarts it once the VIP is provenThe guard asks nobody over the network. On a node with no pair it does nothing. If the spec of a pair cannot be read, it refuses the start.
This does not start the legitimate holder as a standby and then promote it: that path hits
FENCED_REFUSED, and each reboot would make a new timeline.Tests
tests/test_system_dbpgguard.py(8 cases), the CLI wiring, and a packaging test for the drop-in.keel#167: a cut of the site that held etcd's leader made the VIP holder drop the VIP for 2 to 4 s on real nodes. The new leader came 7.4 s after the cut. The kernel ended the address int(10 - age) - 1 s after the carry, so about 8 s after the last renewal that the majority confirmed. - RELEASE_AFTER is 15 s, not 10 s. The kernel now keeps the address up to 14 s after that renewal, which covers one election of 5 to 10 s and a renewal. The release stays 5 s inside the TTL of 20 s, which etcd counts from its receipt of the renewal, so a holder cut off from the majority has dropped the VIP before any claim is possible. - With the longer grace, a lease that was revoked early could look expired once the node waited until its due time. The controller now takes a lease as expired only when it first saw it gone at its due time (keel#165). - The netns tests read RELEASE_AFTER from keel, not a copy of 10 s. The 111 s with no etcd leader under netem is not changed here: see the analysis in keel#167. keel#168: during that time the watch stopped the holder's server ("not proven, the VIP is not on wg0"). The VIP came back, but the server stayed stopped: the watch followed only a server that answered. - keel database watch now runs keel database follow on the holder when its server does not answer. Follow starts it once the VIP is on wg0.66feb037258b2fb1ea848b2fb1ea84f4e09f48fcf4e09f48fc5a19d0d5695a19d0d569efcb17a637efcb17a637ce640b1499ce640b1499265ff5b47c265ff5b47cc56252b959