libraft
libraft copied to clipboard
LeaderElection never ends
For some reasons, libraft nodes repeatedly handle election timeout and change role FOLLOWER->CANDIDATE, even when the term number is 100+. The YAML files used are sxx-kayvee.yml under testenv dir.
It's been a couple of years since I've looked at the code, but...it's hard to debug this without seeing the logs from all the nodes. FWIW, you could see this if the timeouts are too aggressive for the network setup you have, or if messages are repeatedly lost, etc.
The logs from all the nodes are same as follow:
INFO [TIME] io.libraft.algorithm.RaftAlgorithm: [SERVER_ID]: handle election timeout INFO [TIME] io.libraft.algorithm.RaftAlgorithm: [SERVER_ID]: changing role FOLLOWER->CANDIDATE in term [TERM_ID]
BTW, a java.sql.SQLException: [SQLITE_BUSY] The database file is locked exception was thrown when I commented the raftConfiguration.setXXX() functions at line 110~116 in KayVee.java. Don't know the cause of this exception...
Why did you comment those functions out?