You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/04/03 04:16:13 UTC

[incubator-iotdb] branch update_tsfile_format created (now 604ef96)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a change to branch update_tsfile_format
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at 604ef96  add tsfile new format figure

This branch includes the following new commits:

     new 604ef96  add tsfile new format figure

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: add tsfile new format figure

Posted by qi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch update_tsfile_format
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 604ef967d6eaa014dc93d48080d7f763610c6ce3
Author: qiaojialin <64...@qq.com>
AuthorDate: Fri Apr 3 12:16:50 2020 +0800

    add tsfile new format figure
---
 docs/SystemDesign/1-TsFile/2-Format.md    | 18 ++++++++++++++++--
 docs/zh/SystemDesign/1-TsFile/2-Format.md | 24 +++++++++++++++++++-----
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/docs/SystemDesign/1-TsFile/2-Format.md b/docs/SystemDesign/1-TsFile/2-Format.md
index 5e37bc5..9a04701 100644
--- a/docs/SystemDesign/1-TsFile/2-Format.md
+++ b/docs/SystemDesign/1-TsFile/2-Format.md
@@ -66,13 +66,27 @@
 
 Here is a graph about the TsFile structure.
 
-![TsFile Breakdown](https://user-images.githubusercontent.com/40447846/61616997-6fad1300-ac9c-11e9-9c17-46785ebfbc88.png)
+![TsFile Breakdown](https://user-images.githubusercontent.com/7240743/78322525-93518880-75a1-11ea-8d5e-b438caa86d41.png)
+
+This TsFile contains two devices: d1, d2. Each device contains three measurements: s1, s2, s3. 6 timeseries in total, d1 is blue, d2 is purple. Each timeseries contains 2 Chunks.
+
+There are three parts of metadata
+
+* ChunkMetadata list that grouped by timeseries
+* TimeseriesMetadata that ordered by timeseries
+* TsFileMetadata
+
+Query Process:e.g., read d1.s1
+
+* deserialize TsFileMetadata,get the position and length of all TimeseriesMetadata of d1
+* deserialize all TimeseriesMetadata of d1,get the TimeseriesMetadata of d1.s1
+* according to TimeseriesMetadata of d1.s1,deserialize all ChunkMetadata of d1.s1 
+* according to each ChunkMetadata of d1.s1,read its Chunk
 
 #### 1.2.1 Magic String and Version Number
 
 A TsFile begins with a 6-byte magic string (`TsFile`) and a 6-byte version number (`000001`).
 
-
 #### 1.2.2 Data
 
 The content of a TsFile file can be divided as two parts: data and metadata. There is a byte `0x02` as the marker between
diff --git a/docs/zh/SystemDesign/1-TsFile/2-Format.md b/docs/zh/SystemDesign/1-TsFile/2-Format.md
index 3db4efb..6c3eb11 100644
--- a/docs/zh/SystemDesign/1-TsFile/2-Format.md
+++ b/docs/zh/SystemDesign/1-TsFile/2-Format.md
@@ -65,16 +65,30 @@
 
 下图是关于TsFile的结构图。
 
-![TsFile Breakdown](https://user-images.githubusercontent.com/40447846/61616997-6fad1300-ac9c-11e9-9c17-46785ebfbc88.png)
+![TsFile Breakdown](https://user-images.githubusercontent.com/7240743/78322525-93518880-75a1-11ea-8d5e-b438caa86d41.png)
 
-#### 1.2.1 文件签名和版本号
+此文件包括两个设备 d1、d2,每个设备包含三个测点 s1、s2、s3,共 6 个时间序列,d1为蓝色,d2为紫色。每个时间序列包含两个 Chunk。
+
+元数据分为三部分
+
+* 按时间序列组织的 ChunkMetadata 列表
+* 按时间序列组织的 TimeseriesMetadata
+* TsFileMetadata
 
-TsFile 是由 6 个字节的 "Magic String" (`TsFile`) 和 6 个字节的版本号 (`000001`)组成。
+查询流程:以查 d1.s1 为例
+
+* 反序列化 TsFileMetadata,得到 d1 的所有 TimeseriesMetadata 的位置
+* 反序列化 d1 的所有 TimeseriesMetadata,并得到 d1.s1 的 TimeseriesMetadata
+* 根据 d1.s1 的 TimeseriesMetadata,反序列化其所有 ChunkMetadata
+* 根据 d1.s1 的每一个 ChunkMetadata,读取其 Chunk 数据
+
+#### 1.2.1 文件签名和版本号
 
+TsFile文件头由 6 个字节的 "Magic String" (`TsFile`) 和 6 个字节的版本号 (`000002`)组成。
 
 #### 1.2.2 数据文件
 
-TsFile文件的内容可以划分为两个部分: 数据和元数据。数据和元数据之间是由一个字节的 `0x02` 做为分隔符。
+TsFile文件的内容可以划分为两个部分: 数据(Chunk)和元数据(XXMetadata)。数据和元数据之间是由一个字节的 `0x02` 做为分隔符。
 
 `ChunkGroup` 存储了一个 *设备(device)* 一段时间的数据。
 
@@ -84,7 +98,7 @@ TsFile文件的内容可以划分为两个部分: 数据和元数据。数据和
 
 ##### Chunk
 
-一个 `Chunk` 存储了一个 *传感器(sensor)* 的数据。`Chunk` 是由一个字节的分隔符 `0x01`, 一个 `ChunkHeader` 和若干个 `Page` 构成。
+一个 `Chunk` 存储了一个 *测点(measurement)* 一段时间的数据,Chunk 内数据是按时间递增序存储的。`Chunk` 是由一个字节的分隔符 `0x01`, 一个 `ChunkHeader` 和若干个 `Page` 构成。
 
 ##### ChunkHeader