tikv / raft-rs

Raft distributed consensus algorithm implemented in Rust.
Apache License 2.0
2.93k stars 394 forks source link

Make request_snapshot more safer #498

Closed ethercflow closed 1 year ago

ethercflow commented 1 year ago

ref https://github.com/tikv/tikv/pull/13491#discussion_r1061357600

When a follower uses this interface to actively request a snapshot from the leader, it is not safe to just pass the request log index. For example, when the requested log index is passed by the original leader through appendRPC, but the leader is down before committing the log and the newly elected leader does not contain this log and may never reach to the request_index.