Skip to content

Commit

Permalink
Merge pull request #13437 from yeya24/check-ctx-eval-series
Browse files Browse the repository at this point in the history
Add more context cancellation check at evaluation time
  • Loading branch information
bboreham committed Jan 22, 2024
2 parents 0fe7ba9 + d778591 commit c095ba2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
it := storage.NewBuffer(selRange)
var chkIter chunkenc.Iterator
for i, s := range selVS.Series {
if err := contextDone(ev.ctx, "expression evaluation"); err != nil {
ev.error(err)
}
ev.currentSamples -= len(floats) + totalHPointSize(histograms)
if floats != nil {
floats = floats[:0]
Expand Down Expand Up @@ -1690,6 +1693,9 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, annotations.Annotatio
it := storage.NewMemoizedEmptyIterator(durationMilliseconds(ev.lookbackDelta))
var chkIter chunkenc.Iterator
for i, s := range e.Series {
if err := contextDone(ev.ctx, "expression evaluation"); err != nil {
ev.error(err)
}
chkIter = s.Iterator(chkIter)
it.Reset(chkIter)
ss := Series{
Expand Down

0 comments on commit c095ba2

Please sign in to comment.