Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amber-moe committed Mar 18, 2020
1 parent 79937e8 commit b82a07b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TTL (time-to-live)

**Nebula Graph** 支持 **TTL** ,在一定时间后自动从数据库中删除点或者边。过期数据会在下次 compaction 时被删除,在下次 compaction 前,query 会过滤掉过期的点和边。
**Nebula Graph** 支持 **TTL** ,在一定时间后自动从数据库中删除点或者边。过期数据会在下次 compaction 时被删除,在下次 compaction 前,query 会过滤掉过期的点和边,这些 TTL 的点和边对外不可见

ttl 功能需要 `ttl_col``ttl_duration` 一起使用。自从 `ttl_col` 指定的字段的值起,经过 `ttl_duration` 指定的秒数后,该条数据过期。即,到期阈值是 `ttl_col` 指定的 property 的值加上 `ttl_duration` 设置的秒数。其中 `ttl_col` 指定的字段的类型需为 integer 或者 timestamp。

Expand Down Expand Up @@ -83,7 +83,7 @@ nebula> ALTER TAG t1 ttl_duration = 0; -- keep the ttl but the data never expire

## TTL 使用注意事项

- 如果字段包含 TTL,则不支持对该字段的更改操作。
- 如果包含 `ttl_col` 字段,则不支持对该字段的更改操作。

``` ngql
nebula> CREATE TAG t1(a int, b int, c string) ttl_duration = 100, ttl_col = "a";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# TTL (time-to-live)

With **TTL**, **Nebula Graph** provides the ability to delete the expired vertices or edges automatically. The system will automatically delete the expired data during the compaction phase. Before compaction, query will filter the expired data.
With **TTL**, **Nebula Graph** provides the ability to delete the expired vertices or edges automatically. The system will automatically delete the expired data during the compaction phase. Before compaction, query will filter the expired data. And the TTL data is not available.

TTl requires `ttl_col` and `ttl_duration` together. `ttl_col` indicates the TTL column, while `ttl_duration` indicates the duration of the TTL. When the sum of the TTL column and the ttl_duration is less than the current time, we consider the data as expired. The `ttl_col` type is integer or timestamp, and is set in seconds. `ttl_duration` is also set in seconds.

## TTL configurations
## TTL configuration

- The `ttl_duration` is set in seconds. If it is set to -1 or 0, the vertex property in the tag does not expire.
- The `ttl_duration` is set in seconds. If it is set to -1 or 0, the vertex properties of this tag does not expire.

- If TTL is set, when the sum of the `ttl_col` and the `ttl_duration` is less than the current time, we consider the the vertex property in the tag as expired.
- If TTL is set, when the sum of the `ttl_col` and the `ttl_duration` is less than the current time, we consider the vertex properties of this tag as expired after the specified seconds configured by `ttl_duration` has passed since the `ttl_col` field value.

- -When the vertex has multiple tags, the ttl of each tag is processed separately.
- When the vertex has multiple tags, the TTL of each tag is processed separately.

## Setting a TTL Value

Expand All @@ -31,7 +31,7 @@ nebula> CREATE TAG t2(a int, b int, c string) ttl_duration= 100, ttl_col = "a";
nebula> INSERT VERTEX t2(a, b, c) values 102:(1584441231, 30, "Word");
```

The vertex 102 property in tag t2 will expire after 100 seconds since 18:33:51 CSTMarch 17, 2020 (MacOS).
The vertex 102 property in tag t2 will expire after 100 seconds since March 17 2020 at 18:33:51 CST.

- When a vertex has multiple TAGs, the TTL of each TAG is independent from each other.

Expand Down Expand Up @@ -63,7 +63,7 @@ nebula> FETCH PROP ON * 200;

## Dropping TTL

If you have set a TTL value for a field and later decide do not want it to ever automatically expire, you can drop the TTL value, set it to null or invalidate it by setting it to 0 or -1.
If you have set a TTL value for a field and later decide do not want it to ever automatically expire, you can drop the TTL value, set it to an empty string or invalidate it by setting it to 0 or -1.

```ngql
nebula> ALTER TAG t1 ttl_col = ""; -- drop ttl attribute;
Expand All @@ -83,7 +83,7 @@ nebula> ALTER TAG t1 ttl_duration = 0; -- keep the ttl but the data never expire

## Tips on TTL

- If a field contains a TTL value, you can't make any change on the field.
- If a field contains a `ttl_col` field, you can't make any change on the field.

``` ngql
nebula> CREATE TAG t1(a int, b int, c string) ttl_duration = 100, ttl_col = "a";
Expand Down

0 comments on commit b82a07b

Please sign in to comment.