From 9f33220e5169746a75a7330fdc551d9e73efef3d Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 6 May 2024 23:09:39 +0200 Subject: [PATCH] wip --- lib/logstorage/pipe_sort.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/logstorage/pipe_sort.go b/lib/logstorage/pipe_sort.go index 4437837f7..5e1a95cc8 100644 --- a/lib/logstorage/pipe_sort.go +++ b/lib/logstorage/pipe_sort.go @@ -317,9 +317,12 @@ func (shard *pipeSortProcessorShard) createTimestampsIfNeeded(timestamps []int64 return nil } + timestampsBuf := shard.timestampsBuf timestampsBufLen := len(shard.timestampsBuf) - shard.timestampsBuf = append(shard.timestampsBuf, timestamps...) - shard.stateSizeBudget -= (len(timestamps) - timestampsBufLen) * int(unsafe.Sizeof(timestamps[0])) + timestampsBuf = append(timestampsBuf, timestamps...) + shard.timestampsBuf = timestampsBuf + + shard.stateSizeBudget -= (len(timestampsBuf) - timestampsBufLen) * int(unsafe.Sizeof(timestampsBuf[0])) return shard.timestampsBuf[timestampsBufLen:] }