Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Add raft_voter_contact() #492

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Conversation

ralight
Copy link
Contributor

@ralight ralight commented Jan 25, 2024

This returns the number of voting nodes that are recently in contact with the leader, to allow determining if the cluster is currently in a degraded / at risk state.

I'd be interested on your thoughts on this. At the moment it feels like not being able to find out this information is an omission.

Copy link

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d67cffd) 77.13% compared to head (2e103cb) 77.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #492      +/-   ##
==========================================
- Coverage   77.13%   77.10%   -0.03%     
==========================================
  Files          52       52              
  Lines        9839     9847       +8     
  Branches     2514     2516       +2     
==========================================
+ Hits         7589     7593       +4     
- Misses       1068     1072       +4     
  Partials     1182     1182              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cole-miller
Copy link
Contributor

Not speaking for the rest of the team, but this seems reasonable to me. I would like a note in the docstring that the return value is not to be relied on for correctness (since it could be out of date), and a couple of tests.

include/raft.h Show resolved Hide resolved
@ralight ralight force-pushed the voter-count branch 3 times, most recently from 8237322 to 73e8dc4 Compare January 25, 2024 22:15
This returns the number of voting nodes that are recently in contact
with the leader, to allow determining if the cluster is currently in a
degraded / at risk state.
@ralight
Copy link
Contributor Author

ralight commented Jan 25, 2024

@cole-miller Thanks for the feedback. I've added the initialisation to 0 on init, reset to 1 on changing to a leader, and added a test which starts off with 3 nodes, kills off a node, and revives the node, with checks at each step. If you'd like more tests please give me some hints on the direction to go in.

Copy link
Contributor

@MathieuBordere MathieuBordere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, seems useful.

@cole-miller cole-miller self-requested a review January 29, 2024 15:11
Copy link
Contributor

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cole-miller cole-miller merged commit 8a3e3af into canonical:master Jan 29, 2024
18 of 19 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants