Skip to content

fix: keel vip promote --old-primary-gone waits on the old primary 1.5 s at most (keel#108) - #121

Merged
marcos-mendez merged 1 commit into
mainfrom
fix/promote-old-primary-gone-bounded
Oct 9, 2026
Merged

marcos-mendez merged 1 commit into
mainfrom
fix/promote-old-primary-gone-bounded

Conversation

@marcos-mendez

@marcos-mendez marcos-mendez commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #108 (finding B7 of Keel-Linux/handbook#60, again in the 0.23.7 rollout, Keel-Linux/handbook#62).

Problem

keel vip promote --old-primary-gone took 30.5 s with the old primary dead: three serial waits for the members' channel's 10 s timeout (the epoch, the release, the announcement).

Change (after the safety review)

  • With etcd formed: the old primary's lease fences it. Each ask of it (the release, the announcement) runs in a thread of its own and waits at most 1.5 s (keel/mesh/vipnode.py, bounded, GONE_BOUND); the other peers are not held up. The promote still waits for the lease to go and never revokes it (decision 0049). The ask goes on after the bound, in a thread that is not a daemon, and the promote waits for it before it returns (vipnode.finished), so a slow live old primary still gets the release and the claim.
  • Without etcd: nothing fences a live old primary (no lease, no lifetime on its address), so nothing is bounded, as before. docs/vip.md, the help of keel vip promote and keel database promote, and the docstring of commands.promote_vip say that, without etcd, an old primary that is alive but cannot be reached stays writable until it learns the newer claim.
  • debian/changelog 0.23.8.

Tests

  • Without etcd, a slow old primary (0.6 s, bound 0.3 s) still releases before the new holder takes the VIP.
  • With etcd, a hung old primary costs the bound and the late asks are joined; an old primary that answers after the bound still drops the VIP.
  • tests/mariadb_netns.py: the crash case writes at the VIP from C every 0.1 s (after the replica is connected and semi-synchronous) and reports the write downtime, its parts and the acknowledged rows lost.

Measured (mariadb / trixie, etcd, 250 ms ±25 ms, 2 % loss)

Each ask of the dead old primary: 1.5 s (no answer within 1.5 s, never timed out). With etcd the claim waits for the old primary's lease (TTL 20 s, 0049); #122 removes the lag after the VIP lands. 0 acknowledged rows lost.

CI record

Green at 44a4c68. vip / trixie failed once at g_promote_b (etcdctl get: context deadline exceeded, the same failure as main's run 37833124848); I reran that job once (run 37890526886): green. Earlier head 94bae41: mesh / trixie failed once in test_mesh_channel (TLS EOF), rerun once: green.

…primary 1.5 s at most (keel#108)

With the old primary dead, keel vip promote --old-primary-gone took
30.5 s on a real pair: it waited three times for the members' channel's
10 s timeout, for the epoch, the release and the announcement.

With --old-primary-gone and etcd formed, the old primary's lease fences
it. Each ask of it (the release, the announcement) now runs in a thread
of its own and waits at most 1.5 s (vipnode.GONE_BOUND); the other
peers are not held up. The promote still waits for the old primary's
lease to go and never revokes it, as decision 0049 requires. The ask
goes on after the bound, in a thread that is not a daemon, and the
promote waits for it before it returns (vipnode.finished), so a slow
live old primary still gets the release and the claim.

Without etcd nothing fences a live old primary: no lease, no lifetime
on its address. A live old primary slower than the bound would keep the
VIP and stay writable beside the new one. So without etcd nothing is
bounded, as before. docs/vip.md, the help of both commands and the
docstring of commands.promote_vip say that, without etcd, an old
primary that is alive but cannot be reached stays writable until it
learns the newer claim.

Tests: without etcd, a slow old primary still releases first; with etcd,
a hung old primary costs the bound and the late asks are joined; an old
primary that answers after the bound still drops the VIP. In mariadb /
trixie the crash case writes at the VIP from C every 0.1 s and reports
the unplanned write downtime, its parts and the acknowledged rows lost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keel vip promote --old-primary-gone takes 30.5 s (three 10 s timeouts)

1 participant