Skip to content

Commit

Permalink
Revert "Fix matchersToPostingGroups vals variable shadow bug (thanos-…
Browse files Browse the repository at this point in the history
…io#6817)"

This reverts commit 4ed9bb0.
  • Loading branch information
saswatamcode committed Oct 18, 2023
1 parent fa0a0f8 commit 4bb7e42
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6615](https://github.com/thanos-io/thanos/pull/6615) [#6805](https://github.com/thanos-io/thanos/pull/6805): Build with Go 1.21 and bump golang.org/x/net to v0.17 for addressing [CVE](https://groups.google.com/g/golang-announce/c/iNNxDTCjZvo)
- [#6802](https://github.com/thanos-io/thanos/pull/6802) Receive: head series limiter should not run if no head series limit is set.
- [#6816](https://github.com/thanos-io/thanos/pull/6816) Store: fix prometheus store label values matches for external labels
- [#6817](https://github.com/thanos-io/thanos/pull/6817) Store Gateway: fix `matchersToPostingGroups` label values variable got shadowed bug.

### Added

Expand Down
3 changes: 1 addition & 2 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -2503,9 +2503,8 @@ func matchersToPostingGroups(ctx context.Context, lvalsFn func(name string) ([]s
}
// Cache label values because label name is the same.
if !valuesCached && vals != nil {
lvals := vals
lvalsFunc = func(_ string) ([]string, error) {
return lvals, nil
return vals, nil
}
valuesCached = true
}
Expand Down
23 changes: 0 additions & 23 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3076,29 +3076,6 @@ func TestMatchersToPostingGroup(t *testing.T) {
},
},
},
{
name: "Reproduce values shadow bug",
matchers: []*labels.Matcher{
labels.MustNewMatcher(labels.MatchRegexp, "name", "test.*"),
labels.MustNewMatcher(labels.MatchNotRegexp, "name", "testfoo"),
labels.MustNewMatcher(labels.MatchNotEqual, "name", ""),
},
labelValues: map[string][]string{
"name": {"testbar", "testfoo"},
},
expected: []*postingGroup{
{
name: "name",
addAll: false,
addKeys: []string{"testbar"},
matchers: []*labels.Matcher{
labels.MustNewMatcher(labels.MatchNotEqual, "name", ""),
labels.MustNewMatcher(labels.MatchRegexp, "name", "test.*"),
labels.MustNewMatcher(labels.MatchNotRegexp, "name", "testfoo"),
},
},
},
},
} {
t.Run(tc.name, func(t *testing.T) {
actual, err := matchersToPostingGroups(ctx, func(name string) ([]string, error) {
Expand Down

0 comments on commit 4bb7e42

Please sign in to comment.