From ddabc13796d80a160cb58884be4b5b8a5b994a00 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 3 Sep 2020 12:08:14 +0300 Subject: [PATCH] app/vmagent: properly flush big blocks of data Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/741 Thanks to @IceRain00 for the investigation and initial attempt to fix the issue at https://github.com/VictoriaMetrics/VictoriaMetrics/pull/742 --- app/vmagent/remotewrite/pendingseries.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/vmagent/remotewrite/pendingseries.go b/app/vmagent/remotewrite/pendingseries.go index 31177a7fe..36a61bd1f 100644 --- a/app/vmagent/remotewrite/pendingseries.go +++ b/app/vmagent/remotewrite/pendingseries.go @@ -126,9 +126,9 @@ func (wr *writeRequest) push(src []prompbmarshal.TimeSeries) { tssDst := wr.tss for i := range src { tssDst = append(tssDst, prompbmarshal.TimeSeries{}) - dst := &tssDst[len(tssDst)-1] - wr.copyTimeSeries(dst, &src[i]) - if len(wr.tss) >= maxRowsPerBlock { + wr.copyTimeSeries(&tssDst[len(tssDst)-1], &src[i]) + if len(tssDst) >= maxRowsPerBlock { + wr.tss = tssDst wr.flush() tssDst = wr.tss }