mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logstorage: properly clone field values at values
stats function
Previously field values weren't properly cloned, which could lead to garbage output for `values` stats function Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7458
This commit is contained in:
parent
9b766d3e32
commit
2f1ce74d97
2 changed files with 6 additions and 4 deletions
|
@ -25,6 +25,7 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
|
|||
* FEATURE: [syslog data ingestion](https://docs.victoriametrics.com/victorialogs/data-ingestion/syslog/): allow adding the specified [log fields](https://docs.victoriametrics.com/victorialogs/keyconcepts/#data-model) during data ingestion. See [these docs](https://docs.victoriametrics.com/victorialogs/data-ingestion/syslog/#adding-extra-fields). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7354).
|
||||
* FEATURE: [Loki data ingestion](https://docs.victoriametrics.com/victorialogs/data-ingestion/#loki-json-api): show the original request body on parse errors. This should simplify debugging. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7490).
|
||||
|
||||
* BUGFIX: [`values` stats function](https://docs.victoriametrics.com/victorialogs/logsql/#values-stats): fix a bug, which could lead to corrupted results. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7458).
|
||||
* BUGFIX: [HTTP querying APIs](https://docs.victoriametrics.com/victorialogs/querying/#http-api): properly take into account the `end` query arg when calculating time range for [`_time:duration` filter](https://docs.victoriametrics.com/victorialogs/logsql/#time-filter). Previously the `_time:duration` filter was treated as `_time:[now-duration, now)`, while it should be treated as `_time:[end-duration, end)`.
|
||||
|
||||
## [v0.41.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.41.0-victorialogs)
|
||||
|
|
|
@ -91,12 +91,13 @@ func (svp *statsValuesProcessor) updateStatsForAllRowsColumn(c *blockResultColum
|
|||
}
|
||||
|
||||
values := svp.values
|
||||
vPrev := ""
|
||||
for _, v := range c.getValues(br) {
|
||||
if len(values) == 0 || values[len(values)-1] != v {
|
||||
v = strings.Clone(v)
|
||||
stateSizeIncrease += len(v)
|
||||
if len(values) == 0 || v != vPrev {
|
||||
vPrev = strings.Clone(v)
|
||||
stateSizeIncrease += len(vPrev)
|
||||
}
|
||||
values = append(values, v)
|
||||
values = append(values, vPrev)
|
||||
}
|
||||
svp.values = values
|
||||
|
||||
|
|
Loading…
Reference in a new issue