mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vminsert: properly initialize InsertCtx
This should prevent from panic described at https://github.com/VictoriaMetrics/VictoriaMetrics/issues/339
This commit is contained in:
parent
0597f1e39a
commit
1286cead75
6 changed files with 6 additions and 0 deletions
|
@ -32,6 +32,7 @@ func insertRows(at *auth.Token, rows []parser.Row) error {
|
||||||
ctx := netstorage.GetInsertCtx()
|
ctx := netstorage.GetInsertCtx()
|
||||||
defer netstorage.PutInsertCtx(ctx)
|
defer netstorage.PutInsertCtx(ctx)
|
||||||
|
|
||||||
|
ctx.Reset() // This line is required for initializing ctx internals.
|
||||||
atCopy := *at
|
atCopy := *at
|
||||||
for i := range rows {
|
for i := range rows {
|
||||||
r := &rows[i]
|
r := &rows[i]
|
||||||
|
|
|
@ -59,6 +59,7 @@ func insertRows(at *auth.Token, db string, rows []parser.Row) error {
|
||||||
defer putPushCtx(ctx)
|
defer putPushCtx(ctx)
|
||||||
|
|
||||||
ic := &ctx.Common
|
ic := &ctx.Common
|
||||||
|
ic.Reset() // This line is required for initializing ic internals.
|
||||||
rowsTotal := 0
|
rowsTotal := 0
|
||||||
for i := range rows {
|
for i := range rows {
|
||||||
r := &rows[i]
|
r := &rows[i]
|
||||||
|
|
|
@ -32,6 +32,7 @@ func insertRows(at *auth.Token, rows []parser.Row) error {
|
||||||
ctx := netstorage.GetInsertCtx()
|
ctx := netstorage.GetInsertCtx()
|
||||||
defer netstorage.PutInsertCtx(ctx)
|
defer netstorage.PutInsertCtx(ctx)
|
||||||
|
|
||||||
|
ctx.Reset() // This line is required for initializing ctx internals.
|
||||||
atCopy := *at
|
atCopy := *at
|
||||||
for i := range rows {
|
for i := range rows {
|
||||||
r := &rows[i]
|
r := &rows[i]
|
||||||
|
|
|
@ -50,6 +50,7 @@ func insertRows(at *auth.Token, rows []parser.Row) error {
|
||||||
ctx := netstorage.GetInsertCtx()
|
ctx := netstorage.GetInsertCtx()
|
||||||
defer netstorage.PutInsertCtx(ctx)
|
defer netstorage.PutInsertCtx(ctx)
|
||||||
|
|
||||||
|
ctx.Reset() // This line is required for initializing ctx internals.
|
||||||
for i := range rows {
|
for i := range rows {
|
||||||
r := &rows[i]
|
r := &rows[i]
|
||||||
ctx.Labels = ctx.Labels[:0]
|
ctx.Labels = ctx.Labels[:0]
|
||||||
|
|
|
@ -31,6 +31,7 @@ func insertRows(at *auth.Token, timeseries []prompb.TimeSeries) error {
|
||||||
ctx := netstorage.GetInsertCtx()
|
ctx := netstorage.GetInsertCtx()
|
||||||
defer netstorage.PutInsertCtx(ctx)
|
defer netstorage.PutInsertCtx(ctx)
|
||||||
|
|
||||||
|
ctx.Reset() // This line is required for initializing ctx internals.
|
||||||
rowsTotal := 0
|
rowsTotal := 0
|
||||||
for i := range timeseries {
|
for i := range timeseries {
|
||||||
ts := ×eries[i]
|
ts := ×eries[i]
|
||||||
|
|
|
@ -32,6 +32,7 @@ func insertRows(at *auth.Token, rows []parser.Row) error {
|
||||||
ctx := netstorage.GetInsertCtx()
|
ctx := netstorage.GetInsertCtx()
|
||||||
defer netstorage.PutInsertCtx(ctx)
|
defer netstorage.PutInsertCtx(ctx)
|
||||||
|
|
||||||
|
ctx.Reset() // This line is required for initializing ctx internals.
|
||||||
rowsTotal := 0
|
rowsTotal := 0
|
||||||
for i := range rows {
|
for i := range rows {
|
||||||
r := &rows[i]
|
r := &rows[i]
|
||||||
|
|
Loading…
Reference in a new issue