lib/storage: fix a bug, which breaks searching by Graphite wildcard filters

This commit is contained in:
Aliaksandr Valialkin 2021-02-03 18:45:42 +02:00
parent 45a63a1da9
commit 2976ec89b8
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,8 @@
# tip # tip
* BUGFIX: vmselect: fix the bug peventing from proper searching by Graphite filter with wildcards such as `{__graphite__="foo.*.bar"}`.
# [v1.53.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.53.0) # [v1.53.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.53.0)

View File

@ -1095,12 +1095,12 @@ func (s *Storage) SearchGraphitePaths(accountID, projectID uint32, tr TimeRange,
return nil, fmt.Errorf("more than maxPaths=%d suffixes found", maxPaths) return nil, fmt.Errorf("more than maxPaths=%d suffixes found", maxPaths)
} }
qPrefixStr := queryStr[:n] qPrefixStr := queryStr[:n]
qNode := queryStr[n:]
qTail := "" qTail := ""
qNode := queryStr[n:]
mustMatchLeafs := true mustMatchLeafs := true
if m := strings.IndexByte(qNode, '.'); m >= 0 { if m := strings.IndexByte(qNode, '.'); m >= 0 {
qNode = qNode[:m+1]
qTail = qNode[m+1:] qTail = qNode[m+1:]
qNode = qNode[:m+1]
mustMatchLeafs = false mustMatchLeafs = false
} }
re, err := getRegexpForGraphiteNodeQuery(qNode) re, err := getRegexpForGraphiteNodeQuery(qNode)