From a3cdef6b0691028ca3dbdae2db5661bb75d972ad 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 31177a7fee..36a61bd1fd 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 }