raft-rs
raft-rs copied to clipboard
Initialize `next_idx` in Raft::new
In Raft::new
, we always create a ProgressSet
with setting next_idx
1 in each Progress
:
https://github.com/tikv/raft-rs/blob/f7f7d0121132ef6406b59fc774778285cd1477d6/src/raft.rs#L251-L255
In the situation where recovering the raft node, I think maybe we can just use the current Snapshot
's meta index as same as the implementation in restore_raft
:
https://github.com/tikv/raft-rs/blob/f7f7d0121132ef6406b59fc774778285cd1477d6/src/raft.rs#L1984-L1987
When a peer becomes leader, it will reset next_idx
to last_index + 1
for all followers. So I think it's OK?
I just want to make the implementation stay consistent with resotre_snapmeta
:). Feel free to close this.