mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-24 03:06:48 +01:00
app/vmselect/promql: fix seriesFetched update logic (#7181)
### Describe Your Changes
evalInstantRollup could have overreport the number of fetched series if
`offset` checks will result into retry. This change updates fetched
series only if these checks were successful.
It also adds a comment to another potential place of over-reporting
series fetched. It doesn't fix it, because it would require spending
extra resources on such a check, while discrepancy in seriesFetched
doesn't affect calculations in any way.
Probably related to
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7170
### Checklist
The following checks are **mandatory**:
- [x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
Signed-off-by: hagen1778 <roman@victoriametrics.com>
(cherry picked from commit ebd393d8b3
)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
2d4cde5506
commit
f825a9de80
@ -1123,7 +1123,6 @@ func evalInstantRollup(qt *querytracer.Tracer, ec *EvalConfig, funcName string,
|
|||||||
again:
|
again:
|
||||||
offset := int64(0)
|
offset := int64(0)
|
||||||
tssCached := rollupResultCacheV.GetInstantValues(qt, at, expr, window, ec.Step, ec.EnforcedTagFilterss)
|
tssCached := rollupResultCacheV.GetInstantValues(qt, at, expr, window, ec.Step, ec.EnforcedTagFilterss)
|
||||||
ec.QueryStats.addSeriesFetched(len(tssCached))
|
|
||||||
if len(tssCached) == 0 {
|
if len(tssCached) == 0 {
|
||||||
// Cache miss. Re-populate the missing data.
|
// Cache miss. Re-populate the missing data.
|
||||||
start := int64(fasttime.UnixTimestamp()*1000) - cacheTimestampOffset.Milliseconds()
|
start := int64(fasttime.UnixTimestamp()*1000) - cacheTimestampOffset.Milliseconds()
|
||||||
@ -1167,6 +1166,7 @@ func evalInstantRollup(qt *querytracer.Tracer, ec *EvalConfig, funcName string,
|
|||||||
deleteCachedSeries(qt)
|
deleteCachedSeries(qt)
|
||||||
goto again
|
goto again
|
||||||
}
|
}
|
||||||
|
ec.QueryStats.addSeriesFetched(len(tssCached))
|
||||||
return tssCached, offset, nil
|
return tssCached, offset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1678,6 +1678,10 @@ func evalRollupFuncWithMetricExpr(qt *querytracer.Tracer, ec *EvalConfig, funcNa
|
|||||||
ecNew = copyEvalConfig(ec)
|
ecNew = copyEvalConfig(ec)
|
||||||
ecNew.Start = start
|
ecNew.Start = start
|
||||||
}
|
}
|
||||||
|
// call to evalWithConfig also updates QueryStats.addSeriesFetched
|
||||||
|
// without checking whether tss has intersection with tssCached.
|
||||||
|
// So final number could be bigger than actual number of unique series.
|
||||||
|
// This discrepancy is acceptable, since seriesFetched stat is used as info only.
|
||||||
tss, err := evalWithConfig(ecNew)
|
tss, err := evalWithConfig(ecNew)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user