RATIS-2685. Follower gauges are stale after LogAppender restart - #1587
Merged
Merged
Conversation
LeaderStateImpl.restart() creates a new FollowerInfo for the same follower, but the follower gauges registered for the old FollowerInfo are never removed, and the registry does not replace an existing gauge. The gauges keep reading the stopped FollowerInfo. Remove the follower gauges when senders are stopped and before re-registering them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
szetszwo
reviewed
Sep 14, 2026
Replace the follower gauges in LogAppenderMetrics and do not remove them in LeaderStateImpl.stopAndRemoveSenders. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
szetszwo
approved these changes
Sep 15, 2026
szetszwo
left a comment
Contributor
There was a problem hiding this comment.
+1 the change looks good.
Contributor
Author
|
@szetszwo Test passed locally, could you help to retry the failed test? |
szetszwo
approved these changes
Sep 15, 2026
szetszwo
left a comment
Contributor
There was a problem hiding this comment.
+1 the change looks good.
Contributor
Author
|
@szetszwo Thank you for the review and merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When a LogAppender is restarted, a new
FollowerInfois created, but the old follower gauges (follower_<id>_next_index,match_index,rpc_response_time) are never removed. The registry does not replace an existing gauge, so these gauges keep reading the stoppedFollowerInfoand stop changing.This PR removes the follower gauges when senders are stopped and before re-registering them.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-2685
How was this patch tested?
Added
TestLogAppenderMetrics#testFollowerGaugesAfterReAdd, which fails without the fix.🤖 Generated with Claude Code