mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
app/vmselect/promql: make sure AdjustStartEnd returns time range covering the same number of points as the initial time range
This should prevent from the following panic at app/vmselect/promql/binary_op.go:255: BUG: len(leftVaues) must match len(rightValues) and len(dstValues)
This commit is contained in:
parent
f22c9dbb0f
commit
ff18101d30
@ -58,6 +58,14 @@ func AdjustStartEnd(start, end, step int64) (int64, int64) {
|
|||||||
if adjust > 0 {
|
if adjust > 0 {
|
||||||
end += step - adjust
|
end += step - adjust
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure that the new number of points is the same as the initial number of points.
|
||||||
|
newPoints := (end-start)/step + 1
|
||||||
|
for newPoints > points {
|
||||||
|
end -= step
|
||||||
|
newPoints--
|
||||||
|
}
|
||||||
|
|
||||||
return start, end
|
return start, end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +420,12 @@ func evalRollupFunc(ec *EvalConfig, name string, rf rollupFunc, re *rollupExpr,
|
|||||||
ecNew = newEvalConfig(ec)
|
ecNew = newEvalConfig(ec)
|
||||||
ecNew.Start -= offset
|
ecNew.Start -= offset
|
||||||
ecNew.End -= offset
|
ecNew.End -= offset
|
||||||
ecNew.Start, ecNew.End = AdjustStartEnd(ecNew.Start, ecNew.End, ecNew.Step)
|
if ecNew.MayCache {
|
||||||
|
start, end := AdjustStartEnd(ecNew.Start, ecNew.End, ecNew.Step)
|
||||||
|
offset += ecNew.Start - start
|
||||||
|
ecNew.Start = start
|
||||||
|
ecNew.End = end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var rvs []*timeseries
|
var rvs []*timeseries
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user