From 867f671cc4d2b3eae7a4b9b7911a07268743faf4 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 12 Oct 2024 20:49:34 +0200 Subject: [PATCH] lib/logstorage: make sure that bs.br is non-nil before checking br.bs.bsw.bh.rowsCount there br.bs may be nil when br contains the block with additional filters applied during pipe calculations. For example, `* | count() if (error) errors`. --- docs/VictoriaLogs/CHANGELOG.md | 3 +++ lib/logstorage/block_result.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/VictoriaLogs/CHANGELOG.md b/docs/VictoriaLogs/CHANGELOG.md index 533f5488e..cece5d096 100644 --- a/docs/VictoriaLogs/CHANGELOG.md +++ b/docs/VictoriaLogs/CHANGELOG.md @@ -15,6 +15,9 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta ## tip +* BUGFIX: avoid panic at `lib/logstorage.(*blockResultColumn).forEachDictValue()` when [stats with additional filters](https://docs.victoriametrics.com/victorialogs/logsql/#stats-with-additional-filters). The panic has been introduced in [v0.33.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.33.0-victorialogs) in [this commit](https://github.com/VictoriaMetrics/VictoriaMetrics/commit/a350be48b68330ee1a487e1fb09b002d3be45163). + + ## [v0.35.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.35.0-victorialogs) * FEATURE: [vlogscli](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/): add ability to live tail query results - see [these docs](https://docs.victoriametrics.com/victorialogs/querying/vlogscli/#live-tailing). diff --git a/lib/logstorage/block_result.go b/lib/logstorage/block_result.go index 319df03fb..c95fe8597 100644 --- a/lib/logstorage/block_result.go +++ b/lib/logstorage/block_result.go @@ -1733,7 +1733,7 @@ func (c *blockResultColumn) forEachDictValue(br *blockResult, f func(v string)) if c.valueType != valueTypeDict { logger.Panicf("BUG: unexpected column valueType=%d; want %d", c.valueType, valueTypeDict) } - if uint64(br.rowsLen) == br.bs.bsw.bh.rowsCount { + if br.bs != nil && uint64(br.rowsLen) == br.bs.bsw.bh.rowsCount { // Fast path - there is no need in reading encoded values for _, v := range c.dictValues { f(v)