From 461481fbdf974f95809bf08c3ee3bee7c742115b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 23 Jul 2020 17:53:52 +0300 Subject: [PATCH] app/vmselect/netstorage: protect from too smart compiler, which may break memory usage optimization in ProcessSearchQuery --- app/vmselect/netstorage/netstorage.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 61f8373e33..94f5bc8893 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -579,9 +579,8 @@ func ProcessSearchQuery(sq *storage.SearchQuery, fetchData bool, deadline Deadli } else { // An optimization for big number of time series with long metricName values: // use only a single copy of metricName for both orderedMetricNames and m. - metricNameStr := string(metricName) - orderedMetricNames = append(orderedMetricNames, metricNameStr) - m[metricNameStr] = brs + orderedMetricNames = append(orderedMetricNames, string(metricName)) + m[orderedMetricNames[len(orderedMetricNames)-1]] = brs } } if err := sr.Error(); err != nil {