consul icon indicating copy to clipboard operation
consul copied to clipboard

Set replication metric to 0 when losing leadership

Open jorgemarey opened this issue 1 year ago • 4 comments

Fixes https://github.com/hashicorp/consul/issues/11377#issuecomment-966107284

When the leader changes the replication metrics on the old leader (now follower) keeps reporting 1. This PR fixes that issue.

jorgemarey avatar Feb 16 '24 11:02 jorgemarey

This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.

github-actions[bot] avatar Apr 17 '24 01:04 github-actions[bot]

Hi there. There's one other place that needs a similar change to fixup the rest of the replicators (like for config entries). For historical reasons there are two versions of the replicators, the ACL ones and the common plumbing for the rest. You fixed the former in this PR so far and the other is in this area: https://github.com/hashicorp/consul/blob/main/agent/consul/replication.go#L156

You can see the pairing of status/index normally being set down here https://github.com/hashicorp/consul/blob/main/agent/consul/leader.go#L797 so you'll just have to repeat the fix in this one place and it should be good.

rboyer avatar May 01 '24 16:05 rboyer

Hi @rboyer, I made the change you suggested.

jorgemarey avatar May 02 '24 20:05 jorgemarey