mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: fix metric name match for composite filter
This commit is contained in:
parent
fa0ef143b1
commit
17d5a03f6e
1 changed files with 5 additions and 1 deletions
|
@ -1910,6 +1910,10 @@ func (is *indexSearch) updateMetricIDsByMetricNameMatch(metricIDs, srcMetricIDs
|
||||||
// sort srcMetricIDs in order to speed up Seek below.
|
// sort srcMetricIDs in order to speed up Seek below.
|
||||||
sortedMetricIDs := srcMetricIDs.AppendTo(nil)
|
sortedMetricIDs := srcMetricIDs.AppendTo(nil)
|
||||||
|
|
||||||
|
kb := &is.kb
|
||||||
|
kb.B = is.marshalCommonPrefix(kb.B[:0], nsPrefixTagToMetricIDs)
|
||||||
|
tfs = fromCompositeTagFilters(tfs, kb.B)
|
||||||
|
|
||||||
metricName := kbPool.Get()
|
metricName := kbPool.Get()
|
||||||
defer kbPool.Put(metricName)
|
defer kbPool.Put(metricName)
|
||||||
mn := GetMetricName()
|
mn := GetMetricName()
|
||||||
|
@ -2140,6 +2144,7 @@ func fromCompositeTagFilters(tfs []*tagFilter, prefix []byte) []*tagFilter {
|
||||||
}
|
}
|
||||||
tagKey = tagKey[nameLen:]
|
tagKey = tagKey[nameLen:]
|
||||||
tfNew := *tf
|
tfNew := *tf
|
||||||
|
tfNew.key = append(tfNew.key[:0], tagKey...)
|
||||||
tfNew.prefix = append(tfNew.prefix[:0], prefix...)
|
tfNew.prefix = append(tfNew.prefix[:0], prefix...)
|
||||||
tfNew.prefix = marshalTagValue(tfNew.prefix, tagKey)
|
tfNew.prefix = marshalTagValue(tfNew.prefix, tagKey)
|
||||||
tfNew.prefix = append(tfNew.prefix, tail...)
|
tfNew.prefix = append(tfNew.prefix, tail...)
|
||||||
|
@ -2150,7 +2155,6 @@ func fromCompositeTagFilters(tfs []*tagFilter, prefix []byte) []*tagFilter {
|
||||||
|
|
||||||
func matchTagFilters(mn *MetricName, tfs []*tagFilter, kb *bytesutil.ByteBuffer) (bool, error) {
|
func matchTagFilters(mn *MetricName, tfs []*tagFilter, kb *bytesutil.ByteBuffer) (bool, error) {
|
||||||
kb.B = marshalCommonPrefix(kb.B[:0], nsPrefixTagToMetricIDs, mn.AccountID, mn.ProjectID)
|
kb.B = marshalCommonPrefix(kb.B[:0], nsPrefixTagToMetricIDs, mn.AccountID, mn.ProjectID)
|
||||||
tfs = fromCompositeTagFilters(tfs, kb.B)
|
|
||||||
for i, tf := range tfs {
|
for i, tf := range tfs {
|
||||||
if bytes.Equal(tf.key, graphiteReverseTagKey) {
|
if bytes.Equal(tf.key, graphiteReverseTagKey) {
|
||||||
// Skip artificial tag filter for Graphite-like metric names with dots,
|
// Skip artificial tag filter for Graphite-like metric names with dots,
|
||||||
|
|
Loading…
Reference in a new issue