app/vmselect/promql: properly calculate rollup result if lookbehind window isn't set

This is a follow-up for 41a0fdaf39
This commit is contained in:
Aliaksandr Valialkin 2023-10-31 22:22:34 +01:00
parent 744f8c3fe7
commit 7b7ad44e84
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -1358,13 +1358,15 @@ func evalRollupFuncWithMetricExpr(qt *querytracer.Tracer, ec *EvalConfig, funcNa
tssCached, start := rollupResultCacheV.GetSeries(qt, ec, expr, window)
ec.QueryStats.addSeriesFetched(len(tssCached))
if start > ec.End {
// The result is fully cached.
qt.Printf("the result is fully cached")
rollupResultCacheFullHits.Inc()
return tssCached, nil
}
if start > ec.Start {
qt.Printf("partial cache hit")
rollupResultCachePartialHits.Inc()
} else {
qt.Printf("cache miss")
rollupResultCacheMiss.Inc()
}
@ -1399,7 +1401,7 @@ func evalRollupFuncNoCache(qt *querytracer.Tracer, ec *EvalConfig, funcName stri
qt = qt.NewChild("rollup %s: timeRange=%s, step=%d, window=%d", expr.AppendString(nil), ec.timeRangeString(), ec.Step, window)
defer qt.Done()
}
if window <= 0 {
if window < 0 {
return nil, nil
}
// Obtain rollup configs before fetching data from db, so type errors could be caught earlier.