Conversation
|
Would you mind adding some unit tests? |
|
I should have given some thought to making this optional. Once you write some smaller chunks, you need the code change to read them back, so you'd need to be sure you weren't rolling back past this change. |
The existing unit tests exercise this code. What extra were you thinking of? |
Theres nothing in this package which exercises this code. The tests in I think it would be good to have a test which appends an increasing number of samples to a chunk, encodes it via a |
|
Also needs a DCO. |
#1029 edited the code here too. |
I added such a test in #1048 |
|
Sure, if you like. I left it alone because I saw only a 5% overall reduction in storage size, but I still think it's worth doing if you have time. |
- Only effective for varbit chunks at present. - Also allow undersized varbit chunks to be unmarshalled. - Use varbit encoding in chunk tests, since that's what we use most commonly in production - Remove chunk.Unmarshal(io.Reader), its only used in tests. Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
8ab1310 to
74cd091
Compare
|
There you go @bboreham; I ended up remove the |
|
(Its an LGTM from me, but I'll let you merge it @bboreham) |
|
Current status is I believe I have tried this and I believe it isn't working, in that it still outputs a bunch of zeros at the end of the chunk. |
|
I take it back: the code where I thought this had been used was turned off. |
|
I did a more effective test. Everything worked when I had ingesters rolled forward and queriers to match, but when I tried to roll back the ingesters the chunk hand-over failed: this is something I hadn't thought about: it's actually a nice efficiency gain for the old-style chunks to do the hand-over without padding, but you can't fail back to older ingesters. So, what to do? Make it optional on the write path so we can update everything and then turn it on? |
0e2fe2f to
b8f3a78
Compare
cmd/ingester/main.go
Outdated
There was a problem hiding this comment.
Could this be done more like PreallocConfig in the client pkg? https://github.com/cortexproject/cortex/blob/master/pkg/ingester/client/timeseries.go#L13
|
One nit, otherwise LGTM |
This allows all components to be rolled out in a mode which accepts either size of chunk, then changed over to write the new way at a later date. Signed-off-by: Bryan Boreham <bryan@weave.works>
Also un-export MarshalLen since it is not called from outside. Signed-off-by: Bryan Boreham <bryan@weave.works>
7e07298 to
5f8de0c
Compare
|
Nice, thanks! LGTM |
|
This is a bit broken, because you need the flag on the reading side but I only plumbed it in to ingester. What I wanted was that all components could read chunks of either style, and the flag changes what ingester writes. |
|
Still broken - the chunks passed from one ingester to another in hand-over cannot be appended to. |
Fixes #631
Note we had not previously edited the chunk code copy-pasted from Prometheus (v1).Only fully implemented for varbit chunks at present; I don't think we're intending to use other kinds.
Varbit chunks hold metadata in a header and a footer at the end of the chunk, however the footer is only used while appending more samples, so can be discarded when the chunk is "closed" and written to store.
A flag is added to make the new behaviour optional on writing, since shorter chunks cannot be read by older versions of Cortex so if you roll back after turning it on, you lose the ability to query any data written with short chunks.
The shorter encoding is also used when transferring chunks from one ingester to another on rolling updates.