Skip to content

Commit

Permalink
Merge pull request thanos-io#6456 from mhoffm-aiven/mhoffm-fix-store-…
Browse files Browse the repository at this point in the history
…crash-on-empty-regex-matcher

Store: fix crash on empty regex matcher
  • Loading branch information
fpetkovski authored Jun 19, 2023
2 parents b7a7522 + 86225bc commit 88cdb28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#6441](https://github.com/thanos-io/thanos/pull/6441) Compact: Compactor will set `index_stats` in `meta.json` file with max series and chunk size information.

### Fixed
- [#6456](https://github.com/thanos-io/thanos/pull/6456) Store: fix crash when computing set matches from regex pattern
- [#6427](https://github.com/thanos-io/thanos/pull/6427) Receive: increasing log level for failed uploads to error
- [#6172](https://github.com/thanos-io/thanos/pull/6172) query-frontend: return JSON formatted errors for invalid PromQL expression in the split by interval middleware.
- [#6171](https://github.com/thanos-io/thanos/pull/6171) Store: fix error handling on limits.
Expand Down
3 changes: 3 additions & 0 deletions pkg/store/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ func init() {
// Copied from Prometheus querier.go, removed check for Prometheus wrapper.
// Returns list of values that can regex matches.
func findSetMatches(pattern string) []string {
if len(pattern) == 0 {
return nil
}
escaped := false
sets := []*strings.Builder{{}}
init := 0
Expand Down
5 changes: 5 additions & 0 deletions pkg/store/opts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func TestFindSetMatches(t *testing.T) {
"foo|bar|baz",
},
},
// empty pattern
{
pattern: "",
exp: nil,
},
}

for _, c := range cases {
Expand Down

0 comments on commit 88cdb28

Please sign in to comment.