Fix bug with counting of clusters for deleted elected replicas. #4336
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 this PR does: This PR fixes a bug when HA tracker in distributor got confused about number of cluster that a user has.
When user stops sending samples for some cluster, and HA tracker removes elected replica from its KV store (implemented in #3809), it wouldn't correctly update in-memory number of clusters that a user has. If user later started to send samples for this cluster again, the cluster would be counted in number of clusters twice, which could eventually lead to user hitting limit for number of HA clusters.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]