tikv / raft-rs

Raft distributed consensus algorithm implemented in Rust.
Apache License 2.0
2.86k stars 391 forks source link

Suggestion: Provides test suite for ensuring the storage implementation is correct #538

Open jopemachine opened 4 months ago

jopemachine commented 4 months ago

I am currently developing a high-level Raft framework based on raft-rs, as shown below. https://github.com/lablup/raftify

One thing I've realized while developing this framework is that even a slightly incorrect storage implementation can lead to totally unexpected bugs in certain scenarios.

It seems like openraft provides a test suite that allows the storage developers to test their own custom storage, as shown in this link to prevent such situations.

I think passing these test suite can alleviate the anxiety storage developers might have about encountering unforeseen errors in specific scenarios.

Documentation about this: https://docs.rs/openraft/latest/openraft/docs/getting_started/index.html#ensure-the-implementation-of-raftstorage-is-correct

I think it would be very helpful if raft-rs provide a similar test suite if possible.

BusyJay commented 4 months ago

Good idea! One approach is to adapt the implementations in

https://github.com/tikv/raft-rs/blob/65a00620d80a89603c3358fd4b90265a692ae767/src/storage.rs#L522-L813

to accept arbitrary engine. Actually, TiKV itself adapts these cases to test its own PeerStorage in the first version.