From 0ff9dcf5e70b9f1f87ad60582a5a995deb4b9441 Mon Sep 17 00:00:00 2001 From: Weny Xu Date: Fri, 17 May 2024 16:59:35 +0800 Subject: [PATCH] docs: add upgrade note for using InfluxDB protocol --- docs/nightly/en/user-guide/upgrade.md | 13 +++------ docs/nightly/zh/user-guide/upgrade.md | 42 +++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/docs/nightly/en/user-guide/upgrade.md b/docs/nightly/en/user-guide/upgrade.md index 110a52b46..3ae50f5eb 100644 --- a/docs/nightly/en/user-guide/upgrade.md +++ b/docs/nightly/en/user-guide/upgrade.md @@ -45,11 +45,6 @@ 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`. -### Upgrade from 0.7.0 or 0.7.1 -:::warning NOTICE -If you are using `v0.7.0` or `v0.7.1`, Please replace the old version with `v0.7.11`(Open the data directory using the GreptimeDB `v0.7.11`). -::: - ### Export `CREATE TABLE` Assuming the HTTP service port of the old database is `4000`. @@ -88,7 +83,7 @@ CREATE TABLE foo ( TIME INDEX (ts), PRIMARY KEY(host) ) ENGINE=mito -WITH( +WITH( # Delete regions=1 ); ``` @@ -136,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( @@ -185,7 +180,7 @@ 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( @@ -200,7 +195,7 @@ Related [issue](https://github.com/GreptimeTeam/greptimedb/pull/3794) Before: ```sql CREATE TABLE IF NOT EXISTS "phy" ( - "ts" TIMESTAMP(6) NOT NULL, + "ts" TIMESTAMP(6) NOT NULL, # Modify this line "val" DOUBLE NULL, "host" STRING NULL, "job" STRING NULL, diff --git a/docs/nightly/zh/user-guide/upgrade.md b/docs/nightly/zh/user-guide/upgrade.md index 9e95545e9..692210a6d 100644 --- a/docs/nightly/zh/user-guide/upgrade.md +++ b/docs/nightly/zh/user-guide/upgrade.md @@ -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` @@ -101,7 +101,7 @@ CREATE TABLE foo ( TIME INDEX (ts), PRIMARY KEY(host) ) ENGINE=mito -WITH( +WITH( # 删除 regions=1 ); ``` @@ -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( @@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS "phy" ( "val" DOUBLE NULL, "host" STRING NULL, "job" STRING NULL, - PRIMARY KEY ("host", "job") + PRIMARY KEY ("host", "job") ) ENGINE=metric WITH( @@ -199,7 +199,7 @@ 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( @@ -207,6 +207,36 @@ WITH( ); ``` +#### 为 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; +``` + ### 导入表结构和数据