cowsql / raft

Asynchronous C implementation of the Raft consensus protocol
https://raft.readthedocs.io
Other
53 stars 6 forks source link

legacy: Add a `step_cb()` callback which filres after each `raft_step()` call #99

Closed freeekanayaka closed 1 year ago

freeekanayaka commented 1 year ago

The cowsql code needs to immediately detect when leadership lost after a raft_step() call, in order to close all client connections. So far, this has been done using a uv_prepare handle, but that is unreliable, since a lot of data might accumulate in the kernel TCP buffers when for example the process is paused (e.g. by the Jepsen nemesis), and the prepare handle does not have a chance to run.

This branch also fixes a few other bugs that were surfaced by Jepsen tests.