Skip to content

Commit

Permalink
Fixes iota unexpected behaviour with bytes for chunk encoding. (#2945)
Browse files Browse the repository at this point in the history
* Fixes iota unexpected behaviour with bytes for chunk encoding.

This was introducing incompatibilities since iota with bytes starts at 2.
Seems like a weird conversion between iota int and byte.

This can currenlty corrupt chunks, and previous chunks are not decodable.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>

* With iota correclty this time.

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
cyriltovena authored Nov 18, 2020
1 parent 14a5fda commit fa7ea9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/chunkenc/memchunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
)

const (
blocksPerChunk = 10
maxLineLength = 1024 * 1024 * 1024

_ byte = iota
chunkFormatV1
chunkFormatV2
chunkFormatV3

blocksPerChunk = 10
maxLineLength = 1024 * 1024 * 1024
)

var (
Expand Down

1 comment on commit fa7ea9c

@slim-bean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we saying the ordering of how these constants are defined affects the value in them??

Please sign in to comment.