wangchao316 commented on a change in pull request #4024:
URL: https://github.com/apache/iotdb/pull/4024#discussion_r715418428
##########
File path: docs/zh/SystemDesign/Tools/Settle.md
##########
@@ -0,0 +1,96 @@
+## TsFile整理工具
+
+### 介绍
+
+1.
整理工具可以帮助你整理已封口的TsFile文件和.mods文件,过滤掉删除的数据并生成新的TsFile。整理完后会将本地旧的.mods文件删除,若某TsFile里的数据被全部删除了,则会删除本地该TsFile文件和对应的.resource文件。
+
+2.
整理工具只能针对v0.12版本的IOTDB来使用,即只能针对版本为V3的TsFile进行整理,若低于此版本则必须先用在线升级工具将TsFile升级到V3版本。
+3.
TsFile整理工具分为在线整理工具和离线整理工具,两者在整理的时候都会记录日志,供下次恢复先前整理失败的文件。在执行整理的时候会先去检测日志里是否存在失败的文件,有的话则优先整理它们。
+
+### 1. 离线整理工具
+
+离线整理工具是以命令行的方式来启动,该工具的启动脚本settle.bat和settle.sh在编译了server后会生成至server\target\iotdb-server-{version}\tools\tsfileToolSet目录中。在使用的时候必须保证IOTDB
Server是停止运行的,否则会出现整理错误。具体使用方式详见用户手册。
+
+#### 1.1 涉及的相关类
+
+整理工具类:org.apache.iotdb.db.tools.settle.TsFileAndModSettleTool
+
+### 2.在线整理工具
+
+在线整理工具是当用户在IOTDB客户端输入了settle命令后,会在后台注册启动一个整理服务Settle
Service,该服务会去寻找指定存储组下的所有TsFile文件,并为每个TsFile开启一个整理线程进行整理。下面讲解整理线程的工作流程。
+
+#### 2.1 整理线程的工作流程
+
+1.
首先对该旧TsFile文件**加读锁**,避免在重写的过程中该TsFile被删除,而在删除该TsFile的本地mods文件前允许用户对该TsFile进行查询操作。【该步骤在StorageGroupProcessor类的settle()方法里】
+
Review comment:
Thanks for your contribution.
I have some question.
If the tsfile is being merged, it needs to be deleted. What about this
tsfile? Do you want to delete or not delete?
I suggest we should use hardlink for tsfile, when settle tsfile.
This function minimizes the impact on other functions,
In addition, compact is a frequent function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]