diff --git a/tsdb/index/postings.go b/tsdb/index/postings.go index eb572704c3..56e8d3d82a 100644 --- a/tsdb/index/postings.go +++ b/tsdb/index/postings.go @@ -858,9 +858,9 @@ func NewPostingsCloner(p Postings) *PostingsCloner { // so the returned slice capacity may be well above the actual number of items. // In such case, we shrink it. if float64(len(ids)) < float64(cap(ids))*0.70 { - shrinked := make([]storage.SeriesRef, len(ids)) - copy(shrinked, ids) - ids = shrinked + shrunk := make([]storage.SeriesRef, len(ids)) + copy(shrunk, ids) + ids = shrunk } return &PostingsCloner{ids: ids, err: err} diff --git a/tsdb/index/postings_test.go b/tsdb/index/postings_test.go index 61a1ca3de1..a5cdbd7895 100644 --- a/tsdb/index/postings_test.go +++ b/tsdb/index/postings_test.go @@ -1108,13 +1108,13 @@ func TestNewPostingsCloner_ShrinkExpandedPostingsSlice(t *testing.T) { t.Run("should not shrink expanded postings if length is >= 70% capacity", func(t *testing.T) { cloner := NewPostingsCloner(NewListPostings(make([]storage.SeriesRef, 60))) assert.Equal(t, 60, len(cloner.ids)) - assert.Equal(t, 64, cap(cloner.ids)) // Not shrinked. + assert.Equal(t, 64, cap(cloner.ids)) // Not shrunk. }) t.Run("should shrink expanded postings if length is < 70% capacity", func(t *testing.T) { cloner := NewPostingsCloner(NewListPostings(make([]storage.SeriesRef, 33))) assert.Equal(t, 33, len(cloner.ids)) - assert.Equal(t, 33, cap(cloner.ids)) // Shrinked. + assert.Equal(t, 33, cap(cloner.ids)) // Shrunk. }) }