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

docs: add upgrade note for using InfluxDB protocol #963

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions docs/nightly/en/user-guide/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ For a complete upgrade, you will need to execute this tools twice with each targ

Here is a complete example for upgrading from `v0.7.x` to `v0.8.0`.


### Export `CREATE TABLE`

Assuming the HTTP service port of the old database is `4000`.

```shell
greptime cli export --addr '127.0.0.1:4000' --output-dir /tmp/greptimedb-export --target create-table
```
Expand Down Expand Up @@ -82,7 +83,7 @@ CREATE TABLE foo (
TIME INDEX (ts),
PRIMARY KEY(host)
) ENGINE=mito
WITH(
WITH( # Delete
regions=1
);
```
Expand Down Expand Up @@ -130,7 +131,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"__tsid" BIGINT UNSIGNED NOT NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("__table_id", "__tsid", "host", "job")
PRIMARY KEY ("__table_id", "__tsid", "host", "job") # Modify this line
)
ENGINE=metric
WITH(
Expand Down Expand Up @@ -179,14 +180,43 @@ CREATE TABLE IF NOT EXISTS "phy" (
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job")
TIME INDEX ("ts")
TIME INDEX ("ts") # Add this line
)
ENGINE=metric
WITH(
physical_metric_table = ''
);
```

#### Update the create table statement for tables written using the InfluxDB protocol

Related [issue](https://github.com/GreptimeTeam/greptimedb/pull/3794)

Before:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(6) NOT NULL, # Modify to TIMESTAMP(9)
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```

After:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(9) NOT NULL,
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```

### Export table data

Expand Down
40 changes: 35 additions & 5 deletions docs/nightly/zh/user-guide/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ OPTIONS:

对于完整的升级,您需要使用每个目标选项两次执行此工具。

## 示例
## 从 0.7.x 升级

这一节将演示如何从 `v0.7.x` 升级到 `v0.8.0`。

在下面的文本中,我们假设您的 Frontend 的 HTTP 端口为 `127.0.0.1:4000`。输出目录是 `/tmp/greptimedb-export`。
在下面的文本中,我们假设您的数据库的 HTTP 端口为 `127.0.0.1:4000`。

### 导出 `CREATE TABLE`

Expand Down Expand Up @@ -101,7 +101,7 @@ CREATE TABLE foo (
TIME INDEX (ts),
PRIMARY KEY(host)
) ENGINE=mito
WITH(
WITH( # 删除
regions=1
);
```
Expand Down Expand Up @@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"__tsid" BIGINT UNSIGNED NOT NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("__table_id", "__tsid", "host", "job")
PRIMARY KEY ("__table_id", "__tsid", "host", "job") # 修改此处
)
ENGINE=metric
WITH(
Expand Down Expand Up @@ -199,14 +199,44 @@ CREATE TABLE IF NOT EXISTS "phy" (
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job")
TIME INDEX ("ts")
TIME INDEX ("ts") # 添加在此处
)
ENGINE=metric
WITH(
physical_metric_table = ''
);
```

#### 为 InfluxDB 协议的表更新建表语句

相关 [issue](https://github.com/GreptimeTeam/greptimedb/pull/3794)

修改前:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(6) NOT NULL, # 修改此处
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```

修改后:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(9) NOT NULL,
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```


### 导入表结构和数据

Expand Down