Repository navigation
fix(backend): recover unavailable replicas when peers return not-found - #598
Merged
Merged
Conversation
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.
Why
A temporarily unavailable replica can fail an otherwise answered render. When one replica returns HTTP 503 or times out and all other selected replica groups for the same cluster report that the target does not exist, the error fan-in currently turns the render into HTTP 500. This particularly affects missing targets in wildcard or multi-target expressions.
Architecture
Render replies are grouped by data center and cluster, and classified separately for each fetch. Extend the existing cross-replica connection-failure recovery to HTTP 503 and timeout errors. Recovery requires another selected replica group in the same cluster, and every other selected group in that cluster must have answered without data.
Successful data replies retain their existing behavior. Arbitrary HTTP 500 responses, malformed bodies, ungrouped backends, unrelated clusters, and wholly unavailable clusters retain their errors. This changes local fan-in classification and adds no retry or transport path.
Before / after
Validation
With
GOTOOLCHAIN=go1.27.0, build, vet and tests pass for./pkg/backend ./pkg/app/carbonapi.Extended render-handler regression cases cover 503 with data, missing targets, wrapped errors, read timeouts and context deadlines, and verify that HTTP 500, malformed responses, unavailable peers, unrelated clusters and ungrouped backends still fail where required. Existing cases exercise ordinary and coalesced fetches.