This commit is contained in:
Aliaksandr Valialkin 2024-05-15 12:15:16 +02:00
parent 87de9936f9
commit 21f09ab823
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB
2 changed files with 3 additions and 1 deletions

View file

@ -19,6 +19,8 @@ according to [these docs](https://docs.victoriametrics.com/VictoriaLogs/QuickSta
## tip
* BUGFIX: properly take into account `offset` [`sort` pipe](https://docs.victoriametrics.com/victorialogs/logsql/#sort-pipe) when it already has `limit`. For example, `_time:5m | sort by (foo) offset 20 limit 10`.
## [v0.7.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v0.7.0-victorialogs)
Released at 2024-05-15

View file

@ -263,7 +263,7 @@ func (shard *pipeTopkProcessorShard) addRow(byColumns []string, otherColumns []F
// Slow path - add r to shard.rows.
r = r.clone()
shard.stateSizeBudget -= r.sizeBytes()
if uint64(len(rows)) < shard.ps.limit {
if uint64(len(rows)) < shard.ps.offset+shard.ps.limit {
heap.Push(shard, r)
shard.stateSizeBudget -= int(unsafe.Sizeof(r))
} else {