mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/streamaggr: explicitly call resetSeries after flushSeries
This makes the code less fragile
This commit is contained in:
parent
ac3cf3f357
commit
86494518da
1 changed files with 2 additions and 2 deletions
|
@ -674,6 +674,7 @@ func (a *aggregator) flush(pushFunc PushFunc) {
|
||||||
ctx := getFlushCtx(a, pushFunc)
|
ctx := getFlushCtx(a, pushFunc)
|
||||||
as.flushState(ctx)
|
as.flushState(ctx)
|
||||||
ctx.flushSeries()
|
ctx.flushSeries()
|
||||||
|
ctx.resetSeries()
|
||||||
putFlushCtx(ctx)
|
putFlushCtx(ctx)
|
||||||
}(as)
|
}(as)
|
||||||
}
|
}
|
||||||
|
@ -925,8 +926,6 @@ func (ctx *flushCtx) flushSeries() {
|
||||||
}
|
}
|
||||||
auxLabels.Labels = dstLabels
|
auxLabels.Labels = dstLabels
|
||||||
promutils.PutLabels(auxLabels)
|
promutils.PutLabels(auxLabels)
|
||||||
|
|
||||||
ctx.resetSeries()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *flushCtx) appendSeries(key, suffix string, timestamp int64, value float64) {
|
func (ctx *flushCtx) appendSeries(key, suffix string, timestamp int64, value float64) {
|
||||||
|
@ -948,6 +947,7 @@ func (ctx *flushCtx) appendSeries(key, suffix string, timestamp int64, value flo
|
||||||
// Limit the maximum length of ctx.tss in order to limit memory usage.
|
// Limit the maximum length of ctx.tss in order to limit memory usage.
|
||||||
if len(ctx.tss) >= 10_000 {
|
if len(ctx.tss) >= 10_000 {
|
||||||
ctx.flushSeries()
|
ctx.flushSeries()
|
||||||
|
ctx.resetSeries()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue