database: a cut MariaDB primary acknowledges writes the new primary never gets (semi-sync timeout 10 s, fence waits behind the write) #186
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/keel#186
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found while the cross-site release test of the LNMP pair was prepared, 2026-10-16. Reproduced on a local MariaDB 11.8.6 pair (semi-synchronous, AFTER_SYNC), with the replica stopped by SIGSTOP as a cut.
Problem. On a MariaDB pair, a cut of the primary's site can lose writes that the old primary acknowledged. Two causes:
rpl_semi_sync_master_timeout = 10000is shorter than the VIP release (RELEASE_AFTER = 15 s, keel#174, the 0049 amendment of 2026-10-15). A write that waits for the replica's ACK on the cut primary commits and returns OK after 10 s. Then semi-sync is OFF and the next writes return OK at once, until the old primary drops the VIP at about 15 s and turns read only. These writes are errant: the new primary does not have them.keel database followsetsread_only = ONon the node that lost the VIP.SET GLOBAL read_only = ONwaits for the backup lock behind a write that waits for the ACK, and the write returns OK when the timeout ends:A
KILL CONNECTIONof the waiting write gives the client an error, not OK:The row stays on the old primary (an errant GTID, so the old primary comes back diverged and needs the confirmed reseed), but no client was told it is stored.
What is needed (the least power):
read_only = ON, so no waiting write gets an OK after the node lost the VIP. Replication threads and keel's own session stay.rpl_semi_sync_master_timeoutlonger than the VIP release plus the time follow needs, so the fence comes first. This changes the 10 s of the maintainer's answer of 2026-10-03 (0031). It keeps the fallback for a lost replica, only later.The pass criterion of the release test is "0 acknowledged writes lost" for a network cut of the primary. Without this fix, the LNMP pair fails it by design.
Measured in the cross-site rehearsal, 2026-10-16 (keel 0.23.29, lnmp 19.0-2; primary 9103 on BR2, replica 9102 and witness 9101 on BR1, 5 ms RTT). Cut of 9103 at 5554.20 (nft drops UDP 51820). A writer on each pair node wrote through the VIP only while the node carried it; a third writer on 9101 wrote through the VIP all the time.
Acknowledged ids: 1906. On 9102: 1894. Missing: 200131 to 200142 (12), all acknowledged by the cut 9103. After the heal 9103 was diverged: errant
0-470210458-277(and0-1455937763-6, the server id of its first boot). The 9101 client lost nothing: its write in flight at the cut was not acknowledged.The bridge mirrored this item to GitHub: https://github.com/Keel-Linux/keel/issues/165
Comments, labels and the open or closed state sync both ways.