NuRaft icon indicating copy to clipboard operation
NuRaft copied to clipboard

Wrong election timer config may cause never-ending leader election

Open greensky00 opened this issue 6 years ago • 1 comments

Let's say we have 3 servers: S1, S2, and S3. Suppose that we don't have leader now. S1 and S2's priorities are higher than S3.

However, let's assume that we have wrong config; election timeout for S1 and S2 is much longer than S3. Below is what will happen in such case:

  1. After some timeouts, S3's target priority is properly lowered.
  2. S3 will initiate pre-vote.
  3. S1 and S2 will accept the pre-vote.
  4. S3 will initiate actual vote.
  5. Since S1 and S2 haven't encountered election timeout, they reject the vote due to their target priority.
  6. S1 and S2 update their term; so reset their election timer.

Problem: S1 and S2 will never reach the election timeout, so that never reduce their target priority.

greensky00 avatar Aug 22 '19 17:08 greensky00

Fix: https://github.com/eBay/NuRaft/pull/33

greensky00 avatar Aug 27 '19 23:08 greensky00