Repository navigation
Ensure timestamp monotonicity within a series. - #889
Conversation
acdfc3e to
e741a20
Compare
There was a problem hiding this comment.
I'd opt for putting same types in the same row – but whatever you prefer.
There was a problem hiding this comment.
I actually prefer having them aligned under each other for legibility. Not strongly, but will keep it as is for now :)
|
I recently started prefixing commit messages with the name of the mainly affected subsystem/package. I think it improves searching for specific changes significantly if we did it consistently. |
|
Looks good. |
|
Changed the commit message. I feel like the prefixes are mostly good, but I'm ambivalent about making them mandatory. The one obvious downside is that adding them leaves even fewer characters before reaching the recommended 50-char limit for the first line (http://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting). Like right now, I'm stepping over it already :) |
|
Other question would be: what prefix (if any) to use for cross-cutting changes that touch all/multiple parts? |
|
I don't see the value. If I'm looking for changes to a certain part of the
codebase I can just restrict `git log`?
|
There was a problem hiding this comment.
Don't capitalize error messages.
There was a problem hiding this comment.
Hmm, some other panics in this file are capitalized too, others not. Will lower-case them all.
There was a problem hiding this comment.
Did that and also inserted another panic in delta.go where there was a similar comment.
There was a problem hiding this comment.
Weird, I thought golint would catch capitalized panic messages.
There was a problem hiding this comment.
This is a fairly expensive operation. It involves locking the timestamp and creation of a chunk iterator.
And this is the hottest spot in the code, i.e. almost all appends will go through this.
We need to remember the last append time in the series object (and probably want to include it in the checkpoint, too).
There was a problem hiding this comment.
Ah, good point. Append benchmarks show that this goes from 2us to 2.4us per op with this added, so it's definitely relevant.
There was a problem hiding this comment.
Plus the allocation churn for the chunk iterator... up to 360,000 times per second... ;)
|
We probably do not have to save the latest timestamp in the checkpoint, but we should have in in the series object and populate it upon load from the checkpointed head chunk (with the expensive operation currently in the normal code, this code path will then only executed once per time series upon startup). Crash recovery needs updates, too, for that. |
|
@beorn7 Changed this cache the last time in the series. That field is already reconstructed in memory when loading a checkpoint. I haven't touched crash recovery yet, and probably there should also be a test for the new feature in the checkpoint loading. Feel free to push over this branch (and eventually merge) while I'm on vacation... |
There was a problem hiding this comment.
I added clientmodel.Earliest here to make it compile for now - haven't checked yet what it really should be in this context.
|
OK, I'm taking this over. |
6147c72 to
6fa0862
Compare
Fixes #481 While doing so, clean up and fix a few other things: - Fix `go vet` warnings (@fabxc to blame ;). - Fix a racey problem with unarchiving: Whenever we unarchive a series, we essentially want to do something with it. However, until we have done something with it, it appears like a series that is ready to be archived or even purged. So e.g. it would be ignored during checkpointing. With this fix, we always load the chunkDescs upon unarchiving. This is wasteful if we only want to add a new sample to an archived time series, but the (presumably more common) case where we access an archived time series in a query doesn't become more expensive. - The change above streamlined the getOrCreateSeries ond newMemorySeries flow. Also, the modTime is now always set correctly. - Fix the leveldb-backed implementation of KeyValueStore.Delete. It had the wrong behavior of still returning true, nil if a non-existing key has been passed in.
|
@fabxc This is ready for review now. As @juliusv is on vacation, I delegate to you. About the package prefix in commit messages: It breaks the common practice of starting a commit message with a verb in imperative form. Not that I would feel strongly personally. But it means our convention would fight a very established Git convention. |
|
Picking up the question of whether there can be two samples with the same timestamp: In our current understanding of the world there is only one state at any given time (advanced physics put aside). The time series we collect are thus an approximation of a function over time. The easiest solution is to simply not ingest a sample for a time at which we already have a sample. |
|
Yeah, overwriting is hard as we so far maintained append-only semantics... If we enforce strict monotonicity, the bug I have found cannot happen anymore. (See #880 .) I still think my fix makes the code simpler and more robust, so we should keep it. Just my test doesn't work anymore, because it created samples with the same timestamp. So I could remove my commit that allowed non-strict monotonicity and modify my test in #880 . Thought? |
|
Sounds good. |
There was a problem hiding this comment.
Can we set the Value to i so down below it is clearer which sample was actually inserted?
|
👍 |
Ensure timestamp monotonicity within a series.
…rge-11-06-25 Sync upstream prometheus @ 94d5e0f
Fixes #481