raft: add error injection that drops append_entries

It will be needed for a test that simulates the cluster getting stuck
during upgrade. Specifically, it will be used to simulate network
isolation and to prevent raft commands from reaching that node.
This commit is contained in:
Piotr Dulikowski
2024-03-29 15:01:55 +01:00
parent cd1a336885
commit f112d76422

View File

@@ -123,6 +123,10 @@ void raft_group_registry::init_rpc_verbs() {
ser::raft_rpc_verbs::register_raft_append_entries(&_ms, [handle_raft_rpc] (const rpc::client_info& cinfo, rpc::opt_time_point timeout,
raft::group_id gid, raft::server_id from, raft::server_id dst, raft::append_request append_request) mutable {
return handle_raft_rpc(cinfo, gid, from, dst, [from, append_request = std::move(append_request), original_shard_id = this_shard_id()] (raft_rpc& rpc) mutable {
if (utils::get_local_injector().enter("raft_drop_incoming_append_entries")) {
return;
}
// lw_shared_ptr (raft::log_entry_ptr) doesn't support cross-shard ref counting (see debug_shared_ptr_counter_type),
// so we are copying entries to this shard if it isn't equal the original one.
rpc.append_entries(std::move(from),