From 52f6cf6e79be4dd87addfa18fcf24ed01801b6ff Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Mon, 14 Aug 2023 23:52:46 -0700 Subject: [PATCH] address review comments Signed-off-by: Ben Ye --- pkg/store/bucket.go | 5 +++-- pkg/store/bucket_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 09ebd0648d4..c3e9330ab9a 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -2478,7 +2478,8 @@ func newPostingGroup(addAll bool, name string, addKeys, removeKeys []string) *po } } -func (pg postingGroup) merge(other *postingGroup) *postingGroup { +// mergeKeys merges keys from two posting groups and ignores other fields. +func (pg postingGroup) mergeKeys(other *postingGroup) *postingGroup { if other == nil { return &pg } @@ -2619,7 +2620,7 @@ func matchersToPostingGroups(ctx context.Context, lvalsFn func(name string) ([]s if mergedPG == nil { mergedPG = pg } else { - mergedPG = mergedPG.merge(pg) + mergedPG = mergedPG.mergeKeys(pg) } // If this groups adds nothing, it's an empty group. We can shortcut this, since intersection with empty diff --git a/pkg/store/bucket_test.go b/pkg/store/bucket_test.go index db6dbb95c86..b0d6fd3a9ff 100644 --- a/pkg/store/bucket_test.go +++ b/pkg/store/bucket_test.go @@ -3255,7 +3255,7 @@ func TestPostingGroupMerge(t *testing.T) { slices.Sort(tc.group2.addKeys) slices.Sort(tc.group2.removeKeys) } - res := tc.group1.merge(tc.group2) + res := tc.group1.mergeKeys(tc.group2) testutil.Equals(t, tc.expected, res) }) }