app/vmselect/netstorage: protect from too smart compiler, which may break memory usage optimization in tmpBlocksFileWrapper.WriteBlocks

This commit is contained in:
Aliaksandr Valialkin 2020-07-23 17:55:18 +03:00
parent 0750d2cec1
commit 16a4b1b20c

View file

@ -896,9 +896,8 @@ func (tbfw *tmpBlocksFileWrapper) WriteBlock(mb *storage.MetricBlock) error {
} else {
// An optimization for big number of time series with long names: store only a single copy of metricNameStr
// in both tbfw.orderedMetricNames and tbfw.m.
metricNameStr := string(metricName)
tbfw.orderedMetricNames = append(tbfw.orderedMetricNames, metricNameStr)
tbfw.m[metricNameStr] = addrs
tbfw.orderedMetricNames = append(tbfw.orderedMetricNames, string(metricName))
tbfw.m[tbfw.orderedMetricNames[len(tbfw.orderedMetricNames)-1]] = addrs
}
}
tbfw.mu.Unlock()