prometheus/tsdb/tsdbutil
Filip Petkovski 1f69dcfa6b
Fix reusing float histograms
In https://github.com/prometheus/prometheus/pull/13276 we started reusing float histogram objects to reduce allocations in PromQL.
That PR introduces a bug where histogram pointers gets copied to the beginning of the histograms slice,
but are still kept in the end of the slice. When a new histogram is read into the last element,
it can overwrite a previous element because the pointer is the same.

This commit fixes the issue by moving outdated points to the end of the slice
so that we don't end up with duplicate pointers in the same buffer. In other words,
the slice gets rotated so that old objects can get reused.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
2023-12-14 11:53:58 +01:00
..
dir_locker.go tsdb/tsdbutil: use Go standard errors 2023-11-14 20:46:36 +01:00
dir_locker_test.go Share TSDB locker code with agent (#9623) 2021-11-11 11:45:25 -05:00
dir_locker_testutil.go refactor: move from io/ioutil to io and os packages (#10528) 2022-04-27 11:24:36 +02:00
histogram.go Fix reusing float histograms 2023-12-14 11:53:58 +01:00