tarantool icon indicating copy to clipboard operation
tarantool copied to clipboard

Raft: decide on worker fiber vs async writes

Open Gerold103 opened this issue 5 years ago • 0 comments

Initially in Raft implementation it was decided to use ev_check/ev_prepare watchers to dump Raft state on disk when it changes. This didn't work, because these watchers are invoked from a scheduler fiber, where it is not possible to yield.

Need to check if this is true - perhaps it is not possible to yield only in ev_check because it is last. And ev_prepare would work.

Also Raft has another watcher - ev_timer to track when leader dies, and when election times out. For dumping currently Raft has a worker fiber to perform state dumps, as a workaround.

So in total, Raft uses both fiber and watcher to perform "async" work. That is inconsistent. Either ev_timer should be removed, and the worker fiber should do the waiting, or the fiber should be removed, and the dumping should be done using async WAL writes with a completion callback.

Gerold103 avatar Sep 09 '20 22:09 Gerold103