From 911e3bc8a3116c16db34bfef2f8a4e7baf86a164 Mon Sep 17 00:00:00 2001 From: Sebastian Rabenhorst Date: Tue, 10 Jan 2023 15:24:42 +0100 Subject: [PATCH] Renamed lastValue of dedup iter and added TODO Signed-off-by: Sebastian Rabenhorst --- pkg/dedup/iter.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/dedup/iter.go b/pkg/dedup/iter.go index 2462b3c3b67..34b7ef04847 100644 --- a/pkg/dedup/iter.go +++ b/pkg/dedup/iter.go @@ -323,7 +323,7 @@ type adjustableSeriesIterator interface { // adjustAtValue allows to adjust value by implementation if needed knowing the last value. This is used by counter // implementation which can adjust for obsolete counter value. - adjustAtValue(lastValue float64) + adjustAtValue(lastFloatValue float64) } type noopAdjustableSeriesIterator struct { @@ -360,11 +360,11 @@ type counterErrAdjustSeriesIterator struct { errAdjust float64 } -func (it *counterErrAdjustSeriesIterator) adjustAtValue(lastValue float64) { +func (it *counterErrAdjustSeriesIterator) adjustAtValue(lastFloatValue float64) { _, v := it.At() - if lastValue > v { + if lastFloatValue > v { // This replica has obsolete value (did not see the correct "end" of counter value before app restart). Adjust. - it.errAdjust += lastValue - v + it.errAdjust += lastFloatValue - v } } @@ -405,6 +405,7 @@ func (it *dedupSeriesIterator) Next() chunkenc.ValueType { if it.useA != lastUseA && isFloatVal { // We switched replicas. // Ensure values are correct bases on value before At. + // TODO(rabenhorst): Investiagte if we also need to implement adjusting histograms here. it.adjustAtValue(lastFloatVal) } }() @@ -487,12 +488,12 @@ func (it *dedupSeriesIterator) lastFloatVal() (float64, bool) { return 0, false } -func (it *dedupSeriesIterator) adjustAtValue(lastValue float64) { +func (it *dedupSeriesIterator) adjustAtValue(lastFloatValue float64) { if it.aval == chunkenc.ValFloat { - it.a.adjustAtValue(lastValue) + it.a.adjustAtValue(lastFloatValue) } if it.bval == chunkenc.ValFloat { - it.b.adjustAtValue(lastValue) + it.b.adjustAtValue(lastFloatValue) } }