Skip to content

fix(distributor): UserStats returns error when a ring member is LEAVING#7705

Open
Goutham-Annem wants to merge 1 commit into
cortexproject:masterfrom
Goutham-Annem:fix/4936-userstats-leaving-ingester
Open

fix(distributor): UserStats returns error when a ring member is LEAVING#7705
Goutham-Annem wants to merge 1 commit into
cortexproject:masterfrom
Goutham-Annem:fix/4936-userstats-leaving-ingester

Conversation

@Goutham-Annem

Copy link
Copy Markdown

Fixes #4936

Proposed Changes

UserStats called GetIngestersForMetadata (which uses ring.Read, including LEAVING instances) and then explicitly set replicationSet.MaxErrors = 0, requiring every ingester in the set to respond. During a rolling update or any graceful shutdown, ingesters transition through the LEAVING state and may return RPC errors. With MaxErrors = 0, a single such failure caused the entire /api/v1/user_stats endpoint to return an error.

The fix removes the MaxErrors = 0 override and lets the ring's own quorum tolerance apply (RF/2 failures are allowed for Read operations). This matches the behaviour of other metadata endpoints (e.g. LabelValuesForLabelName) that do not override MaxErrors.

  • 🐛 Remove replicationSet.MaxErrors = 0 in UserStats; add explanatory comment
  • 🧹 Add UserStats method to mockIngester
  • 🧹 Add TestUserStats_ToleratesLeavingIngester that confirms the endpoint succeeds with one unhappy ingester out of three

Note: This PR was developed with AI assistance (Claude Code).

Release Note

[BUGFIX] Distributor: UserStats no longer errors when one ingester in the replication set is LEAVING or temporarily unavailable.

…AVING

UserStats queried all ingesters via GetIngestersForMetadata then forced
MaxErrors = 0, requiring every ingester to respond successfully. When any
ingester was in the LEAVING state (normal during a rolling update) and its
RPC failed, UserStats returned an error to the caller.

Remove the MaxErrors = 0 override so the ring's own quorum tolerance
(RF/2 failures allowed for a Read operation) applies. Partial stats are
better than a hard failure on the /api/v1/user_stats page.

Closes cortexproject#4936

Signed-off-by: Goutham Annem <gouthemannem@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage Statistics page railse error if some ingester is LEAVING

1 participant