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`.
This commit is contained in:
Aliaksandr Valialkin 2024-10-12 20:49:34 +02:00
parent 2239f5829f
commit 867f671cc4
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 4 additions and 1 deletions

View file

@ -15,6 +15,9 @@ according to [these docs](https://docs.victoriametrics.com/victorialogs/quicksta
## tip ## 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) ## [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). * 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).

View file

@ -1733,7 +1733,7 @@ func (c *blockResultColumn) forEachDictValue(br *blockResult, f func(v string))
if c.valueType != valueTypeDict { if c.valueType != valueTypeDict {
logger.Panicf("BUG: unexpected column valueType=%d; want %d", 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 // Fast path - there is no need in reading encoded values
for _, v := range c.dictValues { for _, v := range c.dictValues {
f(v) f(v)