Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

文件结构 


每个数据文件 TsFile 在内存中对应一个对象 TsFileResource,主要包含以下信息

...

VERSION_NUMBER = 1 (1 byte)

timeIndexType = 0 FileTimeIndex / 1 DeviceTimeIndex  (1 byte)

timeIndex (ITimeIndex)

FileTimeIndexDeviceTimeIndex

deviceNum (int)

devices (String[])

startTime (long)

endTime (long)

deviceNum (int)

startTimes + endTimes (long[], long[])

deviceName + index (String[], int[])

maxPlanIndex (long)

minPlanIndex (long)

modFileName (String)


各个字段用处

  • 版本号
    • IoTDB 版本升级时识别不同版本的 TsFileResource 结构
  • 时间索引
    • 查询时根据 TsFileResource 中的时间索引判断某个 TsFile 是否可能包含待查数据
    • 跨文件空间数据合并时,根据 TsFileResource 的时间索引判断哪些文件需要被合并
    • TTL 线程根据 TsFileResource 的时间索引定期检查 TsFile 是否整个过期,可以完全删除
  • Raft 日志段
  • 墓碑文件路径