mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: limit loops count in order to reduce max CPU usage during filter search
This commit is contained in:
parent
e2a0c8bd72
commit
41fe707bec
1 changed files with 3 additions and 0 deletions
|
@ -2979,6 +2979,9 @@ func (is *indexSearch) getMetricIDsForDateAndFilters(date uint64, tfs *TagFilter
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
maxLoopsCount := getFirstPositiveFilterLoopsCount(tfws[i+1:])
|
maxLoopsCount := getFirstPositiveFilterLoopsCount(tfws[i+1:])
|
||||||
|
if maxLoopsCount == int64Max {
|
||||||
|
maxLoopsCount = int64(metricIDsLen) * loopsCountPerMetricNameMatch
|
||||||
|
}
|
||||||
m, filterLoopsCount, err := is.getMetricIDsForDateTagFilter(tf, date, tfs.commonPrefix, intMax, maxLoopsCount)
|
m, filterLoopsCount, err := is.getMetricIDsForDateTagFilter(tf, date, tfs.commonPrefix, intMax, maxLoopsCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, errTooManyLoops) {
|
if errors.Is(err, errTooManyLoops) {
|
||||||
|
|
Loading…
Reference in a new issue