Files
scylladb/service/raft
Kamil Braun 41cac23aa4 Merge 'raft: verify RPC destination ID' from Mikołaj Grzebieluch
All Raft verbs include `dst_id`, the ID of the destination server, but
it isn't checked. `append_entries` will work even if it arrives at
completely the wrong server (but in the same group). It can cause
problems, e.g. in the scenario of replacing a dead node.

This commit adds verifying if `dst_id` matches the server's ID and if it
doesn't, the Raft verb is rejected.

Closes #12179

Testing
---

Testcase and scylla's configuration:
57d3ef14d8

It artificially lengthens the duration of replacing the old node. It
increases the chance of getting the RPC command sent to a replaced node,
by the new node.

In the logs of the node that replaced the old one, we can see logs in
the form:
```
DEBUG <time> [shard 0] raft_group_registry - Got message for server <dst_id>, but my id is <my_id>
```
It indicates that the Raft verb with the wrong `dst_id` was rejected.

This test isn't included in the PR because it doesn't catch any specific error.

Closes #13575

* github.com:scylladb/scylladb:
  service/raft: raft_group_registry: Add verification of destination ID
  service/raft: raft_group_registry: `handle_raft_rpc` refactor
2023-05-09 11:33:28 +02:00
..