thulab / tsfile

THIS REPO HAS MOVED TO https://github.com/apache/incubator-iotdb. TsFile is a columnar file format designed for time-series data, which supports efficient compression and query. It is easy to integrate TsFile with your IOT big data processing frameworks.
https://github.com/apache/incubator-iotdb
111 stars 22 forks source link

New File format #167

Open qiaojialin opened 5 years ago

qiaojialin commented 5 years ago

v0.8.0, add ChunkHeader and ChunkGroupFooter

jixuan1989 commented 5 years ago

TsFile 文件结构变化记录 2018/11/13 黄向东、乔嘉林、刘昆、江天

    1. Thanos V1
    2. 2.3 文件结构 TsFile thanos分支中RowGroup 的 metadata存在数据之前,需要在内存中缓存整个 RowGroup 的数据。结构如下图。

image

1. 2.3  接口

写RowGroup Metadata:RowGroupWriter.writeMedatadata() 单列数据写入内存:ChunkWriter.write(datapoint) 单列数据写入磁盘:ChunkWriter.flush()

  1. 2.3 数据恢复 将不完整的RowGroup切掉,最后生成完整的File Metadata,此种方式会丢失一个RowGroup。
      1. Thanos V2
  2. 2.3 文件结构 为了减少RowGroup 数据内存占用,现将 RowGroup Metadata 移动到每个 RowGroup数据之后,Chunk与 Page 结构不变。

image

此种结构,内存中仅需缓存一个 Chunk 的数据,按需要可以随时将 Chunk 写入磁盘。每个Header前的byte用来标识接下来的一个metadata的种类。

  1. 2.3 接口 在内存创建RowGroup Metadata:RowGroupWriter.startRowGroup() 单列数据写入内存:ChunkWriter.write(datapoint) 单列数据写入磁盘:ChunkWriter.flush() RowGroup Metadata 写入磁盘:RowGroupWriter.writeMetadata()
  2. 2.3 数据恢复 将最后一个不完整的Chunk 切掉,生成RowGroup Metadata,生成File Metadata,此种方式会丢失一个Chunk。