From aeec0b85a29b4274bdc71740f30ba440072c4107 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Wed, 5 Aug 2020 16:27:59 +0000 Subject: [PATCH] Add chunk flush outcome "Dropped", for short series If the series is below a configured length it gets dropped instead of flushed. Add a separate `outcome` for this case, otherwise it is reported as "NoChunksToFlush". Signed-off-by: Bryan Boreham --- pkg/ingester/flush.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/ingester/flush.go b/pkg/ingester/flush.go index 9c619f78778..1b3d0806a2d 100644 --- a/pkg/ingester/flush.go +++ b/pkg/ingester/flush.go @@ -111,6 +111,7 @@ const ( noSeries noChunks flushError + reasonDropped maxFlushReason // Used for testing String() method. Should be last. ) @@ -138,6 +139,8 @@ func (f flushReason) String() string { return "NoChunksToFlush" case flushError: return "FlushError" + case reasonDropped: + return "Dropped" default: panic("unrecognised flushReason") } @@ -307,12 +310,17 @@ func (i *Ingester) flushUserSeries(flushQueueIndex int, userID string, fp model. "queue", flushQueueIndex, ) chunks = nil + reason = reasonDropped } } } userState.fpLocker.Unlock(fp) + if reason == reasonDropped { + return reason, nil + } + // No need to flush these chunks again. for len(chunks) > 0 && chunks[0].flushed { chunks = chunks[1:]