Skip to content

Commit 586f28a

Browse files
bborehampracucci
andcommitted
Add chunk flush outcome "Dropped", for short series (#2998)
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 <[email protected]> Co-authored-by: Marco Pracucci <[email protected]>
1 parent b399437 commit 586f28a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/ingester/flush.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const (
111111
noSeries
112112
noChunks
113113
flushError
114+
reasonDropped
114115
maxFlushReason // Used for testing String() method. Should be last.
115116
)
116117

@@ -138,6 +139,8 @@ func (f flushReason) String() string {
138139
return "NoChunksToFlush"
139140
case flushError:
140141
return "FlushError"
142+
case reasonDropped:
143+
return "Dropped"
141144
default:
142145
panic("unrecognised flushReason")
143146
}
@@ -307,12 +310,17 @@ func (i *Ingester) flushUserSeries(flushQueueIndex int, userID string, fp model.
307310
"queue", flushQueueIndex,
308311
)
309312
chunks = nil
313+
reason = reasonDropped
310314
}
311315
}
312316
}
313317

314318
userState.fpLocker.Unlock(fp)
315319

320+
if reason == reasonDropped {
321+
return reason, nil
322+
}
323+
316324
// No need to flush these chunks again.
317325
for len(chunks) > 0 && chunks[0].flushed {
318326
chunks = chunks[1:]

0 commit comments

Comments
 (0)