From 0ea261b33d0d53bd7c19a16d9dc5dba1590579be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Tue, 29 Oct 2024 18:34:01 +0100 Subject: [PATCH] Do not treat explicit counter resets special in OOO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleared them like any other reset. Signed-off-by: György Krajcsovits --- tsdb/head_test.go | 2 +- tsdb/ooo_head.go | 4 ++-- tsdb/ooo_head_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tsdb/head_test.go b/tsdb/head_test.go index 143bbe9450..46a65e0ef5 100644 --- a/tsdb/head_test.go +++ b/tsdb/head_test.go @@ -4803,7 +4803,7 @@ func TestOOOHistogramCounterResetHeaders(t *testing.T) { numSamples: 1, }, expOOOMmappedChunks{ - header: chunkenc.CounterReset, + header: chunkenc.UnknownCounterReset, mint: 210, maxt: 210, numSamples: 1, diff --git a/tsdb/ooo_head.go b/tsdb/ooo_head.go index 9ccd1d9ac6..5e214a6d9c 100644 --- a/tsdb/ooo_head.go +++ b/tsdb/ooo_head.go @@ -137,7 +137,7 @@ func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error if newChunk != nil { // A new chunk was allocated. if !recoded { hc := newChunk.(*chunkenc.HistogramChunk) - if s.h.CounterResetHint != histogram.CounterReset && hc.GetCounterResetHeader() == chunkenc.CounterReset { + if hc.GetCounterResetHeader() == chunkenc.CounterReset { // Clear the detected counter reset in the chunk as we cannot trust // it in OOO. hc.ClearCounterReset() @@ -158,7 +158,7 @@ func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error if newChunk != nil { // A new chunk was allocated. if !recoded { hc := newChunk.(*chunkenc.FloatHistogramChunk) - if s.fh.CounterResetHint != histogram.CounterReset && hc.GetCounterResetHeader() == chunkenc.CounterReset { + if hc.GetCounterResetHeader() == chunkenc.CounterReset { // Clear the detected counter reset in the chunk as we cannot trust // it in OOO. hc.ClearCounterReset() diff --git a/tsdb/ooo_head_test.go b/tsdb/ooo_head_test.go index 830d575b14..c5386757a5 100644 --- a/tsdb/ooo_head_test.go +++ b/tsdb/ooo_head_test.go @@ -217,7 +217,7 @@ func TestOOOChunks_ToEncodedChunks(t *testing.T) { {t: 1000, h: h1}, {t: 1100, h: h2explicit}, }, - expectedCounterResets: []histogram.CounterResetHint{histogram.UnknownCounterReset, histogram.CounterReset}, + expectedCounterResets: []histogram.CounterResetHint{histogram.UnknownCounterReset, histogram.UnknownCounterReset}, expectedChunks: []chunkVerify{ {encoding: chunkenc.EncHistogram, minTime: 1000, maxTime: 1000}, {encoding: chunkenc.EncHistogram, minTime: 1100, maxTime: 1100},