InfluxDB数据读取流程
indirectIndex结构体
在讲解InfluxDB数据读取流程之前,首先来看一下InfluxDB中一个中要的结构体struct indirectIndex,这样有助于我们了解后续数据读取以及删除的整个流程,indirectIndex相当于TSM文件的index,通过indirectIndex来查找TSM中的IndexBlock
// indirectIndex is a TSMIndex that uses a raw byte slice representation of an index. This
// implementation can be used for indexes that may be MMAPed into memory.
type indirectIndex struct {
mu sync.RWMutex
// b is the underlying index byte slice. This could be a copy on the heap or an MMAP
// slice reference
b []byte
// offsets contains the positions in b for each key. It points to the 2 byte length of
// key.
offsets []byte
// minKey, maxKey are the minium and maximum (lexicographically sorted) contained in the
// file
minKey, maxKey []byte
// minTime, maxTime are the minimum and maximum times contained in the file across all
// series.
minTime, ma