Grafana Mimir 二进制索引头
为了查询对象存储中块内的序列,store-gateway 必须获取每个块索引的信息。为了获取所需信息,store-gateway 会为每个块构建一个索引头并存储在本地磁盘上。
store-gateway 使用 GET byte range request
构建索引头,其中包含块索引的特定部分。store-gateway 在查询时使用该索引头。
由于下载原始块索引的特定部分是一个计算量小的操作,因此索引头不会上传到对象存储。如果本地磁盘上没有索引头,store-gateway 实例(或滚动更新完成后没有持久磁盘的同一实例)会从原始块索引重新构建索引头。
格式(版本 1)
索引头是块索引的子集,包含
- Symbol Table(符号表):用于解除字符串值的intern操作
- Posting Offset Table(倒排索引偏移表):用于查找倒排索引
以下示例展示了位于每个块的 store-gateway 本地目录中的索引头文件格式。文件末尾有一个目录,作为索引的入口点。
┌─────────────────────────────┬───────────────────────────────┐
│ magic(0xBAAAD792) <4b> │ version(1) <1 byte> │
├─────────────────────────────┬───────────────────────────────┤
│ index version(2) <1 byte> │ index PostingOffsetTable <8b> │
├─────────────────────────────┴───────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Symbol Table (exact copy from original index) │ │
│ ├─────────────────────────────────────────────────────────┤ │
│ │ Posting Offset Table (exact copy from index) │ │
│ ├─────────────────────────────────────────────────────────┤ │
│ │ TOC │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘