openraft icon indicating copy to clipboard operation
openraft copied to clipboard

vote request should have timeout control.

Open drmingdrmer opened this issue 3 years ago • 2 comments

I don't think that would work. When I read the code correctly that timeout would simply lead to a lot of them piling up and being executed later - as the vote is spawed in a new task and doesn't prevent multiple of those tasks to be spawned in parallel.

Right. vote request should have timeout control. This is a missing feature :(. It should be done the same as append-entries does: https://github.com/datafuselabs/openraft/blob/062d24cbdeb4939469a400772e494554be4232b6/openraft/src/core/raft_core.rs#L390-L409

What I could see is returning an error on each call instead of sending; perhaps that's an option? Perhaps with adding something like ReplicationError::Backoff ?

When the raft sees a BackOff error, what does it do with it? As I can see, it is application specific. The raft could just stop calling RaftNetwork API for a while. But what if the application wants to retry sending out some data to check if the network is restored?

IMHO, it's the raft's responsibility to tell the application what should be done, and it's the application's responsibility to decide how to do it. Raft just needs to ensure everything goes well no matter what the application's decision is, e.g., not to pile up too many unfinished tasks.

Originally posted by @drmingdrmer in https://github.com/datafuselabs/openraft/issues/462#issuecomment-1191728827

drmingdrmer avatar Jul 21 '22 17:07 drmingdrmer

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

github-actions[bot] avatar Jul 21 '22 17:07 github-actions[bot]

/assignme

ClSlaid avatar Jul 26 '22 03:07 ClSlaid

Fixed in 0d024b3ae99d51d108181bdc5baafa80d3d1b376 Thanks to @ClSlaid

drmingdrmer avatar Aug 18 '22 02:08 drmingdrmer