Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Ye <[email protected]>
  • Loading branch information
yeya24 committed Aug 31, 2023
1 parent fdbe7c4 commit 52f6cf6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down

0 comments on commit 52f6cf6

Please sign in to comment.