Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add device level TTL docs #399

Merged
merged 5 commits into from
Nov 8, 2024
Merged

Conversation

shuwenwei
Copy link
Contributor

Add device level TTL docs

Comment on lines 642 to 656
| Name | ttl\_check\_interval |
|:-----------:|:-------------------------|
| Description | The interval of TTL check task in each database. Default is 2 hours. |
| Type | int |
| Default | 7200000 |
| Effective | After restarting system |

* max\_expired\_time

| Name | max\_expired\_time |
| :----------: |:-------------------------------------------------------------------------|
| Description | The maximum expiring time of device which has a ttl. Default is 1 month. |
| Type | int |
| Default | 2592000000 |
| Effective | After restarting system |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it can be inferred, it is better to give the unit explicitly.

@@ -21,29 +21,42 @@

# TTL

IoTDB supports storage-level TTL settings, which means it is able to delete old data automatically and periodically. The benefit of using TTL is that hopefully you can control the total disk space usage and prevent the machine from running out of disks. Moreover, the query performance may downgrade as the total number of files goes up and the memory usage also increase as there are more files. Timely removing such files helps to keep at a high query performance level and reduce memory usage.
IoTDB supports device-level TTL settings, which means it is able to delete old data automatically and periodically. The benefit of using TTL is that hopefully you can control the total disk space usage and prevent the machine from running out of disks. Moreover, the query performance may downgrade as the total number of files goes up and the memory usage also increase as there are more files. Timely removing such files helps to keep at a high query performance level and reduce memory usage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the memory usage also increase -> increases

```
IoTDB> set ttl to root.ln 3600000
```
When setting TTL, the system will look for all devices included in the set path and set TTL time for these devices. The system will delete expired data at the device granularity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set path -> path
TTL time -> TTL

IoTDB> set ttl to root.ln 3600000
```
When setting TTL, the system will look for all devices included in the set path and set TTL time for these devices. The system will delete expired data at the device granularity.
After the device data expires, it will not be queryable, but the data in the disk file cannot be guaranteed to be deleted immediately (it will be deleted within a certain time), but it can be guaranteed to be deleted eventually.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"(it will be deleted within a certain time)" seems confusing, may should remove it.
"cannot be guaranteed to be deleted immediately, but it can be guaranteed to be deleted eventually."
And, there are two "but"s in this sentence, break it into two sentences.

```
When setting TTL, the system will look for all devices included in the set path and set TTL time for these devices. The system will delete expired data at the device granularity.
After the device data expires, it will not be queryable, but the data in the disk file cannot be guaranteed to be deleted immediately (it will be deleted within a certain time), but it can be guaranteed to be deleted eventually.
Considering the operational cost, the system will not immediately physically delete data exceeding TTL, but will delay physical deletion through merging. Therefore, before the data is physically deleted, if the TTL is reduced or lifted, it may cause data that was previously invisible due to TTL to reappear.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence says similar things to the previous sentence, may merge them.
Possible revision:

After the device data expires, it will not be queryable.
However, due to operational costs, the expired data will not be physically deleted right after expiring.
The physical deletion is delayed until compaction.
Therefore...

```
IoTDB> set ttl to root.sgcc.** 3600000
## TTL Path Rule
The set path only supports prefix paths (i.e., the path cannot contain \* and \*\*, and must end with \*\*).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "set" has too many meanings, which is confusing.
"The path can only be prefix paths..." should be enough.

"cannot contain * and **" and "must end with **)" conflict.
should be "cannot contain * and ** except the last level"

## TTL Path Rule
The set path only supports prefix paths (i.e., the path cannot contain \* and \*\*, and must end with \*\*).
This path will match devices and also allows users to specify paths without asterisks as specific databases or devices.
When the path does not contain asterisks, it will check if it matches a database; if it matches a database, both the path and path.\*\* will be set at the same time. Note: Device TTL settings do not verify the existence of metadata, i.e., it is allowed to set TTL for a non-existent device.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"it will check if it matches a database" the two "it"s refer to different things, which is confusing.
it will check -> the system will check

```
It supports setting TTL for databases in a path. This example represents setting TTL for all databases in the `root.sgcc` path.
qualified path:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path -> paths

The unset ttl operation indicates unmounting TTL for the corresponding path pattern; if there is no corresponding TTL, nothing will be done.
If you want to set TTL to be infinitely large, you can use the INF keyword.
The SQL Statement for setting TTL is as follow:
Set the Time to Live (TTL) to a prefix path of 360,000 milliseconds; the prefix path should not contain a wildcard (\*) and must end with a double asterisk (\*\*). The prefix path is used to match corresponding devices.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not contain a wildcard in the middle

支持给某一路径下的 database 设置TTL,这个例子表示`root.sgcc`路径下的所有 database 设置TTL。
```
IoTDB> set ttl to root.** 3600000
set ttl to prefixPath 360000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set ttl to prefixPath 360000;
set ttl to pathPattern 360000;


| 名字 | max\_expired\_time |
| :----------: |:-----------------------------|
| 描述 | 具有TTL的设备的最大过期时间。单位 ms,默认为一个月 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 描述 | 具有TTL的设备的最大过期时间。单位 ms,默认为一个月 |
| 描述 | 如果一个文件中存在设备已经过期超过此时间,那么这个文件将被立即整理。 |

@qiaojialin qiaojialin merged commit 4cff14a into apache:main Nov 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants