eBay / NuRaft

C++ implementation of Raft core logic as a replication library
Apache License 2.0
1.02k stars 240 forks source link

Fix race on precommit when cluster is changed #554

Open antonio2368 opened 4 days ago

antonio2368 commented 4 days ago

On config changes, the precommit index will be updated instantly to index of config change. After it, request_append_entries is called which instantly commits up to precommit index if a node was removed from 2-node cluster. If logs were being applied at the same time it could lead to commit thread trying to commit logs that were still not precommitted. I couldn't find another explanation for such scenario. If my conclusions are wrong feel free to correct me. :pray: I also couldn't find a better way to fix it quickly.