app/vminsert: properly reset InsertCtx.mrs - they must be empty after Reset call

This commit is contained in:
Aliaksandr Valialkin 2019-05-28 16:08:01 +03:00
parent 437e0b2300
commit 0eae39daa7

View file

@ -30,11 +30,10 @@ func (ctx *InsertCtx) Reset(rowsLen int) {
mr.MetricNameRaw = nil
}
ctx.mrs = ctx.mrs[:0]
if n := rowsLen - cap(ctx.mrs); n > 0 {
ctx.mrs = append(ctx.mrs[:cap(ctx.mrs)], make([]storage.MetricRow, n)...)
}
ctx.mrs = ctx.mrs[:rowsLen]
ctx.mrs = ctx.mrs[:0]
ctx.metricNamesBuf = ctx.metricNamesBuf[:0]
}