github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/docs/blocks-storage/binary-index-header.md (about) 1 --- 2 title: "Binary index-header" 3 linkTitle: "Binary index-header" 4 weight: 5 5 slug: binary-index-header 6 --- 7 8 In order to query series inside blocks from object storage, the [store-gateway](./store-gateway.md) has to know certain initial info from each block index. In order to achieve so, the store-gateway builds an index-header for each block and stores it on local disk; such index-header is built by downloading specific pieces of original block's index and storing them on local disk. Index header is then used by store-gateway at query time. 9 10 Store-gateways build the index-header with specific sections of the block's index downloaded using **GET byte range requests**. Since downloading specific sections of the original block's index is a computationally easy operation, the index-header is never uploaded back to the object storage and multiple store-gateway instances (or the same instance after a rolling update without a persistent disk) will re-build the index-header from original block's index each time, if not already existing on local disk. 11 12 ## Format (version 1) 13 14 The index-header is a subset of the block index and contains: 15 16 - [Symbol Table](https://github.com/prometheus/prometheus/blob/master/tsdb/docs/format/index.md#symbol-table), used to unintern string values 17 - [Posting Offset Table](https://github.com/prometheus/prometheus/blob/master/tsdb/docs/format/index.md#postings-offset-table), used to lookup postings 18 19 The following describes the format of the index-header file found in each block store-gateway local directory. It is terminated by a table of contents which serves as an entry point into the index. 20 21 ``` 22 ┌─────────────────────────────┬───────────────────────────────┐ 23 │ magic(0xBAAAD792) <4b> │ version(1) <1 byte> │ 24 ├─────────────────────────────┬───────────────────────────────┤ 25 │ index version(2) <1 byte> │ index PostingOffsetTable <8b> │ 26 ├─────────────────────────────┴───────────────────────────────┤ 27 │ ┌─────────────────────────────────────────────────────────┐ │ 28 │ │ Symbol Table (exact copy from original index) │ │ 29 │ ├─────────────────────────────────────────────────────────┤ │ 30 │ │ Posting Offset Table (exact copy from index) │ │ 31 │ ├─────────────────────────────────────────────────────────┤ │ 32 │ │ TOC │ │ 33 │ └─────────────────────────────────────────────────────────┘ │ 34 └─────────────────────────────────────────────────────────────┘ 35 ```