diff --git a/tsdb/docs/format/chunks.md b/tsdb/docs/format/chunks.md index 7eb0820e44..d6e3a3ae6c 100644 --- a/tsdb/docs/format/chunks.md +++ b/tsdb/docs/format/chunks.md @@ -25,20 +25,20 @@ in-file offset (lower 4 bytes) and segment sequence number (upper 4 bytes). └──────────────────────────────┘ ``` - # Chunk ``` -┌───────────────┬───────────────────┬─────────────┬────────────────┐ -│ len │ encoding <1 byte> │ data │ CRC32 <4 byte> │ -└───────────────┴───────────────────┴─────────────┴────────────────┘ +┌───────────────┬───────────────────┬─────────────┬───────────────────┐ +│ len │ encoding <1 byte> │ data │ checksum <4 byte> │ +└───────────────┴───────────────────┴─────────────┴───────────────────┘ ``` Notes: -* `` has 1 to 10 bytes. -* `encoding`: Currently either `XOR`, `histogram`, or `floathistogram`, see - [code for numerical values](https://github.com/prometheus/prometheus/blob/02d0de9987ad99dee5de21853715954fadb3239f/tsdb/chunkenc/chunk.go#L28-L47). + +* `len`: Chunk size in bytes. 1 to 10 bytes long using the [`` encoding](https://go.dev/src/encoding/binary/varint.go). +* `encoding`: Currently either `XOR`, `histogram`, or `floathistogram`, see [code for numerical values](https://github.com/prometheus/prometheus/blob/02d0de9987ad99dee5de21853715954fadb3239f/tsdb/chunkenc/chunk.go#L28-L47). * `data`: See below for each encoding. +* `checksum`: Checksum of `encoding` and `data`. It's a [cyclic redudancy check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) with the Castagnoli polynomial, serialised as an unsigned 32 bits big endian number. Can be refered as a `CRC-32C`. ## XOR chunk data @@ -177,7 +177,6 @@ the encoding will therefore result in a short varbit representation. The upper bound of 33554430 is picked so that the varbit encoded value will take at most 4 bytes. - ## Float histogram chunk data Float histograms have the same layout as histograms apart from the encoding of samples.