app/vminsert: correctly allocate buffer for storagenodes (#554)

in case of dynamic discovery number of nodes may change and we have to allocate new buffer for this case
otherwise vminsert may panic
This commit is contained in:
Nikolay 2023-04-18 17:30:42 +02:00 committed by Aliaksandr Valialkin
parent 8b15f93426
commit 82e2f19bc2
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -65,7 +65,7 @@ func (ctx *InsertCtx) Reset() {
ctx.Labels = ctx.Labels[:0]
ctx.MetricNameBuf = ctx.MetricNameBuf[:0]
if ctx.bufRowss == nil {
if ctx.bufRowss == nil || len(ctx.bufRowss) != len(ctx.snb.sns) {
ctx.bufRowss = make([]bufRows, len(ctx.snb.sns))
}
for i := range ctx.bufRowss {