mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/logstorage: clear hits slice obtained from encoding.GetUint64s() before updating it with hits for valueTypeDict column
encoding.GetUint64s() returns uninitialized slice, which may contain arbitrary values. So values in this slice must be reset to zero before using it for counting hits in `uniq` and `top` pipes.
This commit is contained in:
parent
94afcbd9a9
commit
55eb321f77
3 changed files with 4 additions and 0 deletions
|
@ -19,6 +19,8 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
|
||||||
* FEATURE: [`sort` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe): allow using `order` alias instead of `sort`. For example, `_time:5s | order by (_time)` query works the same as `_time:5s | sort by (_time)`.
|
* FEATURE: [`sort` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe): allow using `order` alias instead of `sort`. For example, `_time:5s | order by (_time)` query works the same as `_time:5s | sort by (_time)`.
|
||||||
* FEATURE: [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe): allow using multiple identical [stats functions](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe-functions) with distinct [filters](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) and automatically generated result names. For example, `_time:5m | count(), count() if (error)` query works as expected now, e.g. it returns two results over the last 5 minutes: the total number of logs and the number of logs with `error` [word](https://docs.victoriametrics.com/victorialogs/logsql/#word). Previously this query couldn't be executed because the `if (...)` condition wasn't included in the automatically generate result name, so both results had the same name - `count(*)`.
|
* FEATURE: [`stats` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe): allow using multiple identical [stats functions](https://docs.victoriametrics.com/victorialogs/logsql/#stats-pipe-functions) with distinct [filters](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters) and automatically generated result names. For example, `_time:5m | count(), count() if (error)` query works as expected now, e.g. it returns two results over the last 5 minutes: the total number of logs and the number of logs with `error` [word](https://docs.victoriametrics.com/victorialogs/logsql/#word). Previously this query couldn't be executed because the `if (...)` condition wasn't included in the automatically generate result name, so both results had the same name - `count(*)`.
|
||||||
|
|
||||||
|
* BUGFIX: properly calculate [`uniq`](https://docs.victoriametrics.com/victorialogs/logsql/#uniq-pipe) and [`top`](https://docs.victoriametrics.com/victorialogs/logsql/#top-pipe) pipes. Previously they could return invalid results in some cases.
|
||||||
|
|
||||||
## [v0.31.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.31.0-victorialogs)
|
## [v0.31.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.31.0-victorialogs)
|
||||||
|
|
||||||
Released at 2024-09-27
|
Released at 2024-09-27
|
||||||
|
|
|
@ -166,6 +166,7 @@ func (shard *pipeTopProcessorShard) writeBlock(br *blockResult) {
|
||||||
if c.valueType == valueTypeDict {
|
if c.valueType == valueTypeDict {
|
||||||
a := encoding.GetUint64s(len(c.dictValues))
|
a := encoding.GetUint64s(len(c.dictValues))
|
||||||
hits := a.A
|
hits := a.A
|
||||||
|
clear(hits)
|
||||||
valuesEncoded := c.getValuesEncoded(br)
|
valuesEncoded := c.getValuesEncoded(br)
|
||||||
for _, v := range valuesEncoded {
|
for _, v := range valuesEncoded {
|
||||||
idx := unmarshalUint8(v)
|
idx := unmarshalUint8(v)
|
||||||
|
|
|
@ -169,6 +169,7 @@ func (shard *pipeUniqProcessorShard) writeBlock(br *blockResult) bool {
|
||||||
if needHits {
|
if needHits {
|
||||||
a := encoding.GetUint64s(len(c.dictValues))
|
a := encoding.GetUint64s(len(c.dictValues))
|
||||||
hits := a.A
|
hits := a.A
|
||||||
|
clear(hits)
|
||||||
valuesEncoded := c.getValuesEncoded(br)
|
valuesEncoded := c.getValuesEncoded(br)
|
||||||
for _, v := range valuesEncoded {
|
for _, v := range valuesEncoded {
|
||||||
idx := unmarshalUint8(v)
|
idx := unmarshalUint8(v)
|
||||||
|
|
Loading…
Reference in a new issue