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
576a80b3d9
commit
ccfb0ae2d3
1 changed files with 3 additions and 0 deletions
|
@ -2954,6 +2954,9 @@ func (is *indexSearch) getMetricIDsForDateAndFilters(date uint64, tfs *TagFilter
|
|||
break
|
||||
}
|
||||
maxLoopsCount := getFirstPositiveFilterLoopsCount(tfws[i+1:])
|
||||
if maxLoopsCount == int64Max {
|
||||
maxLoopsCount = int64(metricIDsLen) * loopsCountPerMetricNameMatch
|
||||
}
|
||||
m, filterLoopsCount, err := is.getMetricIDsForDateTagFilter(tf, date, tfs.commonPrefix, intMax, maxLoopsCount)
|
||||
if err != nil {
|
||||
if errors.Is(err, errTooManyLoops) {
|
||||
|
|
Loading…
Reference in a new issue