From 82e2f19bc2168c77bc35e9da8394f166d3ddcb65 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Tue, 18 Apr 2023 17:30:42 +0200 Subject: [PATCH] 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 --- app/vminsert/netstorage/insert_ctx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vminsert/netstorage/insert_ctx.go b/app/vminsert/netstorage/insert_ctx.go index 340895664..8c1c1076b 100644 --- a/app/vminsert/netstorage/insert_ctx.go +++ b/app/vminsert/netstorage/insert_ctx.go @@ -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 {