mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: skip non-matching metricIDs in sortedFilter
This should improve performance for big sorteFilter lists.
This commit is contained in:
parent
0c88afa386
commit
2ecb117082
1 changed files with 9 additions and 0 deletions
|
@ -1678,6 +1678,15 @@ func (is *indexSearch) updateMetricIDsForOrSuffixWithFilter(prefix []byte, metri
|
||||||
}
|
}
|
||||||
metricID := encoding.UnmarshalUint64(v)
|
metricID := encoding.UnmarshalUint64(v)
|
||||||
if metricID != nextMetricID {
|
if metricID != nextMetricID {
|
||||||
|
// Skip metricIDs smaller than the found metricID, since they don't
|
||||||
|
// match anything.
|
||||||
|
if len(sortedFilter) > 0 && metricID > sortedFilter[0] {
|
||||||
|
sortedFilter = sortedFilter[1:]
|
||||||
|
n := sort.Search(len(sortedFilter), func(i int) bool {
|
||||||
|
return metricID <= sortedFilter[i]
|
||||||
|
})
|
||||||
|
sortedFilter = sortedFilter[n:]
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if isNegative {
|
if isNegative {
|
||||||
|
|
Loading…
Reference in a new issue