diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 3ce79d016..0088e3044 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -2743,14 +2743,15 @@ func copyTimeseriesMetricNames(tss []*timeseries, makeCopy bool) []*timeseries { return rvs } -// copyTimeseriesShallow returns a copy of arg with shallow copies of MetricNames, -// Timestamps and Values. -func copyTimeseriesShallow(arg []*timeseries) []*timeseries { - rvs := make([]*timeseries, len(arg)) - for i, src := range arg { - var dst timeseries - dst.CopyShallow(src) - rvs[i] = &dst +// copyTimeseriesShallow returns a copy of src with shallow copies of MetricNames, Timestamps and Values. +func copyTimeseriesShallow(src []*timeseries) []*timeseries { + tss := make([]timeseries, len(src)) + for i, src := range src { + tss[i].CopyShallow(src) + } + rvs := make([]*timeseries, len(tss)) + for i := range tss { + rvs[i] = &tss[i] } return rvs }