You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
guozhihao
authored and
guozhihao
committed
feat(raft): integrate raft consensus into the redis write path
Route cluster-mode write commands through Raft consensus by making the
storage batch layer mode-aware, instead of per-command serialization.
- storage: implement BinlogBatch capturing CF put/delete as BinlogEntry;
Redis gains an injectable append_log_fn (OnceLock) so create_batch returns
BinlogBatch in cluster mode and RocksBatch otherwise; the apply path
(on_binlog_write) always uses create_rocks_batch to avoid recursive propose;
Storage::set_append_log_fn propagates to all instances.
- raft: add a lightweight LeaderGate trait implemented by RaftApp.
- net: thread an optional LeaderGate to the executor and reject writes on
non-leaders with MOVED / not-leader before execution.
- server: in cluster mode, create the raft node, bridge storage->raft via an
mpsc channel and a drain task calling client_write, inject append_log_fn
(block_in_place around blocking_recv to avoid an async-context panic), and
pass the LeaderGate to the network server.
- cmd: remove the now-dead per-command to_binlog/needs_raft.
0 commit comments