I guess this won't work in the case where no changes will be made to the state machine after a follower node becomes offline as the applied log indexes will remain the same, thus the difference will not change.
You're correct. To better assess the connectivity status of a follower node, it would be beneficial to add a metric that tracks the timestamp of the last acknowledged heartbeat from each follower. This additional information would provide a more accurate and timely indication of the follower's connectivity status. Here's how we could refine this idea:
Add a new field to the RaftMetrics struct specifically for follower heartbeat information:
In the leader's routine that checks follower health:
const HEARTBEAT_TIMEOUT: Duration = Duration::from_secs(/* define your timeout */);
for (follower_id, last_heartbeat) in &raft_metrics.follower_heartbeats {
if last_heartbeat.elapsed() > HEARTBEAT_TIMEOUT {
// Consider this follower as potentially disconnected
}
}
You're correct. To better assess the connectivity status of a follower node, it would be beneficial to add a metric that tracks the timestamp of the last acknowledged heartbeat from each follower. This additional information would provide a more accurate and timely indication of the follower's connectivity status. Here's how we could refine this idea:
RaftMetrics
struct specifically for follower heartbeat information:Originally posted by @drmingdrmer in https://github.com/datafuselabs/openraft/discussions/1174#discussioncomment-10079123