raft: repurpose unused Node interface #122131
Labels
A-kv-replication
Relating to Raft, consensus, and coordination.
A-testing
Testing tools and infrastructure
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-kv
KV Team
We only use RawNode interface to
raft
, and don't use the Node which is a wrapper aroundRawNode
with goroutines and channels that runs the node. In CRDB, we do all that in the raft scheduler.We could outright remove the
Node
interface, but maybe we should leave if for additional testing coverage, or migrate the tests to useRawNode
. TheNode
tests tend to be flaky (e.g. #121745) because of timing/scheduling: e.g. a test may wait for a leader and then assume that the leader is stable, but timing flakes can result in a leader change in the middle of the test.A better approach to testing would be to have randomized, but deterministic tests based on
RawNode
. Then all the flakes would be preventable and/or reproducible.We probably can repurpose
Node
to be a test-only type, with added benefits of randomized testing. We could improve reproducibility of these runs, by tracing allStep/Ready
calls and message sends/drops done by theNode
s. The trace would be convertible to a list ofdatadriven
commands thatTestInteraction
operates with, so any test run could be then reliably reproduced withRawNode
s.Jira issue: CRDB-37718
Epic CRDB-39898
The text was updated successfully, but these errors were encountered: