Skip to content

Commit

Permalink
raft: deflake non-determinisctic raft node tests
Browse files Browse the repository at this point in the history
We sporadically see that some raft node_test tests fail due to the
leader not being stable. This commit should reduce the chances of that
happening by increasing the election timeout to 50ms (instead of 10ms).

I couldn't reproduce the bug locally with this change.

If the bug still happens, we can try to force leadership to make it
more deterministic.

Fixes: cockroachdb#132992

Release note: None
  • Loading branch information
iskettaneh committed Oct 23, 2024
1 parent 62803f3 commit 3898d36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/raft/rafttest/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func startNode(id raftpb.PeerID, peers []raft.Peer, iface iface) *node {
st := raft.NewMemoryStorage()
c := &raft.Config{
ID: id,
ElectionTick: 10,
ElectionTick: 50,
HeartbeatTick: 1,
Storage: st,
MaxSizePerMsg: 1024 * 1024,
Expand Down

0 comments on commit 3898d36

Please sign in to comment.