Closed JackyWoo closed 1 year ago
@JackyWoo
Actually, apply_snapshot()
is for the purpose of resetting state machine (and then applying snapshot). Why don't you put your clean-up logic into apply_snapshot()
? Unless reset()
is independently used for somewhere else in NuRaft, having that API separate from apply_snapshot()
seems to me redundant.
Got it, thanks.
Use case
If a node leave cluster for a long time, when it startup it wil first load local data into memory then it will receive the
append_entry
request from leader and leader will check data ga. If the gap can not satisfied by log, leader will send sanpshot.The newly startup node reveive the sanpshot and load it into memory.But it should clear data in memory first, if not inconsistence may occur, details see here.
I think it is better to add a new reset API.