Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop processing split queries on first error. #11067

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/querier/queryrange/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,7 @@ func NewMetricTripperware(
if len(queryRangeMiddleware) > 0 {
rt := NewLimitedRoundTripper(next, limits, schema.Configs, queryRangeMiddleware...)
return base.HandlerFunc(func(ctx context.Context, r base.Request) (base.Response, error) {
_, ok := r.(*LokiRequest)
if !ok {
if _, ok := r.(*LokiRequest); !ok {
return next.Do(ctx, r)
}
return rt.Do(ctx, r)
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/queryrange/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func TestMetricsTripperware(t *testing.T) {
queryCount, queryHandler = counter()
h = getQueryAndStatsHandler(queryHandler, statsHandler)
_, err = tpw.Wrap(h).Do(ctx, lreq)
require.Error(t, err)
require.ErrorContains(t, err, "query too large to execute on a single querie")
jeschkies marked this conversation as resolved.
Show resolved Hide resolved
require.Equal(t, 0, *queryCount)
require.Equal(t, 2, *statsCount)

Expand Down
5 changes: 5 additions & 0 deletions pkg/querier/queryrange/split_by_interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ func (h *splitByInterval) loop(ctx context.Context, ch <-chan *lokiResult, next
case <-ctx.Done():
return
case data.ch <- &packedResp{resp, err}:
// The parent Process method will return on the first error. So stop
// processng.
if err != nil {
return
}
}
}
}
Expand Down