mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmstorage: fix query like {foo=~"bar|"}
return extra timeseries cause by negative filter transformation malfunction (#2032)
1. L2749 make kb.B remain the value of comonPrefix instead of tf.prefix 2. L2762 avoid change tf.value from "bar|" to ".+r|"
This commit is contained in:
parent
e1d7cbfc77
commit
38bf5fc136
1 changed files with 2 additions and 2 deletions
|
@ -2719,10 +2719,9 @@ func (is *indexSearch) getMetricIDsForDateTagFilter(tf *tagFilter, date uint64,
|
|||
// Use global search if date isn't set.
|
||||
kb.B = is.marshalCommonPrefix(kb.B[:0], nsPrefixTagToMetricIDs)
|
||||
}
|
||||
kb.B = append(kb.B, tf.prefix[len(commonPrefix):]...)
|
||||
tfNew := *tf
|
||||
tfNew.isNegative = false // isNegative for the original tf is handled by the caller.
|
||||
tfNew.prefix = kb.B
|
||||
tfNew.prefix = append(kb.B, tf.prefix[len(commonPrefix):]...)
|
||||
metricIDs, loopsCount, err := is.getMetricIDsForTagFilter(&tfNew, maxMetrics, maxLoopsCount)
|
||||
if err != nil {
|
||||
return nil, loopsCount, err
|
||||
|
@ -2735,6 +2734,7 @@ func (is *indexSearch) getMetricIDsForDateTagFilter(tf *tagFilter, date uint64,
|
|||
// This fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1601
|
||||
// See also https://github.com/VictoriaMetrics/VictoriaMetrics/issues/395
|
||||
maxLoopsCount -= loopsCount
|
||||
tfNew = tagFilter{}
|
||||
if err := tfNew.Init(kb.B, tf.key, []byte(".+"), false, true); err != nil {
|
||||
logger.Panicf(`BUG: cannot init tag filter: {%q=~".+"}: %s`, tf.key, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue