-
Notifications
You must be signed in to change notification settings - Fork 816
Make max chunk size 1hr #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Will need post-merge review #97 |
@@ -515,7 +515,7 @@ func (i *Ingester) flushSeries(u *userState, fp model.Fingerprint, series *memor | |||
} | |||
|
|||
firstTime := series.chunkDescs[0].FirstTime() | |||
flush := immediate || model.Now().Sub(firstTime) > i.cfg.MaxChunkAge | |||
flush := immediate || len(series.chunkDescs) > 1 || model.Now().Sub(firstTime) > i.cfg.MaxChunkAge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why strictly greater than one? I could understand > 0
, but > 1
seems a bit odd. I realise at this point we know that it's non-empty, but why do we not want to flush if it has only 1 thing?
Somewhat out of scope for this PR, but it's difficult for me to reason locally about fpLocker
. Any reader of this method needs to know about its call-site to understand why locking is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why strictly greater than one?
We need to flush something in the series if:
- we are existing (
immedidate
) - a chunk has be filled by the incoming data and a new one created (
len > 1
) - the series (and by implication, the one and only chunk) is older than the threshold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. The logic is that we always flush closed chunks, or open old chunks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More of less. Series.Add will 'close' chunks when they get full:
https://github.com/weaveworks/cortex/blob/master/ingester/series.go#L141
(chunks don't actually have a closed concept, we just track it for the head chunk specially)
Also, schedule series for flushing if it has >1 chunk.