etcd-io / etcd-io/raft

raftLog: decouple log data structure and flow control

Open
#142 19 comments 0 reactions 2 assignees Claimed by @IAMRogerXi View on GitHub
enhancement
Dominant language
Go
Stars
1.1k
Forks
273
Avg merge
4h 12m
Merged PRs (30d)
10

Description

The [raftLog](https://github.com/etcd-io/raft/blob/026484c68b7bc59cd208e216d35e1ff747d24d9c/log.go#L24) structure currently plays multiple roles. Notably:

- Provides read/write [access](https://github.com/etcd-io/raft/blob/026484c68b7bc59cd208e216d35e1ff747d24d9c/log.go#L25-L34) to the raft log (both the `unstable` in-memory part, and the `Storage` part), and keeps the basic metadata about the log.
- To some degree, ensures correctness w.r.t. the core `raft` algorithm.
- Implements [flow control](https://github.com/etcd-io/raft/blob/026484c68b7bc59cd208e216d35e1ff747d24d9c/log.go#L35-L62) mechanisms for applying the commands from this log.

The flow control role is quite distinct from the other roles, and is less fundamental. It should be decoupled. Once decoupling is done, `raftLog` can be isolated in its own package and rigorously tested without assumptions about the flow.

Related to #64, though this clean-up has value on its own.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.