mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 04:26:48 +00:00
Currently send_snapshot is the only two-way RPC used by Raft. However, the sender (the leader) does not look at the receiver's reply, other than checks it's not an error. This has the following issues: - if the follower has a newer term and rejects the snapshot for that reason, the leader will not learn about a newer follower term and will not step down - the send_snapshot message doesn't pass through a single-endpoint fsm::step() and thus may not follow the general Raft rules which apply for all messages. - making a general purpose transport that simply calls fsm::step() for every message becomes impossible. Fix it by actually responding with snapshot_reply to send_snapshot RPC, generating this reply in fsm::step() on the follower, and feeding into fsm::step() on the leader. * scylla-dev/raft-send-snapshot-v2: raft: pass snapshot_reply into fsm::step() raft: respond with snapshot_reply to send_snapshot RPC raft: set follower's next_idx when switching to SNAPSHOT mode raft: set the current leader upon getting InstallSnapshot