diff --git a/Jenkinsfile2 b/Jenkinsfile2
index 4b47d56a6c..423169c007 100644
--- a/Jenkinsfile2
+++ b/Jenkinsfile2
@@ -40,6 +40,7 @@ def pre_test(){
git reset --hard
cd ${WKC}
git reset --hard
+ git clean -fxd
'''
script {
if (env.CHANGE_TARGET == 'master') {
diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index 68af4e7fcb..7a12413377 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG df8678f
+ GIT_TAG 766dcc4
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 60f1f0448d..620faa636b 100644
--- a/cmake/taostools_CMakeLists.txt.in
+++ b/cmake/taostools_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
- GIT_TAG 2a2def1
+ GIT_TAG 8a5e336
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in
index 3c1a7f5e73..a2b45a5bfa 100644
--- a/cmake/taosws_CMakeLists.txt.in
+++ b/cmake/taosws_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosws-rs
ExternalProject_Add(taosws-rs
GIT_REPOSITORY https://github.com/taosdata/taosws-rs.git
- GIT_TAG 9de599d
+ GIT_TAG 648cc62
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/07-develop/01-connect/index.md b/docs/en/07-develop/01-connect/index.md
index 720f8e2384..1318f4619b 100644
--- a/docs/en/07-develop/01-connect/index.md
+++ b/docs/en/07-develop/01-connect/index.md
@@ -73,7 +73,7 @@ If `maven` is used to manage the projects, what needs to be done is only adding
com.taosdata.jdbc
taos-jdbcdriver
- 2.0.38
+ 3.0.0
```
@@ -102,7 +102,7 @@ module goexample
go 1.17
-require github.com/taosdata/driver-go/v2 develop
+require github.com/taosdata/driver-go/v3 latest
```
:::note
@@ -137,7 +137,7 @@ Node.js connector provides different ways of establishing connections by providi
1. Install Node.js Native Connector
```
-npm i td2.0-connector
+npm install @tdengine/client
```
:::note
@@ -147,7 +147,7 @@ It's recommend to use Node whose version is between `node-v12.8.0` and `node-v13
2. Install Node.js REST Connector
```
-npm i td2.0-rest-connector
+npm install @tdengine/rest
```
@@ -167,7 +167,7 @@ Just need to add the reference to [TDengine.Connector](https://www.nuget.org/pac
-
+
@@ -187,7 +187,7 @@ The sample code below are based on dotnet6.0, they may need to be adjusted if yo
-1. Download [taos-jdbcdriver-version-dist.jar](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/2.0.38/).
+1. Download [taos-jdbcdriver-version-dist.jar](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.0.0/).
2. Install the dependency package `RJDBC`:
```R
diff --git a/docs/en/12-taos-sql/12-interval.md b/docs/en/12-taos-sql/12-distinguished.md
similarity index 98%
rename from docs/en/12-taos-sql/12-interval.md
rename to docs/en/12-taos-sql/12-distinguished.md
index acfb0de0e1..d2f7cf66b6 100644
--- a/docs/en/12-taos-sql/12-interval.md
+++ b/docs/en/12-taos-sql/12-distinguished.md
@@ -1,6 +1,6 @@
---
-sidebar_label: Interval
-title: Aggregate by Time Window
+sidebar_label: Distinguished
+title: Distinguished Query for Time Series Database
---
Aggregation by time window is supported in TDengine. For example, in the case where temperature sensors report the temperature every seconds, the average temperature for every 10 minutes can be retrieved by performing a query with a time window.
diff --git a/docs/en/12-taos-sql/13-tmq.md b/docs/en/12-taos-sql/13-tmq.md
new file mode 100644
index 0000000000..4d9c475a38
--- /dev/null
+++ b/docs/en/12-taos-sql/13-tmq.md
@@ -0,0 +1,66 @@
+---
+sidebar_label: 消息队列
+title: 消息队列
+---
+
+TDengine 3.0.0.0 开始对消息队列做了大幅的优化和增强以简化用户的解决方案。
+
+## 创建订阅主题
+
+```sql
+CREATE TOPIC [IF NOT EXISTS] topic_name AS {subquery | DATABASE db_name | STABLE stb_name };
+```
+
+订阅主题包括三种:列订阅、超级表订阅和数据库订阅。
+
+**列订阅是**用 subquery 描述,支持过滤和标量函数和 UDF 标量函数,不支持 JOIN、GROUP BY、窗口切分子句、聚合函数和 UDF 聚合函数。列订阅规则如下:
+
+1. TOPIC 一旦创建则返回结果的字段确定
+2. 被订阅或用于计算的列不可被删除、修改
+3. 列可以新增,但新增的列不出现在订阅结果字段中
+4. 对于 select \*,则订阅展开为创建时所有的列(子表、普通表为数据列,超级表为数据列加标签列)
+
+**超级表订阅和数据库订阅**规则如下:
+
+1. 被订阅主体的 schema 变更不受限
+2. 返回消息中 schema 是块级别的,每块的 schema 可能不一样
+3. 列变更后写入的数据若未落盘,将以写入时的 schema 返回
+4. 列变更后写入的数据若未已落盘,将以落盘时的 schema 返回
+
+## 删除订阅主题
+
+```sql
+DROP TOPIC [IF EXISTS] topic_name;
+```
+
+此时如果该订阅主题上存在 consumer,则此 consumer 会收到一个错误。
+
+## 查看订阅主题
+
+## SHOW TOPICS
+
+```sql
+SHOW TOPICS;
+```
+
+显示当前数据库下的所有主题的信息。
+
+## 创建消费组
+
+消费组的创建只能通过 TDengine 客户端驱动或者连接器所提供的 API 创建。
+
+## 删除消费组
+
+```sql
+DROP CONSUMER GROUP [IF EXISTS] cgroup_name ON topic_name;
+```
+
+删除主题 topic_name 上的消费组 cgroup_name。
+
+## 查看消费组
+
+```sql
+SHOW CONSUMERS;
+```
+
+显示当前数据库下所有活跃的消费者的信息。
diff --git a/docs/en/12-taos-sql/14-limit.md b/docs/en/12-taos-sql/14-limit.md
deleted file mode 100644
index e8bb77fc27..0000000000
--- a/docs/en/12-taos-sql/14-limit.md
+++ /dev/null
@@ -1,53 +0,0 @@
----
-title: Naming & Restrictions
----
-
-## Naming Rules
-
-1. Only characters from the English alphabet, digits and underscore are allowed
-2. Names cannot start with a digit
-3. Case insensitive without escape character "\`"
-4. Identifier with escape character "\`"
- To support more flexible table or column names, a new escape character "\`" is introduced. For more details please refer to [escape](/taos-sql/escape).
-
-## Password Rule
-
-The legal character set is `[a-zA-Z0-9!?$%^&*()_–+={[}]:;@~#|<,>.?/]`.
-
-## General Limits
-
-- Maximum length of database name is 32 bytes, and it can't include "." or special characters.
-- Maximum length of table name is 192 bytes, excluding the database name prefix and the separator.
-- Maximum length of each data row is 48K bytes. Please note that the upper limit includes the extra 2 bytes consumed by each column of BINARY/NCHAR type.
-- Maximum length of column name is 64.
-- Maximum number of columns is 4096. There must be at least 2 columns, and the first column must be timestamp.
-- Maximum length of tag name is 64.
-- Maximum number of tags is 128. There must be at least 1 tag. The total length of tag values should not exceed 16K bytes.
-- Maximum length of singe SQL statement is 1048576, i.e. 1 MB. It can be configured in the parameter `maxSQLLength` in the client side, the applicable range is [65480, 1048576].
-- At most 4096 columns can be returned by `SELECT`. Functions in the query statement constitute columns. An error is returned if the limit is exceeded.
-- Maximum numbers of databases, STables, tables are dependent only on the system resources.
-- Maximum number of replicas for a database is 3.
-- Maximum length of user name is 23 bytes.
-- Maximum length of password is 15 bytes.
-- Maximum number of rows depends only on the storage space.
-- Maximum number of vnodes for a single database is 1024.
-
-## Restrictions of Table/Column Names
-
-### Name Restrictions of Table/Column
-
-The name of a table or column can only be composed of ASCII characters, digits and underscore and it cannot start with a digit. The maximum length is 192 bytes. Names are case insensitive. The name mentioned in this rule doesn't include the database name prefix and the separator.
-
-### Name Restrictions After Escaping
-
-To support more flexible table or column names, new escape character "\`" is introduced in TDengine to avoid the conflict between table name and keywords and break the above restrictions for table names. The escape character is not counted in the length of table name.
-
-With escaping, the string inside escape characters are case sensitive, i.e. will not be converted to lower case internally.
-
-For example:
-\`aBc\` and \`abc\` are different table or column names, but "abc" and "aBc" are same names because internally they are all "abc".
-
-:::note
-The characters inside escape characters must be printable characters.
-
-:::
diff --git a/docs/en/12-taos-sql/14-stream.md b/docs/en/12-taos-sql/14-stream.md
new file mode 100644
index 0000000000..7ff7da2bfb
--- /dev/null
+++ b/docs/en/12-taos-sql/14-stream.md
@@ -0,0 +1,122 @@
+---
+sidebar_label: 流式计算
+title: 流式计算
+---
+
+在时序数据的处理中,经常要对原始数据进行清洗、预处理,再使用时序数据库进行长久的储存。用户通常需要在时序数据库之外再搭建 Kafka、Flink、Spark 等流计算处理引擎,增加了用户的开发成本和维护成本。
+
+使用 TDengine 3.0 的流式计算引擎能够最大限度的减少对这些额外中间件的依赖,真正将数据的写入、预处理、长期存储、复杂分析、实时计算、实时报警触发等功能融为一体,并且,所有这些任务只需要使用 SQL 完成,极大降低了用户的学习成本、使用成本。
+
+## 创建流式计算
+
+```sql
+CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] INTO stb_name AS subquery
+stream_options: {
+ TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time]
+ WATERMARK time
+}
+
+```
+
+其中 subquery 是 select 普通查询语法的子集:
+
+```sql
+subquery: SELECT [DISTINCT] select_list
+ from_clause
+ [WHERE condition]
+ [PARTITION BY tag_list]
+ [window_clause]
+ [group_by_clause]
+```
+
+不支持 order_by,limit,slimit,fill 语句
+
+例如,如下语句创建流式计算,同时自动创建名为 avg_vol 的超级表,此流计算以一分钟为时间窗口、30 秒为前向增量统计这些电表的平均电压,并将来自 meters 表的数据的计算结果写入 avg_vol 表,不同 partition 的数据会分别创建子表并写入不同子表。
+
+```sql
+CREATE STREAM avg_vol_s INTO avg_vol AS
+SELECT _wstartts, count(*), avg(voltage) FROM meters PARTITION BY tbname INTERVAL(1m) SLIDING(30s);
+```
+
+## 删除流式计算
+
+```sql
+DROP STREAM [IF NOT EXISTS] stream_name
+```
+
+仅删除流式计算任务,由流式计算写入的数据不会被删除。
+
+## 展示流式计算
+
+```sql
+SHOW STREAMS;
+```
+
+## 流式计算的触发模式
+
+在创建流时,可以通过 TRIGGER 指令指定流式计算的触发模式。
+
+对于非窗口计算,流式计算的触发是实时的;对于窗口计算,目前提供 3 种触发模式:
+
+1. AT_ONCE:写入立即触发
+
+2. WINDOW_CLOSE:窗口关闭时触发(窗口关闭由事件时间决定,可配合 watermark 使用,详见《流式计算的乱序数据容忍策略》)
+
+3. MAX_DELAY time:若窗口关闭,则触发计算。若窗口未关闭,且未关闭时长超过 max delay 指定的时间,则触发计算。
+
+由于窗口关闭是由事件时间决定的,如事件流中断、或持续延迟,则事件时间无法更新,可能导致无法得到最新的计算结果。
+
+因此,流式计算提供了以事件时间结合处理时间计算的 MAX_DELAY 触发模式。
+
+MAX_DELAY 模式在窗口关闭时会立即触发计算。此外,当数据写入后,计算触发的时间超过 max delay 指定的时间,则立即触发计算
+
+## 流式计算的乱序数据容忍策略
+
+在创建流时,可以在 stream_option 中指定 watermark。
+
+流式计算通过 watermark 来度量对乱序数据的容忍程度,watermark 默认为 0。
+
+T = 最新事件时间 - watermark
+
+每批到来的数据都会以上述公式更新窗口关闭时间,并将窗口结束时间 < T 的所有打开的窗口关闭,若触发模式为 WINDOW_CLOSE 或 MAX_DELAY,则推送窗口聚合结果。
+
+流式计算的过期数据处理策略
+对于已关闭的窗口,再次落入该窗口中的数据被标记为过期数据,对于过期数据,流式计算提供两种处理方式:
+
+1. 直接丢弃:这是常见流式计算引擎提供的默认(甚至是唯一)计算模式
+
+2. 重新计算:从 TSDB 中重新查找对应窗口的所有数据并重新计算得到最新结果
+
+无论在哪种模式下,watermark 都应该被妥善设置,来得到正确结果(直接丢弃模式)或避免频繁触发重算带来的性能开销(重新计算模式)。
+
+## 流式计算的数据填充策略
+
+TODO
+
+## 流式计算与会话窗口(session window)
+
+```sql
+window_clause: {
+ SESSION(ts_col, tol_val)
+ | STATE_WINDOW(col)
+ | INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
+}
+```
+
+其中,SESSION 是会话窗口,tol_val 是时间间隔的最大范围。在 tol_val 时间间隔范围内的数据都属于同一个窗口,如果连续的两条数据的时间超过 tol_val,则自动开启下一个窗口。
+
+## 流式计算的监控与流任务分布查询
+
+TODO
+
+## 流式计算的内存控制与存算分离
+
+TODO
+
+## 流式计算的暂停与恢复
+
+```sql
+STOP STREAM stream_name;
+
+RESUME STREAM stream_name;
+```
diff --git a/docs/en/12-taos-sql/13-operators.md b/docs/en/12-taos-sql/16-operators.md
similarity index 100%
rename from docs/en/12-taos-sql/13-operators.md
rename to docs/en/12-taos-sql/16-operators.md
diff --git a/docs/en/12-taos-sql/16-json.md b/docs/en/12-taos-sql/17-json.md
similarity index 100%
rename from docs/en/12-taos-sql/16-json.md
rename to docs/en/12-taos-sql/17-json.md
diff --git a/docs/en/12-taos-sql/19-limit.md b/docs/en/12-taos-sql/19-limit.md
new file mode 100644
index 0000000000..ff552fc977
--- /dev/null
+++ b/docs/en/12-taos-sql/19-limit.md
@@ -0,0 +1,59 @@
+---
+sidebar_label: 命名与边界限制
+title: 命名与边界限制
+---
+
+## 名称命名规则
+
+1. 合法字符:英文字符、数字和下划线
+2. 允许英文字符或下划线开头,不允许以数字开头
+3. 不区分大小写
+4. 转义后表(列)名规则:
+ 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。可用让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查
+ 转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一
+
+ 例如:\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
+ 需要注意的是转义字符中的内容必须是可打印字符。
+
+## 密码合法字符集
+
+`[a-zA-Z0-9!?$%^&*()_–+={[}]:;@~#|<,>.?/]`
+
+去掉了 `` ‘“`\ `` (单双引号、撇号、反斜杠、空格)
+
+## 一般限制
+
+- 数据库名最大长度为 32
+- 表名最大长度为 192,不包括数据库名前缀和分隔符
+- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
+- 列名最大长度为 64
+- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
+- 标签名最大长度为 64
+- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB
+- SQL 语句最大长度 1048576 个字符,也可通过客户端配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576
+- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错
+- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
+- 数据库的副本数只能设置为 1 或 3
+- 用户名的最大长度是 23 个字节
+- 用户密码的最大长度是 15 个字节
+- 总数据行数取决于可用资源
+- 单个数据库的虚拟结点数上限为 1024
+
+## 表(列)名合法性说明
+
+### TDengine 中的表(列)名命名规则如下:
+
+只能由字母、数字、下划线构成,数字不能在首位,长度不能超过 192 字节,不区分大小写。这里表名称不包括数据库名的前缀和分隔符。
+
+### 转义后表(列)名规则:
+
+为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`",可以避免表名与关键词的冲突,同时不受限于上述表名合法性约束检查,转义符不计入表名的长度。
+转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一。
+
+例如:
+\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
+
+:::note
+转义字符中的内容必须是可打印字符。
+
+:::
diff --git a/docs/en/12-taos-sql/21-node.md b/docs/en/12-taos-sql/21-node.md
new file mode 100644
index 0000000000..4816daf420
--- /dev/null
+++ b/docs/en/12-taos-sql/21-node.md
@@ -0,0 +1,154 @@
+---
+sidebar_label: 集群管理
+title: 集群管理
+---
+
+组成 TDengine 集群的物理实体是 dnode (data node 的缩写),它是一个运行在操作系统之上的进程。在 dnode 中可以建立负责时序数据存储的 vnode (virtual node),在多节点集群环境下当某个数据库的 replica 为 3 时,该数据库中的每个 vgroup 由 3 个 vnode 组成;当数据库的 replica 为 1 时,该数据库中的每个 vgroup 由 1 个 vnode 组成。如果要想配置某个数据库为多副本,则集群中的 dnode 数量至少为 3。在 dnode 还可以创建 mnode (management node),单个集群中最多可以创建三个 mnode。在 TDengine 3.0.0.0 中为了支持存算分离,引入了一种新的逻辑节点 qnode (query node),qnode 和 vnode 既可以共存在一个 dnode 中,也可以完全分离在不同的 dnode 上。
+
+## 创建数据节点
+
+```sql
+CREATE DNODE {dnode_endpoint | dnode_host_name PORT port_val}
+```
+
+其中 `dnode_endpoint` 是形成 `hostname:port`的格式。也可以分开指定 hostname 和 port。
+
+实际操作中推荐先创建 dnode,再启动相应的 dnode 进程,这样该 dnode 就可以立即根据其配置文件中的 firstEP 加入集群。每个 dnode 在加入成功后都会被分配一个 ID。
+
+## 查看数据节点
+
+```sql
+SHOW DNODES;
+```
+
+可以列出集群中所有的数据节点,所列出的字段有 dnode 的 ID, endpoint, status。
+
+## 删除数据节点
+
+```sql
+DROP DNODE {dnode_id | dnode_endpoint}
+```
+
+可以用 dnoe_id 或 endpoint 两种方式从集群中删除一个 dnode。注意删除 dnode 不等于停止相应的进程。实际中推荐先将一个 dnode 删除之后再停止其所对应的进程。
+
+## 修改数据节点配置
+
+```sql
+ALTER DNODE dnode_id dnode_option
+
+ALTER ALL DNODES dnode_option
+
+dnode_option: {
+ 'resetLog'
+ | 'balance' value
+ | 'monitor' value
+ | 'debugFlag' value
+ | 'monDebugFlag' value
+ | 'vDebugFlag' value
+ | 'mDebugFlag' value
+ | 'cDebugFlag' value
+ | 'httpDebugFlag' value
+ | 'qDebugflag' value
+ | 'sdbDebugFlag' value
+ | 'uDebugFlag' value
+ | 'tsdbDebugFlag' value
+ | 'sDebugflag' value
+ | 'rpcDebugFlag' value
+ | 'dDebugFlag' value
+ | 'mqttDebugFlag' value
+ | 'wDebugFlag' value
+ | 'tmrDebugFlag' value
+ | 'cqDebugFlag' value
+}
+```
+
+上面语法中的这些可修改配置项其配置方式与 dnode 配置文件中的配置方式相同,区别是修改是动态的立即生效,且不需要重启 dnode。
+
+## 添加管理节点
+
+```sql
+CREATE MNODE ON DNODE dnode_id
+```
+
+系统启动默认在 firstEP 节点上创建一个 MNODE,用户可以使用此语句创建更多的 MNODE 来提高系统可用性。一个集群最多存在三个 MNODE,一个 DNODE 上只能创建一个 MNODE。
+
+## 查看管理节点
+
+```sql
+SHOW MNODES;
+```
+
+列出集群中所有的管理节点,包括其 ID,所在 DNODE 以及状态。
+
+## 删除管理节点
+
+```sql
+DROP MNODE ON DNODE dnode_id;
+```
+
+删除 dnode_id 所指定的 DNODE 上的 MNODE。
+
+## 创建查询节点
+
+```sql
+CREATE QNODE ON DNODE dnode_id;
+```
+
+系统启动默认没有 QNODE,用户可以创建 QNODE 来实现计算和存储的分离。一个 DNODE 上只能创建一个 QNODE。一个 DNODE 的 `supportVnodes` 参数如果不为 0,同时又在其上创建上 QNODE,则在该 dnode 中既有负责存储管理的 vnode 又有负责查询计算的 qnode,如果还在该 dnode 上创建了 mnode,则一个 dnode 上最多三种逻辑节点都可以存在。但通过配置也可以使其彻底分离。将一个 dnode 的`supportVnodes`配置为 0,可以选择在其上创建 mnode 或者 qnode 中的一种,这样可以实现三种逻辑节点在物理上的彻底分离。
+
+## 查看查询节点
+
+```sql
+SHOW QNODES;
+```
+
+列出集群中所有查询节点,包括 ID,及所在 DNODE。
+
+## 删除查询节点
+
+```sql
+DROP QNODE ON DNODE dnode_id;
+```
+
+删除 ID 为 dnode_id 的 DNODE 上的 QNODE,但并不会影响该 dnode 的状态。
+
+## 修改客户端配置
+
+如果将客户端也看作广义的集群的一部分,可以通过如下命令动态修改客户端配置参数。
+
+```sql
+ALTER LOCAL local_option
+
+local_option: {
+ 'resetLog'
+ | 'rpcDebugFlag' value
+ | 'tmrDebugFlag' value
+ | 'cDebugFlag' value
+ | 'uDebugFlag' value
+ | 'debugFlag' value
+}
+```
+
+上面语法中的参数与在配置文件中配置客户端的用法相同,但不需要重启客户端,修改后立即生效。
+
+## 查看客户端配置
+
+```sql
+SHOW LOCAL VARIABLES;
+```
+
+## 合并 vgroup
+
+```sql
+MERGE VGROUP vgroup_no1 vgroup_no2;
+```
+
+如果在系统实际运行一段时间后,因为不同时间线的数据特征不同导致在 vgroups 之间的数据和负载分布不均衡,可以通过合并或拆分 vgroups 的方式逐步实现负载均衡。
+
+## 拆分 vgroup
+
+```sql
+SPLIT VGROUP vgroup_no;
+```
+
+会创建一个新的 vgroup,并将指定 vgroup 中的数据按照一致性 HASH 迁移一部分到新的 vgroup 中。此过程中,原 vgroup 可以正常提供读写服务。
diff --git a/docs/en/12-taos-sql/22-meta.md b/docs/en/12-taos-sql/22-meta.md
new file mode 100644
index 0000000000..1e17870685
--- /dev/null
+++ b/docs/en/12-taos-sql/22-meta.md
@@ -0,0 +1,247 @@
+---
+sidebar_label: 元数据库
+title: 元数据库
+---
+
+TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。`INFORMATION_SCHEMA` 数据库旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)所提供的信息的访问。与 SHOW 语句相比,使用 SELECT ... FROM INFORMATION_SCHEMA.tablename 具有以下优点:
+
+1. 可以使用 USE 语句将 INFORMATION_SCHEMA 设为默认数据库
+2. 可以使用 SELECT 语句熟悉的语法,只需要学习一些表名和列名
+3. 可以对查询结果进行筛选、排序等操作。事实上,可以使用任意 TDengine 支持的 SELECT 语句对 INFORMATION_SCHEMA 中的表进行查询
+4. TDengine 在后续演进中可以灵活的添加已有 INFORMATION_SCHEMA 中表的列,而不用担心对既有业务系统造成影响
+5. 与其他数据库系统更具互操作性。例如,Oracle 数据库用户熟悉查询 Oracle 数据字典中的表
+
+Note: 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们仍然被保留。
+
+本章将详细介绍 `INFORMATION_SCHEMA` 这个内置元数据库中的表和表结构。
+
+## INS_DNODES
+
+提供 dnode 的相关信息。也可以使用 SHOW DNODES 来查询这些信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------------: | ------------ | ------------------------- |
+| 1 | vnodes | SMALLINT | dnode 中的实际 vnode 个数 |
+| 2 | support_vnodes | SMALLINT | 最多支持的 vnode 个数 |
+| 3 | status | BINARY(10) | 当前状态 |
+| 4 | note | BINARY(256) | 离线原因等信息 |
+| 5 | id | SMALLINT | dnode id |
+| 6 | endpoint | BINARY(134) | dnode 的地址 |
+| 7 | create | TIMESTAMP | 创建时间 |
+
+## INS_MNODES
+
+提供 mnode 的相关信息。也可以使用 SHOW MNODES 来查询这些信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | ------------------ |
+| 1 | id | SMALLINT | mnode id |
+| 2 | endpoint | BINARY(134) | mnode 的地址 |
+| 3 | role | BINARY(10) | 当前角色 |
+| 4 | role_time | TIMESTAMP | 成为当前角色的时间 |
+| 5 | create_time | TIMESTAMP | 创建时间 |
+
+## INS_MODULES
+
+提供组件的相关信息。也可以使用 SHOW MODULES 来查询这些信息
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------: | ------------ | ---------- |
+| 1 | id | SMALLINT | module id |
+| 2 | endpoint | BINARY(134) | 组件的地址 |
+| 3 | module | BINARY(10) | 组件状态 |
+
+## INS_QNODES
+
+当前系统中 QNODE 的信息。也可以使用 SHOW QNODES 来查询这些信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | ------------ |
+| 1 | id | SMALLINT | qnode id |
+| 2 | endpoint | BINARY(134) | qnode 的地址 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+
+## INS_CLUSTER
+
+存储集群相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | ---------- |
+| 1 | id | BIGINT | cluster id |
+| 2 | name | BINARY(134) | 集群名称 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+
+## INS_DATABASES
+
+提供用户创建的数据库对象的相关信息。也可以使用 SHOW DATABASES 来查询这些信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------------------: | ---------------- | ------------------------------------------------ |
+| 1 | name | BINARY(32) | 数据库名 |
+| 2 | create_time | TIMESTAMP | 创建时间 |
+| 3 | ntables | INT | 数据库中表的数量,包含子表和普通表但不包含超级表 |
+| 4 | vgroups | INT | 数据库中有多少个 vgroup |
+| 6 | replica | INT | 副本数 |
+| 7 | quorum | BINARY(3) | 强一致性 |
+| 8 | duration | INT | 单文件存储数据的时间跨度 |
+| 9 | keep | INT | 数据保留时长 |
+| 10 | buffer | INT | 每个 vnode 写缓存的内存块大小,单位 MB |
+| 11 | pagesize | INT | 每个 VNODE 中元数据存储引擎的页大小,单位为 KB |
+| 12 | pages | INT | 每个 vnode 元数据存储引擎的缓存页个数 |
+| 13 | minrows | INT | 文件块中记录的最大条数 |
+| 14 | maxrows | INT | 文件块中记录的最小条数 |
+| 15 | comp | INT | 数据压缩方式 |
+| 16 | precision | BINARY(2) | 时间分辨率 |
+| 17 | status | BINARY(10) | 数据库状态 |
+| 18 | retention | BINARY (60) | 数据的聚合周期和保存时长 |
+| 19 | single_stable | BOOL | 表示此数据库中是否只可以创建一个超级表 |
+| 20 | cachemodel | BINARY(60) | 表示是否在内存中缓存子表的最近数据 |
+| 21 | cachesize | INT | 表示每个 vnode 中用于缓存子表最近数据的内存大小 |
+| 22 | wal_level | INT | WAL 级别 |
+| 23 | wal_fsync_period | INT | 数据落盘周期 |
+| 24 | wal_retention_period | INT | WAL 的保存时长 |
+| 25 | wal_retention_size | INT | WAL 的保存上限 |
+| 26 | wal_roll_period | INT | wal 文件切换时长 |
+| 27 | wal_segment_size | wal 单个文件大小 |
+
+## INS_FUNCTIONS
+
+用户创建的自定义函数的信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | -------------- |
+| 1 | name | BINARY(64) | 函数名 |
+| 2 | comment | BINARY(255) | 补充说明 |
+| 3 | aggregate | INT | 是否为聚合函数 |
+| 4 | output_type | BINARY(31) | 输出类型 |
+| 5 | create_time | TIMESTAMP | 创建时间 |
+| 6 | code_len | INT | 代码长度 |
+| 7 | bufsize | INT | buffer 大小 |
+
+## INS_INDEXES
+
+提供用户创建的索引的相关信息。也可以使用 SHOW INDEX 来查询这些信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :--------------: | ------------ | ---------------------------------------------------------------------------------- |
+| 1 | db_name | BINARY(32) | 包含此索引的表所在的数据库名 |
+| 2 | table_name | BINARY(192) | 包含此索引的表的名称 |
+| 3 | index_name | BINARY(192) | 索引名 |
+| 4 | column_name | BINARY(64) | 建索引的列的列名 |
+| 5 | index_type | BINARY(10) | 目前有 SMA 和 FULLTEXT |
+| 6 | index_extensions | BINARY(256) | 索引的额外信息。对 SMA 类型的索引,是函数名的列表。对 FULLTEXT 类型的索引为 NULL。 |
+
+## INS_STABLES
+
+提供用户创建的超级表的相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :-----------: | ------------ | ------------------------ |
+| 1 | stable_name | BINARY(192) | 超级表表名 |
+| 2 | db_name | BINARY(64) | 超级表所在的数据库的名称 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+| 4 | columns | INT | 列数目 |
+| 5 | tags | INT | 标签数目 |
+| 6 | last_update | TIMESTAMP | 最后更新时间 |
+| 7 | table_comment | BINARY(1024) | 表注释 |
+| 8 | watermark | BINARY(64) | 窗口的关闭时间 |
+| 9 | max_delay | BINARY(64) | 推送计算结果的最大延迟 |
+| 10 | rollup | BINARY(128) | rollup 聚合函数 |
+
+## INS_TABLES
+
+提供用户创建的普通表和子表的相关信息
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :-----------: | ------------ | ---------------- |
+| 1 | table_name | BINARY(192) | 表名 |
+| 2 | db_name | BINARY(64) | 数据库名 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+| 4 | columns | INT | 列数目 |
+| 5 | stable_name | BINARY(192) | 所属的超级表表名 |
+| 6 | uid | BIGINT | 表 id |
+| 7 | vgroup_id | INT | vgroup id |
+| 8 | ttl | INT | 表的生命周期 |
+| 9 | table_comment | BINARY(1024) | 表注释 |
+| 10 | type | BINARY(20) | 表类型 |
+
+## INS_TAGS
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------- | ---------------------- |
+| 1 | table_name | BINARY(192) | 表名 |
+| 2 | db_name | BINARY(64) | 该表所在的数据库的名称 |
+| 3 | stable_name | BINARY(192) | 所属的超级表表名 |
+| 4 | tag_name | BINARY(64) | tag 的名称 |
+| 5 | tag_type | BINARY(64) | tag 的类型 |
+| 6 | tag_value | BINARY(16384) | tag 的值 |
+
+## INS_USERS
+
+提供系统中创建的用户的相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | -------- |
+| 1 | user_name | BINARY(23) | 用户名 |
+| 2 | privilege | BINARY(256) | 权限 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+
+## INS_GRANTS
+
+提供企业版授权的相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | -------------------------------------------------- |
+| 1 | version | BINARY(9) | 企业版授权说明:official(官方授权的)/trial(试用的) |
+| 2 | cpu_cores | BINARY(9) | 授权使用的 CPU 核心数量 |
+| 3 | dnodes | BINARY(10) | 授权使用的 dnode 节点数量 |
+| 4 | streams | BINARY(10) | 授权创建的流数量 |
+| 5 | users | BINARY(10) | 授权创建的用户数量 |
+| 6 | accounts | BINARY(10) | 授权创建的帐户数量 |
+| 7 | storage | BINARY(21) | 授权使用的存储空间大小 |
+| 8 | connections | BINARY(21) | 授权使用的客户端连接数量 |
+| 9 | databases | BINARY(11) | 授权使用的数据库数量 |
+| 10 | speed | BINARY(9) | 授权使用的数据点每秒写入数量 |
+| 11 | querytime | BINARY(9) | 授权使用的查询总时长 |
+| 12 | timeseries | BINARY(21) | 授权使用的测点数量 |
+| 13 | expired | BINARY(5) | 是否到期,true:到期,false:未到期 |
+| 14 | expire_time | BINARY(19) | 试用期到期时间 |
+
+## INS_VGROUPS
+
+系统中所有 vgroups 的信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :-------: | ------------ | ------------------------------------------------------ |
+| 1 | vgroup_id | INT | vgroup id |
+| 2 | db_name | BINARY(32) | 数据库名 |
+| 3 | tables | INT | 此 vgroup 内有多少表 |
+| 4 | status | BINARY(10) | 此 vgroup 的状态 |
+| 5 | v1_dnode | INT | 第一个成员所在的 dnode 的 id |
+| 6 | v1_status | BINARY(10) | 第一个成员的状态 |
+| 7 | v2_dnode | INT | 第二个成员所在的 dnode 的 id |
+| 8 | v2_status | BINARY(10) | 第二个成员的状态 |
+| 9 | v3_dnode | INT | 第三个成员所在的 dnode 的 id |
+| 10 | v3_status | BINARY(10) | 第三个成员的状态 |
+| 11 | nfiles | INT | 此 vgroup 中数据/元数据文件的数量 |
+| 12 | file_size | INT | 此 vgroup 中数据/元数据文件的大小 |
+| 13 | tsma | TINYINT | 此 vgroup 是否专用于 Time-range-wise SMA,1: 是, 0: 否 |
+
+## INS_CONFIGS
+
+系统配置参数。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------: | ------------ | ------------ |
+| 1 | name | BINARY(32) | 配置项名称 |
+| 2 | value | BINARY(64) | 该配置项的值 |
+
+## INS_DNODE_VARIABLES
+
+系统中每个 dnode 的配置参数。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------: | ------------ | ------------ |
+| 1 | dnode_id | INT | dnode 的 ID |
+| 2 | name | BINARY(32) | 配置项名称 |
+| 3 | value | BINARY(64) | 该配置项的值 |
diff --git a/docs/zh/12-taos-sql/23-show.md b/docs/en/12-taos-sql/24-show.md
similarity index 100%
rename from docs/zh/12-taos-sql/23-show.md
rename to docs/en/12-taos-sql/24-show.md
diff --git a/docs/en/12-taos-sql/25-grant.md b/docs/en/12-taos-sql/25-grant.md
new file mode 100644
index 0000000000..0c290350cc
--- /dev/null
+++ b/docs/en/12-taos-sql/25-grant.md
@@ -0,0 +1,94 @@
+---
+sidebar_label: 权限管理
+title: 权限管理
+---
+
+本节讲述如何在 TDengine 中进行权限管理的相关操作。
+
+## 创建用户
+
+```sql
+CREATE USER use_name PASS password;
+```
+
+创建用户。
+
+use_name最长为23字节。
+
+password最长为128字节,合法字符包括"a-zA-Z0-9!?$%^&*()_–+={[}]:;@~#|<,>.?/",不可以出现单双引号、撇号、反斜杠和空格,且不可以为空。
+
+## 删除用户
+
+```sql
+DROP USER user_name;
+```
+
+## 修改用户信息
+
+```sql
+ALTER USER user_name alter_user_clause
+
+alter_user_clause: {
+ PASS 'literal'
+ | ENABLE value
+ | SYSINFO value
+}
+```
+
+- PASS:修改用户密码。
+- ENABLE:修改用户是否启用。1表示启用此用户,0表示禁用此用户。
+- SYSINFO:修改用户是否可查看系统信息。1表示可以查看系统信息,0表示不可以查看系统信息。
+
+
+## 授权
+
+```sql
+GRANT privileges ON priv_level TO user_name
+
+privileges : {
+ ALL
+ | priv_type [, priv_type] ...
+}
+
+priv_type : {
+ READ
+ | WRITE
+}
+
+priv_level : {
+ dbname.*
+ | *.*
+}
+```
+
+对用户授权。
+
+授权级别支持到DATABASE,权限有READ和WRITE两种。
+
+TDengine 有超级用户和普通用户两类用户。超级用户缺省创建为root,拥有所有权限。使用超级用户创建出来的用户为普通用户。在未授权的情况下,普通用户可以创建DATABASE,并拥有自己创建的DATABASE的所有权限,包括删除数据库、修改数据库、查询时序数据和写入时序数据。超级用户可以给普通用户授予其他DATABASE的读写权限,使其可以在此DATABASE上读写数据,但不能对其进行删除和修改数据库的操作。
+
+对于非DATABASE的对象,如USER、DNODE、UDF、QNODE等,普通用户只有读权限(一般为SHOW命令),不能创建和修改。
+
+## 撤销授权
+
+```sql
+REVOKE privileges ON priv_level FROM user_name
+
+privileges : {
+ ALL
+ | priv_type [, priv_type] ...
+}
+
+priv_type : {
+ READ
+ | WRITE
+}
+
+priv_level : {
+ dbname.*
+ | *.*
+}
+
+```
+
+收回对用户的授权。
\ No newline at end of file
diff --git a/docs/en/12-taos-sql/26-udf.md b/docs/en/12-taos-sql/26-udf.md
new file mode 100644
index 0000000000..bd8d61a584
--- /dev/null
+++ b/docs/en/12-taos-sql/26-udf.md
@@ -0,0 +1,28 @@
+---
+sidebar_label: 自定义函数
+title: 用户自定义函数
+---
+
+除了 TDengine 的内置函数以外,用户还可以编写自己的函数逻辑并加入TDengine系统中。
+
+## 创建函数
+
+```sql
+CREATE [AGGREGATE] FUNCTION func_name AS library_path OUTPUTTYPE type_name [BUFSIZE value]
+```
+
+语法说明:
+
+AGGREGATE:标识此函数是标量函数还是聚集函数。
+func_name:函数名,必须与函数实现中udfNormalFunc的实际名称一致。
+library_path:包含UDF函数实现的动态链接库的绝对路径,是在客户端侧主机上的绝对路径。
+OUTPUTTYPE:标识此函数的返回类型。
+BUFSIZE:中间结果的缓冲区大小,单位是字节。不设置则默认为0。最大不可超过512字节。
+
+关于如何开发自定义函数,请参考 [UDF使用说明](../../develop/udf)。
+
+## 删除自定义函数
+
+```sql
+DROP FUNCTION func_name
+```
\ No newline at end of file
diff --git a/docs/en/12-taos-sql/27-index.md b/docs/en/12-taos-sql/27-index.md
new file mode 100644
index 0000000000..2c0907723e
--- /dev/null
+++ b/docs/en/12-taos-sql/27-index.md
@@ -0,0 +1,47 @@
+---
+sidebar_label: 索引
+title: 使用索引
+---
+
+TDengine 从 3.0.0.0 版本开始引入了索引功能,支持 SMA 索引和 FULLTEXT 索引。
+
+## 创建索引
+
+```sql
+CREATE FULLTEXT INDEX index_name ON tb_name (col_name [, col_name] ...)
+
+CREATE SMA INDEX index_name ON tb_name index_option
+
+index_option:
+ FUNCTION(functions) INTERVAL(interval_val [, interval_offset]) [SLIDING(sliding_val)] [WATERMARK(watermark_val)] [MAX_DELAY(max_delay_val)]
+
+functions:
+ function [, function] ...
+```
+
+### SMA 索引
+
+对指定列按 INTERVAL 子句定义的时间窗口创建进行预聚合计算,预聚合计算类型由 functions_string 指定。SMA 索引能提升指定时间段的聚合查询的性能。目前,限制一个超级表只能创建一个 SMA INDEX。
+
+- 支持的函数包括 MAX、MIN 和 SUM。
+- WATERMARK: 最小单位毫秒,取值范围 [0ms, 900000ms],默认值为 5 秒,只可用于超级表。
+- MAX_DELAY: 最小单位毫秒,取值范围 [1ms, 900000ms],默认值为 interval 的值(但不能超过最大值),只可用于超级表。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。
+
+### FULLTEXT 索引
+
+对指定列建立文本索引,可以提升含有文本过滤的查询的性能。FULLTEXT 索引不支持 index_option 语法。现阶段只支持对 JSON 类型的标签列创建 FULLTEXT 索引。不支持多列联合索引,但可以为每个列分布创建 FULLTEXT 索引。
+
+## 删除索引
+
+```sql
+DROP INDEX index_name;
+```
+
+## 查看索引
+
+````sql
+```sql
+SHOW INDEXES FROM tbl_name [FROM db_name];
+````
+
+显示在所指定的数据库或表上已创建的索引。
diff --git a/docs/en/12-taos-sql/28-recovery.md b/docs/en/12-taos-sql/28-recovery.md
new file mode 100644
index 0000000000..72b220b8ff
--- /dev/null
+++ b/docs/en/12-taos-sql/28-recovery.md
@@ -0,0 +1,38 @@
+---
+sidebar_label: 异常恢复
+title: 异常恢复
+---
+
+在一个复杂的应用场景中,连接和查询任务等有可能进入一种错误状态或者耗时过长迟迟无法结束,此时需要有能够终止这些连接或任务的方法。
+
+## 终止连接
+
+```sql
+KILL CONNECTION conn_id;
+```
+
+conn_id 可以通过 `SHOW CONNECTIONS` 获取。
+
+## 终止查询
+
+```sql
+SHOW QUERY query_id;
+```
+
+query_id 可以通过 `SHOW QUERIES` 获取。
+
+## 终止事务
+
+```sql
+KILL TRANSACTION trans_id
+```
+
+trans_id 可以通过 `SHOW TRANSACTIONS` 获取。
+
+## 重置客户端缓存
+
+```sql
+RESET QUERY CACHE;
+```
+
+如果在多客户端情况下出现元数据不同步的情况,可以用这条命令强制清空客户端缓存,随后客户端会从服务端拉取最新的元数据。
diff --git a/docs/en/14-reference/03-connector/_verify_linux.mdx b/docs/en/14-reference/03-connector/_verify_linux.mdx
index a6e5455224..875c9e132b 100644
--- a/docs/en/14-reference/03-connector/_verify_linux.mdx
+++ b/docs/en/14-reference/03-connector/_verify_linux.mdx
@@ -2,13 +2,18 @@ Execute TDengine CLI program `taos` directly from the Linux shell to connect to
```text
$ taos
-Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
-Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
+Welcome to the TDengine shell from Linux, Client Version:3.0.0.0
+Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.
+
+Server is Community Edition.
+
taos> show databases;
-name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB)| blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
-=========================================================================================================================================================================================================================
-test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16| 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
-log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1| 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
-Query OK, 2 row(s) in set (0.001198s)
+ name | create_time | vgroups | ntables | replica | strict | duration | keep | buffer | pagesize | pages | minrows | maxrows | comp | precision | status | retention | single_stable | cachemodel | cachesize | wal_level | wal_fsync_period | wal_retention_period | wal_retention_size | wal_roll_period | wal_seg_size |
+=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ information_schema | NULL | NULL | 14 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ performance_schema | NULL | NULL | 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ db | 2022-08-04 14:14:49.385 | 2 | 4 | 1 | off | 14400m | 5254560m,5254560m,5254560m | 96 | 4 | 256 | 100 | 4096 | 2 | ms | ready | NULL | false | none | 1 | 1 | 3000 | 0 | 0 | 0 | 0 |
+Query OK, 3 rows in database (0.019154s)
+
taos>
```
diff --git a/docs/en/14-reference/03-connector/_verify_windows.mdx b/docs/en/14-reference/03-connector/_verify_windows.mdx
index daeb151bb1..4813bd24c3 100644
--- a/docs/en/14-reference/03-connector/_verify_windows.mdx
+++ b/docs/en/14-reference/03-connector/_verify_windows.mdx
@@ -1,14 +1,19 @@
Go to the `C:\TDengine` directory from `cmd` and execute TDengine CLI program `taos.exe` directly to connect to the TDengine service and enter the TDengine CLI interface, for example, as follows:
```text
- C:\TDengine>taos
- Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
- Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
- taos> show databases;
- name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
- ===================================================================================================================================================================================================================================================================
- test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
- log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
- Query OK, 2 row(s) in set (0.045000s)
- taos>
+Welcome to the TDengine shell from Windows, Client Version:3.0.0.0
+Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.
+
+Server is Community Edition.
+
+taos> show databases;
+ name | create_time | vgroups | ntables | replica | strict | duration | keep | buffer | pagesize | pages | minrows | maxrows | comp | precision | status | retention | single_stable | cachemodel | cachesize | wal_level | wal_fsync_period | wal_retention_period | wal_retention_size | wal_roll_period | wal_seg_size |
+=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ information_schema | NULL | NULL | 14 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ performance_schema | NULL | NULL | 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ test | 2022-08-04 16:46:40.506 | 2 | 0 | 1 | off | 14400m | 5256000m,5256000m,5256000m | 96 | 4 | 256 |
+100 | 4096 | 2 | ms | ready | NULL | false | none | 1 | 1 | 3000 | 0 | 0 | 0 | 0 |
+Query OK, 3 rows in database (0.123000s)
+
+taos>
```
diff --git a/docs/en/14-reference/06-taosdump.md b/docs/en/14-reference/06-taosdump.md
index 96e68d0edb..2105ba83fa 100644
--- a/docs/en/14-reference/06-taosdump.md
+++ b/docs/en/14-reference/06-taosdump.md
@@ -29,7 +29,7 @@ There are two ways to install taosdump:
1. backing up all databases: specify `-A` or `-all-databases` parameter.
2. backup multiple specified databases: use `-D db1,db2,... ` parameters;
-3. back up some super or normal tables in the specified database: use `-dbname stbname1 stbname2 tbname1 tbname2 ... ` parameters. Note that the first parameter of this input sequence is the database name, and only one database is supported. The second and subsequent parameters are the names of super or normal tables in that database, separated by spaces.
+3. back up some super or normal tables in the specified database: use `dbname stbname1 stbname2 tbname1 tbname2 ... ` parameters. Note that the first parameter of this input sequence is the database name, and only one database is supported. The second and subsequent parameters are the names of super or normal tables in that database, separated by spaces.
4. back up the system log database: TDengine clusters usually contain a system database named `log`. The data in this database is the data that TDengine runs itself, and the taosdump will not back up the log database by default. If users need to back up the log database, users can use the `-a` or `-allow-sys` command-line parameter.
5. Loose mode backup: taosdump version 1.4.1 onwards provides `-n` and `-L` parameters for backing up data without using escape characters and "loose" mode, which can reduce the number of backups if table names, column names, tag names do not use escape characters. This can also reduce the backup data time and backup data footprint. If you are unsure about using `-n` and `-L` conditions, please use the default parameters for "strict" mode backup. See the [official documentation](/taos-sql/escape) for a description of escaped characters.
@@ -104,7 +104,10 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
use letter and number only. Default is NOT.
-n, --no-escape No escape char '`'. Default is using it.
-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is
- 5.
+ 8.
+ -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service
+ -R, --restful Use RESTful interface to connect TDengine
+ -t, --timeout=SECONDS The timeout seconds for websocket to interact.
-g, --debug Print debug info.
-?, --help Give this help list
--usage Give a short usage message
diff --git a/docs/en/20-third-party/09-emq-broker.md b/docs/en/20-third-party/09-emq-broker.md
index 8dfa09e6c7..0900dd3d75 100644
--- a/docs/en/20-third-party/09-emq-broker.md
+++ b/docs/en/20-third-party/09-emq-broker.md
@@ -16,6 +16,7 @@ The following preparations are required for EMQX to add TDengine data sources co
Depending on the current operating system, users can download the installation package from the [EMQX official website](https://www.emqx.io/downloads) and execute the installation. After installation, use `sudo emqx start` or `sudo systemctl start emqx` to start the EMQX service.
+Note: this chapter is based on EMQX v4.4.5. Other version of EMQX probably change its user interface, configuration methods or functions.
## Create Database and Table
@@ -31,7 +32,7 @@ Note: The table schema is based on the blog [(In Chinese) Data Transfer, Storage
## Configuring EMQX Rules
-Since the configuration interface of EMQX differs from version to version, here is v4.4.3 as an example. For other versions, please refer to the corresponding official documentation.
+Since the configuration interface of EMQX differs from version to version, here is v4.4.5 as an example. For other versions, please refer to the corresponding official documentation.
### Login EMQX Dashboard
diff --git a/docs/examples/R/connect_native.r b/docs/examples/R/connect_native.r
index 18c142872b..3c5c9e199b 100644
--- a/docs/examples/R/connect_native.r
+++ b/docs/examples/R/connect_native.r
@@ -8,9 +8,9 @@ library("rJava")
library("RJDBC")
args<- commandArgs(trailingOnly = TRUE)
-driver_path = args[1] # path to jdbc-driver for example: "/root/taos-jdbcdriver-2.0.37-dist.jar"
+driver_path = args[1] # path to jdbc-driver for example: "/root/taos-jdbcdriver-3.0.0-dist.jar"
driver = JDBC("com.taosdata.jdbc.TSDBDriver", driver_path)
conn = dbConnect(driver, "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata")
dbGetQuery(conn, "SELECT server_version()")
dbDisconnect(conn)
-# ANCHOR_END: demo
\ No newline at end of file
+# ANCHOR_END: demo
diff --git a/docs/examples/csharp/AsyncQueryExample.cs b/docs/examples/csharp/AsyncQueryExample.cs
index 3dabbebd16..0d47325932 100644
--- a/docs/examples/csharp/AsyncQueryExample.cs
+++ b/docs/examples/csharp/AsyncQueryExample.cs
@@ -1,4 +1,7 @@
+using System;
+using System.Collections.Generic;
using TDengineDriver;
+using TDengineDriver.Impl;
using System.Runtime.InteropServices;
namespace TDengineExample
@@ -19,8 +22,8 @@ namespace TDengineExample
{
if (code == 0 && taosRes != IntPtr.Zero)
{
- FetchRowAsyncCallback fetchRowAsyncCallback = new FetchRowAsyncCallback(FetchRowCallback);
- TDengine.FetchRowAsync(taosRes, fetchRowAsyncCallback, param);
+ FetchRawBlockAsyncCallback fetchRowAsyncCallback = new FetchRawBlockAsyncCallback(FetchRawBlockCallback);
+ TDengine.FetchRawBlockAsync(taosRes, fetchRowAsyncCallback, param);
}
else
{
@@ -28,179 +31,44 @@ namespace TDengineExample
}
}
- static void FetchRowCallback(IntPtr param, IntPtr taosRes, int numOfRows)
+ // Iteratively call this interface until "numOfRows" is no greater than 0.
+ static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows)
{
if (numOfRows > 0)
{
Console.WriteLine($"{numOfRows} rows async retrieved");
- DisplayRes(taosRes);
- TDengine.FetchRowAsync(taosRes, FetchRowCallback, param);
+ IntPtr pdata = TDengine.GetRawBlock(taosRes);
+ List metaList = TDengine.FetchFields(taosRes);
+ List
@@ -168,7 +168,7 @@ Node.js 连接器通过不同的包提供不同的连接方式。
-
+
@@ -188,7 +188,7 @@ dotnet add package TDengine.Connector
-1. 下载 [taos-jdbcdriver-version-dist.jar](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/2.0.38/)。
+1. 下载 [taos-jdbcdriver-version-dist.jar](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.0.0/)。
2. 安装 R 的依赖包`RJDBC`:
```R
diff --git a/docs/zh/07-develop/07-tmq.md b/docs/zh/07-develop/07-tmq.md
index 0f531e07c9..358c824ffa 100644
--- a/docs/zh/07-develop/07-tmq.md
+++ b/docs/zh/07-develop/07-tmq.md
@@ -1,254 +1,241 @@
----
-sidebar_label: 数据订阅
-description: "轻量级的数据订阅与推送服务。连续写入到 TDengine 中的时序数据能够被自动推送到订阅客户端。"
-title: 数据订阅
----
-
-import Tabs from "@theme/Tabs";
-import TabItem from "@theme/TabItem";
-import Java from "./_sub_java.mdx";
-import Python from "./_sub_python.mdx";
-import Go from "./_sub_go.mdx";
-import Rust from "./_sub_rust.mdx";
-import Node from "./_sub_node.mdx";
-import CSharp from "./_sub_cs.mdx";
-import CDemo from "./_sub_c.mdx";
-
-基于数据天然的时间序列特性,TDengine 的数据写入(insert)与消息系统的数据发布(pub)逻辑上一致,均可视为系统中插入一条带时间戳的新记录。同时,TDengine 在内部严格按照数据时间序列单调递增的方式保存数据。本质上来说,TDengine 中每一张表均可视为一个标准的消息队列。
-
-TDengine 内嵌支持轻量级的消息订阅与推送服务。使用系统提供的 API,用户可使用普通查询语句订阅数据库中的一张或多张表。订阅的逻辑和操作状态的维护均是由客户端完成,客户端定时轮询服务器是否有新的记录到达,有新的记录到达就会将结果反馈到客户。
-
-TDengine 的订阅与推送服务的状态是由客户端维持,TDengine 服务端并不维持。因此如果应用重启,从哪个时间点开始获取最新数据,由应用决定。
-
-TDengine 的 API 中,与订阅相关的主要有以下三个:
-
-```c
-taos_subscribe
-taos_consume
-taos_unsubscribe
-```
-
-这些 API 的文档请见 [C/C++ Connector](/reference/connector/cpp),下面仍以智能电表场景为例介绍一下它们的具体用法(超级表和子表结构请参考上一节“连续查询”),完整的示例代码可以在 [这里](https://github.com/taosdata/TDengine/blob/master/examples/c/subscribe.c) 找到。
-
-如果我们希望当某个电表的电流超过一定限制(比如 10A)后能得到通知并进行一些处理, 有两种方法:一是分别对每张子表进行查询,每次查询后记录最后一条数据的时间戳,后续只查询这个时间戳之后的数据:
-
-```sql
-select * from D1001 where ts > {last_timestamp1} and current > 10;
-select * from D1002 where ts > {last_timestamp2} and current > 10;
-...
-```
-
-这确实可行,但随着电表数量的增加,查询数量也会增加,客户端和服务端的性能都会受到影响,当电表数增长到一定的程度,系统就无法承受了。
-
-另一种方法是对超级表进行查询。这样,无论有多少电表,都只需一次查询:
-
-```sql
-select * from meters where ts > {last_timestamp} and current > 10;
-```
-
-但是,如何选择 `last_timestamp` 就成了一个新的问题。因为,一方面数据的产生时间(也就是数据时间戳)和数据入库的时间一般并不相同,有时偏差还很大;另一方面,不同电表的数据到达 TDengine 的时间也会有差异。所以,如果我们在查询中使用最慢的那台电表的数据的时间戳作为 `last_timestamp`,就可能重复读入其它电表的数据;如果使用最快的电表的时间戳,其它电表的数据就可能被漏掉。
-
-TDengine 的订阅功能为上面这个问题提供了一个彻底的解决方案。
-
-首先是使用 `taos_subscribe` 创建订阅:
-
-```c
-TAOS_SUB* tsub = NULL;
-if (async) {
- // create an asynchronized subscription, the callback function will be called every 1s
- tsub = taos_subscribe(taos, restart, topic, sql, subscribe_callback, &blockFetch, 1000);
-} else {
- // create an synchronized subscription, need to call 'taos_consume' manually
- tsub = taos_subscribe(taos, restart, topic, sql, NULL, NULL, 0);
-}
-```
-
-TDengine 中的订阅既可以是同步的,也可以是异步的,上面的代码会根据从命令行获取的参数 `async` 的值来决定使用哪种方式。这里,同步的意思是用户程序要直接调用 `taos_consume` 来拉取数据,而异步则由 API 在内部的另一个线程中调用 `taos_consume`,然后把拉取到的数据交给回调函数 `subscribe_callback`去处理。(注意,`subscribe_callback` 中不宜做较为耗时的操作,否则有可能导致客户端阻塞等不可控的问题。)
-
-参数 `taos` 是一个已经建立好的数据库连接,在同步模式下无特殊要求。但在异步模式下,需要注意它不会被其它线程使用,否则可能导致不可预计的错误,因为回调函数在 API 的内部线程中被调用,而 TDengine 的部分 API 不是线程安全的。
-
-参数 `sql` 是查询语句,可以在其中使用 where 子句指定过滤条件。在我们的例子中,如果只想订阅电流超过 10A 时的数据,可以这样写:
-
-```sql
-select * from meters where current > 10;
-```
-
-注意,这里没有指定起始时间,所以会读到所有时间的数据。如果只想从一天前的数据开始订阅,而不需要更早的历史数据,可以再加上一个时间条件:
-
-```sql
-select * from meters where ts > now - 1d and current > 10;
-```
-
-订阅的 `topic` 实际上是它的名字,因为订阅功能是在客户端 API 中实现的,所以没必要保证它全局唯一,但需要它在一台客户端机器上唯一。
-
-如果名为 `topic` 的订阅不存在,参数 `restart` 没有意义;但如果用户程序创建这个订阅后退出,当它再次启动并重新使用这个 `topic` 时,`restart` 就会被用于决定是从头开始读取数据,还是接续上次的位置进行读取。本例中,如果 `restart` 是 **true**(非零值),用户程序肯定会读到所有数据。但如果这个订阅之前就存在了,并且已经读取了一部分数据,且 `restart` 是 **false**(**0**),用户程序就不会读到之前已经读取的数据了。
-
-`taos_subscribe`的最后一个参数是以毫秒为单位的轮询周期。在同步模式下,如果前后两次调用 `taos_consume` 的时间间隔小于此时间,`taos_consume` 会阻塞,直到间隔超过此时间。异步模式下,这个时间是两次调用回调函数的最小时间间隔。
-
-`taos_subscribe` 的倒数第二个参数用于用户程序向回调函数传递附加参数,订阅 API 不对其做任何处理,只原样传递给回调函数。此参数在同步模式下无意义。
-
-订阅创建以后,就可以消费其数据了,同步模式下,示例代码是下面的 else 部分:
-
-```c
-if (async) {
- getchar();
-} else while(1) {
- TAOS_RES* res = taos_consume(tsub);
- if (res == NULL) {
- printf("failed to consume data.");
- break;
- } else {
- print_result(res, blockFetch);
- getchar();
- }
-}
-```
-
-这里是一个 **while** 循环,用户每按一次回车键就调用一次 `taos_consume`,而 `taos_consume` 的返回值是查询到的结果集,与 `taos_use_result` 完全相同,例子中使用这个结果集的代码是函数 `print_result`:
-
-```c
-void print_result(TAOS_RES* res, int blockFetch) {
- TAOS_ROW row = NULL;
- int num_fields = taos_num_fields(res);
- TAOS_FIELD* fields = taos_fetch_fields(res);
- int nRows = 0;
- if (blockFetch) {
- nRows = taos_fetch_block(res, &row);
- for (int i = 0; i < nRows; i++) {
- char temp[256];
- taos_print_row(temp, row + i, fields, num_fields);
- puts(temp);
- }
- } else {
- while ((row = taos_fetch_row(res))) {
- char temp[256];
- taos_print_row(temp, row, fields, num_fields);
- puts(temp);
- nRows++;
- }
- }
- printf("%d rows consumed.\n", nRows);
-}
-```
-
-其中的 `taos_print_row` 用于处理订阅到数据,在我们的例子中,它会打印出所有符合条件的记录。而异步模式下,消费订阅到的数据则显得更为简单:
-
-```c
-void subscribe_callback(TAOS_SUB* tsub, TAOS_RES *res, void* param, int code) {
- print_result(res, *(int*)param);
-}
-```
-
-当要结束一次数据订阅时,需要调用 `taos_unsubscribe`:
-
-```c
-taos_unsubscribe(tsub, keep);
-```
-
-其第二个参数,用于决定是否在客户端保留订阅的进度信息。如果这个参数是**false**(**0**),那无论下次调用 `taos_subscribe` 时的 `restart` 参数是什么,订阅都只能重新开始。另外,进度信息的保存位置是 _{DataDir}/subscribe/_ 这个目录下(注:`taos.cfg` 配置文件中 `DataDir` 参数值默认为 **/var/lib/taos/**,但是 Windows 服务器上本身不存在该目录,所以需要在 Windows 的配置文件中修改 `DataDir` 参数值为相应的已存在目录"),每个订阅有一个与其 `topic` 同名的文件,删掉某个文件,同样会导致下次创建其对应的订阅时只能重新开始。
-
-代码介绍完毕,我们来看一下实际的运行效果。假设:
-
-- 示例代码已经下载到本地
-- TDengine 也已经在同一台机器上安装好
-- 示例所需的数据库、超级表、子表已经全部创建好
-
-则可以在示例代码所在目录执行以下命令来编译并启动示例程序:
-
-```bash
-make
-./subscribe -sql='select * from meters where current > 10;'
-```
-
-示例程序启动后,打开另一个终端窗口,启动 TDengine CLI 向 **D1001** 插入一条电流为 12A 的数据:
-
-```sql
-$ taos
-> use test;
-> insert into D1001 values(now, 12, 220, 1);
-```
-
-这时,因为电流超过了 10A,您应该可以看到示例程序将它输出到了屏幕上。您可以继续插入一些数据观察示例程序的输出。
-
-## 示例程序
-
-下面的示例程序展示是如何使用连接器订阅所有电流超过 10A 的记录。
-
-### 准备数据
-
-```
-# create database "power"
-taos> create database power;
-# use "power" as the database in following operations
-taos> use power;
-# create super table "meters"
-taos> create table meters(ts timestamp, current float, voltage int, phase int) tags(location binary(64), groupId int);
-# create tabes using the schema defined by super table "meters"
-taos> create table d1001 using meters tags ("California.SanFrancisco", 2);
-taos> create table d1002 using meters tags ("California.LosAngeles", 2);
-# insert some rows
-taos> insert into d1001 values("2020-08-15 12:00:00.000", 12, 220, 1),("2020-08-15 12:10:00.000", 12.3, 220, 2),("2020-08-15 12:20:00.000", 12.2, 220, 1);
-taos> insert into d1002 values("2020-08-15 12:00:00.000", 9.9, 220, 1),("2020-08-15 12:10:00.000", 10.3, 220, 1),("2020-08-15 12:20:00.000", 11.2, 220, 1);
-# filter out the rows in which current is bigger than 10A
-taos> select * from meters where current > 10;
- ts | current | voltage | phase | location | groupid |
-===========================================================================================================
- 2020-08-15 12:10:00.000 | 10.30000 | 220 | 1 | California.LosAngeles | 2 |
- 2020-08-15 12:20:00.000 | 11.20000 | 220 | 1 | California.LosAngeles | 2 |
- 2020-08-15 12:00:00.000 | 12.00000 | 220 | 1 | California.SanFrancisco | 2 |
- 2020-08-15 12:10:00.000 | 12.30000 | 220 | 2 | California.SanFrancisco | 2 |
- 2020-08-15 12:20:00.000 | 12.20000 | 220 | 1 | California.SanFrancisco | 2 |
-Query OK, 5 row(s) in set (0.004896s)
-```
-
-### 示例代码
-
-
-
-
-
-
-
-
- {/*
-
- */}
-
-
-
- {/*
-
-
-
-
- */}
-
-
-
-
-
-### 运行示例程序
-
-示例程序会先消费符合查询条件的所有历史数据:
-
-```bash
-ts: 1597464000000 current: 12.0 voltage: 220 phase: 1 location: California.SanFrancisco groupid : 2
-ts: 1597464600000 current: 12.3 voltage: 220 phase: 2 location: California.SanFrancisco groupid : 2
-ts: 1597465200000 current: 12.2 voltage: 220 phase: 1 location: California.SanFrancisco groupid : 2
-ts: 1597464600000 current: 10.3 voltage: 220 phase: 1 location: California.LosAngeles groupid : 2
-ts: 1597465200000 current: 11.2 voltage: 220 phase: 1 location: California.LosAngeles groupid : 2
-```
-
-接着,使用 TDengine CLI 向表中新增一条数据:
-
-```
-# taos
-taos> use power;
-taos> insert into d1001 values(now, 12.4, 220, 1);
-```
-
-因为这条数据的电流大于 10A,示例程序会将其消费:
-
-```
-ts: 1651146662805 current: 12.4 voltage: 220 phase: 1 location: California.SanFrancisco groupid: 2
-```
+---
+sidebar_label: 消息队列
+description: "数据订阅与推送服务。连续写入到 TDengine 中的时序数据能够被自动推送到订阅客户端。"
+title: 消息队列
+---
+
+基于数据天然的时间序列特性,TDengine 的数据写入(insert)与消息系统的数据发布(pub)逻辑上一致,均可视为系统中插入一条带时间戳的新记录。同时,TDengine 在内部严格按照数据时间序列单调递增的方式保存数据。本质上来说,TDengine 中每一张表均可视为一个标准的消息队列。
+
+TDengine 内嵌支持消息订阅与推送服务(下文都简称TMQ)。使用系统提供的 API,用户可使用普通查询语句订阅数据库中的一张或多张表,或整个库。客户端启动订阅后,定时或按需轮询服务器是否有新的记录到达,有新的记录到达就会将结果反馈到客户。
+
+TMQ提供了提交机制来保证消息队列的可靠性和正确性。在调用方法上,支持自动提交和手动提交。
+
+TMQ 的 API 中,与订阅相关的主要数据结构和API如下:
+
+```c
+typedef struct tmq_t tmq_t;
+typedef struct tmq_conf_t tmq_conf_t;
+typedef struct tmq_list_t tmq_list_t;
+
+typedef void(tmq_commit_cb(tmq_t *, int32_t code, void *param));
+
+DLL_EXPORT tmq_list_t *tmq_list_new();
+DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
+DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
+DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
+DLL_EXPORT const char *tmq_err2str(int32_t code);
+
+DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
+DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
+DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
+DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
+DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
+DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
+
+enum tmq_conf_res_t {
+ TMQ_CONF_UNKNOWN = -2,
+ TMQ_CONF_INVALID = -1,
+ TMQ_CONF_OK = 0,
+};
+typedef enum tmq_conf_res_t tmq_conf_res_t;
+
+DLL_EXPORT tmq_conf_t *tmq_conf_new();
+DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
+DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
+DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
+```
+
+这些 API 的文档请见 [C/C++ Connector](/reference/connector/cpp),下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码可以在 [tmq.c](https://github.com/taosdata/TDengine/blob/3.0/examples/c/tmq.c) 看到。
+
+一、首先完成建库、建一张超级表和多张子表,并每个子表插入若干条数据记录:
+
+```sql
+drop database if exists tmqdb;
+create database tmqdb;
+create table tmqdb.stb (ts timestamp, c1 int, c2 float, c3 varchar(16) tags(t1 int, t3 varchar(16));
+create table tmqdb.ctb0 using tmqdb.stb tags(0, "subtable0");
+create table tmqdb.ctb1 using tmqdb.stb tags(1, "subtable1");
+create table tmqdb.ctb2 using tmqdb.stb tags(2, "subtable2");
+create table tmqdb.ctb3 using tmqdb.stb tags(3, "subtable3");
+insert into tmqdb.ctb0 values(now, 0, 0, 'a0')(now+1s, 0, 0, 'a00');
+insert into tmqdb.ctb1 values(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
+insert into tmqdb.ctb2 values(now, 2, 2, 'a1')(now+1s, 22, 22, 'a22');
+insert into tmqdb.ctb3 values(now, 3, 3, 'a1')(now+1s, 33, 33, 'a33');
+```
+
+二、创建topic:
+
+```sql
+create topic topicName as select ts, c1, c2, c3 from tmqdb.stb where c1 > 1;
+```
+
+注:TMQ支持多种订阅类型:
+1、列订阅
+
+语法:CREATE TOPIC topic_name as subquery
+通过select语句订阅(包括select *,或select ts, c1等指定列描述订阅,可以带条件过滤、标量函数计算,但不支持聚合函数、不支持时间窗口聚合)
+
+- TOPIC一旦创建则schema确定
+- 被订阅或用于计算的column和tag不可被删除、修改
+- 若发生schema变更,新增的column不出现在结果中
+
+2、超级表订阅
+语法:CREATE TOPIC topic_name AS STABLE stbName
+
+- 订阅某超级表的全部数据,schema变更不受限,schema变更后写入的数据将以最新schema返回
+- 在tmq的返回消息中schema是块级别的,每块的schema可能不一样
+- 列变更后写入的数据若未落盘,将以写入时的schema返回
+- 列变更后写入的数据若已落盘,将以落盘时的schema返回
+
+3、db订阅
+语法:CREATE TOPIC topic_name AS DATABASE db_name
+
+- 订阅某一db的全部数据,schema变更不受限
+- 在tmq的返回消息中schema是块级别的,每块的schema可能不一样
+- 列变更后写入的数据若未落盘,将以写入时的schema返回
+- 列变更后写入的数据若已落盘,将以落盘时的schema返回
+
+三、创建consumer
+
+目前支持的config:
+
+| 参数名称 | 参数值 | 备注 |
+| ---------------------------- | ------------------------------ | ------------------------------------------------------ |
+| group.id | 最大长度:192 | |
+| enable.auto.commit | 合法值:true, false | |
+| auto.commit.interval.ms | | |
+| auto.offset.reset | 合法值:earliest, latest, none | |
+| td.connect.ip | 用于连接,同taos_connect的参数 | |
+| td.connect.user | 用于连接,同taos_connect的参数 | |
+| td.connect.pass | 用于连接,同taos_connect的参数 | |
+| td.connect.port | 用于连接,同taos_connect的参数 | |
+| enable.heartbeat.background | 合法值:true, false | 开启后台心跳,即consumer不会因为长时间不poll而认为离线 |
+| experimental.snapshot.enable | 合法值:true, false | 从wal开始消费,还是从tsbs开始消费 |
+| msg.with.table.name | 合法值:true, false | 从消息中能否解析表名 |
+
+```sql
+/* 根据需要,设置消费组(group.id)、自动提交(enable.auto.commit)、自动提交时间间隔(auto.commit.interval.ms)、用户名(td.connect.user)、密码(td.connect.pass)等参数 */
+ tmq_conf_t* conf = tmq_conf_new();
+ tmq_conf_set(conf, "enable.auto.commit", "true");
+ tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
+ tmq_conf_set(conf, "group.id", "cgrpName");
+ tmq_conf_set(conf, "td.connect.user", "root");
+ tmq_conf_set(conf, "td.connect.pass", "taosdata");
+ tmq_conf_set(conf, "auto.offset.reset", "earliest");
+ tmq_conf_set(conf, "experimental.snapshot.enable", "true");
+ tmq_conf_set(conf, "msg.with.table.name", "true");
+ tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
+
+ tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
+ tmq_conf_destroy(conf);
+ return tmq;
+```
+
+四、创建订阅主题列表
+
+```sql
+ tmq_list_t* topicList = tmq_list_new();
+ tmq_list_append(topicList, "topicName");
+ return topicList;
+```
+
+单个consumer支持同时订阅多个topic。
+
+五、启动订阅并开始消费
+
+```sql
+ /* 启动订阅 */
+ tmq_subscribe(tmq, topicList);
+ tmq_list_destroy(topicList);
+
+ /* 循环poll消息 */
+ int32_t totalRows = 0;
+ int32_t msgCnt = 0;
+ int32_t consumeDelay = 5000;
+ while (running) {
+ TAOS_RES* tmqmsg = tmq_consumer_poll(tmq, consumeDelay);
+ if (tmqmsg) {
+ msgCnt++;
+ totalRows += msg_process(tmqmsg);
+ taos_free_result(tmqmsg);
+ } else {
+ break;
+ }
+ }
+
+ fprintf(stderr, "%d msg consumed, include %d rows\n", msgCnt, totalRows);
+```
+
+这里是一个 **while** 循环,每调用一次tmq_consumer_poll(),获取一个消息,该消息与普通查询返回的结果集完全相同,可以使用相同的解析API完成消息内容的解析:
+
+```sql
+ static int32_t msg_process(TAOS_RES* msg) {
+ char buf[1024];
+ int32_t rows = 0;
+
+ const char* topicName = tmq_get_topic_name(msg);
+ const char* dbName = tmq_get_db_name(msg);
+ int32_t vgroupId = tmq_get_vgroup_id(msg);
+
+ printf("topic: %s\n", topicName);
+ printf("db: %s\n", dbName);
+ printf("vgroup id: %d\n", vgroupId);
+
+ while (1) {
+ TAOS_ROW row = taos_fetch_row(msg);
+ if (row == NULL) break;
+
+ TAOS_FIELD* fields = taos_fetch_fields(msg);
+ int32_t numOfFields = taos_field_count(msg);
+ int32_t* length = taos_fetch_lengths(msg);
+ int32_t precision = taos_result_precision(msg);
+ const char* tbName = tmq_get_table_name(msg);
+ rows++;
+ taos_print_row(buf, row, fields, numOfFields);
+ printf("row content from %s: %s\n", (tbName != NULL ? tbName : "null table"), buf);
+ }
+
+ return rows;
+}
+```
+
+五、结束消费
+
+```sql
+ /* 取消订阅 */
+ tmq_unsubscribe(tmq);
+
+ /* 关闭消费 */
+ tmq_consumer_close(tmq);
+```
+
+六、删除topic
+
+如果不再需要,可以删除创建topic,但注意:只有没有被订阅的topic才能别删除。
+
+```sql
+ /* 删除topic */
+ drop topic topicName;
+```
+
+七、状态查看
+
+1、topics:查询已经创建的topic
+
+```sql
+ show topics;
+```
+
+2、consumers:查询consumer的状态及其订阅的topic
+
+```sql
+ show consumers;
+```
+
+3、subscriptions:查询consumer与vgroup之间的分配关系
+
+```sql
+ show subscriptions;
+```
+
+
diff --git a/docs/zh/07-develop/09-udf.md b/docs/zh/07-develop/09-udf.md
index 09681650db..6071275b55 100644
--- a/docs/zh/07-develop/09-udf.md
+++ b/docs/zh/07-develop/09-udf.md
@@ -16,72 +16,96 @@ description: "支持用户编码的聚合函数和标量函数,在查询中嵌
用户可以按照下列函数模板定义自己的标量计算函数
- `void udfNormalFunc(char* data, short itype, short ibytes, int numOfRows, long long* ts, char* dataOutput, char* interBuf, char* tsOutput, int* numOfOutput, short otype, short obytes, SUdfInit* buf)`
+ `int32_t udf(SUdfDataBlock* inputDataBlock, SUdfColumn *resultColumn)`
- 其中 udfNormalFunc 是函数名的占位符,以上述模板实现的函数对行数据块进行标量计算,其参数项是固定的,用于按照约束完成与引擎之间的数据交换。
+ 其中 udf 是函数名的占位符,以上述模板实现的函数对行数据块进行标量计算。
-- udfNormalFunc 中各参数的具体含义是:
- - data:输入数据。
- - itype:输入数据的类型。这里采用的是短整型表示法,与各种数据类型对应的值可以参见 [column_meta 中的列类型说明](/reference/rest-api/)。例如 4 用于表示 INT 型。
- - iBytes:输入数据中每个值会占用的字节数。
- - numOfRows:输入数据的总行数。
- - ts:主键时间戳在输入中的列数据(只读)。
- - dataOutput:输出数据的缓冲区,缓冲区大小为用户指定的输出类型大小 \* numOfRows。
- - interBuf:中间计算结果的缓冲区,大小为用户在创建 UDF 时指定的 BUFSIZE 大小。通常用于计算中间结果与最终结果不一致时使用,由引擎负责分配与释放。
- - tsOutput:主键时间戳在输出时的列数据,如果非空可用于输出结果对应的时间戳。
- - numOfOutput:输出结果的个数(行数)。
- - oType:输出数据的类型。取值含义与 itype 参数一致。
- - oBytes:输出数据中每个值占用的字节数。
- - buf:用于在 UDF 与引擎间的状态控制信息传递块。
-
- [add_one.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/add_one.c) 是结构最简单的 UDF 实现,也即上面定义的 udfNormalFunc 函数的一个具体实现。其功能为:对传入的一个数据列(可能因 WHERE 子句进行了筛选)中的每一项,都输出 +1 之后的值,并且要求输入的列数据类型为 INT。
+- scalarFunction 中各参数的具体含义是:
+ - inputDataBlock: 输入的数据块
+ - resultColumn: 输出列
### 聚合函数
用户可以按照如下函数模板定义自己的聚合函数。
-`void abs_max_merge(char* data, int32_t numOfRows, char* dataOutput, int32_t* numOfOutput, SUdfInit* buf)`
+`int32_t udf_start(SUdfInterBuf *interBuf)`
-其中 udfMergeFunc 是函数名的占位符,以上述模板实现的函数用于对计算中间结果进行聚合,只有针对超级表的聚合查询才需要调用该函数。其中各参数的具体含义是:
+`int32_t udf(SUdfDataBlock* inputBlock, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf)`
- - data:udfNormalFunc 的输出数据数组,如果使用了 interBuf 那么 data 就是 interBuf 的数组。
- - numOfRows:data 中数据的行数。
- - dataOutput:输出数据的缓冲区,大小等于一条最终结果的大小。如果此时输出还不是最终结果,可以选择输出到 interBuf 中即 data 中。
- - numOfOutput:输出结果的个数(行数)。
- - buf:用于在 UDF 与引擎间的状态控制信息传递块。
+`int32_t udf_finish(SUdfInterBuf* interBuf, SUdfInterBuf *result)`
+其中 udf 是函数名的占位符。其中各参数的具体含义是:
-[abs_max.c](https://github.com/taosdata/TDengine/blob/develop/tests/script/sh/abs_max.c) 实现的是一个聚合函数,功能是对一组数据按绝对值取最大值。
+ - interBuf:中间结果 buffer。
+ - inputBlock:输入的数据块。
+ - newInterBuf:新的中间结果buffer。
+ - result:最终结果。
-其计算过程为:与所在查询语句相关的数据会被分为多个行数据块,对每个行数据块调用 udfNormalFunc(在本例的实现代码中,实际函数名是 `abs_max`)来生成每个子表的中间结果,再将子表的中间结果调用 udfMergeFunc(本例中,其实际的函数名是 `abs_max_merge`)进行聚合,生成超级表的最终聚合结果或中间结果。聚合查询最后还会通过 udfFinalizeFunc(本例中,其实际的函数名是 `abs_max_finalize`)再把超级表的中间结果处理为最终结果,最终结果只能含 0 或 1 条结果数据。
-其他典型场景,如协方差的计算,也可通过定义聚合 UDF 的方式实现。
+其计算过程为:首先调用udf_start生成结果buffer,然后相关的数据会被分为多个行数据块,对每个行数据块调用 udf 用数据块更新中间结果,最后再调用 udf_finish 从中间结果产生最终结果,最终结果只能含 0 或 1 条结果数据。
-### 最终计算
+### UDF 初始化和销毁
+`int32_t udf_init()`
-用户可以按下面的函数模板实现自己的函数对计算结果进行最终计算,通常用于有 interBuf 使用的场景。
+`int32_t udf_destroy()`
-`void abs_max_finalize(char* dataOutput, char* interBuf, int* numOfOutput, SUdfInit* buf)`
-
-其中 udfFinalizeFunc 是函数名的占位符 ,其中各参数的具体含义是:
- - dataOutput:输出数据的缓冲区。
- - interBuf:中间结算结果缓冲区,可作为输入。
- - numOfOutput:输出数据的个数,对聚合函数来说只能是 0 或者 1。
- - buf:用于在 UDF 与引擎间的状态控制信息传递块。
-
-## UDF 实现方式的规则总结
-
-三类 UDF 函数: udfNormalFunc、udfMergeFunc、udfFinalizeFunc ,其函数名约定使用相同的前缀,此前缀即 udfNormalFunc 的实际函数名,也即 udfNormalFunc 函数不需要在实际函数名后添加后缀;而udfMergeFunc 的函数名要加上后缀 `_merge`、udfFinalizeFunc 的函数名要加上后缀 `_finalize`,这是 UDF 实现规则的一部分,系统会按照这些函数名后缀来调用相应功能。
-
-根据 UDF 函数类型的不同,用户所要实现的功能函数也不同:
-
-- 标量函数:UDF 中需实现 udfNormalFunc。
-- 聚合函数:UDF 中需实现 udfNormalFunc、udfMergeFunc(对超级表查询)、udfFinalizeFunc。
+其中 udf 是函数名的占位符。udf_init 完成初始化工作。 udf_destroy 完成清理工作。
:::note
如果对应的函数不需要具体的功能,也需要实现一个空函数。
:::
+### UDF 数据结构
+```c
+typedef struct SUdfColumnMeta {
+ int16_t type;
+ int32_t bytes;
+ uint8_t precision;
+ uint8_t scale;
+} SUdfColumnMeta;
+
+typedef struct SUdfColumnData {
+ int32_t numOfRows;
+ int32_t rowsAlloc;
+ union {
+ struct {
+ int32_t nullBitmapLen;
+ char *nullBitmap;
+ int32_t dataLen;
+ char *data;
+ } fixLenCol;
+
+ struct {
+ int32_t varOffsetsLen;
+ int32_t *varOffsets;
+ int32_t payloadLen;
+ char *payload;
+ int32_t payloadAllocLen;
+ } varLenCol;
+ };
+} SUdfColumnData;
+
+typedef struct SUdfColumn {
+ SUdfColumnMeta colMeta;
+ bool hasNull;
+ SUdfColumnData colData;
+} SUdfColumn;
+
+typedef struct SUdfDataBlock {
+ int32_t numOfRows;
+ int32_t numOfCols;
+ SUdfColumn **udfCols;
+} SUdfDataBlock;
+
+typedef struct SUdfInterBuf {
+ int32_t bufLen;
+ char* buf;
+ int8_t numOfResult; //zero or one
+} SUdfInterBuf;
+```
+
+为了更好的操作以上数据结构,提供了一些便利函数,定义在 taosudf.h。
+
## 编译 UDF
用户定义函数的 C 语言源代码无法直接被 TDengine 系统使用,而是需要先编译为 动态链接库,之后才能载入 TDengine 系统。
diff --git a/docs/zh/12-taos-sql/22-meta.md b/docs/zh/12-taos-sql/22-meta.md
index e5bc800de7..1e17870685 100644
--- a/docs/zh/12-taos-sql/22-meta.md
+++ b/docs/zh/12-taos-sql/22-meta.md
@@ -15,21 +15,21 @@ Note: 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们
本章将详细介绍 `INFORMATION_SCHEMA` 这个内置元数据库中的表和表结构。
-## DNODES
+## INS_DNODES
提供 dnode 的相关信息。也可以使用 SHOW DNODES 来查询这些信息。
-| # | **列名** | **数据类型** | **说明** |
-| --- | :------------: | ------------ | --------------------- |
-| 1 | vnodes | SMALLINT | dnode 中的 vnode 个数 |
-| 2 | support_vnodes | SMALLINT | 支持的 vnode 个数 |
-| 3 | status | BINARY(10) | 当前状态 |
-| 4 | note | BINARY(256) | 离线原因等信息 |
-| 5 | id | SMALLINT | dnode id |
-| 6 | endpoint | BINARY(134) | dnode 的地址 |
-| 7 | create | TIMESTAMP | 创建时间 |
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------------: | ------------ | ------------------------- |
+| 1 | vnodes | SMALLINT | dnode 中的实际 vnode 个数 |
+| 2 | support_vnodes | SMALLINT | 最多支持的 vnode 个数 |
+| 3 | status | BINARY(10) | 当前状态 |
+| 4 | note | BINARY(256) | 离线原因等信息 |
+| 5 | id | SMALLINT | dnode id |
+| 6 | endpoint | BINARY(134) | dnode 的地址 |
+| 7 | create | TIMESTAMP | 创建时间 |
-## MNODES
+## INS_MNODES
提供 mnode 的相关信息。也可以使用 SHOW MNODES 来查询这些信息。
@@ -41,7 +41,7 @@ Note: 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们
| 4 | role_time | TIMESTAMP | 成为当前角色的时间 |
| 5 | create_time | TIMESTAMP | 创建时间 |
-## MODULES
+## INS_MODULES
提供组件的相关信息。也可以使用 SHOW MODULES 来查询这些信息
@@ -51,46 +51,74 @@ Note: 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们
| 2 | endpoint | BINARY(134) | 组件的地址 |
| 3 | module | BINARY(10) | 组件状态 |
-## QNODES
+## INS_QNODES
当前系统中 QNODE 的信息。也可以使用 SHOW QNODES 来查询这些信息。
| # | **列名** | **数据类型** | **说明** |
| --- | :---------: | ------------ | ------------ |
-| 1 | id | SMALLINT | module id |
+| 1 | id | SMALLINT | qnode id |
| 2 | endpoint | BINARY(134) | qnode 的地址 |
| 3 | create_time | TIMESTAMP | 创建时间 |
-## USER_DATABASES
+## INS_CLUSTER
+
+存储集群相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | ---------- |
+| 1 | id | BIGINT | cluster id |
+| 2 | name | BINARY(134) | 集群名称 |
+| 3 | create_time | TIMESTAMP | 创建时间 |
+
+## INS_DATABASES
提供用户创建的数据库对象的相关信息。也可以使用 SHOW DATABASES 来查询这些信息。
-TODO
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------------------: | ---------------- | ------------------------------------------------ |
+| 1 | name | BINARY(32) | 数据库名 |
+| 2 | create_time | TIMESTAMP | 创建时间 |
+| 3 | ntables | INT | 数据库中表的数量,包含子表和普通表但不包含超级表 |
+| 4 | vgroups | INT | 数据库中有多少个 vgroup |
+| 6 | replica | INT | 副本数 |
+| 7 | quorum | BINARY(3) | 强一致性 |
+| 8 | duration | INT | 单文件存储数据的时间跨度 |
+| 9 | keep | INT | 数据保留时长 |
+| 10 | buffer | INT | 每个 vnode 写缓存的内存块大小,单位 MB |
+| 11 | pagesize | INT | 每个 VNODE 中元数据存储引擎的页大小,单位为 KB |
+| 12 | pages | INT | 每个 vnode 元数据存储引擎的缓存页个数 |
+| 13 | minrows | INT | 文件块中记录的最大条数 |
+| 14 | maxrows | INT | 文件块中记录的最小条数 |
+| 15 | comp | INT | 数据压缩方式 |
+| 16 | precision | BINARY(2) | 时间分辨率 |
+| 17 | status | BINARY(10) | 数据库状态 |
+| 18 | retention | BINARY (60) | 数据的聚合周期和保存时长 |
+| 19 | single_stable | BOOL | 表示此数据库中是否只可以创建一个超级表 |
+| 20 | cachemodel | BINARY(60) | 表示是否在内存中缓存子表的最近数据 |
+| 21 | cachesize | INT | 表示每个 vnode 中用于缓存子表最近数据的内存大小 |
+| 22 | wal_level | INT | WAL 级别 |
+| 23 | wal_fsync_period | INT | 数据落盘周期 |
+| 24 | wal_retention_period | INT | WAL 的保存时长 |
+| 25 | wal_retention_size | INT | WAL 的保存上限 |
+| 26 | wal_roll_period | INT | wal 文件切换时长 |
+| 27 | wal_segment_size | wal 单个文件大小 |
-| # | **列名** | **数据类型** | **说明** |
-| --- | :---------: | ------------ | ------------------------------------------------ |
-| 1 | name | BINARY(32) | 数据库名 |
-| 2 | create_time | TIMESTAMP | 创建时间 |
-| 3 | ntables | INT | 数据库中表的数量,包含子表和普通表但不包含超级表 |
-| 4 | vgroups | INT | 数据库中有多少个 vgroup |
-| 5 | replica | INT | 副本数 |
-| 6 | quorum | INT | 写成功的确认数 |
-| 7 | days | INT | 单文件存储数据的时间跨度 |
-| 8 | keep | INT | 数据保留时长 |
-| 9 | buffer | INT | 每个 vnode 写缓存的内存块大小,单位 MB |
-| 10 | minrows | INT | 文件块中记录的最大条数 |
-| 11 | maxrows | INT | 文件块中记录的最小条数 |
-| 12 | wal_level | INT | WAL 级别 |
-| 13 | walfsync_period | INT | 数据落盘周期 |
-| 14 | comp | INT | 数据压缩方式 |
-| 15 | precision | BINARY(2) | 时间分辨率 |
-| 16 | status | BINARY(10) | 数据库状态 |
+## INS_FUNCTIONS
-## USER_FUNCTIONS
+用户创建的自定义函数的信息。
-TODO
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | -------------- |
+| 1 | name | BINARY(64) | 函数名 |
+| 2 | comment | BINARY(255) | 补充说明 |
+| 3 | aggregate | INT | 是否为聚合函数 |
+| 4 | output_type | BINARY(31) | 输出类型 |
+| 5 | create_time | TIMESTAMP | 创建时间 |
+| 6 | code_len | INT | 代码长度 |
+| 7 | bufsize | INT | buffer 大小 |
-## USER_INDEXES
+## INS_INDEXES
提供用户创建的索引的相关信息。也可以使用 SHOW INDEX 来查询这些信息。
@@ -103,7 +131,7 @@ TODO
| 5 | index_type | BINARY(10) | 目前有 SMA 和 FULLTEXT |
| 6 | index_extensions | BINARY(256) | 索引的额外信息。对 SMA 类型的索引,是函数名的列表。对 FULLTEXT 类型的索引为 NULL。 |
-## USER_STABLES
+## INS_STABLES
提供用户创建的超级表的相关信息。
@@ -120,19 +148,7 @@ TODO
| 9 | max_delay | BINARY(64) | 推送计算结果的最大延迟 |
| 10 | rollup | BINARY(128) | rollup 聚合函数 |
-## USER_STREAMS
-
-提供用户创建的流计算的相关信息。
-
-| # | **列名** | **数据类型** | **说明** |
-| --- | :---------: | ------------ | --------------------------- |
-| 1 | stream_name | BINARY(192) | 流计算名称 |
-| 2 | user_name | BINARY(23) | 创建流计算的用户 |
-| 3 | dest_table | BINARY(192) | 流计算写入的目标表 |
-| 4 | create_time | TIMESTAMP | 创建时间 |
-| 5 | sql | BLOB | 创建流计算时提供的 SQL 语句 |
-
-## USER_TABLES
+## INS_TABLES
提供用户创建的普通表和子表的相关信息
@@ -149,7 +165,18 @@ TODO
| 9 | table_comment | BINARY(1024) | 表注释 |
| 10 | type | BINARY(20) | 表类型 |
-## USER_USERS
+## INS_TAGS
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------- | ---------------------- |
+| 1 | table_name | BINARY(192) | 表名 |
+| 2 | db_name | BINARY(64) | 该表所在的数据库的名称 |
+| 3 | stable_name | BINARY(192) | 所属的超级表表名 |
+| 4 | tag_name | BINARY(64) | tag 的名称 |
+| 5 | tag_type | BINARY(64) | tag 的类型 |
+| 6 | tag_value | BINARY(16384) | tag 的值 |
+
+## INS_USERS
提供系统中创建的用户的相关信息。
@@ -159,21 +186,62 @@ TODO
| 2 | privilege | BINARY(256) | 权限 |
| 3 | create_time | TIMESTAMP | 创建时间 |
-## VGROUPS
+## INS_GRANTS
+
+提供企业版授权的相关信息。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :---------: | ------------ | -------------------------------------------------- |
+| 1 | version | BINARY(9) | 企业版授权说明:official(官方授权的)/trial(试用的) |
+| 2 | cpu_cores | BINARY(9) | 授权使用的 CPU 核心数量 |
+| 3 | dnodes | BINARY(10) | 授权使用的 dnode 节点数量 |
+| 4 | streams | BINARY(10) | 授权创建的流数量 |
+| 5 | users | BINARY(10) | 授权创建的用户数量 |
+| 6 | accounts | BINARY(10) | 授权创建的帐户数量 |
+| 7 | storage | BINARY(21) | 授权使用的存储空间大小 |
+| 8 | connections | BINARY(21) | 授权使用的客户端连接数量 |
+| 9 | databases | BINARY(11) | 授权使用的数据库数量 |
+| 10 | speed | BINARY(9) | 授权使用的数据点每秒写入数量 |
+| 11 | querytime | BINARY(9) | 授权使用的查询总时长 |
+| 12 | timeseries | BINARY(21) | 授权使用的测点数量 |
+| 13 | expired | BINARY(5) | 是否到期,true:到期,false:未到期 |
+| 14 | expire_time | BINARY(19) | 试用期到期时间 |
+
+## INS_VGROUPS
系统中所有 vgroups 的信息。
-| # | **列名** | **数据类型** | **说明** |
-| --- | :--------: | ------------ | ---------------------------- |
-| 1 | vg_id | INT | vgroup id |
-| 2 | db_name | BINARY(32) | 数据库名 |
-| 3 | tables | INT | 此 vgroup 内有多少表 |
-| 4 | status | BINARY(10) | 此 vgroup 的状态 |
-| 5 | onlines | INT | 在线的成员数目 |
-| 6 | v1_dnode | INT | 第一个成员所在的 dnode 的 id |
-| 7 | v1_status | BINARY(10) | 第一个成员的状态 |
-| 8 | v2_dnode | INT | 第二个成员所在的 dnode 的 id |
-| 9 | v2_status | BINARY(10) | 第二个成员的状态 |
-| 10 | v3_dnode | INT | 第三个成员所在的 dnode 的 id |
-| 11 | v3_status | BINARY(10) | 第三个成员的状态 |
-| 12 | compacting | INT | compact 状态 |
+| # | **列名** | **数据类型** | **说明** |
+| --- | :-------: | ------------ | ------------------------------------------------------ |
+| 1 | vgroup_id | INT | vgroup id |
+| 2 | db_name | BINARY(32) | 数据库名 |
+| 3 | tables | INT | 此 vgroup 内有多少表 |
+| 4 | status | BINARY(10) | 此 vgroup 的状态 |
+| 5 | v1_dnode | INT | 第一个成员所在的 dnode 的 id |
+| 6 | v1_status | BINARY(10) | 第一个成员的状态 |
+| 7 | v2_dnode | INT | 第二个成员所在的 dnode 的 id |
+| 8 | v2_status | BINARY(10) | 第二个成员的状态 |
+| 9 | v3_dnode | INT | 第三个成员所在的 dnode 的 id |
+| 10 | v3_status | BINARY(10) | 第三个成员的状态 |
+| 11 | nfiles | INT | 此 vgroup 中数据/元数据文件的数量 |
+| 12 | file_size | INT | 此 vgroup 中数据/元数据文件的大小 |
+| 13 | tsma | TINYINT | 此 vgroup 是否专用于 Time-range-wise SMA,1: 是, 0: 否 |
+
+## INS_CONFIGS
+
+系统配置参数。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------: | ------------ | ------------ |
+| 1 | name | BINARY(32) | 配置项名称 |
+| 2 | value | BINARY(64) | 该配置项的值 |
+
+## INS_DNODE_VARIABLES
+
+系统中每个 dnode 的配置参数。
+
+| # | **列名** | **数据类型** | **说明** |
+| --- | :------: | ------------ | ------------ |
+| 1 | dnode_id | INT | dnode 的 ID |
+| 2 | name | BINARY(32) | 配置项名称 |
+| 3 | value | BINARY(64) | 该配置项的值 |
diff --git a/docs/zh/12-taos-sql/24-show.md b/docs/zh/12-taos-sql/24-show.md
new file mode 100644
index 0000000000..781f94324c
--- /dev/null
+++ b/docs/zh/12-taos-sql/24-show.md
@@ -0,0 +1,270 @@
+---
+sidebar_label: SHOW 命令
+title: 使用 SHOW 命令查看系统元数据
+---
+
+除了使用 `select` 语句查询 `INFORMATION_SCHEMA` 数据库中的表获得系统中的各种元数据、系统信息和状态之外,也可以用 `SHOW` 命令来实现同样的目的。
+
+## SHOW ACCOUNTS
+
+```sql
+SHOW ACCOUNTS;
+```
+
+显示当前系统中所有租户的信息。
+
+注:企业版独有
+
+## SHOW APPS
+
+```sql
+SHOW APPS;
+```
+
+显示接入集群的应用(客户端)信息。
+
+## SHOW BNODES
+
+```sql
+SHOW BNODES;
+```
+
+显示当前系统中存在的 BNODE (backup node, 即备份节点)的信息。
+
+## SHOW CLUSTER
+
+```sql
+SHOW CLUSTER;
+```
+
+显示当前集群的信息
+
+## SHOW CONNECTIONS
+
+```sql
+SHOW CONNECTIONS;
+```
+
+显示当前系统中存在的连接的信息。
+
+## SHOW CONSUMERS
+
+```sql
+SHOW CONSUMERS;
+```
+
+显示当前数据库下所有活跃的消费者的信息。
+
+## SHOW CREATE DATABASE
+
+```sql
+SHOW CREATE DATABASE db_name;
+```
+
+显示 db_name 指定的数据库的创建语句。
+
+## SHOW CREATE STABLE
+
+```sql
+SHOW CREATE STABLE [db_name.]stb_name;
+```
+
+显示 tb_name 指定的超级表的创建语句
+
+## SHOW CREATE TABLE
+
+```sql
+SHOW CREATE TABLE [db_name.]tb_name
+```
+
+显示 tb_name 指定的表的创建语句。支持普通表、超级表和子表。
+
+## SHOW DATABASES
+
+```sql
+SHOW DATABASES;
+```
+
+显示用户定义的所有数据库。
+
+## SHOW DNODES
+
+```sql
+SHOW DNODES;
+```
+
+显示当前系统中 DNODE 的信息。
+
+## SHOW FUNCTIONS
+
+```sql
+SHOW FUNCTIONS;
+```
+
+显示用户定义的自定义函数。
+
+## SHOW LICENSE
+
+```sql
+SHOW LICENSE;
+SHOW GRANTS;
+```
+
+显示企业版许可授权的信息。
+
+注:企业版独有
+
+## SHOW INDEXES
+
+```sql
+SHOW INDEXES FROM tbl_name [FROM db_name];
+```
+
+显示已创建的索引。
+
+## SHOW LOCAL VARIABLES
+
+```sql
+SHOW LOCAL VARIABLES;
+```
+
+显示当前客户端配置参数的运行值。
+
+## SHOW MNODES
+
+```sql
+SHOW MNODES;
+```
+
+显示当前系统中 MNODE 的信息。
+
+## SHOW MODULES
+
+```sql
+SHOW MODULES;
+```
+
+显示当前系统中所安装的组件的信息。
+
+## SHOW QNODES
+
+```sql
+SHOW QNODES;
+```
+
+显示当前系统中 QNODE (查询节点)的信息。
+
+## SHOW SCORES
+
+```sql
+SHOW SCORES;
+```
+
+显示系统被许可授权的容量的信息。
+
+注:企业版独有
+
+## SHOW SNODES
+
+```sql
+SHOW SNODES;
+```
+
+显示当前系统中 SNODE (流计算节点)的信息。
+
+## SHOW STABLES
+
+```sql
+SHOW [db_name.]STABLES [LIKE 'pattern'];
+```
+
+显示当前数据库下的所有超级表的信息。可以使用 LIKE 对表名进行模糊匹配。
+
+## SHOW STREAMS
+
+```sql
+SHOW STREAMS;
+```
+
+显示当前系统内所有流计算的信息。
+
+## SHOW SUBSCRIPTIONS
+
+```sql
+SHOW SUBSCRIPTIONS;
+```
+
+显示当前数据库下的所有的订阅关系
+
+## SHOW TABLES
+
+```sql
+SHOW [db_name.]TABLES [LIKE 'pattern'];
+```
+
+显示当前数据库下的所有普通表和子表的信息。可以使用 LIKE 对表名进行模糊匹配。
+
+## SHOW TABLE DISTRIBUTED
+
+```sql
+SHOW TABLE DISTRIBUTED table_name;
+```
+
+显示表的数据分布信息。
+
+## SHOW TAGS
+
+```sql
+SHOW TAGS FROM child_table_name [FROM db_name];
+```
+
+显示子表的标签信息。
+
+## SHOW TOPICS
+
+```sql
+SHOW TOPICS;
+```
+
+显示当前数据库下的所有主题的信息。
+
+## SHOW TRANSACTIONS
+
+```sql
+SHOW TRANSACTIONS;
+```
+
+显示当前系统中正在执行的事务的信息
+
+## SHOW USERS
+
+```sql
+SHOW USERS;
+```
+
+显示当前系统中所有用户的信息。包括用户自定义的用户和系统默认用户。
+
+## SHOW VARIABLES
+
+```sql
+SHOW VARIABLES;
+SHOW DNODE dnode_id VARIABLES;
+```
+
+显示当前系统中各节点需要相同的配置参数的运行值,也可以指定 DNODE 来查看其的配置参数。
+
+## SHOW VGROUPS
+
+```sql
+SHOW [db_name.]VGROUPS;
+```
+
+显示当前系统中所有 VGROUP 或某个 db 的 VGROUPS 的信息。
+
+## SHOW VNODES
+
+```sql
+SHOW VNODES [dnode_name];
+```
+
+显示当前系统中所有 VNODE 或某个 DNODE 的 VNODE 的信息。
diff --git a/docs/zh/14-reference/03-connector/01-error-code.md b/docs/zh/14-reference/03-connector/01-error-code.md
new file mode 100644
index 0000000000..53e006e108
--- /dev/null
+++ b/docs/zh/14-reference/03-connector/01-error-code.md
@@ -0,0 +1,481 @@
+---
+sidebar_label: 错误码
+title: TDengine C/C++ 连接器错误码
+---
+
+本文中详细列举了在使用 TDengine C/C++ 连接器时客户端可能得到的错误码以及所要采取的相应动作。其它语言的连接器在使用原生连接方式时也会所得到的返回码返回给连接器的调用者。
+
+ | **Error Code** | **说明** | 如何处理错误 |
+ | -------------- | ------------------ | ------------ |
+ | 0 | 请求处理成功 | None |
+ | -1 | 请求失败,未知原因 | TODO |
+ | 0x0003 | RPC 认证失败 | TODO |
+ | 0x0004 | RPC 重定向 |TODO|
+ | 0x000B | 无法建立连接 |TODO|
+ | 0x0015 | FQDN 解析失败 |检查各个dnode配置的FQDN是否正确,并且能够从其它节点 ping 到 |
+ | 0x0017 | 端口已经被占用 | 检查所配置的端口被哪个进程占用,关闭该进程以释放端口;或者更改配置使用另一端口号 |
+ | 0x0018 | 连接被断开 | 检查 dnode 进程是否还在,如果无异常检查网络情况 |
+ | 0x0013 | 客户端和服务端的时间未同步 | 检查客户端和服务端的时间设置是否同步|
+ | 0x0014 | 数据库不可用 |检查数据库是否存在,检查数据库的vgroups的状态 |
+ | 0x0100 | 该操作不支持 | 参考SQL手册,使用正确的操作 |
+ | 0x0102 | 无法分配内存,系统内存耗尽 | 检查系统中内存被耗尽的原因,采取措施释放内存。如果内存是被 dnode 耗尽的话重启该进程 |
+ | 0x0104 | 文件被破坏 | TODO |
+ | 0x0111 | 操作在进行中 | 等待该操作完成 |
+ | 0x0115 | 无效的消息 | TODO |
+ | 0x0116 | 无效的消息长度 | TODO |
+ | 0x0117 | 无效指针 | TODO |
+ | 0x0118 | 无效参数 | |
+ | 0x0119 | 无效配置 | 检查配置参数的值是否在合法值域范围内 |
+ | 0x011A | 无效选项 | 检查配置中是否有不支持的无效配置项 |
+ | 0x011B | 无效的JSON 格式 | 修正插入数据中的JSON值|
+ | 0x011C | 无效版本号 | 检查客户端版本是否匹配,更换正确的客户端 |
+ | 0x011D | 无效版本信息 | 检查客户端版本是否匹配,更换正确的客户端 |
+ | 0x011E | 版本不匹配 | TODO |
+ | 0x011F | 校验和错误 | TODO |
+ | 0x0120 | 数据压缩失败 | TODO |
+ | 0x0121 | 消息未处理 | TODO |
+ | 0x0122 | 配置未找到 | TODO|
+ | 0x0123 | 重复初始化 | TODO |
+ | 0x0124 | 无法将重复的key加入hash| TODO |
+ | 0x0125 | 需要重试 | 重试 |
+ | 0x0126 | RPC 队列内存耗尽 | TODO |
+ | 0x0127 | 无效的时间戳 | 修正插入数据 |
+ | 0x0128 | 消息解码失败 | 检查客户端版本是否匹配和兼容 |
+ | 0x0129 | 磁盘耗尽 | TODO |
+ | 0x012A | TODO | TODO |
+ | 0x0200 | 无效操作 | 检查SQL命令,根据SQL手册使用正确的操作|
+ | 0x0201 | 无效的查询句柄 | TODO |
+ | 0x0202 | 无效的客户端/服务端时间组合 | TODO |
+ | 0x0203 | 无效值 | TODO |
+ | 0x0204 | 无效的客户端版本 | 检查客户端版本是否匹配,更换为正确的客户端版本 |
+ | 0x0205 | TODO | TODO |
+ | 0x0206 | 无效的 FQDN | 检查服务器 fqdn 配置是否正确,是否能够从其它服务器访问到该 fqdn |
+ | 0x0207 | 用户名长度过长 | 检查用户名长度是否过长 |
+ | 0x0208 | 密码长度过长 | 检查密码长度是否过长 |
+ | 0x0209 | 数据库名字长度过长 | 检查数据库名是否过长 |
+ | 0x020A | 表名长度过长 | 检查表名是否过长 |
+ | 0x020B | 无效连接 | 检查该连接是否已经断开 |
+ | 0x020C | 系统内存耗尽 | 检查系统中内存被耗尽的原因,尝试释放出内存 |
+ | 0x020D | 磁盘空间耗尽 | 检查系统中磁盘耗尽的原因,尝试释放或增加磁盘空间 |
+ | 0x020E | 查询缓存被清除 |TODO |
+ | 0x020F | 查询已经被结束 | 尝试优化查询条件再重启查询 |
+ | 0x0210 | 结果集过大无法存储 | 尝试优化查询条件,缩小结果集,再重启查询 |
+ | 0x0211 | 数据库不可用 | 查看数据库是否存在,查看数据库的 vgroups 状态 |
+ | 0x0212 | 操作正在进行中 | 等待操作完成 |
+ | 0x0213 | 连接被服务端断开 | 查看服务端进程是否发生 crash 等异常终止情况 |
+ | 0x0214 | 没有写权限 | 只进行读操作或者尝试获取写权限 |
+ | 0x0215 | 连接被 kill | 重新建立连接 |
+ | 0x0216 | SQL 语法错误 | 参考 SQL手册,纠正语法错误再重试 |
+ | 0x0217 | 未指定数据库或者指定的数据库不可用 | 指定数据库,或者检查指定数据库的状态 |
+ | 0x0218 | 所查询的表不存在 | 确认表名后纠正查询语句 |
+ | 0x0219 | SQL 语句超长 | 根据 maxSQLLength 缩短SQL语句或者加大maxSQLLength (如果还未配置到上限)|
+ | 0x021A | 空文件 | TODO |
+ | 0x021B | Line 协议语法错误 | 纠正插入语句 |
+ | 0x021C | 元数据未被缓存 | TODO |
+ | 0x021D | 重复的列名 | 纠正SQL语句中的相应错误 |
+ | 0x021E | tag 过长 | 纠正过长的 tag |
+ | 0x021F | 列名过长 | 纠正过长的列名 |
+ | 0x0220 | 重复的表名**TODO** | TODO|
+ | 0x0221 | JSON 格式错误 | 纠正错误的 JSON 结构 |
+ | 0x0222 | JSON 中使用了无效的数据类型 | 纠正 JSON 结构中的错误 |
+ | 0x0224 | 超出了所支持的值域 | 纠正到值域范围内 |
+ | 0x0229 | 无效的 tsc 输入 **TODO** | TODO |
+ | 0x022A | stmt API 使用错误 | 根据参考手册正确使用 |
+ | 0x022B | stmt 使用时未指定表名 | 指定表名 |
+ | 0x022C | 不支持 stmt 子名 | 根据参考手册纠正错误用法 |
+ | 0x022D | 查询被 kill | 优化查询语句,尽量减小计算量和结果集,然后重新启动查询 |
+ | 0x022E | 在当前配置的查询策略下没有可用的计算节点 | 创建新的 qnode |
+ | 0x022F | 所指定的表不是超级表 | 确认下该查询场景适用于超级表还是子表/普通表,如果是前者则纠正为超级表名 |
+ | 0x0303 | 没有权限进行所发起的操作 | 申请权限或调整操作 |
+ | 0x0304 | 管理节点内部错误 | TODO |
+ | 0x0305 | 无效连接 | TODO |
+ | 0x030B | 所要展示的操作其数据已经因为超时而被删除 | 更换想要展示操作或者放弃此次操作 |
+ | 0x030C | 无效的查询ID| 确认正确的查询ID再重新发起 |
+ | 0x030D | 无效的流ID| 确认正确的流ID再重新发起|
+ | 0x030E | 无效的连接ID| 确认正确的连接ID再重新发起|
+ | 0x0310 | mnode已经在运行 | 无须采取任何动作 |
+ | 0x0311 | 配置同步失败 | TODO |
+ | 0x0312 | 无法启动同步 | TODO |
+ | 0x0313 | 无法创建 mnode 对应的目录 | 确认磁盘上是否有可用空间以及是否有相应的写权限 |
+ | 0x0314 | 启动组件失败 | TODO |
+ | 0x0315 | 用户帐号被禁用 | 联系管理员激活该帐号 |
+ | 0x0320 | 元数据中已经存在所要创建的对象 | 检查所要创建的对象,比如超级表或表,是否已经存在 |
+ | 0x0321 | 元数据库中非预期的一般性错误 | TODO |
+ | 0x0322 | 无效的表类型 | TODO |
+ | 0x0323 | 所要查找的对象不存在 | TODO |
+ | 0x0325 | 无效的 key 类型 | TODO |
+ | 0x0326 | 无效的动作类型 | TODO |
+ | 0x0327 | 无效的状态类型 | TODO |
+ | 0x0328 | 无效的原始数据版本 | TODO |
+ | 0x0329 | 无效的原始数据长度 | TODO |
+ | 0x032A | 无效的原始数据内容 | TODO |
+ | 0x032B | 无效的 wal 版本 | TODO |
+ | 0x032C | 对象创建中 | TODO |
+ | 0x032D | 对象停止中 | TODO |
+ | 0x0330 | dnode 已经存在 | 无需任何动作,放弃重复创建dnode的操作 |
+ | 0x0331 | dnode 不存在 | 确认所要查询或者操作的dnode ID 或者 end point 是否正确 |
+ | 0x0332 | vgroup 不存在 | 确认所要查询或者操作的vgroup ID 是否正确 |
+ | 0x0333 | 系统拒绝 drop 其角色是 leader 的 mnode | 放弃该操作 |
+ | 0x0334 | 没有足够的 dnode 创建所指定的 vgroups | 增加 dnode 或者修改现有dnode的配置参数 `supportVgroups` |
+ | 0x0335 | 集群中各个dnode的配置不一致 | 检查各个dnode的配置参数确保其一致 |
+ | 0x0338 | 所要查询或操作的vgroup不在所指定的dnode中| 检查vgroup ID 和 dnode ID是否正确 |
+ | 0x0339 | 所要查询或操作的 vgroup 已经在所指定的dnode中 | 检查 vgroup ID 和 dnode ID是否正确 |
+ | 0x033B | 集群 ID 不匹配 | TODO |
+ | 0x0340 | 该帐户已经存在 | 放弃重复创建帐户的操作 |
+ | 0x0342 | 无效的帐户选项 | 检查创建帐户时的参数选项是否正确 |
+ | 0x0343 | 帐户授权已经过期 | 联系管理员重新授权 |
+ | 0x0344 | 无效帐户 | 联系管理员确认帐户 |
+ | 0x0345 | 操作的帐户过多,无法支持 | 减少同时操作的帐户数 |
+ | 0x0350 | 用户已经存在 | 放弃重复创建用户的操作 |
+ | 0x0351 | 无效用户 | 检查并确认正确用户 |
+ | 0x0352 | 无效的用户名格式 | 查看参考手册修改用户名 |
+ | 0x0353 | 无效的密码格式 | 查看参考手册修改密码 |
+ | 0x0354 | 无法从连接中获取用户名 | 检查客户端环境初始化是否使用了正确的用户名 |
+ | 0x0355 | 一次尝试操作的用户过多 | 查看参考手册减少同时操作的用户数 |
+ | 0x0356 | 无效的修改操作 | 查看参考手册使用正确的操作 |
+ | 0x0357 | 认证失败 | 使用正确的用户名和密码 |
+ | 0x0360 | 要创建的超级表已经存在 | 放弃重复创建的操作或者删除该超级表再重新创建 |
+ | 0x0362 | 所使用或查询的超级表不存在 | 确认超级表名是否正确,如果正确则需要先创建超级表 |
+ | 0x0364 | 标签过多 | 查看参考手册减少标签数量 |
+ | 0x0365 | 列过多 | 查看参考手册减少列数量 |
+ | 0x0369 | 要添加的标签已经存在 | 修改标签名 |
+ | 0x036A | 要查询或修改的标签不存在 | 确认标签名是否正确 |
+ | 0x036B | 要添加的列已经存在 | 修改列名或者放弃该操作 |
+ | 0x036C | 要查询或修改的列不存在 | 确认列名是否正确 |
+ | 0x036E | 无效的超级表操作 | 查看参考手册进行正确的操作 |
+ | 0x036F | 错误的行字节数 | TODO |
+ | 0x0370 | 无效的函数名 | 确认函数名是否正确 |
+ | 0x0372 | 无效的函数代码 | 无效的函数编码 |
+ | 0x0373 | 该函数已经存在 | 修改函数名或者放弃该操作|
+ | 0x0374 | 所引用的函数不存在 | 确认函数名是否正确 |
+ | 0x0375 | 无效的 bufSize | 查看参考手册修改 bufSize |
+ | 0x0378 | 无效的函数注释 | 查看参考手册修改函数注释 |
+ | 0x0379 | 无效的函数检索消息 | TODO |
+ | 0x0380 | 未指定数据库或者指定的数据库不可用 | 指定数据库,或者检查所指定的数据库的状态 |
+ | 0x0381 | 数据库已经存在 | 放弃重复创建,或者修改数据库名 |
+ | 0x0382 | 无效的数据库参数 | 查看参考手册使用正确的参数 |
+ | 0x0383 | 无效的数据库名称 | 查看参考手册使用正确的数据库名 |
+ | 0x0385 | 该帐号下的数据库过多 | 删除旧的数据库再尝试创建新数据库 |
+ | 0x0388 | 数据库不存在 | 确认数据库名是否正确 |
+ | 0x0389 | 无效的数据库帐户 | 确认帐户是否正确 |
+ | 0x038A | 数据库参数未修改 | 查看参考手册确认修改的参数和值是否正确 |
+ | 0x038B | 索引不存在 |确认索引名称是否正确 |
+ | 0x039A | 无效的系统表名 | 查看参考手册确认表名是否正确 |
+ | 0x03A0 | mnode 已经存在 | 放弃该操作 |
+ | 0x03A1 | mnode 不存在 | 确认要查看或操作的 mnode ID |
+ | 0x03A2 | qnode 已经存在 | 放弃该操作 |
+ | 0x03A3 | qnode 不存在 | 确认要查看或操作的 qnode ID 是否正确 |
+ | 0x03A8 | mnode 的 replica 不能小于1 | 停止 drop mnode |
+ | 0x03A9 | mnode 的 replica 不能大于3 | 停止 create mnode |
+ | 0x03B0 | dnode 数量过多 | 停止添加新的 dnode |
+ | 0x03B1 | dnode 没有足够的可用内存 | 检查所在系统的内存使用情况 ,尝试释放出内存 |
+ | 0x03B2 | 无效的 dnode 配置 | 查看参考手册纠正配置 |
+ | 0x03B3 | 无效的 dnode 地址 | 确认 dnode 的 FQDN 和 serverPort参数是否正确 |
+ | 0x03B4 | 无效的 dnode ID | 确认正确的 dnode ID |
+ | 0x03B5 | vgroup 的分布未发生变化 | TODO |
+ | 0x03B6 | 存在状态为 offline 的 dnode | drop 这些 dnode 或者启动相应的 dnode 使其状态为 ready |
+ | 0x03B7 | 无效的 vgroup 副本 | TODO |
+ | 0x03C0 | topic 与超级表冲突 | TODO |
+ | 0x03C1 | 订阅了过多的超级表 | 查看参考手册减少超级表数量 |
+ | 0x03C2 | 无效的 超级表修改参数 | 查看参考手册进行纠正 |
+ | 0x03C3 | 超级表参数未被修改 | 查看参考手册确认参数是否正确 |
+ | 0x03C4 | 该字段被某个主题所使用 | TODO |
+ | 0x03C5 | 该数据库是单超级表模式 | 修改数据库为多超级表模式或者放弃创建新的超级表 |
+ | 0x03C6 | 修改超级表使用了无效的 schema 版本 | TODO |
+ | 0x03C7 | 修改超级表使用了无效的超级表 ID | 确认超级表使用是否正确 |
+ | 0x03C8 | 该字段被 tsma 所使用 | TODO |
+ | 0x03D0 | 该事务已经存在 | TODO |
+ | 0x03D1 | 该事务不存在 | TODO |
+ | 0x03D2 | 要 kill 的 stage 不存在 | TODO |
+ | 0x03D3 | 冲突的事务没有完成 | TODO |
+ | 0x03D4 | 未知的事务错误 | TODO |
+ | 0x03D5 | 事务提交日志已满 | TODO |
+ | 0x03DF | 在执行事务时无法建立连接 | 等待事务完成尝试重新建立连接 |
+ | 0x03E0 | Topic 已经存在 | 修改 topic 名字或者放弃创建重复的 topic |
+ | 0x03E1 | Topic 不存在 | 确认 Topic 名字是否正确 |
+ | 0x03E2 | Topic 过多 | 尝试删除不用的 topic 再建立新的,或者放弃此次操作 |
+ | 0x03E3 | 无效的 Topic | 确认 Topic 是否正确 |
+ | 0x03E4 | 建立 Topic 的查询子名无效 | 查看参考手册纠正查询子名 |
+ | 0x03E5 | 建立 Topic 的参数无效 | 查看参考手册使用正确的参数 |
+ | 0x03E6 | 消费者不存在 | 确认正确的消费者 ID |
+ | 0x03E7 | 消费者未修改 | TODO |
+ | 0x03E8 | 订阅不存在 | 确认正确的订阅 ID |
+ | 0x03E9 | 偏移量不存在 | 纠正偏移量 |
+ | 0x03EA | 消费者不可用 | TODO |
+ | 0x03EB | 无法删除已经被订阅的 Topic | 先取消订阅再尝试删除 |
+ | 0x03EC | Consumer group正在被某些消费者使用 | TODO |
+ | 0x03F0 | 流已经存在 | 修改流名称或者放弃创建该流 |
+ | 0x03F1 | 要查询或操作的流不存在 | 确认正确的流 ID |
+ | 0x03F2 | 无效的流参数 | 查看参考手册纠正错误的参数 |
+ | 0x0480 | SMA 已经存在 | 修改 SMA 名称或者放弃创建 |
+ | 0x0481 | SMA 不存在 | 确认正确的 SMA 名称或者 ID |
+ | 0x0482 | SMA 参数错误 | 查看参考手册纠正参数 |
+ | 0x0408 | 节点不在线 | TODO |
+ | 0x0409 | 节点已经部署 | TODO |
+ | 0x040A | 节点未部署 | TODO |
+ | 0x0500 | 该动作作在进行中| TODO |
+ | 0x0501 | 消息未被处理 | TODO |
+ | 0x0502 | 该动作需要被重新处理 | TODO |
+ | 0x0503 | 无效的 vgroup ID | 检查确认正确的 vgroups ID |
+ | 0x0504 | vnode 初始化失败 | TODO |
+ | 0x0505 | 系统磁盘空间耗尽 | 尝试释放或者增加磁盘空间 |
+ | 0x0506 | 对磁盘文件没有写权限 | 检查启动 TDengine 的系统帐号的写权限 |
+ | 0x0507 | 数据文件缺失 | TODO |
+ | 0x0508 | vnode 没有可用内存 | TODO |
+ | 0x0509 | vnode 中未预期的一般性错误 | TODO |
+ | 0x050C | 数据库无空闲内存 | TODO |
+ | 0x050D | 数据库正在删除中 | TODO |
+ | 0x050E | 数据库正在更新中 | TODO |
+ | 0x0510 | 数据库正在关闭中 | TODO |
+ | 0x0511 | 数据库被暂停操作 | TODO |
+ | 0x0512 | 数据库写操作被拒绝 | 检查用户权限,申请写操作授权 |
+ | 0x0513 | 数据库正在同步中 | TODO |
+ | 0x0514 | 无效的 tsdb 状态 | TODO |
+ | 0x0520 | 指定的表不存在 | 检查确认正确的表名 |
+ | 0x0521 | 指定的SMA 不存在 | 检查确认正确的 SMA名称 |
+ | 0x0522 | Hash 值不匹配 | TODO |
+ | 0x0523 | 指定的表不存在 | 检查确认正确的表名 |
+ | 0x0524 | 无效的表动作 | TODO |
+ | 0x0525 | 列名已经存在 | 修改列名或放弃操作 |
+ | 0x0526 | 列名不存在 | 确认正确的列名 |
+ | 0x0527 | 该列已经被订阅 | 先取消订阅再操作或者放弃操作 |
+ | 0x0528 | 无效的配置文件 | 检查配置文件的路径和访问权限 |
+ | 0x0529 | 无效的 term 文件 | TODO |
+ | 0x0600 | 无效的表 ID | 确认表名是否正确 |
+ | 0x0601 | 无效的表 类型 | TODO |
+ | 0x0602 | 无效的 schema 版本 | TODO |
+ | 0x0603 | 表已经存在 | 修改表名或放弃操作 |
+ | 0x0604 | 配置无效 | 查看参考手册纠正配置 |
+ | 0x0605 | TSDB 初始化失败 | TODO |
+ | 0x0606 | 磁盘空间耗尽 | 查看磁盘空间耗尽的原因,尝试释放或增加磁盘空间 |
+ | 0x0607 | 磁盘文件没有访问权限 | 确认启动集群的系统帐户是否有相应的写权限 |
+ | 0x0608 | 数据文件被破坏 | TODO |
+ | 0x0609 | 内存耗尽 | 检查内存被耗尽的原因,尝试释放内存 |
+ | 0x060A | 标签版本过老 | TODO |
+ | 0x060B | 时间戳不在允许范围内 | 查看参考手册了解允许写入的时间戳规则 |
+ | 0x060C | 提交消息被破坏 | TODO |
+ | 0x060D | 无效操作 | TODO |
+ | 0x060E | 建表消息无效 | TODO |
+ | 0x060F | 内存跳表中没有表的数据 | TODO |
+ | 0x0610 | 文件已经存在 | TODO |
+ | 0x0611 | 需要重新配置该表 | TODO |
+ | 0x0612 | 建表的信息无效 | TODO |
+ | 0x0613 | 磁盘空间耗尽 | 尝试释放或增加磁盘空间 |
+ | 0x0614 | 消息被破坏 |TODO |
+ | 0x0615 | 无效的标签值 | 修正标签值 |
+ | 0x0616 | 未缓存最后一行的原始数据 | 修改数据库的 cacheModel 参数 |
+ | 0x0618 | 该表不存在 | 检查表名是否正确 |
+ | 0x0619 | 超级表已经存在 | 修改超级表名再次尝试 |
+ | 0x061A | 超级表不存在 | 检查超级表名是否正确 |
+ | 0x061B | 表被重新创建 | TODO |
+ | 0x061C | TDB 环境打开错误 | N/A |
+ | 0x0700 | 无效的查询句柄 | N/A |
+ | 0x0701 | 无效的消息 | TODO |
+ | 0x0702 | 磁盘空间耗尽 | 尝试释放或增加磁盘空间 |
+ | 0x0703 | 系统内存耗尽 | 尝试释放内存 |
+ | 0x0704 | 未知错误 | TODO |
+ | 0x0705 | 重复的 Join Key | 修正查询语句中的 Join Key |
+ | 0x0706 | 标签过滤条件过多 | 减小查询语句中的标签过滤条件 |
+ | 0x0707 | 查询不可用 | TODO |
+ | 0x0708 | TODO | TODO |
+ | 0x0709 | TODO | TODO |
+ | 0x070A | 查询中的时间窗口过多 | 修改查询语句以减小时间窗口的数量 |
+ | 0x070B | 查询缓冲区达到上限 | TODO |
+ | 0x070C | 多副本数据不一致 | TODO |
+ | 0x070D | 系统错误 | TODO |
+ | 0x070E | 无效的时间范围 | 修正查询语句中的时间范围 |
+ | 0x070F | 无效输入 | 修正查询语句 |
+ | 0x0720 | 调度器不存在 | TODO |
+ | 0x0721 | 任务不存在 | TODO |
+ | 0x0722 | 任务已经存在 | TODO |
+ | 0x0723 | 任务上下文不存在 | TODO |
+ | 0x0724 | 任务被取消 | TODO |
+ | 0x0725 | 任务被停止 | TODO |
+ | 0x0726 | 任务正在取消中 | TODO |
+ | 0x0727 | 任务正在停止中 | TODO |
+ | 0x0728 | 重复操作 | TODO |
+ | 0x0729 | 任务消息错误 | TODO |
+ | 0x072A | 作业已经被释放 | TODO |
+ | 0x072B | 任务状态错误 | TODO |
+ | 0x072C | in 和 not in 操作符不支持 JSON 类型 | 修正查询语句 |
+ | 0x072D | 此处不支持 JSON |修正查询语句 |
+ | 0x072E | group 和 partition by 不支持 JSON 类型 |
+ | 0x072F | 查询作业不存在 | TODO |
+ | 0x0800 | License 已经过期 | 重新激活或获取 License |
+ | 0x0801 | 受限于 License 无法创建 dnode | 获取新的License |
+ | 0x0802 | 受限于 License 无法创建帐户 | 获取新的 License |
+ | 0x0803 | 受限于 License 无法创建表 | 获取新的 License |
+ | 0x0804 | 受限于 License 无法创建数据库 | 获取新的 License |
+ | 0x0805 | 受限于 License 无法创建用户 | 获取新的 License |
+ | 0x0806 | 受限于 License 无法创建连接 | 获取新的 License |
+ | 0x0807 | 受限于 License 无法创建流 | 获取新的 License |
+ | 0x0808 | 写入速度受限于 License | 获取新的 License |
+ | 0x0809 | 存储容量受限于 License | 获取新的 License |
+ | 0x080A | 查询时间受限于 License | 获取新的 License |
+ | 0x080B | CPU 核数受限于 License | 获取新的 License |
+ | 0x080C | 受限于 License 无法创建超级表 | 获取新的 License |
+ | 0x080D | 受限于 License 无法创建表 | 获取新的 License |
+ | 0x0A00 | TQ 无效配置 | TODO |
+ | 0x0A01 | TQ 初始化失败 | TODO |
+ | 0x0A02 | TQ 磁盘空间耗尽 | 尝试释放或增加磁盘空间 |
+ | 0x0A03 | TQ 没有写磁盘权限 | 确认启动集群的系统帐号是否具有写磁盘权限 |
+ | 0x0A04 | TQ 文件被破坏 | TODO |
+ | 0x0A05 | TQ 内存耗尽 | 尝试释放内存 |
+ | 0x0A06 | TQ 文件已经存在 | TODO |
+ | 0x0A07 | TQ 创建目录失败 | TODO |
+ | 0x0A08 | TQ meta 中不存在该 key | TODO |
+ | 0x0A09 | meta key在事务中不存在 | TODO |
+ | 0x0A0A | meta key在事务中重复 | TODO |
+ | 0x0A0B | 消费组不存在 | 指定正确的消费组 |
+ | 0x0A0C | 该表的 schema 不存在 | 确认表名是否正确 |
+ | 0x0A0D | 没有已经提交的 offset | TODO |
+ | 0x1000 | WAL 未知错误 | TODO |
+ | 0x1001 | WAL 文件被破坏 | TODO |
+ | 0x1002 | WAL 大小超出上限 | TODO |
+ | 0x1003 | WAL 使用了错误的版本号 | TODO |
+ | 0x1004 | 系统内存耗尽 | 尝试释放内存 |
+ | 0x1005 | WAL 日志不存在 | TODO |
+ | 0x2201 | 无效的 mount 配置 | 修正 mount 配置参数 |
+ | 0x2202 | mount 点过多 | TODO |
+ | 0x2203 | 重复的 primary mount | TODO |
+ | 0x2204 | primary mount 缺失 | TODO |
+ | 0x2205 | no mount at tier: TODO | TODO |
+ | 0x2206 | 文件已经存在 | 更改文件名或者删除该文件 |
+ | 0x2207 | 无效的级别 | TODO |
+ | 0x2208 | 没有可用磁盘 | TODO |
+ | 0x220F | 系统内存耗尽 | TODO |
+ | 0x2400 | catalog 内部错误 | TODO |
+ | 0x2401 | 无效的 catalog 输入参数 | TODO |
+ | 0x2402 | catalog 不可用 | TODO |
+ | 0x2403 | catalog 系统错误 | TODO |
+ | 0x2404 | 数据库被删除 | TODO |
+ | 0x2405 | catalog 不可用 | TODO |
+ | 0x2406 | 表元数据和 vgroup 不匹配 | TODO |
+ | 0x2407 | catalog 不存在 | TODO |
+ | 0x2550 | 无效的消息顺序 | TODO |
+ | 0x2501 | 调度器状态错误 | TODO |
+ | 0x2502 | 调度器内部错误 | TODO |
+ | 0x2504 | 任务超时 | TODO |
+ | 0x2505 | 作业正在停止中 | TODO |
+ | 0x2600 | 语法错误 | 参考 SQL 手册纠正 |
+ | 0x2601 | 不完整的 SQL 语句 | 参考 SQL 手册纠正 |
+ | 0x2602 | 无效列名 | 使用正确的列名 |
+ | 0x2603 | 表不存在 | 使用正确的表名 |
+ | 0x2604 | 表名定义有二义性 | 参考 SQL 手册纠正 |
+ | 0x2605 | 无效的值类型 | 参考 SQL 手册纠正 |
+ | 0x2608 | 此处不能使用聚合查询 | 参考 SQL 手册纠正 |
+ | 0x2609 | ORDER BY 只能用于查询语句中的结果列 | 参考 SQL 手册纠正 |
+ | 0x260A | GROUP BY 缺失表达式 (TODO) | 参考 SQL 手册纠正 |
+ | 0x260B | 不是 SELECT 表达式 | 参考 SQL 手册纠正 |
+ | 0x260C | 不是单一分组的分组函数 (TODO) | 参考 SQL 手册纠正 |
+ | 0x260D | 标签数量不匹配 | 参考 SQL 手册纠正 |
+ | 0x260E | 无效的标签名 | 改用正确的标签名 |
+ | 0x2610 | 名字或密码过长 | 参考 SQL 手册纠正 |
+ | 0x2611 | 密码不能为空 | 提供非空密码 |
+ | 0x2612 | 端口无效 | 端口号必须在 (0,65535) 范围内 |
+ | 0x2613 | 地址格式错误 | 正确格式是 "fqdn: port" |
+ | 0x2614 | 该语句不再支持 | 参考 SQL 手册纠正 |
+ | 0x2615 | 时间窗口过小 | 参考 SQL 手册纠正 |
+ | 0x2616 | 未指定数据库 | 在表名或超级表名前添加 "." 指定数据库 |
+ | 0x2617 | 标识符无效 | 参考 SQL 手册纠正 |
+ | 0x2618 | 该数据库中不存在对应的超级表 | 使用正确的数据库名或者超级表名 |
+ | 0x2619 | 数据库参数无效 | 参考 SQL 手册纠正 |
+ | 0x261A | 建表参数无效 | 参考 SQL 手册纠正 |
+ | 0x2624 | GROUP BY 和 窗口子句不能共用 | 参考 SQL 手册纠正 |
+ | 0x2627 | 聚合函数不支持嵌套 | 参考 SQL 手册纠正 |
+ | 0x2628 | 在 integer/bool/varchar 类型的列上只支持 状态窗口 | 参考 SQL 手册纠正 |
+ | 0x2629 | 标签列上不支持状态窗口 | 参考 SQL 手册纠正 |
+ | 0x262A | 状态窗口查询不支持超级表 | 参考 SQL 手册纠正 |
+ | 0x262B | 会话之间的 gap 应该是大于 0 的固定大小的窗口 | 参考 SQL 手册纠正 |
+ | 0x262C | 只在主键时间戳列上支持会话 | 参考 SQL 手册纠正 |
+ | 0x262D | 窗口偏移量不能是负值 | 参考 SQL 手册纠正 |
+ | 0x262E | 当 interval 的单位是 "year" 时 offset 的单位不能是 "month" | 参考 SQL 手册纠正 |
+ | 0x262F | offset 所指定的时间长度应该小于 interval 所指定的时间长度 | 参考 SQL 手册纠正 |
+ | 0x2630 | 当 interval 是自然年/月时不能使用 slidig | 参考 SQL 手册纠正 |
+ | 0x2631 | sliding 所指定的时间长度不能大于 interval 所指定的时间长度 | 参考 SQL 手册纠正 |
+ | 0x2632 | sliding 不能小于 interval 的 1%% | 参考 SQL 手册纠正 |
+ | 0x2633 | 当使用 JSON 类型的 tag 时只允许这一个 tag 的存在 | 去除其它 tag |
+ | 0x2634 | 查询块中包含的结果列的数量不正确 | TODO |
+ | 0x2635 | 时间戳不正确 | TODO |
+ | 0x2637 | offset/soffset 不能小于 0 | 纠正 offset/soffset |
+ | 0x2638 | offset/soffset 只能用于 partition by | 参考 SQL 手册纠正 |
+ | 0x2639 | 无效的 topic 查询 | TODO |
+ | 0x263A | 不能批量删除超级表 | 请逐个删除 |
+ | 0x263B | 查询时间范围未指定起止时间或者时间范围过大 | 参考 SQL 手册纠正 |
+ | 0x263C | 重复的列表 | 参考 SQL 手册纠正 |
+ | 0x263D | 标签长度超过上限 | 参考 SQL 手册纠正 |
+ | 0x263E | 行长度超过上限 | 参考 SQL 手册纠正 |
+ | 0x263F | 不合法的列数量 | 参考 SQL 手册纠正 |
+ | 0x2640 | 列数过多 | 参考 SQL 手册纠正 |
+ | 0x2641 | 首列必须是时间戳 | 参考 SQL 手册纠正 |
+ | 0x2642 | binary/nchar 类型的列长度无效 | 参考 SQL 手册纠正 |
+ | 0x2643 | 标签列数量无效 | 参考 SQL 手册纠正 |
+ | 0x2644 | 无权进行该操作 | 参考 SQL 手册纠正 |
+ | 0x2645 | 无效的流查询 | 参考 SQL 手册纠正 |
+ | 0x2646 | 无效的 _c0 或 _rowts 表达式 | 参考 SQL 手册纠正 |
+ | 0x2647 | 无效的时间线函数 | 参考 SQL 手册纠正 |
+ | 0x2648 | 无效的密码 | 参考 SQL 手册纠正 |
+ | 0x2649 | 无效的 alter table 语句 | 参考 SQL 手册纠正 |
+ | 0x264A | 不能删除时间戳主列 | 参考 SQL 手册纠正 |
+ | 0x264B | 只有 binary/nchar 类型的列能够修改长度 | 参考 SQL 手册纠正 |
+ | 0x264C | 无效的 tbname 伪列 | 参考 SQL 手册纠正 |
+ | 0x264D | 无效的函数名 | 参考 SQL 手册纠正 |
+ | 0x264E | 注释过长 | 参考 SQL 手册纠正 |
+ | 0x264F | 有些函数只能用在查询的 SELECT 列表中,且不能与其它非标量函数或列混用 | 参考 SQL 手册纠正 |
+ | 0x2650 | 不支持窗口查询,因为子查询的结果不包含时间戳列 | 参考 SQL 手册纠正 |
+ | 0x2651 | 任何列都不能被删除 | 参考 SQL 手册纠正 |
+ | 0x2652 | 只有 标签列可以是 JSON 类型 | 参考 SQL 手册纠正 |
+ | 0x2653 | 列或标签的值过长 | 参考 SQL 手册纠正 |
+ | 0x2655 | DELETE 语句必须有一个确定的时间范围 | 参考 SQL 手册纠正 |
+ | 0x2656 | REDISTRIBUTE VGROUP 语句只支持 1 到 3 个 vgroup | 参考 SQL 手册纠正 |
+ | 0x2657 | 不支持 Fill | 参考 SQL 手册纠正 |
+ | 0x2658 | 无效的窗口伪列 | 参考 SQL 手册纠正 |
+ | 0x2659 | 不允许做窗口查询: TODO | 参考 SQL 手册纠正 |
+ | 0x265A | 不允许做流计算: TODO | 参考 SQL 手册纠正 |
+ | 0x265B | 不允许做 Group By | 参考 SQL 手册纠正 |
+ | 0x265D | interp 子句错误 | 参考 SQL 手册纠正 |
+ | 0x265E | 窗口查询中不支持该函数 | 参考 SQL 手册纠正 |
+ | 0x265F | 只支持单表 | 参考 SQL 手册纠正 |
+ | 0x2660 | 无效的 SMA 索引 | 参考 SQL 手册纠正 |
+ | 0x2661 | 无效的 SELECT 表达式 | 参考 SQL 手册纠正 |
+ | 0x2662 | 获取表的元数据失败 | TODO |
+ | 0x2663 | 表名/表名不唯一 | 参考 SQL 手册纠正 |
+ | 0x266F | 解析器内部错误 | TODO |
+ | 0x2700 | 计划器内部错误 | TODO |
+ | 0x2701 | TODO | TODO |
+ | 0x2702 | 不支持 cross join | 参考 SQL 手册纠正 |
+ | 0x2800 | 函数内部错误 | 参考 SQL 手册纠正 |
+ | 0x2801 | 函数参数个数错误 | 参考 SQL 手册纠正 |
+ | 0x2802 | 函数参数类型错误 | 参考 SQL 手册纠正 |
+ | 0x2803 | 函数参数值错误 | 参考 SQL 手册纠正 |
+ | 0x2804 | 非内置函数 | 参考 SQL 手册纠正 |
+ | 0x2901 | UDF 正在停止 | TODO |
+ | 0x2902 | UDF 管道读取错误 | TODO |
+ | 0x2903 | UDF 连接错误 | TODO |
+ | 0x2904 | UDF 管道缺失 | TODO |
+ | 0x2905 | UDF 加载失败 | TODO |
+ | 0x2906 | UDF 无效状态 | TODO |
+ | 0x2907 | UDF 无效输入 | TODO |
+ | 0x2908 | UDF 没有函数句柄 | TODO |
+ | 0x2909 | UDF 无效的 bufsize | TODO |
+ | 0x290A | UDF 无效的输出类型 | TODO |
+ | 0x3000 | 无效的行协议类型 | 修正数据中的协议类型 |
+ | 0x3001 | 无效的时间戳精度类型 | 修正时间戳精度类型 |
+ | 0x3002 | 无效的数据格式 | 修正数据格式 |
+ | 0x3003 | 无效的无模式数据库配置 | 修改配置 |
+ | 0x3004 | 写入类型与之前的不同 | 修正写入类型 |
+ | 0x3100 | TSMA 初始化失败 | TODO |
+ | 0x3101 | TSMA 已经存在 | 放弃重复建立 TSMA |
+ | 0x3102 | 元数据中没有 TSMA 索引 | TODO |
+ | 0x3103 | 无效的 TSMA 环境 | TODO |
+ | 0x3104 | 无效的 TSMA 状态 | TODO |
+ | 0x3105 | 无效的 TSMA 指针 | TODO |
+ | 0x3106 | 无效的 TSMA 参数 | 参考 SQL 手册纠正 |
+ | 0x3107 | cache 中没有该 TSMA 的索引 | TODO |
+ | 0x3150 | 无效的 RSMA 索引 | TODO |
+ | 0x3151 | 无效的 RSMA 状态 | TODO |
+ | 0x3152 | RSMA 创建 qtaskinfo 失败 | TODO |
+ | 0x3153 | RSMA 文件被破坏 | TODO |
+ | 0x3200 | 索引正在重建中 |TODO |
+ | 0x3201 | 无效的索引文件 | TODO |
+ | 0x4000 | 无效消息 | TODO |
\ No newline at end of file
diff --git a/docs/zh/14-reference/03-connector/_verify_linux.mdx b/docs/zh/14-reference/03-connector/_verify_linux.mdx
index fcb8aae6ae..4979b6f72f 100644
--- a/docs/zh/14-reference/03-connector/_verify_linux.mdx
+++ b/docs/zh/14-reference/03-connector/_verify_linux.mdx
@@ -2,13 +2,18 @@
```text
$ taos
-Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
-Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
+Welcome to the TDengine shell from Linux, Client Version:3.0.0.0
+Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.
+
+Server is Community Edition.
+
taos> show databases;
-name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB)| blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
-=========================================================================================================================================================================================================================
-test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16| 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
-log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1| 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
-Query OK, 2 row(s) in set (0.001198s)
+ name | create_time | vgroups | ntables | replica | strict | duration | keep | buffer | pagesize | pages | minrows | maxrows | comp | precision | status | retention | single_stable | cachemodel | cachesize | wal_level | wal_fsync_period | wal_retention_period | wal_retention_size | wal_roll_period | wal_seg_size |
+=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ information_schema | NULL | NULL | 14 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ performance_schema | NULL | NULL | 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ db | 2022-08-04 14:14:49.385 | 2 | 4 | 1 | off | 14400m | 5254560m,5254560m,5254560m | 96 | 4 | 256 | 100 | 4096 | 2 | ms | ready | NULL | false | none | 1 | 1 | 3000 | 0 | 0 | 0 | 0 |
+Query OK, 3 rows in database (0.019154s)
+
taos>
```
diff --git a/docs/zh/14-reference/03-connector/_verify_windows.mdx b/docs/zh/14-reference/03-connector/_verify_windows.mdx
index 87c9fbd024..8873d2928a 100644
--- a/docs/zh/14-reference/03-connector/_verify_windows.mdx
+++ b/docs/zh/14-reference/03-connector/_verify_windows.mdx
@@ -1,14 +1,19 @@
在 cmd 下进入到 C:\TDengine 目录下直接执行 `taos.exe`,连接到 TDengine 服务,进入到 TDengine CLI 界面,示例如下:
```text
- C:\TDengine>taos
- Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
- Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
- taos> show databases;
- name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
- ===================================================================================================================================================================================================================================================================
- test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
- log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
- Query OK, 2 row(s) in set (0.045000s)
- taos>
+Welcome to the TDengine shell from Windows, Client Version:3.0.0.0
+Copyright (c) 2022 by TAOS Data, Inc. All rights reserved.
+
+Server is Community Edition.
+
+taos> show databases;
+ name | create_time | vgroups | ntables | replica | strict | duration | keep | buffer | pagesize | pages | minrows | maxrows | comp | precision | status | retention | single_stable | cachemodel | cachesize | wal_level | wal_fsync_period | wal_retention_period | wal_retention_size | wal_roll_period | wal_seg_size |
+=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================
+ information_schema | NULL | NULL | 14 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ performance_schema | NULL | NULL | 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
+ test | 2022-08-04 16:46:40.506 | 2 | 0 | 1 | off | 14400m | 5256000m,5256000m,5256000m | 96 | 4 | 256 |
+100 | 4096 | 2 | ms | ready | NULL | false | none | 1 | 1 | 3000 | 0 | 0 | 0 | 0 |
+Query OK, 3 rows in database (0.123000s)
+
+taos>
```
diff --git a/docs/zh/14-reference/03-connector/csharp.mdx b/docs/zh/14-reference/03-connector/csharp.mdx
index 1e23df9286..723c12932b 100644
--- a/docs/zh/14-reference/03-connector/csharp.mdx
+++ b/docs/zh/14-reference/03-connector/csharp.mdx
@@ -22,7 +22,9 @@ import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx"
本文介绍如何在 Linux 或 Windows 环境中安装 `TDengine.Connector`,并通过 `TDengine.Connector` 连接 TDengine 集群,进行数据写入、查询等基本操作。
-`TDengine.Connector` 的源码托管在 [GitHub](https://github.com/taosdata/taos-connector-dotnet)。
+注意:`TDengine.Connector` 3.x 不兼容 TDengine 2.x,如果在运行 TDengine 2.x 版本的环境下需要使用 C# 连接器请使用 TDengine.Connector 的 1.x 版本 。
+
+`TDengine.Connector` 的源码托管在 [GitHub](https://github.com/taosdata/taos-connector-dotnet/tree/3.0)。
## 支持的平台
@@ -63,15 +65,15 @@ dotnet add package TDengine.Connector
-可以下载 TDengine 的源码,直接引用最新版本的 TDengine.Connector 库
+也可以[下载源码](https://github.com/taosdata/taos-connector-dotnet/tree/3.0),直接引用 TDengine.Connector 库
```bash
-git clone https://github.com/taosdata/TDengine.git
-cd TDengine/src/connector/C#/src/
-cp -r TDengineDriver/ myProject
+git clone -b 3.0 https://github.com/taosdata/taos-connector-dotnet.git
+cd taos-connector-dotnet
+cp -r src/ myProject
cd myProject
-dotnet add TDengineDriver/TDengineDriver.csproj
+dotnet add exmaple.csproj reference src/TDengine.csproj
```
@@ -145,20 +147,19 @@ namespace TDengineExample
|示例程序 | 示例程序描述 |
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
-| [C#checker](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/C%23checker) | 使用 TDengine.Connector 可以通过 help 命令中提供的参数,测试C# Driver的同步写入和查询 |
-| [TDengineTest](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/TDengineTest) | 使用 TDengine.Connector 实现的简单写入和查询的示例 |
-| [insertCn](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/insertCn) | 使用 TDengine.Connector 实现的写入和查询中文字符的示例 |
-| [jsonTag](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/jsonTag) | 使用 TDengine.Connector 实现的写入和查询 json tag 类型数据的示例 |
-| [stmt](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/stmt) | 使用 TDengine.Connector 实现的参数绑定的示例 |
-| [schemaless](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/schemaless) | 使用 TDengine.Connector 实现的使用 schemaless 写入的示例 |
-| [benchmark](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/taosdemo) | 使用 TDengine.Connector 实现的简易 Benchmark |
-| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/develop/examples/QueryAsyncSample.cs) | 使用 TDengine.Connector 实现的异步查询的示例 |
-| [subscribe](https://github.com/taosdata/taos-connector-dotnet/blob/develop/examples/SubscribeSample.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 |
+| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/Query/Query.cs) | 使用 TDengine.Connector 实现的建表、插入、查询示例 |
+| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/JSONTag) | 使用 TDengine.Connector 实现的写入和查询 JSON tag 类型数据的示例 |
+| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/Stmt) | 使用 TDengine.Connector 实现的参数绑定插入和查询的示例 |
+| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/schemaless) | 使用 TDengine.Connector 实现的使用 schemaless 写入的示例 |
+| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/AsyncQuery/QueryAsync.cs) | 使用 TDengine.Connector 实现的异步查询的示例 |
+| [TMQ](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/TMQ/TMQ.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 |
## 重要更新记录
| TDengine.Connector | 说明 |
|--------------------|--------------------------------|
+| 3.0.0 | 支持 TDengine 3.0.0.0,不兼容 2.x。新增接口TDengine.Impl.GetData(),解析查询结果。 |
+| 1.0.7 | 修复 TDengine.Query()内存泄露。 |
| 1.0.6 | 修复 schemaless 在 1.0.4 和 1.0.5 中失效 bug。 |
| 1.0.5 | 修复 Windows 同步查询中文报错 bug。 |
| 1.0.4 | 新增异步查询,订阅等功能。修复绑定参数 bug。 |
diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md
index 6b694543b1..f4aff0169d 100644
--- a/docs/zh/14-reference/05-taosbenchmark.md
+++ b/docs/zh/14-reference/05-taosbenchmark.md
@@ -227,40 +227,12 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
#### 数据库相关配置参数
-创建数据库时的相关参数在 json 配置文件中的 `dbinfo` 中配置,具体参数如下。这些参数与 TDengine 中 `create database` 时所指定的数据库参数相对应。
+创建数据库时的相关参数在 json 配置文件中的 `dbinfo` 中配置,个别具体参数如下。其余参数均与 TDengine 中 `create database` 时所指定的数据库参数相对应,详见[../../taos-sql/database]
- **name** : 数据库名。
- **drop** : 插入前是否删除数据库,默认为 true。
-- **replica** : 创建数据库时指定的副本数。
-
-- **days** : 单个数据文件中存储数据的时间跨度,默认值为 10。
-
-- **cache** : 缓存块的大小,单位是 MB,默认值是 16。
-
-- **blocks** : 每个 vnode 中缓存块的数量,默认为 6。
-
-- **precision** : 数据库时间精度,默认值为 "ms"。
-
-- **keep** : 保留数据的天数,默认值为 3650。
-
-- **minRows** : 文件块中的最小记录数,默认值为 100。
-
-- **maxRows** : 文件块中的最大记录数,默认值为 4096。
-
-- **comp** : 文件压缩标志,默认值为 2。
-
-- **walLevel** : WAL 级别,默认为 1。
-
-- **cacheLast** : 是否允许将每个表的最后一条记录保留在内存中,默认值为 0,可选值为 0,1,2,3。
-
-- **quorum** : 多副本模式下的写确认数量,默认值为 1。
-
-- **fsync** : 当 wal 设置为 2 时,fsync 的间隔时间,单位为 ms,默认值为 3000。
-
-- **update** : 是否支持数据更新,默认值为 0, 可选值为 0, 1, 2。
-
#### 超级表相关配置参数
创建超级表时的相关参数在 json 配置文件中的 `super_tables` 中配置,具体参数如下表。
@@ -335,6 +307,8 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
- **values** : nchar/binary 列/标签的值域,将从值中随机选择。
+- **sma**: 将该列加入bsma中,值为 "yes" 或者 "no",默认为 "no"。
+
#### 插入行为配置参数
- **thread_count** : 插入数据的线程数量,默认为 8。
diff --git a/docs/zh/14-reference/06-taosdump.md b/docs/zh/14-reference/06-taosdump.md
index 95ee20bfba..625499a949 100644
--- a/docs/zh/14-reference/06-taosdump.md
+++ b/docs/zh/14-reference/06-taosdump.md
@@ -107,7 +107,10 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
use letter and number only. Default is NOT.
-n, --no-escape No escape char '`'. Default is using it.
-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is
- 5.
+ 8.
+ -C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service
+ -R, --restful Use RESTful interface to connect TDengine
+ -t, --timeout=SECONDS The timeout seconds for websocket to interact.
-g, --debug Print debug info.
-?, --help Give this help list
--usage Give a short usage message
diff --git a/docs/zh/17-operation/17-diagnose.md b/docs/zh/17-operation/17-diagnose.md
index e2a2ef035a..e6e9be7153 100644
--- a/docs/zh/17-operation/17-diagnose.md
+++ b/docs/zh/17-operation/17-diagnose.md
@@ -1,131 +1,71 @@
----
-title: 诊断及其他
----
-
-## 网络连接诊断
-
-当出现客户端应用无法访问服务端时,需要确认客户端与服务端之间网络的各端口连通情况,以便有针对性地排除故障。
-
-目前网络连接诊断支持在:Linux 与 Linux,Linux 与 Windows 之间进行诊断测试。
-
-诊断步骤:
-
-1. 如拟诊断的端口范围与服务器 taosd 实例的端口范围相同,须先停掉 taosd 实例
-2. 服务端命令行输入:`taos -n server -P -l ` 以服务端身份启动对端口 port 为基准端口的监听
-3. 客户端命令行输入:`taos -n client -h -P -l ` 以客户端身份启动对指定的服务器、指定的端口发送测试包
-
--l : 测试网络包的大小(单位:字节)。最小值是 11、最大值是 64000,默认值为 1000。
-注:两端命令行中指定的测试包长度必须一致,否则测试显示失败。
-
-服务端运行正常的话会输出以下信息:
-
-```bash
-# taos -n server -P 6000
-12/21 14:50:13.522509 0x7f536f455200 UTL work as server, host:172.27.0.7 startPort:6000 endPort:6011 pkgLen:1000
-
-12/21 14:50:13.522659 0x7f5352242700 UTL TCP server at port:6000 is listening
-12/21 14:50:13.522727 0x7f5351240700 UTL TCP server at port:6001 is listening
-...
-...
-...
-12/21 14:50:13.523954 0x7f5342fed700 UTL TCP server at port:6011 is listening
-12/21 14:50:13.523989 0x7f53437ee700 UTL UDP server at port:6010 is listening
-12/21 14:50:13.524019 0x7f53427ec700 UTL UDP server at port:6011 is listening
-12/21 14:50:22.192849 0x7f5352242700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6000
-12/21 14:50:22.192993 0x7f5352242700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6000
-12/21 14:50:22.237082 0x7f5351a41700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6000
-12/21 14:50:22.237203 0x7f5351a41700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6000
-12/21 14:50:22.237450 0x7f5351240700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6001
-12/21 14:50:22.237576 0x7f5351240700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6001
-12/21 14:50:22.281038 0x7f5350a3f700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6001
-12/21 14:50:22.281141 0x7f5350a3f700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6001
-...
-...
-...
-12/21 14:50:22.677443 0x7f5342fed700 UTL TCP: read:1000 bytes from 172.27.0.8 at 6011
-12/21 14:50:22.677576 0x7f5342fed700 UTL TCP: write:1000 bytes to 172.27.0.8 at 6011
-12/21 14:50:22.721144 0x7f53427ec700 UTL UDP: recv:1000 bytes from 172.27.0.8 at 6011
-12/21 14:50:22.721261 0x7f53427ec700 UTL UDP: send:1000 bytes to 172.27.0.8 at 6011
-```
-
-客户端运行正常会输出以下信息:
-
-```bash
-# taos -n client -h 172.27.0.7 -P 6000
-12/21 14:50:22.192434 0x7fc95d859200 UTL work as client, host:172.27.0.7 startPort:6000 endPort:6011 pkgLen:1000
-
-12/21 14:50:22.192472 0x7fc95d859200 UTL server ip:172.27.0.7 is resolved from host:172.27.0.7
-12/21 14:50:22.236869 0x7fc95d859200 UTL successed to test TCP port:6000
-12/21 14:50:22.237215 0x7fc95d859200 UTL successed to test UDP port:6000
-...
-...
-...
-12/21 14:50:22.676891 0x7fc95d859200 UTL successed to test TCP port:6010
-12/21 14:50:22.677240 0x7fc95d859200 UTL successed to test UDP port:6010
-12/21 14:50:22.720893 0x7fc95d859200 UTL successed to test TCP port:6011
-12/21 14:50:22.721274 0x7fc95d859200 UTL successed to test UDP port:6011
-```
-
-仔细阅读打印出来的错误信息,可以帮助管理员找到原因,以解决问题。
-
-## 启动状态及 RPC 诊断
-
-`taos -n startup -h `
-
-判断 taosd 服务端是否成功启动,是数据库管理员经常遇到的一种情形。特别当若干台服务器组成集群时,判断每个服务端实例是否成功启动就会是一个重要问题。除检索 taosd 服务端日志文件进行问题定位、分析外,还可以通过 `taos -n startup -h ` 来诊断一个 taosd 进程的启动状态。
-
-针对多台服务器组成的集群,当服务启动过程耗时较长时,可通过该命令行来诊断每台服务器的 taosd 实例的启动状态,以准确定位问题。
-
-`taos -n rpc -h `
-
-该命令用来诊断已经启动的 taosd 实例的端口是否可正常访问。如果 taosd 程序异常或者失去响应,可以通过 `taos -n rpc -h ` 来发起一个与指定 fqdn 的 rpc 通信,看看 taosd 是否能收到,以此来判定是网络问题还是 taosd 程序异常问题。
-
-## sync 及 arbitrator 诊断
-
-```
-taos -n sync -P 6040 -h
-taos -n sync -P 6042 -h
-```
-
-用来诊断 sync 端口是否工作正常,判断服务端 sync 模块是否成功工作。另外,-P 6042 用来诊断 arbitrator 是否配置正常,判断指定服务器的 arbitrator 是否能正常工作。
-
-## 网络速度诊断
-
-`taos -n speed -h -P 6030 -N 10 -l 10000000 -S TCP`
-
-从 2.2.0.0 版本开始,taos 工具新提供了一个网络速度诊断的模式,可以对一个正在运行中的 taosd 实例或者 `taos -n server` 方式模拟的一个服务端实例,以非压缩传输的方式进行网络测速。这个模式下可供调整的参数如下:
-
--n:设为“speed”时,表示对网络速度进行诊断。
--h:所要连接的服务端的 FQDN 或 ip 地址。如果不设置这一项,会使用本机 taos.cfg 文件中 FQDN 参数的设置作为默认值。
--P:所连接服务端的网络端口。默认值为 6030。
--N:诊断过程中使用的网络包总数。最小值是 1、最大值是 10000,默认值为 100。
--l:单个网络包的大小(单位:字节)。最小值是 1024、最大值是 1024 `*` 1024 `*` 1024,默认值为 1024。
--S:网络封包的类型。可以是 TCP 或 UDP,默认值为 TCP。
-
-## FQDN 解析速度诊断
-
-`taos -n fqdn -h `
-
-从 2.2.0.0 版本开始,taos 工具新提供了一个 FQDN 解析速度的诊断模式,可以对一个目标 FQDN 地址尝试解析,并记录解析过程中所消耗的时间。这个模式下可供调整的参数如下:
-
--n:设为“fqdn”时,表示对 FQDN 解析进行诊断。
--h:所要解析的目标 FQDN 地址。如果不设置这一项,会使用本机 taos.cfg 文件中 FQDN 参数的设置作为默认值。
-
-## 服务端日志
-
-taosd 服务端日志文件标志位 debugflag 默认为 131,在 debug 时往往需要将其提升到 135 或 143 。
-
-一旦设定为 135 或 143,日志文件增长很快,特别是写入、查询请求量较大时,增长速度惊人。如合并保存日志,很容易把日志内的关键信息(如配置信息、错误信息等)冲掉。为此,服务端将重要信息日志与其他日志分开存放:
-
-- taosinfo 存放重要信息日志, 包括:INFO/ERROR/WARNING 级别的日志信息。不记录 DEBUG、TRACE 级别的日志。
-- taosdlog 服务器端生成的日志,记录 taosinfo 中全部信息外,还根据设置的日志输出级别,记录 DEBUG(日志级别 135)、TRACE(日志级别是 143)。
-
-## 客户端日志
-
-每个独立运行的客户端(一个进程)生成一个独立的客户端日志,其命名方式采用 taoslog+<序号> 的方式命名。文件标志位 debugflag 默认为 131,在 debug 时往往需要将其提升到 135 或 143 。
-
-- taoslog 客户端(driver)生成的日志,默认记录客户端 INFO/ERROR/WARNING 级别日志,还根据设置的日志输出级别,记录 DEBUG(日志级别 135)、TRACE(日志级别是 143)。
-
-其中,日志文件最大长度由 numOfLogLines 来进行配置,一个 taosd 实例最多保留两个文件。
-
-taosd 服务端日志采用异步落盘写入机制,优点是可以避免硬盘写入压力太大,对性能造成很大影响。缺点是,在极端情况下,存在少量日志行数丢失的可能。
+---
+title: 诊断及其他
+---
+
+## 网络连接诊断
+
+当出现客户端应用无法访问服务端时,需要确认客户端与服务端之间网络的各端口连通情况,以便有针对性地排除故障。
+
+目前网络连接诊断支持在:Linux 与 Linux,Linux 与 Windows 之间进行诊断测试。
+
+诊断步骤:
+
+1. 如拟诊断的端口范围与服务器 taosd 实例的端口范围相同,须先停掉 taosd 实例
+2. 服务端命令行输入:`taos -n server -P -l ` 以服务端身份启动对端口 port 为基准端口的监听
+3. 客户端命令行输入:`taos -n client -h -P -l ` 以客户端身份启动对指定的服务器、指定的端口发送测试包
+
+-l : 测试网络包的大小(单位:字节)。最小值是 11、最大值是 64000,默认值为 1000。
+注:两端命令行中指定的测试包长度必须一致,否则测试显示失败。
+
+服务端运行正常的话会输出以下信息:
+
+```bash
+# taos -n server -P 6030 -l 1000
+network test server is initialized, port:6030
+request is received, size:1000
+request is received, size:1000
+...
+...
+...
+request is received, size:1000
+request is received, size:1000
+```
+
+客户端运行正常会输出以下信息:
+
+```bash
+# taos -n client -h 172.27.0.7 -P 6000
+taos -n client -h v3s2 -P 6030 -l 1000
+network test client is initialized, the server is v3s2:6030
+request is sent, size:1000
+response is received, size:1000
+request is sent, size:1000
+response is received, size:1000
+...
+...
+...
+request is sent, size:1000
+response is received, size:1000
+request is sent, size:1000
+response is received, size:1000
+
+total succ: 100/100 cost: 16.23 ms speed: 5.87 MB/s
+```
+
+仔细阅读打印出来的错误信息,可以帮助管理员找到原因,以解决问题。
+
+## 服务端日志
+
+taosd 服务端日志文件标志位 debugflag 默认为 131,在 debug 时往往需要将其提升到 135 或 143 。
+
+一旦设定为 135 或 143,日志文件增长很快,特别是写入、查询请求量较大时,增长速度惊人。请注意日志文件目录所在磁盘的空间大小。
+
+## 客户端日志
+
+每个独立运行的客户端(一个进程)生成一个独立的客户端日志,其命名方式采用 taoslog+<序号> 的方式命名。文件标志位 debugflag 默认为 131,在 debug 时往往需要将其提升到 135 或 143 。
+
+- taoslog 客户端(driver)生成的日志,默认记录客户端 INFO/ERROR/WARNING 级别日志,还根据设置的日志输出级别,记录 DEBUG(日志级别 135)、TRACE(日志级别是 143)。
+
+其中,日志文件最大长度由 numOfLogLines 来进行配置,一个 taosd 实例最多保留两个文件。
+
+taosd 服务端日志采用异步落盘写入机制,优点是可以避免硬盘写入压力太大,对性能造成很大影响。缺点是,在极端情况下,存在少量日志行数丢失的可能。当问题分析需要的时候,可以考虑将 参数 asynclog 设置成 0,修改为同步落盘写入机制,保证日志不会丢失。
diff --git a/docs/zh/20-third-party/09-emq-broker.md b/docs/zh/20-third-party/09-emq-broker.md
index 84b1027f6b..dd98374558 100644
--- a/docs/zh/20-third-party/09-emq-broker.md
+++ b/docs/zh/20-third-party/09-emq-broker.md
@@ -17,6 +17,7 @@ MQTT 是流行的物联网数据传输协议,[EMQX](https://github.com/emqx/em
用户可以根据当前的操作系统,到 EMQX 官网下载安装包,并执行安装。下载地址如下:。安装后使用 `sudo emqx start` 或 `sudo systemctl start emqx` 启动 EMQX 服务。
+注意:本文基于 EMQX v4.4.5 版本,其他版本由于相关配置界面、配置方法以及功能可能随着版本升级有所区别。
## 创建数据库和表
@@ -32,7 +33,7 @@ CREATE TABLE sensor_data (ts TIMESTAMP, temperature FLOAT, humidity FLOAT, volum
## 配置 EMQX 规则
-由于 EMQX 不同版本配置界面所有不同,这里仅以 v4.4.3 为例,其他版本请参考相应官网文档。
+由于 EMQX 不同版本配置界面所有不同,这里仅以 v4.4.5 为例,其他版本请参考相应官网文档。
### 登录 EMQX Dashboard
diff --git a/examples/c/tmq.c b/examples/c/tmq.c
index 3686251b4b..1cdd4c02da 100644
--- a/examples/c/tmq.c
+++ b/examples/c/tmq.c
@@ -1,473 +1,287 @@
-/*
- * Copyright (c) 2019 TAOS Data, Inc.
- *
- * This program is free software: you can use, redistribute, and/or modify
- * it under the terms of the GNU Affero General Public License, version 3
- * or later ("AGPL"), as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-#include
-#include
-#include
-#include
-#include
-#include "taos.h"
-
-static int running = 1;
-static void msg_process(TAOS_RES* msg) {
- char buf[1024];
- /*memset(buf, 0, 1024);*/
- printf("topic: %s\n", tmq_get_topic_name(msg));
- printf("db: %s\n", tmq_get_db_name(msg));
- printf("vg: %d\n", tmq_get_vgroup_id(msg));
- if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) {
- tmq_raw_data raw = {0};
- int32_t code = tmq_get_raw(msg, &raw);
- if (code == 0) {
- TAOS* pConn = taos_connect("192.168.1.86", "root", "taosdata", NULL, 0);
- if (pConn == NULL) {
- return;
- }
-
- TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 5");
- if (taos_errno(pRes) != 0) {
- printf("error in create db, reason:%s\n", taos_errstr(pRes));
- return;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "use abc1");
- if (taos_errno(pRes) != 0) {
- printf("error in use db, reason:%s\n", taos_errstr(pRes));
- return;
- }
- taos_free_result(pRes);
-
- int32_t ret = tmq_write_raw(pConn, raw);
- printf("write raw data: %s\n", tmq_err2str(ret));
- taos_close(pConn);
- }
- char* result = tmq_get_json_meta(msg);
- if (result) {
- printf("meta result: %s\n", result);
- }
- tmq_free_json_meta(result);
- return;
- }
- while (1) {
- TAOS_ROW row = taos_fetch_row(msg);
- if (row == NULL) break;
- TAOS_FIELD* fields = taos_fetch_fields(msg);
- int32_t numOfFields = taos_field_count(msg);
- taos_print_row(buf, row, fields, numOfFields);
- printf("%s\n", buf);
-
- const char* tbName = tmq_get_table_name(msg);
- if (tbName) {
- printf("from tb: %s\n", tbName);
- }
- }
-}
-
-int32_t init_env() {
- TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
- if (pConn == NULL) {
- return -1;
- }
-
- TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 5");
- if (taos_errno(pRes) != 0) {
- printf("error in create db, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "use abc1");
- if (taos_errno(pRes) != 0) {
- printf("error in use db, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn,
- "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 "
- "nchar(8), t4 bool)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000, \"ttt\", true)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "insert into ct0 values(now, 1, 2, 'a')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table if not exists ct1 using st1(t1) tags(2000)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create child table ct1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table if not exists ct2 using st1(t1) tags(NULL)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create child table ct2, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "insert into ct1 values(now, 3, 4, 'b')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table if not exists ct3 using st1(t1) tags(3000)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create child table ct3, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "insert into ct3 values(now, 5, 6, 'c')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
-#if 0
- pRes = taos_query(pConn, "alter table st1 add column c4 bigint");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table st1 modify column c3 binary(64)");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table st1 add tag t2 binary(64)");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table ct3 set tag t1=5000");
- if (taos_errno(pRes) != 0) {
- printf("failed to slter child table ct3, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "drop table ct3 ct1");
- if (taos_errno(pRes) != 0) {
- printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "drop table st1");
- if (taos_errno(pRes) != 0) {
- printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))");
- if (taos_errno(pRes) != 0) {
- printf("failed to create normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table n1 add column c3 bigint");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table n1 modify column c2 nchar(8)");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table n1 rename column c3 cc3");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table n1 comment 'hello'");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "alter table n1 drop column c1");
- if (taos_errno(pRes) != 0) {
- printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "drop table n1");
- if (taos_errno(pRes) != 0) {
- printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table jt1 using jt tags('{\"k1\":1, \"k2\":\"hello\"}')");
- if (taos_errno(pRes) != 0) {
- printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create table jt2 using jt tags('')");
- if (taos_errno(pRes) != 0) {
- printf("failed to create super table jt2, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn,
- "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 "
- "nchar(8), t4 bool)");
- if (taos_errno(pRes) != 0) {
- printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "drop table st1");
- if (taos_errno(pRes) != 0) {
- printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-#endif
-
- return 0;
-}
-
-int32_t create_topic() {
- printf("create topic\n");
- TAOS_RES* pRes;
- TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
- if (pConn == NULL) {
- return -1;
- }
-
- pRes = taos_query(pConn, "use abc1");
- if (taos_errno(pRes) != 0) {
- printf("error in use db, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- // pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");
- pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");
- if (taos_errno(pRes) != 0) {
- printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
- pRes = taos_query(pConn, "create topic topic2 as select ts, c1, c2, c3 from st1");
- if (taos_errno(pRes) != 0) {
- printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-
-#if 0
- pRes = taos_query(pConn, "insert into tu1 values(now, 1, 1.0, 'bi1')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
- pRes = taos_query(pConn, "insert into tu1 values(now+1d, 1, 1.0, 'bi1')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
- pRes = taos_query(pConn, "insert into tu2 values(now, 2, 2.0, 'bi2')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
- pRes = taos_query(pConn, "insert into tu2 values(now+1d, 2, 2.0, 'bi2')");
- if (taos_errno(pRes) != 0) {
- printf("failed to insert, reason:%s\n", taos_errstr(pRes));
- return -1;
- }
- taos_free_result(pRes);
-#endif
-
- taos_close(pConn);
- return 0;
-}
-
-void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
- printf("commit %d tmq %p param %p\n", code, tmq, param);
-}
-
-tmq_t* build_consumer() {
-#if 0
- TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
- assert(pConn != NULL);
-
- TAOS_RES* pRes = taos_query(pConn, "use abc1");
- if (taos_errno(pRes) != 0) {
- printf("error in use db, reason:%s\n", taos_errstr(pRes));
- }
- taos_free_result(pRes);
-#endif
-
- tmq_conf_t* conf = tmq_conf_new();
- tmq_conf_set(conf, "group.id", "tg2");
- tmq_conf_set(conf, "client.id", "my app 1");
- tmq_conf_set(conf, "td.connect.user", "root");
- tmq_conf_set(conf, "td.connect.pass", "taosdata");
- tmq_conf_set(conf, "msg.with.table.name", "true");
- tmq_conf_set(conf, "enable.auto.commit", "true");
-
- /*tmq_conf_set(conf, "experimental.snapshot.enable", "true");*/
-
- tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
- tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
- assert(tmq);
- tmq_conf_destroy(conf);
- return tmq;
-}
-
-tmq_list_t* build_topic_list() {
- tmq_list_t* topic_list = tmq_list_new();
- tmq_list_append(topic_list, "topic_ctb_column");
- /*tmq_list_append(topic_list, "tmq_test_db_multi_insert_topic");*/
- return topic_list;
-}
-
-void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
- int32_t code;
-
- if ((code = tmq_subscribe(tmq, topics))) {
- fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code));
- printf("subscribe err\n");
- return;
- }
- int32_t cnt = 0;
- while (running) {
- TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, -1);
- if (tmqmessage) {
- cnt++;
- msg_process(tmqmessage);
- /*if (cnt >= 2) break;*/
- /*printf("get data\n");*/
- taos_free_result(tmqmessage);
- /*} else {*/
- /*break;*/
- /*tmq_commit_sync(tmq, NULL);*/
- }
- }
-
- code = tmq_consumer_close(tmq);
- if (code)
- fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code));
- else
- fprintf(stderr, "%% Consumer closed\n");
-}
-
-void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) {
- static const int MIN_COMMIT_COUNT = 1;
-
- int msg_count = 0;
- int32_t code;
-
- if ((code = tmq_subscribe(tmq, topics))) {
- fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code));
- return;
- }
-
- tmq_list_t* subList = NULL;
- tmq_subscription(tmq, &subList);
- char** subTopics = tmq_list_to_c_array(subList);
- int32_t sz = tmq_list_get_size(subList);
- printf("subscribed topics: ");
- for (int32_t i = 0; i < sz; i++) {
- printf("%s, ", subTopics[i]);
- }
- printf("\n");
- tmq_list_destroy(subList);
-
- while (running) {
- TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1000);
- if (tmqmessage) {
- msg_process(tmqmessage);
- taos_free_result(tmqmessage);
-
- /*tmq_commit_sync(tmq, NULL);*/
- /*if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0);*/
- }
- }
-
- code = tmq_consumer_close(tmq);
- if (code)
- fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code));
- else
- fprintf(stderr, "%% Consumer closed\n");
-}
-
-int main(int argc, char* argv[]) {
- if (argc > 1) {
- printf("env init\n");
- if (init_env() < 0) {
- return -1;
- }
- create_topic();
- }
- tmq_t* tmq = build_consumer();
- tmq_list_t* topic_list = build_topic_list();
- basic_consume_loop(tmq, topic_list);
- /*sync_consume_loop(tmq, topic_list);*/
-}
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include "taos.h"
+
+static int running = 1;
+static char dbName[64] = "tmqdb";
+static char stbName[64] = "stb";
+static char topicName[64] = "topicname";
+
+static int32_t msg_process(TAOS_RES* msg) {
+ char buf[1024];
+ int32_t rows = 0;
+
+ const char* topicName = tmq_get_topic_name(msg);
+ const char* dbName = tmq_get_db_name(msg);
+ int32_t vgroupId = tmq_get_vgroup_id(msg);
+
+ printf("topic: %s\n", topicName);
+ printf("db: %s\n", dbName);
+ printf("vgroup id: %d\n", vgroupId);
+
+ while (1) {
+ TAOS_ROW row = taos_fetch_row(msg);
+ if (row == NULL) break;
+
+ TAOS_FIELD* fields = taos_fetch_fields(msg);
+ int32_t numOfFields = taos_field_count(msg);
+ int32_t* length = taos_fetch_lengths(msg);
+ int32_t precision = taos_result_precision(msg);
+ const char* tbName = tmq_get_table_name(msg);
+ rows++;
+ taos_print_row(buf, row, fields, numOfFields);
+ printf("row content from %s: %s\n", (tbName != NULL ? tbName : "null table"), buf);
+ }
+
+ return rows;
+}
+
+static int32_t init_env() {
+ TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
+ if (pConn == NULL) {
+ return -1;
+ }
+
+ TAOS_RES* pRes;
+ // drop database if exists
+ printf("create database\n");
+ pRes = taos_query(pConn, "drop database if exists tmqdb");
+ if (taos_errno(pRes) != 0) {
+ printf("error in drop tmqdb, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ // create database
+ pRes = taos_query(pConn, "create database tmqdb");
+ if (taos_errno(pRes) != 0) {
+ printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ // create super table
+ printf("create super table\n");
+ pRes = taos_query(pConn, "create table tmqdb.stb (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create super table stb, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ // create sub tables
+ printf("create sub tables\n");
+ pRes = taos_query(pConn, "create table tmqdb.ctb0 using tmqdb.stb tags(0, 'subtable0')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create super table ctb0, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "create table tmqdb.ctb1 using tmqdb.stb tags(1, 'subtable1')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create super table ctb1, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "create table tmqdb.ctb2 using tmqdb.stb tags(2, 'subtable2')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create super table ctb2, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "create table tmqdb.ctb3 using tmqdb.stb tags(3, 'subtable3')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create super table ctb3, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ // insert data
+ printf("insert data into sub tables\n");
+ pRes = taos_query(pConn, "insert into tmqdb.ctb0 values(now, 0, 0, 'a0')(now+1s, 0, 0, 'a00')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to insert into ctb0, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "insert into tmqdb.ctb1 values(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to insert into ctb0, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "insert into tmqdb.ctb2 values(now, 2, 2, 'a1')(now+1s, 22, 22, 'a22')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to insert into ctb0, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ pRes = taos_query(pConn, "insert into tmqdb.ctb3 values(now, 3, 3, 'a1')(now+1s, 33, 33, 'a33')");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to insert into ctb0, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ taos_close(pConn);
+ return 0;
+}
+
+int32_t create_topic() {
+ printf("create topic\n");
+ TAOS_RES* pRes;
+ TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
+ if (pConn == NULL) {
+ return -1;
+ }
+
+ pRes = taos_query(pConn, "use tmqdb");
+ if (taos_errno(pRes) != 0) {
+ printf("error in use tmqdb, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ // pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1");
+ pRes = taos_query(pConn, "create topic topicname as select ts, c1, c2, c3 from tmqdb.stb where c1 > 1");
+ if (taos_errno(pRes) != 0) {
+ printf("failed to create topic topicname, reason:%s\n", taos_errstr(pRes));
+ return -1;
+ }
+ taos_free_result(pRes);
+
+ taos_close(pConn);
+ return 0;
+}
+
+void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
+ printf("tmq_commit_cb_print() code: %d, tmq: %p, param: %p\n", code, tmq, param);
+}
+
+tmq_t* build_consumer() {
+ tmq_conf_res_t code;
+ tmq_conf_t* conf = tmq_conf_new();
+ code = tmq_conf_set(conf, "enable.auto.commit", "true");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "auto.commit.interval.ms", "1000");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "group.id", "cgrpName");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "td.connect.user", "root");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "td.connect.pass", "taosdata");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "auto.offset.reset", "earliest");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "experimental.snapshot.enable", "true");
+ if (TMQ_CONF_OK != code) return NULL;
+ code = tmq_conf_set(conf, "msg.with.table.name", "true");
+ if (TMQ_CONF_OK != code) return NULL;
+
+ tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
+
+ tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
+ tmq_conf_destroy(conf);
+ return tmq;
+}
+
+tmq_list_t* build_topic_list() {
+ tmq_list_t* topicList = tmq_list_new();
+ int32_t code = tmq_list_append(topicList, "topicname");
+ if (code) {
+ return NULL;
+ }
+ return topicList;
+}
+
+void basic_consume_loop(tmq_t* tmq, tmq_list_t* topicList) {
+ int32_t code;
+
+ if ((code = tmq_subscribe(tmq, topicList))) {
+ fprintf(stderr, "%% Failed to tmq_subscribe(): %s\n", tmq_err2str(code));
+ return;
+ }
+
+ int32_t totalRows = 0;
+ int32_t msgCnt = 0;
+ int32_t consumeDelay = 5000;
+ while (running) {
+ TAOS_RES* tmqmsg = tmq_consumer_poll(tmq, consumeDelay);
+ if (tmqmsg) {
+ msgCnt++;
+ totalRows += msg_process(tmqmsg);
+ taos_free_result(tmqmsg);
+ } else {
+ break;
+ }
+ }
+
+ fprintf(stderr, "%d msg consumed, include %d rows\n", msgCnt, totalRows);
+}
+
+int main(int argc, char* argv[]) {
+ int32_t code;
+
+ if (init_env() < 0) {
+ return -1;
+ }
+
+ if (create_topic() < 0) {
+ return -1;
+ }
+
+ tmq_t* tmq = build_consumer();
+ if (NULL == tmq) {
+ fprintf(stderr, "%% build_consumer() fail!\n");
+ return -1;
+ }
+
+ tmq_list_t* topic_list = build_topic_list();
+ if (NULL == topic_list) {
+ return -1;
+ }
+
+ basic_consume_loop(tmq, topic_list);
+
+ code = tmq_unsubscribe(tmq);
+ if (code) {
+ fprintf(stderr, "%% Failed to unsubscribe: %s\n", tmq_err2str(code));
+ }
+ else {
+ fprintf(stderr, "%% unsubscribe\n");
+ }
+
+ code = tmq_consumer_close(tmq);
+ if (code) {
+ fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code));
+ }
+ else {
+ fprintf(stderr, "%% Consumer closed\n");
+ }
+
+ return 0;
+}
diff --git a/include/common/systable.h b/include/common/systable.h
index ca097cd8d2..ed2e6a46c3 100644
--- a/include/common/systable.h
+++ b/include/common/systable.h
@@ -23,38 +23,38 @@ extern "C" {
#define TDENGINE_SYSTABLE_H
#define TSDB_INFORMATION_SCHEMA_DB "information_schema"
-#define TSDB_INS_TABLE_DNODES "dnodes"
-#define TSDB_INS_TABLE_MNODES "mnodes"
-#define TSDB_INS_TABLE_MODULES "modules"
-#define TSDB_INS_TABLE_QNODES "qnodes"
-#define TSDB_INS_TABLE_BNODES "bnodes"
-#define TSDB_INS_TABLE_SNODES "snodes"
-#define TSDB_INS_TABLE_CLUSTER "cluster"
-#define TSDB_INS_TABLE_USER_DATABASES "user_databases"
-#define TSDB_INS_TABLE_USER_FUNCTIONS "user_functions"
-#define TSDB_INS_TABLE_USER_INDEXES "user_indexes"
-#define TSDB_INS_TABLE_USER_STABLES "user_stables"
-#define TSDB_INS_TABLE_USER_TABLES "user_tables"
-#define TSDB_INS_TABLE_USER_TAGS "user_tags"
-#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
-#define TSDB_INS_TABLE_USER_USERS "user_users"
-#define TSDB_INS_TABLE_LICENCES "grants"
-#define TSDB_INS_TABLE_VGROUPS "vgroups"
-#define TSDB_INS_TABLE_VNODES "vnodes"
-#define TSDB_INS_TABLE_CONFIGS "configs"
-#define TSDB_INS_TABLE_DNODE_VARIABLES "dnode_variables"
+#define TSDB_INS_TABLE_DNODES "ins_dnodes"
+#define TSDB_INS_TABLE_MNODES "ins_mnodes"
+#define TSDB_INS_TABLE_MODULES "ins_modules"
+#define TSDB_INS_TABLE_QNODES "ins_qnodes"
+#define TSDB_INS_TABLE_BNODES "ins_bnodes"
+#define TSDB_INS_TABLE_SNODES "ins_snodes"
+#define TSDB_INS_TABLE_CLUSTER "ins_cluster"
+#define TSDB_INS_TABLE_DATABASES "ins_databases"
+#define TSDB_INS_TABLE_FUNCTIONS "ins_functions"
+#define TSDB_INS_TABLE_INDEXES "ins_indexes"
+#define TSDB_INS_TABLE_STABLES "ins_stables"
+#define TSDB_INS_TABLE_TABLES "ins_tables"
+#define TSDB_INS_TABLE_TAGS "ins_tags"
+#define TSDB_INS_TABLE_TABLE_DISTRIBUTED "ins_table_distributed"
+#define TSDB_INS_TABLE_USERS "ins_users"
+#define TSDB_INS_TABLE_LICENCES "ins_grants"
+#define TSDB_INS_TABLE_VGROUPS "ins_vgroups"
+#define TSDB_INS_TABLE_VNODES "ins_vnodes"
+#define TSDB_INS_TABLE_CONFIGS "ins_configs"
+#define TSDB_INS_TABLE_DNODE_VARIABLES "ins_dnode_variables"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
-#define TSDB_PERFS_TABLE_SMAS "smas"
-#define TSDB_PERFS_TABLE_CONNECTIONS "connections"
-#define TSDB_PERFS_TABLE_QUERIES "queries"
-#define TSDB_PERFS_TABLE_TOPICS "topics"
-#define TSDB_PERFS_TABLE_CONSUMERS "consumers"
-#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "subscriptions"
-#define TSDB_PERFS_TABLE_OFFSETS "offsets"
-#define TSDB_PERFS_TABLE_TRANS "trans"
-#define TSDB_PERFS_TABLE_STREAMS "streams"
-#define TSDB_PERFS_TABLE_APPS "apps"
+#define TSDB_PERFS_TABLE_SMAS "perf_smas"
+#define TSDB_PERFS_TABLE_CONNECTIONS "perf_connections"
+#define TSDB_PERFS_TABLE_QUERIES "perf_queries"
+#define TSDB_PERFS_TABLE_TOPICS "perf_topics"
+#define TSDB_PERFS_TABLE_CONSUMERS "perf_consumers"
+#define TSDB_PERFS_TABLE_SUBSCRIPTIONS "perf_subscriptions"
+#define TSDB_PERFS_TABLE_OFFSETS "perf_offsets"
+#define TSDB_PERFS_TABLE_TRANS "perf_trans"
+#define TSDB_PERFS_TABLE_STREAMS "perf_streams"
+#define TSDB_PERFS_TABLE_APPS "perf_apps"
typedef struct SSysDbTableSchema {
const char* name;
diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h
index 22aac46560..7839859e8b 100644
--- a/include/common/tdatablock.h
+++ b/include/common/tdatablock.h
@@ -184,6 +184,7 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
int32_t getJsonValueLen(const char* data);
int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull);
+int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows);
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
const SColumnInfoData* pSource, int32_t numOfRow2);
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
diff --git a/include/common/tgrant.h b/include/common/tgrant.h
index 6392fcf517..97fb773044 100644
--- a/include/common/tgrant.h
+++ b/include/common/tgrant.h
@@ -49,9 +49,9 @@ int32_t grantCheck(EGrantType grant);
#ifndef GRANTS_CFG
#define GRANTS_SCHEMA static const SSysDbTableSchema grantsSchema[] = { \
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "expire time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "storage(GB)", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
@@ -59,8 +59,8 @@ int32_t grantCheck(EGrantType grant);
{.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "cpu cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
- {.name = "speed(PPS)", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
+ {.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
{.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
}
#define GRANT_CFG_ADD
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index f96095eda6..6189602f07 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -227,8 +227,7 @@ typedef struct SSubmitBlk {
int32_t sversion; // data schema version
int32_t dataLen; // data part length, not including the SSubmitBlk head
int32_t schemaLen; // schema length, if length is 0, no schema exists
- int16_t numOfRows; // total number of rows in current submit block
- int16_t padding; // TODO just for padding here
+ int32_t numOfRows; // total number of rows in current submit block
char data[];
} SSubmitBlk;
@@ -256,7 +255,7 @@ typedef struct {
int32_t sversion; // data schema version
int32_t dataLen; // data part length, not including the SSubmitBlk head
int32_t schemaLen; // schema length, if length is 0, no schema exists
- int16_t numOfRows; // total number of rows in current submit block
+ int32_t numOfRows; // total number of rows in current submit block
// head of SSubmitBlk
int32_t numOfBlocks;
const void* pMsg;
@@ -337,8 +336,10 @@ static FORCE_INLINE SSchemaWrapper* tCloneSSchemaWrapper(const SSchemaWrapper* p
}
static FORCE_INLINE void tDeleteSSchemaWrapper(SSchemaWrapper* pSchemaWrapper) {
- taosMemoryFree(pSchemaWrapper->pSchema);
- taosMemoryFree(pSchemaWrapper);
+ if (pSchemaWrapper) {
+ taosMemoryFree(pSchemaWrapper->pSchema);
+ taosMemoryFree(pSchemaWrapper);
+ }
}
static FORCE_INLINE int32_t taosEncodeSSchema(void** buf, const SSchema* pSchema) {
@@ -2223,6 +2224,7 @@ typedef struct SAppClusterSummary {
uint64_t insertBytes; // submit to tsdb since launched.
uint64_t fetchBytes;
+ uint64_t numOfQueryReq;
uint64_t queryElapsedTime;
uint64_t numOfSlowQueries;
uint64_t totalRequests;
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index 6d243bb8d8..9fb0967193 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -81,6 +81,13 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
*/
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type);
+/**
+ * @brief Cleanup SSDataBlock for StreamScanInfo
+ *
+ * @param tinfo
+ */
+void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo);
+
/**
* Update the table id list, add or remove.
*
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 32a53c9f4e..21d3fa92a8 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -253,7 +253,8 @@ typedef struct SShowCreateTableStmt {
ENodeType type;
char dbName[TSDB_DB_NAME_LEN];
char tableName[TSDB_TABLE_NAME_LEN];
- void* pCfg; // STableCfg
+ void* pDbCfg; // SDbCfgInfo
+ void* pTableCfg; // STableCfg
} SShowCreateTableStmt;
typedef struct SShowTableDistributedStmt {
@@ -282,6 +283,7 @@ typedef struct SCreateIndexStmt {
ENodeType type;
EIndexType indexType;
bool ignoreExists;
+ char indexDbName[TSDB_DB_NAME_LEN];
char indexName[TSDB_INDEX_NAME_LEN];
char dbName[TSDB_DB_NAME_LEN];
char tableName[TSDB_TABLE_NAME_LEN];
@@ -292,6 +294,7 @@ typedef struct SCreateIndexStmt {
typedef struct SDropIndexStmt {
ENodeType type;
bool ignoreNotExists;
+ char indexDbName[TSDB_DB_NAME_LEN];
char indexName[TSDB_INDEX_NAME_LEN];
} SDropIndexStmt;
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 2f6bb603c1..40879de3bc 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -114,6 +114,7 @@ typedef struct SAggLogicNode {
SNodeList* pAggFuncs;
bool hasLastRow;
bool hasTimeLineFunc;
+ bool onlyHasKeepOrderFunc;
} SAggLogicNode;
typedef struct SProjectLogicNode {
@@ -552,6 +553,8 @@ typedef struct SQueryPlan {
void nodesWalkPhysiPlan(SNode* pNode, FNodeWalker walker, void* pContext);
+const char* dataOrderStr(EDataOrderLevel order);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index cd2a7d3f9f..db87bde521 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -269,6 +269,7 @@ typedef struct SSelectStmt {
bool hasInterpFunc;
bool hasLastRowFunc;
bool hasTimeLineFunc;
+ bool onlyHasKeepOrderFunc;
bool groupSort;
} SSelectStmt;
diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h
index b62f822313..34d870397f 100644
--- a/include/libs/qcom/query.h
+++ b/include/libs/qcom/query.h
@@ -71,6 +71,7 @@ typedef struct SIndexMeta {
typedef struct SExecResult {
int32_t code;
uint64_t numOfRows;
+ uint64_t numOfBytes;
int32_t msgType;
void* res;
} SExecResult;
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index 240415b66b..103ca6a4f0 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -46,9 +46,10 @@ enum {
};
enum {
- TASK_EXEC_STATUS__IDLE = 1,
- TASK_EXEC_STATUS__EXECUTING,
- TASK_EXEC_STATUS__CLOSING,
+ TASK_SCHED_STATUS__INACTIVE = 1,
+ TASK_SCHED_STATUS__WAITING,
+ TASK_SCHED_STATUS__ACTIVE,
+ TASK_SCHED_STATUS__FAILED,
};
enum {
@@ -65,6 +66,25 @@ enum {
TASK_OUTPUT_STATUS__BLOCKED,
};
+enum {
+ TASK_TRIGGER_STATUS__INACTIVE = 1,
+ TASK_TRIGGER_STATUS__ACTIVE,
+};
+
+enum {
+ TASK_LEVEL__SOURCE = 1,
+ TASK_LEVEL__AGG,
+ TASK_LEVEL__SINK,
+};
+
+enum {
+ TASK_OUTPUT__FIXED_DISPATCH = 1,
+ TASK_OUTPUT__SHUFFLE_DISPATCH,
+ TASK_OUTPUT__TABLE,
+ TASK_OUTPUT__SMA,
+ TASK_OUTPUT__FETCH,
+};
+
typedef struct {
int8_t type;
} SStreamQueueItem;
@@ -201,41 +221,6 @@ typedef struct {
int8_t reserved;
} STaskSinkFetch;
-enum {
- TASK_SOURCE__SCAN = 1,
- TASK_SOURCE__PIPE,
- TASK_SOURCE__MERGE,
-};
-
-enum {
- TASK_EXEC__NONE = 1,
- TASK_EXEC__PIPE,
- TASK_EXEC__MERGE,
-};
-
-enum {
- TASK_DISPATCH__NONE = 1,
- TASK_DISPATCH__FIXED,
- TASK_DISPATCH__SHUFFLE,
-};
-
-enum {
- TASK_SINK__NONE = 1,
- TASK_SINK__TABLE,
- TASK_SINK__SMA,
- TASK_SINK__FETCH,
-};
-
-enum {
- TASK_INPUT_TYPE__SUMBIT_BLOCK = 1,
- TASK_INPUT_TYPE__DATA_BLOCK,
-};
-
-enum {
- TASK_TRIGGER_STATUS__IN_ACTIVE = 1,
- TASK_TRIGGER_STATUS__ACTIVE,
-};
-
typedef struct {
int32_t nodeId;
int32_t childId;
@@ -248,28 +233,24 @@ typedef struct {
typedef struct SStreamTask {
int64_t streamId;
int32_t taskId;
- int8_t isDataScan;
- int8_t execType;
- int8_t sinkType;
- int8_t dispatchType;
- int8_t isStreamDistributed;
+ int8_t taskLevel;
+ int8_t outputType;
int16_t dispatchMsgType;
int8_t taskStatus;
- int8_t execStatus;
+ int8_t schedStatus;
// node info
int32_t selfChildId;
int32_t nodeId;
SEpSet epSet;
- // used for semi or single task,
- // while final task should have processedVer for each child
+ // used for task source and sink,
+ // while task agg should have processedVer for each child
int64_t recoverSnapVer;
int64_t startVer;
int64_t checkpointVer;
int64_t processedVer;
- // int32_t numOfVgroups;
// children info
SArray* childEpInfo; // SArray
@@ -277,19 +258,13 @@ typedef struct SStreamTask {
// exec
STaskExec exec;
- // TODO: unify sink and dispatch
-
- // local sink
- union {
- STaskSinkTb tbSink;
- STaskSinkSma smaSink;
- STaskSinkFetch fetchSink;
- };
-
- // remote dispatcher
+ // output
union {
STaskDispatcherFixedEp fixedEpDispatcher;
STaskDispatcherShuffle shuffleDispatcher;
+ STaskSinkTb tbSink;
+ STaskSinkSma smaSink;
+ STaskSinkFetch fetchSink;
};
int8_t inputStatus;
@@ -303,9 +278,6 @@ typedef struct SStreamTask {
int64_t triggerParam;
void* timer;
- // application storage
- // void* ahandle;
-
// msg handle
SMsgCb* pMsgCb;
} SStreamTask;
@@ -342,7 +314,7 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
}
if (pItem->type != STREAM_INPUT__GET_RES && pItem->type != STREAM_INPUT__CHECKPOINT && pTask->triggerParam != 0) {
- atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__IN_ACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
+ atomic_val_compare_exchange_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE, TASK_TRIGGER_STATUS__ACTIVE);
}
#if 0
@@ -357,18 +329,15 @@ static FORCE_INLINE void streamTaskInputFail(SStreamTask* pTask) {
}
static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBlock* pBlock) {
- if (pTask->sinkType == TASK_SINK__TABLE) {
- ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE);
+ if (pTask->outputType == TASK_OUTPUT__TABLE) {
pTask->tbSink.tbSinkFunc(pTask, pTask->tbSink.vnode, 0, pBlock->blocks);
taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes);
taosFreeQitem(pBlock);
- } else if (pTask->sinkType == TASK_SINK__SMA) {
- ASSERT(pTask->dispatchType == TASK_DISPATCH__NONE);
+ } else if (pTask->outputType == TASK_OUTPUT__SMA) {
pTask->smaSink.smaSink(pTask->smaSink.vnode, pTask->smaSink.smaId, pBlock->blocks);
taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes);
taosFreeQitem(pBlock);
} else {
- ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE);
taosWriteQitem(pTask->outputQueue->queue, pBlock);
}
return 0;
@@ -475,11 +444,10 @@ typedef struct {
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
-int32_t streamLaunchByWrite(SStreamTask* pTask, int32_t vgId);
int32_t streamSetupTrigger(SStreamTask* pTask);
int32_t streamProcessRunReq(SStreamTask* pTask);
-int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg);
+int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg, bool exec);
int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp);
int32_t streamProcessRecoverReq(SStreamTask* pTask, SStreamTaskRecoverReq* pReq, SRpcMsg* pMsg);
int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp);
@@ -487,6 +455,21 @@ int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp)
int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pMsg);
int32_t streamProcessRetrieveRsp(SStreamTask* pTask, SStreamRetrieveRsp* pRsp);
+int32_t streamTryExec(SStreamTask* pTask);
+int32_t streamSchedExec(SStreamTask* pTask);
+
+typedef struct SStreamMeta SStreamMeta;
+
+SStreamMeta* streamMetaOpen();
+void streamMetaClose(SStreamMeta* streamMeta);
+
+int32_t streamMetaAddTask(SStreamMeta* pMeta, SStreamTask* pTask);
+int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
+
+int32_t streamMetaBegin(SStreamMeta* pMeta);
+int32_t streamMetaCommit(SStreamMeta* pMeta);
+int32_t streamMetaRollBack(SStreamMeta* pMeta);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/os/osEnv.h b/include/os/osEnv.h
index a3f92a0b29..798bfc197e 100644
--- a/include/os/osEnv.h
+++ b/include/os/osEnv.h
@@ -49,6 +49,8 @@ void osDefaultInit();
void osUpdate();
void osCleanup();
bool osLogSpaceAvailable();
+bool osDataSpaceAvailable();
+bool osTempSpaceAvailable();
void osSetTimezone(const char *timezone);
void osSetSystemLocale(const char *inLocale, const char *inCharSet);
diff --git a/include/os/osFile.h b/include/os/osFile.h
index 2f6a6ba480..21e3d2e6cf 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -54,6 +54,7 @@ typedef struct TdFile *TdFilePtr;
#define TD_FILE_EXCL 0x0080
#define TD_FILE_STREAM 0x0100 // Only support taosFprintfFile, taosGetLineFile, taosEOFFile
TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions);
+TdFilePtr taosCreateFile(const char *path, int32_t tdFileOptions);
#define TD_FILE_ACCESS_EXIST_OK 0x1
#define TD_FILE_ACCESS_READ_OK 0x2
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index b15be12490..97a664d776 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -608,6 +608,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
#define TSDB_CODE_RSMA_QTASKINFO_CREATE TAOS_DEF_ERROR_CODE(0, 0x3152)
#define TSDB_CODE_RSMA_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x3153)
+#define TSDB_CODE_RSMA_REMOVE_EXISTS TAOS_DEF_ERROR_CODE(0, 0x3154)
//index
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
diff --git a/packaging/docker/bin/entrypoint.sh b/packaging/docker/bin/entrypoint.sh
old mode 100644
new mode 100755
diff --git a/packaging/docker/bin/env-to-cfg b/packaging/docker/bin/env-to-cfg
old mode 100644
new mode 100755
diff --git a/packaging/docker/bin/taos-check b/packaging/docker/bin/taos-check
old mode 100644
new mode 100755
diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh
old mode 100644
new mode 100755
diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh
old mode 100644
new mode 100755
diff --git a/packaging/docker/dockerbuildi.sh b/packaging/docker/dockerbuildi.sh
old mode 100644
new mode 100755
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 2831e7a904..e7a099cf23 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -225,10 +225,12 @@ typedef struct SRequestObj {
SArray* targetTableList;
SQueryExecMetric metric;
SRequestSendRecvBody body;
+ int32_t stmtType;
bool syncQuery; // todo refactor: async query object
bool stableQuery; // todo refactor
bool validateOnly; // todo refactor
bool killed;
+ bool inRetry;
uint32_t prevCode; // previous error code: todo refactor, add update flag for catalog
uint32_t retry;
} SRequestObj;
@@ -326,7 +328,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
STscObj* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
uint16_t port, int connType);
-SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly);
+SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry);
int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb);
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 95ce5c8338..d88a587f6a 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -60,6 +60,7 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
}
static void deregisterRequest(SRequestObj *pRequest) {
+ const static int64_t SLOW_QUERY_INTERVAL = 3000000L; // todo configurable
assert(pRequest != NULL);
STscObj *pTscObj = pRequest->pTscObj;
@@ -72,6 +73,17 @@ static void deregisterRequest(SRequestObj *pRequest) {
tscDebug("0x%" PRIx64 " free Request from connObj: 0x%" PRIx64 ", reqId:0x%" PRIx64 " elapsed:%" PRIu64
" ms, current:%d, app current:%d",
pRequest->self, pTscObj->id, pRequest->requestId, duration / 1000, num, currentInst);
+
+ if (QUERY_NODE_VNODE_MODIF_STMT == pRequest->stmtType) {
+ atomic_add_fetch_64((int64_t *)&pActivity->insertElapsedTime, duration);
+ } else if (QUERY_NODE_SELECT_STMT == pRequest->stmtType) {
+ atomic_add_fetch_64((int64_t *)&pActivity->queryElapsedTime, duration);
+ }
+
+ if (duration >= SLOW_QUERY_INTERVAL) {
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfSlowQueries, 1);
+ }
+
releaseTscObj(pTscObj->id);
}
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 6f8e7d0237..0c4dc1705c 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -688,7 +688,12 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
if (TDMT_VND_SUBMIT == pRequest->type || TDMT_VND_DELETE == pRequest->type ||
TDMT_VND_CREATE_TABLE == pRequest->type) {
pRequest->body.resInfo.numOfRows = res.numOfRows;
-
+ if (TDMT_VND_SUBMIT == pRequest->type) {
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertRows, res.numOfRows);
+ }
+
schedulerFreeJob(&pRequest->body.queryJob, 0);
}
@@ -795,6 +800,8 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
break;
}
case TDMT_VND_SUBMIT: {
+ atomic_add_fetch_64((int64_t *)&pAppInfo->summary.insertBytes, pRes->numOfBytes);
+
code = handleSubmitExecRes(pRequest, pRes->res, pCatalog, &epset);
break;
}
@@ -824,6 +831,11 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
TDMT_VND_CREATE_TABLE == pRequest->type) {
if (pResult) {
pRequest->body.resInfo.numOfRows = pResult->numOfRows;
+ if (TDMT_VND_SUBMIT == pRequest->type) {
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertRows, pResult->numOfRows);
+ }
}
schedulerFreeJob(&pRequest->body.queryJob, 0);
@@ -862,6 +874,20 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) {
SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQuery, void** res) {
int32_t code = 0;
+ if (pQuery->pRoot) {
+ pRequest->stmtType = pQuery->pRoot->type;
+ }
+
+ if (pQuery->pRoot && !pRequest->inRetry) {
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ if (QUERY_NODE_VNODE_MODIF_STMT == pQuery->pRoot->type) {
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
+ } else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) {
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
+ }
+ }
+
switch (pQuery->execMode) {
case QUERY_EXEC_MODE_LOCAL:
if (!pRequest->validateOnly) {
@@ -915,7 +941,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue
return pRequest;
}
-SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly) {
+SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry) {
SRequestObj* pRequest = NULL;
SQuery* pQuery = NULL;
@@ -931,6 +957,7 @@ SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool vali
return pRequest;
}
+ pRequest->inRetry = inRetry;
pRequest->stableQuery = pQuery->stableQuery;
return launchQueryImpl(pRequest, pQuery, false, NULL);
@@ -1079,10 +1106,11 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
SRequestObj* pRequest = NULL;
int32_t retryNum = 0;
int32_t code = 0;
+ bool inRetry = false;
do {
destroyRequest(pRequest);
- pRequest = launchQuery(connId, sql, sqlLen, validateOnly);
+ pRequest = launchQuery(connId, sql, sqlLen, validateOnly, inRetry);
if (pRequest == NULL || TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) {
break;
}
@@ -1092,6 +1120,8 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida
pRequest->code = code;
break;
}
+
+ inRetry = true;
} while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES);
if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
@@ -1437,6 +1467,10 @@ void* doFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUcs4)
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ atomic_add_fetch_64((int64_t *)&pActivity->fetchBytes, pRequest->body.resInfo.payloadLen);
+
if (pResultInfo->numOfRows == 0) {
return NULL;
}
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index a4eaf057d1..6785390952 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -76,7 +76,7 @@ void taos_cleanup(void) {
cleanupTaskQueue();
taosConvDestroy();
-
+
tscInfo("all local resources released");
taosCleanupCfg();
taosCloseLog();
@@ -679,6 +679,9 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
if (code == TSDB_CODE_SUCCESS) {
code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery);
pRequest->stableQuery = pQuery->stableQuery;
+ if (pQuery->pRoot) {
+ pRequest->stmtType = pQuery->pRoot->type;
+ }
}
if (code == TSDB_CODE_SUCCESS) {
@@ -778,6 +781,16 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
goto _error;
}
+ if (!updateMetaForce) {
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ if (NULL == pQuery->pRoot) {
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1);
+ } else if (QUERY_NODE_SELECT_STMT == pQuery->pRoot->type) {
+ atomic_add_fetch_64((int64_t *)&pActivity->numOfQueryReq, 1);
+ }
+ }
+
SqlParseWrapper *pWrapper = taosMemoryCalloc(1, sizeof(SqlParseWrapper));
if (pWrapper == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -796,6 +809,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
code = catalogAsyncGetAllMeta(pCxt->pCatalog, &conn, &catalogReq, retrieveMetaCallback, pWrapper,
&pRequest->body.queryJob);
+ pCxt = NULL;
if (code == TSDB_CODE_SUCCESS) {
return;
}
@@ -803,6 +817,8 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
_error:
tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code),
pRequest->requestId);
+ taosMemoryFree(pCxt);
+
terrno = code;
pRequest->code = code;
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
@@ -841,6 +857,10 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
pRequest->self, pResultInfo->numOfRows, pResultInfo->totalRows, pResultInfo->completed,
pRequest->requestId);
+
+ STscObj *pTscObj = pRequest->pTscObj;
+ SAppClusterSummary *pActivity = &pTscObj->pAppInfo->summary;
+ atomic_add_fetch_64((int64_t *)&pActivity->fetchBytes, pRequest->body.resInfo.payloadLen);
}
pRequest->body.fetchFp(pRequest->body.param, pRequest, pResultInfo->numOfRows);
diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c
index db33532aef..4217cf08b3 100644
--- a/source/client/src/clientMsgHandler.c
+++ b/source/client/src/clientMsgHandler.c
@@ -30,6 +30,10 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
SRequestObj* pRequest = param;
setErrno(pRequest, code);
+ if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) {
+ removeMeta(pRequest->pTscObj, pRequest->targetTableList);
+ }
+
taosMemoryFree(pMsg->pData);
if (pRequest->body.queryFp != NULL) {
pRequest->body.queryFp(pRequest->body.param, pRequest, code);
diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c
index 56d09850fc..9f905a8352 100644
--- a/source/client/src/clientSml.c
+++ b/source/client/src/clientSml.c
@@ -421,6 +421,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SSmlSTableMeta *s
tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq);
SQuery pQuery;
+ memset(&pQuery, 0, sizeof(pQuery));
pQuery.execMode = QUERY_EXEC_MODE_RPC;
pQuery.pCmdMsg = &pCmdMsg;
pQuery.msgType = pQuery.pCmdMsg->msgType;
diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c
index 9c06568d62..64703ed28f 100644
--- a/source/client/src/tmq.c
+++ b/source/client/src/tmq.c
@@ -189,20 +189,6 @@ typedef struct {
tsem_t rspSem;
} SMqPollCbParam;
-#if 0
-typedef struct {
- tmq_t* tmq;
- int8_t async;
- int8_t automatic;
- int8_t freeOffsets;
- tmq_commit_cb* userCb;
- tsem_t rspSem;
- int32_t rspErr;
- SArray* offsets;
- void* userParam;
-} SMqCommitCbParam;
-#endif
-
typedef struct {
tmq_t* tmq;
int8_t automatic;
@@ -385,29 +371,6 @@ static int32_t tmqMakeTopicVgKey(char* dst, const char* topicName, int32_t vg) {
return sprintf(dst, "%s:%d", topicName, vg);
}
-#if 0
-int32_t tmqCommitCb(void* param, const SDataBuf* pMsg, int32_t code) {
- SMqCommitCbParam* pParam = (SMqCommitCbParam*)param;
- pParam->rspErr = code;
- if (pParam->async) {
- if (pParam->automatic && pParam->tmq->commitCb) {
- pParam->tmq->commitCb(pParam->tmq, pParam->rspErr, pParam->tmq->commitCbUserParam);
- } else if (!pParam->automatic && pParam->userCb) {
- pParam->userCb(pParam->tmq, pParam->rspErr, pParam->userParam);
- }
-
- if (pParam->freeOffsets) {
- taosArrayDestroy(pParam->offsets);
- }
-
- taosMemoryFree(pParam);
- } else {
- tsem_post(&pParam->rspSem);
- }
- return 0;
-}
-#endif
-
int32_t tmqCommitCb2(void* param, SDataBuf* pBuf, int32_t code) {
SMqCommitCbParam2* pParam = (SMqCommitCbParam2*)param;
SMqCommitCbParamSet* pParamSet = (SMqCommitCbParamSet*)pParam->params;
@@ -504,15 +467,16 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
pMsgSendInfo->requestId = generateRequestId();
pMsgSendInfo->requestObjRefId = 0;
pMsgSendInfo->param = pParam;
- pMsgSendInfo->paramFreeFp = taosMemoryFree;
+ pMsgSendInfo->paramFreeFp = taosMemoryFree;
pMsgSendInfo->fp = tmqCommitCb2;
pMsgSendInfo->msgType = TDMT_VND_MQ_COMMIT_OFFSET;
// send msg
+ atomic_add_fetch_32(&pParamSet->waitingRspNum, 1);
+ atomic_add_fetch_32(&pParamSet->totalRspNum, 1);
+
int64_t transporterId = 0;
asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, pMsgSendInfo);
- pParamSet->waitingRspNum++;
- pParamSet->totalRspNum++;
return 0;
}
@@ -659,123 +623,6 @@ int32_t tmqCommitInner2(tmq_t* tmq, const TAOS_RES* msg, int8_t automatic, int8_
return 0;
}
-#if 0
-int32_t tmqCommitInner(tmq_t* tmq, const TAOS_RES* msg, int8_t automatic, int8_t async,
- tmq_commit_cb* userCb, void* userParam) {
- SMqCMCommitOffsetReq req;
- SArray* pOffsets = NULL;
- void* buf = NULL;
- SMqCommitCbParam* pParam = NULL;
- SMsgSendInfo* sendInfo = NULL;
- int8_t freeOffsets;
- int32_t code = -1;
-
- if (msg == NULL) {
- freeOffsets = 1;
- pOffsets = taosArrayInit(0, sizeof(SMqOffset));
- for (int32_t i = 0; i < taosArrayGetSize(tmq->clientTopics); i++) {
- SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
- for (int32_t j = 0; j < taosArrayGetSize(pTopic->vgs); j++) {
- SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
- SMqOffset offset;
- tstrncpy(offset.topicName, pTopic->topicName, TSDB_TOPIC_FNAME_LEN);
- tstrncpy(offset.cgroup, tmq->groupId, TSDB_CGROUP_LEN);
- offset.vgId = pVg->vgId;
- offset.offset = pVg->currentOffset;
- taosArrayPush(pOffsets, &offset);
- }
- }
- } else {
- freeOffsets = 0;
- pOffsets = (SArray*)&msg->container;
- }
-
- req.num = (int32_t)pOffsets->size;
- req.offsets = pOffsets->pData;
-
- SEncoder encoder;
-
- tEncoderInit(&encoder, NULL, 0);
- code = tEncodeSMqCMCommitOffsetReq(&encoder, &req);
- if (code < 0) {
- goto END;
- }
- int32_t tlen = encoder.pos;
- buf = taosMemoryMalloc(tlen);
- if (buf == NULL) {
- tEncoderClear(&encoder);
- goto END;
- }
- tEncoderClear(&encoder);
-
- tEncoderInit(&encoder, buf, tlen);
- tEncodeSMqCMCommitOffsetReq(&encoder, &req);
- tEncoderClear(&encoder);
-
- pParam = taosMemoryCalloc(1, sizeof(SMqCommitCbParam));
- if (pParam == NULL) {
- goto END;
- }
- pParam->tmq = tmq;
- pParam->automatic = automatic;
- pParam->async = async;
- pParam->offsets = pOffsets;
- pParam->freeOffsets = freeOffsets;
- pParam->userCb = userCb;
- pParam->userParam = userParam;
- if (!async) tsem_init(&pParam->rspSem, 0, 0);
-
- sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
- if (sendInfo == NULL) goto END;
- sendInfo->msgInfo = (SDataBuf){
- .pData = buf,
- .len = tlen,
- .handle = NULL,
- };
-
- sendInfo->requestId = generateRequestId();
- sendInfo->requestObjRefId = 0;
- sendInfo->param = pParam;
- sendInfo->fp = tmqCommitCb;
- sendInfo->msgType = TDMT_MND_MQ_COMMIT_OFFSET;
-
- SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp);
-
- int64_t transporterId = 0;
- asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
-
- if (!async) {
- tsem_wait(&pParam->rspSem);
- code = pParam->rspErr;
- tsem_destroy(&pParam->rspSem);
- taosMemoryFree(pParam);
- } else {
- code = 0;
- }
-
- // avoid double free if msg is sent
- buf = NULL;
-
-END:
- if (buf) taosMemoryFree(buf);
- /*if (pParam) taosMemoryFree(pParam);*/
- /*if (sendInfo) taosMemoryFree(sendInfo);*/
-
- if (code != 0 && async) {
- if (automatic) {
- tmq->commitCb(tmq, code, (tmq_topic_vgroup_list_t*)pOffsets, tmq->commitCbUserParam);
- } else {
- userCb(tmq, code, (tmq_topic_vgroup_list_t*)pOffsets, userParam);
- }
- }
-
- if (!async && freeOffsets) {
- taosArrayDestroy(pOffsets);
- }
- return code;
-}
-#endif
-
void tmqAssignAskEpTask(void* param, void* tmrId) {
tmq_t* tmq = (tmq_t*)param;
int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM);
@@ -961,7 +808,8 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
tmq_t* pTmq = taosMemoryCalloc(1, sizeof(tmq_t));
if (pTmq == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- tscError("consumer %ld setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(), pTmq->groupId);
+ tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ pTmq->groupId);
return NULL;
}
@@ -979,7 +827,8 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
if (pTmq->clientTopics == NULL || pTmq->mqueue == NULL || pTmq->qall == NULL || pTmq->delayedTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- tscError("consumer %ld setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(), pTmq->groupId);
+ tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ pTmq->groupId);
goto FAIL;
}
@@ -1008,14 +857,16 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
// init semaphore
if (tsem_init(&pTmq->rspSem, 0, 0) != 0) {
- tscError("consumer %ld setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(), pTmq->groupId);
+ tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ pTmq->groupId);
goto FAIL;
}
// init connection
pTmq->pTscObj = taos_connect_internal(conf->ip, user, pass, NULL, NULL, conf->port, CONN_TYPE__TMQ);
if (pTmq->pTscObj == NULL) {
- tscError("consumer %ld setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(), pTmq->groupId);
+ tscError("consumer %" PRId64 " setup failed since %s, consumer group %s", pTmq->consumerId, terrstr(),
+ pTmq->groupId);
tsem_destroy(&pTmq->rspSem);
goto FAIL;
}
@@ -1024,7 +875,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->hbLiveTimer = taosTmrStart(tmqSendHbReq, 1000, pTmq, tmqMgmt.timer);
}
- tscInfo("consumer %ld is setup, consumer group %s", pTmq->consumerId, pTmq->groupId);
+ tscInfo("consumer %" PRId64 " is setup, consumer group %s", pTmq->consumerId, pTmq->groupId);
return pTmq;
@@ -1836,13 +1687,21 @@ int32_t tmq_consumer_close(tmq_t* tmq) {
return rsp;
}
+ int32_t retryCnt = 0;
tmq_list_t* lst = tmq_list_new();
- rsp = tmq_subscribe(tmq, lst);
+ while (1) {
+ rsp = tmq_subscribe(tmq, lst);
+ if (rsp != TSDB_CODE_MND_CONSUMER_NOT_READY || retryCnt > 5) {
+ break;
+ } else {
+ retryCnt++;
+ taosMsleep(500);
+ }
+ }
+
tmq_list_destroy(lst);
- if (rsp != 0) {
- return rsp;
- }
+ return rsp;
}
// TODO: free resources
return 0;
@@ -2194,7 +2053,7 @@ static char* buildCreateCTableJson(STag* pTag, char* sname, char* name, SArray*
cJSON* tvalue = NULL;
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
char* buf = taosMemoryCalloc(pTagVal->nData + 3, 1);
- if(!buf) goto end;
+ if (!buf) goto end;
dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL);
tvalue = cJSON_CreateString(buf);
taosMemoryFree(buf);
@@ -2504,8 +2363,8 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
launchQueryImpl(pRequest, &pQuery, true, NULL);
- if(pRequest->code == TSDB_CODE_SUCCESS){
- SCatalog* pCatalog = NULL;
+ if (pRequest->code == TSDB_CODE_SUCCESS) {
+ SCatalog* pCatalog = NULL;
catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog);
catalogRemoveTableMeta(pCatalog, &tableName);
}
@@ -2573,8 +2432,8 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
launchQueryImpl(pRequest, &pQuery, true, NULL);
- if(pRequest->code == TSDB_CODE_SUCCESS){
- SCatalog* pCatalog = NULL;
+ if (pRequest->code == TSDB_CODE_SUCCESS) {
+ SCatalog* pCatalog = NULL;
catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog);
catalogRemoveTableMeta(pCatalog, &tableName);
}
@@ -2693,7 +2552,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
}
launchQueryImpl(pRequest, pQuery, true, NULL);
- if (pRequest->code == TSDB_CODE_SUCCESS){
+ if (pRequest->code == TSDB_CODE_SUCCESS) {
removeMeta(pTscObj, pRequest->tableList);
}
@@ -2810,7 +2669,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
}
launchQueryImpl(pRequest, pQuery, true, NULL);
- if (pRequest->code == TSDB_CODE_SUCCESS){
+ if (pRequest->code == TSDB_CODE_SUCCESS) {
removeMeta(pTscObj, pRequest->tableList);
}
code = pRequest->code;
@@ -2825,7 +2684,7 @@ end:
// delete from db.tabl where .. -> delete from tabl where ..
// delete from db .tabl where .. -> delete from tabl where ..
-//static void getTbName(char *sql){
+// static void getTbName(char *sql){
// char *ch = sql;
//
// bool inBackQuote = false;
@@ -2856,9 +2715,9 @@ end:
//}
static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
- SDeleteRes req = {0};
- SDecoder coder = {0};
- int32_t code = TSDB_CODE_SUCCESS;
+ SDeleteRes req = {0};
+ SDecoder coder = {0};
+ int32_t code = TSDB_CODE_SUCCESS;
// decode and process req
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
@@ -2869,13 +2728,14 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
goto end;
}
-// getTbName(req.tableFName);
+ // getTbName(req.tableFName);
char sql[256] = {0};
- sprintf(sql, "delete from `%s` where `%s` >= %" PRId64" and `%s` <= %" PRId64, req.tableFName, req.tsColName, req.skey, req.tsColName, req.ekey);
+ sprintf(sql, "delete from `%s` where `%s` >= %" PRId64 " and `%s` <= %" PRId64, req.tableFName, req.tsColName,
+ req.skey, req.tsColName, req.ekey);
printf("delete sql:%s\n", sql);
- TAOS_RES* res = taos_query(taos, sql);
- SRequestObj *pRequest = (SRequestObj *)res;
+ TAOS_RES* res = taos_query(taos, sql);
+ SRequestObj* pRequest = (SRequestObj*)res;
code = pRequest->code;
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
code = TSDB_CODE_SUCCESS;
@@ -2983,9 +2843,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
code = TSDB_CODE_SUCCESS;
}
- if(pRequest->code == TSDB_CODE_SUCCESS){
+ if (pRequest->code == TSDB_CODE_SUCCESS) {
SExecResult* pRes = &pRequest->body.resInfo.execRes;
- if(pRes->res != NULL){
+ if (pRes->res != NULL) {
code = handleAlterTbExecRes(pRes->res, pCatalog);
}
}
@@ -2999,23 +2859,23 @@ end:
return code;
}
-typedef struct{
+typedef struct {
SVgroupInfo vg;
- void *data;
-}VgData;
+ void* data;
+} VgData;
static void destroyVgHash(void* data) {
VgData* vgData = (VgData*)data;
taosMemoryFreeClear(vgData->data);
}
-int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
- int32_t code = TSDB_CODE_SUCCESS;
+int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname) {
+ int32_t code = TSDB_CODE_SUCCESS;
STableMeta* pTableMeta = NULL;
- SQuery *pQuery = NULL;
+ SQuery* pQuery = NULL;
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
- if(!pRequest){
+ if (!pRequest) {
uError("WriteRaw:createRequest error request is null");
code = terrno;
goto end;
@@ -3031,9 +2891,9 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
strcpy(pName.dbname, pRequest->pDb);
strcpy(pName.tname, tbname);
- struct SCatalog *pCatalog = NULL;
+ struct SCatalog* pCatalog = NULL;
code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
uError("WriteRaw: get gatlog error");
goto end;
}
@@ -3058,17 +2918,17 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
}
uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid);
uint64_t uid = pTableMeta->uid;
- int32_t numOfCols = pTableMeta->tableInfo.numOfColumns;
+ int32_t numOfCols = pTableMeta->tableInfo.numOfColumns;
uint16_t fLen = 0;
- int32_t rowSize = 0;
- int16_t nVar = 0;
+ int32_t rowSize = 0;
+ int16_t nVar = 0;
for (int i = 0; i < numOfCols; i++) {
- SSchema *schema = pTableMeta->schema + i;
+ SSchema* schema = pTableMeta->schema + i;
fLen += TYPE_BYTES[schema->type];
rowSize += schema->bytes;
- if(IS_VAR_DATA_TYPE(schema->type)){
- nVar ++;
+ if (IS_VAR_DATA_TYPE(schema->type)) {
+ nVar++;
}
}
@@ -3077,22 +2937,22 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
int32_t schemaLen = 0;
int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize;
- int32_t totalLen = sizeof(SSubmitReq) + submitLen;
+ int32_t totalLen = sizeof(SSubmitReq) + submitLen;
SSubmitReq* subReq = taosMemoryCalloc(1, totalLen);
SSubmitBlk* blk = POINTER_SHIFT(subReq, sizeof(SSubmitReq));
- void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
- STSRow* rowData = POINTER_SHIFT(blkSchema, schemaLen);
+ void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
+ STSRow* rowData = POINTER_SHIFT(blkSchema, schemaLen);
SRowBuilder rb = {0};
tdSRowInit(&rb, pTableMeta->sversion);
tdSRowSetTpInfo(&rb, numOfCols, fLen);
int32_t dataLen = 0;
- char* pStart = pData + sizeof(int32_t) + sizeof(uint64_t) + numOfCols * (sizeof(int16_t) + sizeof(int32_t));
+ char* pStart = pData + sizeof(int32_t) + sizeof(uint64_t) + numOfCols * (sizeof(int16_t) + sizeof(int32_t));
int32_t* colLength = (int32_t*)pStart;
pStart += sizeof(int32_t) * numOfCols;
- SResultColumn *pCol = taosMemoryCalloc(numOfCols, sizeof(SResultColumn));
+ SResultColumn* pCol = taosMemoryCalloc(numOfCols, sizeof(SResultColumn));
for (int32_t i = 0; i < numOfCols; ++i) {
if (IS_VAR_DATA_TYPE(pTableMeta->schema[i].type)) {
@@ -3111,7 +2971,7 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
tdSRowResetBuf(&rb, rowData);
int32_t offset = 0;
for (int32_t k = 0; k < numOfCols; k++) {
- const SSchema* pColumn = &pTableMeta->schema[k];
+ const SSchema* pColumn = &pTableMeta->schema[k];
if (IS_VAR_DATA_TYPE(pColumn->type)) {
if (pCol[k].offset[j] != -1) {
@@ -3140,10 +3000,9 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
blk->uid = htobe64(uid);
blk->suid = htobe64(suid);
- blk->padding = htonl(blk->padding);
blk->sversion = htonl(pTableMeta->sversion);
blk->schemaLen = htonl(schemaLen);
- blk->numOfRows = htons(rows);
+ blk->numOfRows = htonl(rows);
blk->dataLen = htonl(dataLen);
subReq->length = sizeof(SSubmitReq) + sizeof(SSubmitBlk) + schemaLen + dataLen;
subReq->numOfBlocks = 1;
@@ -3157,17 +3016,17 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE;
pQuery->haveResultSet = false;
pQuery->msgType = TDMT_VND_SUBMIT;
- pQuery->pRoot = (SNode *)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
+ pQuery->pRoot = (SNode*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
if (NULL == pQuery->pRoot) {
uError("create pQuery->pRoot error");
code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
- SVnodeModifOpStmt *nodeStmt = (SVnodeModifOpStmt *)(pQuery->pRoot);
+ SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
nodeStmt->pDataBlocks = taosArrayInit(1, POINTER_BYTES);
- SVgDataBlocks *dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
+ SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
if (NULL == dst) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto end;
@@ -3181,7 +3040,7 @@ int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){
subReq->header.contLen = htonl(subReq->length);
subReq->length = htonl(subReq->length);
subReq->numOfBlocks = htonl(subReq->numOfBlocks);
- subReq = NULL; // no need free
+ subReq = NULL; // no need free
taosArrayPush(nodeStmt->pDataBlocks, &dst);
launchQueryImpl(pRequest, pQuery, true, NULL);
@@ -3193,16 +3052,16 @@ end:
return code;
}
-static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
- int32_t code = TSDB_CODE_SUCCESS;
- SHashObj *pVgHash = NULL;
- SQuery *pQuery = NULL;
+static int32_t tmqWriteRaw(TAOS* taos, void* data, int32_t dataLen) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ SHashObj* pVgHash = NULL;
+ SQuery* pQuery = NULL;
SMqRspObj rspObj = {0};
- SDecoder decoder = {0};
+ SDecoder decoder = {0};
terrno = TSDB_CODE_SUCCESS;
SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT);
- if(!pRequest){
+ if (!pRequest) {
uError("WriteRaw:createRequest error request is null");
return terrno;
}
@@ -3212,7 +3071,7 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
tDecoderInit(&decoder, data, dataLen);
code = tDecodeSMqDataRsp(&decoder, &rspObj.rsp);
- if (code != 0){
+ if (code != 0) {
uError("WriteRaw:decode smqDataRsp error");
code = TSDB_CODE_INVALID_MSG;
goto end;
@@ -3226,9 +3085,9 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
taosHashSetFreeFp(pVgHash, destroyVgHash);
- struct SCatalog *pCatalog = NULL;
+ struct SCatalog* pCatalog = NULL;
code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
uError("WriteRaw: get gatlog error");
goto end;
}
@@ -3250,20 +3109,20 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
setResSchemaInfo(&rspObj.resInfo, pSW->pSchema, pSW->nCols);
code = setQueryResultFromRsp(&rspObj.resInfo, pRetrieve, false, false);
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
uError("WriteRaw: setQueryResultFromRsp error");
goto end;
}
uint16_t fLen = 0;
- int32_t rowSize = 0;
- int16_t nVar = 0;
+ int32_t rowSize = 0;
+ int16_t nVar = 0;
for (int i = 0; i < pSW->nCols; i++) {
- SSchema *schema = pSW->pSchema + i;
+ SSchema* schema = pSW->pSchema + i;
fLen += TYPE_BYTES[schema->type];
rowSize += schema->bytes;
- if(IS_VAR_DATA_TYPE(schema->type)){
- nVar ++;
+ if (IS_VAR_DATA_TYPE(schema->type)) {
+ nVar++;
}
}
@@ -3274,7 +3133,7 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize;
const char* tbName = (const char*)taosArrayGetP(rspObj.rsp.blockTbName, rspObj.resIter);
- if(!tbName){
+ if (!tbName) {
uError("WriteRaw: tbname is null");
code = TSDB_CODE_TMQ_INVALID_MSG;
goto end;
@@ -3294,12 +3153,12 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
SSubmitReq* subReq = NULL;
SSubmitBlk* blk = NULL;
- void *hData = taosHashGet(pVgHash, &vgData.vg.vgId, sizeof(vgData.vg.vgId));
- if(hData){
+ void* hData = taosHashGet(pVgHash, &vgData.vg.vgId, sizeof(vgData.vg.vgId));
+ if (hData) {
vgData = *(VgData*)hData;
int32_t totalLen = ((SSubmitReq*)(vgData.data))->length + submitLen;
- void *tmp = taosMemoryRealloc(vgData.data, totalLen);
+ void* tmp = taosMemoryRealloc(vgData.data, totalLen);
if (tmp == NULL) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto end;
@@ -3308,15 +3167,15 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
((VgData*)hData)->data = tmp;
subReq = (SSubmitReq*)(vgData.data);
blk = POINTER_SHIFT(vgData.data, subReq->length);
- }else{
+ } else {
int32_t totalLen = sizeof(SSubmitReq) + submitLen;
- void *tmp = taosMemoryCalloc(1, totalLen);
+ void* tmp = taosMemoryCalloc(1, totalLen);
if (tmp == NULL) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto end;
}
vgData.data = tmp;
- taosHashPut(pVgHash, (const char *)&vgData.vg.vgId, sizeof(vgData.vg.vgId), (char *)&vgData, sizeof(vgData));
+ taosHashPut(pVgHash, (const char*)&vgData.vg.vgId, sizeof(vgData.vg.vgId), (char*)&vgData, sizeof(vgData));
subReq = (SSubmitReq*)(vgData.data);
subReq->length = sizeof(SSubmitReq);
subReq->numOfBlocks = 0;
@@ -3334,7 +3193,7 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
uint64_t uid = pTableMeta->uid;
taosMemoryFreeClear(pTableMeta);
- void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
+ void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk));
STSRow* rowData = POINTER_SHIFT(blkSchema, schemaLen);
SRowBuilder rb = {0};
@@ -3350,12 +3209,12 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
int32_t offset = 0;
for (int32_t k = 0; k < pSW->nCols; k++) {
- const SSchema* pColumn = &pSW->pSchema[k];
- char *data = rspObj.resInfo.row[k];
+ const SSchema* pColumn = &pSW->pSchema[k];
+ char* data = rspObj.resInfo.row[k];
if (!data) {
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, offset, k);
} else {
- if(IS_VAR_DATA_TYPE(pColumn->type)){
+ if (IS_VAR_DATA_TYPE(pColumn->type)) {
data -= VARSTR_HEADER_SIZE;
}
tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, offset, k);
@@ -3369,10 +3228,9 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
blk->uid = htobe64(uid);
blk->suid = htobe64(suid);
- blk->padding = htonl(blk->padding);
blk->sversion = htonl(pSW->version);
blk->schemaLen = htonl(schemaLen);
- blk->numOfRows = htons(rows);
+ blk->numOfRows = htonl(rows);
blk->dataLen = htonl(dataLen);
subReq->length += sizeof(SSubmitBlk) + schemaLen + dataLen;
subReq->numOfBlocks++;
@@ -3387,21 +3245,21 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE;
pQuery->haveResultSet = false;
pQuery->msgType = TDMT_VND_SUBMIT;
- pQuery->pRoot = (SNode *)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
+ pQuery->pRoot = (SNode*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT);
if (NULL == pQuery->pRoot) {
uError("create pQuery->pRoot error");
code = TSDB_CODE_OUT_OF_MEMORY;
goto end;
}
- SVnodeModifOpStmt *nodeStmt = (SVnodeModifOpStmt *)(pQuery->pRoot);
+ SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot);
nodeStmt->payloadType = PAYLOAD_TYPE_KV;
int32_t numOfVg = taosHashGetSize(pVgHash);
nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES);
- VgData *vData = (VgData *)taosHashIterate(pVgHash, NULL);
+ VgData* vData = (VgData*)taosHashIterate(pVgHash, NULL);
while (vData) {
- SVgDataBlocks *dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
+ SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
if (NULL == dst) {
code = TSDB_CODE_TSC_OUT_OF_MEMORY;
goto end;
@@ -3411,14 +3269,14 @@ static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){
dst->numOfTables = subReq->numOfBlocks;
dst->size = subReq->length;
dst->pData = (char*)subReq;
- vData->data = NULL; // no need free
+ vData->data = NULL; // no need free
subReq->header.vgId = htonl(dst->vg.vgId);
subReq->version = htonl(1);
subReq->header.contLen = htonl(subReq->length);
subReq->length = htonl(subReq->length);
subReq->numOfBlocks = htonl(subReq->numOfBlocks);
taosArrayPush(nodeStmt->pDataBlocks, &dst);
- vData = (VgData *)taosHashIterate(pVgHash, vData);
+ vData = (VgData*)taosHashIterate(pVgHash, vData);
}
launchQueryImpl(pRequest, pQuery, true, NULL);
@@ -3457,8 +3315,8 @@ char* tmq_get_json_meta(TAOS_RES* res) {
void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); }
-int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data *raw) {
- if (!raw || !res){
+int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data* raw) {
+ if (!raw || !res) {
return TSDB_CODE_INVALID_PARA;
}
if (TD_RES_TMQ_META(res)) {
@@ -3466,8 +3324,8 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data *raw) {
raw->raw = pMetaRspObj->metaRsp.metaRsp;
raw->raw_len = pMetaRspObj->metaRsp.metaRspLen;
raw->raw_type = pMetaRspObj->metaRsp.resMsgType;
- } else if(TD_RES_TMQ(res)){
- SMqRspObj *rspObj = ((SMqRspObj*)res);
+ } else if (TD_RES_TMQ(res)) {
+ SMqRspObj* rspObj = ((SMqRspObj*)res);
int32_t len = 0;
int32_t code = 0;
@@ -3476,7 +3334,7 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data *raw) {
return -1;
}
- void *buf = taosMemoryCalloc(1, len);
+ void* buf = taosMemoryCalloc(1, len);
SEncoder encoder = {0};
tEncoderInit(&encoder, buf, len);
tEncodeSMqDataRsp(&encoder, &rspObj->rsp);
@@ -3492,31 +3350,31 @@ int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data *raw) {
}
void tmq_free_raw(tmq_raw_data raw) {
- if (raw.raw_type == RES_TYPE__TMQ){
+ if (raw.raw_type == RES_TYPE__TMQ) {
taosMemoryFree(raw.raw);
}
}
-int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw){
+int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) {
if (!taos) {
return TSDB_CODE_INVALID_PARA;
}
- if(raw.raw_type == TDMT_VND_CREATE_STB) {
+ if (raw.raw_type == TDMT_VND_CREATE_STB) {
return taosCreateStb(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_ALTER_STB){
+ } else if (raw.raw_type == TDMT_VND_ALTER_STB) {
return taosCreateStb(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_DROP_STB){
+ } else if (raw.raw_type == TDMT_VND_DROP_STB) {
return taosDropStb(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_CREATE_TABLE){
+ } else if (raw.raw_type == TDMT_VND_CREATE_TABLE) {
return taosCreateTable(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_ALTER_TABLE){
+ } else if (raw.raw_type == TDMT_VND_ALTER_TABLE) {
return taosAlterTable(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_DROP_TABLE) {
+ } else if (raw.raw_type == TDMT_VND_DROP_TABLE) {
return taosDropTable(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == TDMT_VND_DELETE){
+ } else if (raw.raw_type == TDMT_VND_DELETE) {
return taosDeleteData(taos, raw.raw, raw.raw_len);
- }else if(raw.raw_type == RES_TYPE__TMQ){
+ } else if (raw.raw_type == RES_TYPE__TMQ) {
return tmqWriteRaw(taos, raw.raw, raw.raw_len);
}
return TSDB_CODE_INVALID_PARA;
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index c4a3ce2d6b..29d7b557c8 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -246,14 +246,14 @@ static const SSysTableMeta infosMeta[] = {
// {TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
// {TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(bnodesSchema)},
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema)},
- {TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
- {TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
- {TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
- {TSDB_INS_TABLE_USER_STABLES, userStbsSchema, tListLen(userStbsSchema)},
- {TSDB_INS_TABLE_USER_TABLES, userTblsSchema, tListLen(userTblsSchema)},
- {TSDB_INS_TABLE_USER_TAGS, userTagsSchema, tListLen(userTagsSchema)},
- // {TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
- {TSDB_INS_TABLE_USER_USERS, userUsersSchema, tListLen(userUsersSchema)},
+ {TSDB_INS_TABLE_DATABASES, userDBSchema, tListLen(userDBSchema)},
+ {TSDB_INS_TABLE_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
+ {TSDB_INS_TABLE_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
+ {TSDB_INS_TABLE_STABLES, userStbsSchema, tListLen(userStbsSchema)},
+ {TSDB_INS_TABLE_TABLES, userTblsSchema, tListLen(userTblsSchema)},
+ {TSDB_INS_TABLE_TAGS, userTagsSchema, tListLen(userTagsSchema)},
+ // {TSDB_INS_TABLE_TABLE_DISTRIBUTED, userTblDistSchema, tListLen(userTblDistSchema)},
+ {TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema)},
{TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema)},
{TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema)},
{TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema)},
@@ -335,7 +335,7 @@ static const SSysDbTableSchema appSchema[] = {
{.name = "insert_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
{.name = "fetch_bytes", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
{.name = "query_time", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
- {.name = "show_query", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
+ {.name = "slow_query", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
{.name = "total_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
{.name = "current_req", .bytes = 8, .type = TSDB_DATA_TYPE_UBIGINT},
{.name = "last_access", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 7cfc1c0b1d..51c21eafa9 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -118,6 +118,76 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
return 0;
}
+int32_t colDataReserve(SColumnInfoData* pColumnInfoData, size_t newSize) {
+ if (!IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pColumnInfoData->varmeta.allocLen >= newSize) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if (pColumnInfoData->varmeta.allocLen < newSize) {
+ char* buf = taosMemoryRealloc(pColumnInfoData->pData, newSize);
+ if (buf == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pColumnInfoData->pData = buf;
+ pColumnInfoData->varmeta.allocLen = newSize;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t currentRow, const char* pData, int32_t itemLen, int32_t numOfRows) {
+ ASSERT(pColumnInfoData->info.bytes >= itemLen);
+ size_t start = 1;
+
+ // the first item
+ memcpy(pColumnInfoData->pData, pData, itemLen);
+
+ int32_t t = 0;
+ int32_t count = log(numOfRows)/log(2);
+ while(t < count) {
+ int32_t xlen = 1 << t;
+ memcpy(pColumnInfoData->pData + start * itemLen + pColumnInfoData->varmeta.length, pColumnInfoData->pData, xlen * itemLen);
+ t += 1;
+ start += xlen;
+ }
+
+ // the tail part
+ if (numOfRows > start) {
+ memcpy(pColumnInfoData->pData + start * itemLen + currentRow * itemLen, pColumnInfoData->pData, (numOfRows - start) * itemLen);
+ }
+
+ if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
+ for(int32_t i = 0; i < numOfRows; ++i) {
+ pColumnInfoData->varmeta.offset[i + currentRow] = pColumnInfoData->varmeta.length + i * itemLen;
+ }
+
+ pColumnInfoData->varmeta.length += numOfRows * itemLen;
+ }
+}
+
+int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows) {
+ ASSERT(pData != NULL && pColumnInfoData != NULL);
+
+ int32_t len = pColumnInfoData->info.bytes;
+ if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
+ len = varDataTLen(pData);
+ if (pColumnInfoData->varmeta.allocLen < (numOfRows + currentRow) * len) {
+ int32_t code = colDataReserve(pColumnInfoData, (numOfRows + currentRow) * len);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ }
+ }
+
+ doCopyNItems(pColumnInfoData, currentRow, pData, len, numOfRows);
+ return TSDB_CODE_SUCCESS;
+}
+
static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, const SColumnInfoData* pSource,
int32_t numOfRow2) {
if (numOfRow2 <= 0) return;
@@ -1113,15 +1183,12 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo*
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows) {
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
pColumn->varmeta.length = 0;
- if (pColumn->varmeta.offset > 0) {
+ if (pColumn->varmeta.offset != NULL) {
memset(pColumn->varmeta.offset, 0, sizeof(int32_t) * numOfRows);
}
} else {
if (pColumn->nullbitmap != NULL) {
memset(pColumn->nullbitmap, 0, BitmapLen(numOfRows));
- if (pColumn->pData != NULL) {
- memset(pColumn->pData, 0, pColumn->info.bytes * numOfRows);
- }
}
}
}
@@ -1672,6 +1739,9 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI);
printf(" %25s |", pBuf);
break;
+ case TSDB_DATA_TYPE_BOOL:
+ printf(" %15d |", *(int32_t*)var);
+ break;
case TSDB_DATA_TYPE_INT:
printf(" %15d |", *(int32_t*)var);
break;
@@ -1690,6 +1760,22 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
case TSDB_DATA_TYPE_DOUBLE:
printf(" %15lf |", *(double*)var);
break;
+ case TSDB_DATA_TYPE_VARCHAR: {
+ char* pData = colDataGetVarData(pColInfoData, j);
+ int32_t dataSize = TMIN(sizeof(pBuf) - 1, varDataLen(pData));
+ memset(pBuf, 0, dataSize + 1);
+ strncpy(pBuf, varDataVal(pData), dataSize);
+ printf(" %15s |", pBuf);
+ } break;
+ case TSDB_DATA_TYPE_NCHAR: {
+ char* pData = colDataGetVarData(pColInfoData, j);
+ int32_t dataSize = TMIN(sizeof(pBuf), varDataLen(pData));
+ memset(pBuf, 0, dataSize);
+ taosUcs4ToMbs((TdUcs4*)varDataVal(pData), dataSize, pBuf);
+ printf(" %15s |", pBuf);
+ } break;
+ default:
+ break;
}
}
printf("\n");
@@ -1706,8 +1792,10 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
int32_t rows = pDataBlock->info.rows;
int32_t len = 0;
- len += snprintf(dumpBuf + len, size - len, "===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%ld|rows:%d|version:%" PRIu64 "\n", flag,
- (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId,
+ len += snprintf(dumpBuf + len, size - len,
+ "===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64
+ "|rows:%d|version:%" PRIu64 "\n",
+ flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId,
pDataBlock->info.uid, pDataBlock->info.rows, pDataBlock->info.version);
if (len >= size - 1) return dumpBuf;
@@ -1725,6 +1813,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
}
switch (pColInfoData->info.type) {
case TSDB_DATA_TYPE_TIMESTAMP:
+ memset(pBuf, 0, sizeof(pBuf));
formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI);
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
if (len >= size - 1) return dumpBuf;
@@ -1753,6 +1842,26 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
len += snprintf(dumpBuf + len, size - len, " %15lf |", *(double*)var);
if (len >= size - 1) return dumpBuf;
break;
+ case TSDB_DATA_TYPE_BOOL:
+ len += snprintf(dumpBuf + len, size - len, " %15d |", *(bool*)var);
+ if (len >= size - 1) return dumpBuf;
+ break;
+ case TSDB_DATA_TYPE_VARCHAR: {
+ memset(pBuf, 0, sizeof(pBuf));
+ char* pData = colDataGetVarData(pColInfoData, j);
+ int32_t dataSize = TMIN(sizeof(pBuf), varDataLen(pData));
+ memcpy(pBuf, varDataVal(pData), dataSize);
+ len += snprintf(dumpBuf + len, size - len, " %15s |", pBuf);
+ if (len >= size - 1) return dumpBuf;
+ } break;
+ case TSDB_DATA_TYPE_NCHAR: {
+ char* pData = colDataGetVarData(pColInfoData, j);
+ int32_t dataSize = TMIN(sizeof(pBuf), varDataLen(pData));
+ memset(pBuf, 0, sizeof(pBuf));
+ taosUcs4ToMbs((TdUcs4 *)varDataVal(pData), dataSize, pBuf);
+ len += snprintf(dumpBuf + len, size - len, " %15s |", pBuf);
+ if (len >= size - 1) return dumpBuf;
+ } break;
}
}
len += snprintf(dumpBuf + len, size - len, "\n");
@@ -1841,12 +1950,14 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
}
break;
case TSDB_DATA_TYPE_NCHAR: {
- tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, TSDB_DATA_TYPE_NCHAR, TD_VTYPE_NORM, var, true,
+ void* data = colDataGetData(pColInfoData, j);
+ tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, TSDB_DATA_TYPE_NCHAR, TD_VTYPE_NORM, data, true,
offset, k);
break;
}
case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY
- tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, TSDB_DATA_TYPE_VARCHAR, TD_VTYPE_NORM, var, true,
+ void* data = colDataGetData(pColInfoData, j);
+ tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, TSDB_DATA_TYPE_VARCHAR, TD_VTYPE_NORM, data, true,
offset, k);
break;
}
@@ -1917,11 +2028,10 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
int32_t dataLen = blk->dataLen;
blk->uid = htobe64(blk->uid);
blk->suid = htobe64(blk->suid);
- blk->padding = htonl(blk->padding);
blk->sversion = htonl(blk->sversion);
blk->dataLen = htonl(blk->dataLen);
blk->schemaLen = htonl(blk->schemaLen);
- blk->numOfRows = htons(blk->numOfRows);
+ blk->numOfRows = htonl(blk->numOfRows);
blk = (SSubmitBlk*)(blk->data + dataLen);
}
} else {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 41e3917937..f6d8ea51c4 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -18,8 +18,8 @@
#include "tcompare.h"
#include "tconfig.h"
#include "tdatablock.h"
-#include "tlog.h"
#include "tgrant.h"
+#include "tlog.h"
GRANT_CFG_DECLARE;
@@ -452,7 +452,7 @@ static void taosSetClientLogCfg(SConfig *pCfg) {
SConfigItem *pItem = cfgGetItem(pCfg, "logDir");
tstrncpy(tsLogDir, cfgGetItem(pCfg, "logDir")->str, PATH_MAX);
taosExpandDir(tsLogDir, tsLogDir, PATH_MAX);
- tsLogSpace.reserved = cfgGetItem(pCfg, "minimalLogDirGB")->fval;
+ tsLogSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalLogDirGB")->fval) * 1024 * 1024 * 1024);
tsNumOfLogLines = cfgGetItem(pCfg, "numOfLogLines")->i32;
tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval;
tsLogKeepDays = cfgGetItem(pCfg, "logKeepDays")->i32;
@@ -502,7 +502,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
tstrncpy(tsTempDir, cfgGetItem(pCfg, "tempDir")->str, PATH_MAX);
taosExpandDir(tsTempDir, tsTempDir, PATH_MAX);
- tsTempSpace.reserved = cfgGetItem(pCfg, "minimalTmpDirGB")->fval;
+ tsTempSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalTmpDirGB")->fval) * 1024 * 1024 * 1024);
if (taosMulMkDir(tsTempDir) != 0) {
uError("failed to create tempDir:%s since %s", tsTempDir, terrstr());
return -1;
@@ -540,7 +540,7 @@ static void taosSetSystemCfg(SConfig *pCfg) {
}
static int32_t taosSetServerCfg(SConfig *pCfg) {
- tsDataSpace.reserved = cfgGetItem(pCfg, "minimalDataDirGB")->fval;
+ tsDataSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalDataDirGB")->fval) * 1024 * 1024 * 1024);
tsNumOfSupportVnodes = cfgGetItem(pCfg, "supportVnodes")->i32;
tsMaxShellConns = cfgGetItem(pCfg, "maxShellConns")->i32;
tsStatusInterval = cfgGetItem(pCfg, "statusInterval")->i32;
@@ -598,7 +598,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
return 0;
}
-void taosLocalCfgForbiddenToChange(char* name, bool* forbidden) {
+void taosLocalCfgForbiddenToChange(char *name, bool *forbidden) {
int32_t len = strlen(name);
char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0};
strntolower(lowcaseName, name, TMIN(CFG_NAME_MAX_LEN, len));
@@ -612,7 +612,6 @@ void taosLocalCfgForbiddenToChange(char* name, bool* forbidden) {
*forbidden = false;
}
-
int32_t taosSetCfg(SConfig *pCfg, char *name) {
int32_t len = strlen(name);
char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0};
@@ -740,15 +739,15 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
}
case 'i': {
if (strcasecmp("minimalTmpDirGB", name) == 0) {
- tsTempSpace.reserved = cfgGetItem(pCfg, "minimalTmpDirGB")->fval;
+ tsTempSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalTmpDirGB")->fval) * 1024 * 1024 * 1024);
} else if (strcasecmp("minimalDataDirGB", name) == 0) {
- tsDataSpace.reserved = cfgGetItem(pCfg, "minimalDataDirGB")->fval;
+ tsDataSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalDataDirGB")->fval) * 1024 * 1024 * 1024);
} else if (strcasecmp("minSlidingTime", name) == 0) {
tsMinSlidingTime = cfgGetItem(pCfg, "minSlidingTime")->i32;
} else if (strcasecmp("minIntervalTime", name) == 0) {
tsMinIntervalTime = cfgGetItem(pCfg, "minIntervalTime")->i32;
} else if (strcasecmp("minimalLogDirGB", name) == 0) {
- tsLogSpace.reserved = cfgGetItem(pCfg, "minimalLogDirGB")->fval;
+ tsLogSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalLogDirGB")->fval) * 1024 * 1024 * 1024);
}
break;
}
@@ -1114,12 +1113,12 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
const char *options[] = {
"dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag",
"tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag",
- "tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag",
+ "tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag",
};
int32_t *optionVars[] = {
&dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag,
&tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tdbDebugFlag,
- &tmrDebugFlag, &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &metaDebugFlag,
+ &tmrDebugFlag, &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &metaDebugFlag,
};
int32_t optionSize = tListLen(options);
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index e3b758ba4e..e5865c5782 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -76,7 +76,7 @@ int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) {
pIter->sversion = htonl((*pPBlock)->sversion);
pIter->dataLen = htonl((*pPBlock)->dataLen);
pIter->schemaLen = htonl((*pPBlock)->schemaLen);
- pIter->numOfRows = htons((*pPBlock)->numOfRows);
+ pIter->numOfRows = htonl((*pPBlock)->numOfRows);
}
return 0;
}
@@ -4908,7 +4908,6 @@ int32_t tDecodeSRSmaParam(SDecoder *pCoder, SRSmaParam *pRSmaParam) {
if (tDecodeI64v(pCoder, &pRSmaParam->watermark[i]) < 0) return -1;
if (tDecodeI32v(pCoder, &pRSmaParam->qmsgLen[i]) < 0) return -1;
if (pRSmaParam->qmsgLen[i] > 0) {
- tDecoderMalloc(pCoder, pRSmaParam->qmsgLen[i]);
if (tDecodeBinary(pCoder, (uint8_t **)&pRSmaParam->qmsg[i], NULL) < 0) return -1; // qmsgLen contains len of '\0'
} else {
pRSmaParam->qmsg[i] = NULL;
diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c
index 03353b0de6..c86bf08e81 100644
--- a/source/common/src/ttszip.c
+++ b/source/common/src/ttszip.c
@@ -30,6 +30,12 @@ static int32_t STSBufUpdateHeader(STSBuf* pTSBuf, STSBufFileHeader* pHeader);
* @return
*/
STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_TSC_NO_DISKSPACE;
+ // tscError("tmp file created failed since %s", terrstr());
+ return NULL;
+ }
+
STSBuf* pTSBuf = taosMemoryCalloc(1, sizeof(STSBuf));
if (pTSBuf == NULL) {
return NULL;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
index 9d1142801d..1a226abe5c 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
@@ -146,8 +146,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId);
if (pVnode == NULL) {
- dGError("vgId:%d, msg:%p failed to put into vnode queue since %s, msgtype:%s qtype:%d", pHead->vgId, pMsg,
- terrstr(), TMSG_INFO(pMsg->msgType), qtype);
+ dGError("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pHead->vgId, pMsg, terrstr(),
+ TMSG_INFO(pMsg->msgType), qtype);
return terrno != 0 ? terrno : -1;
}
@@ -165,14 +165,22 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
break;
case STREAM_QUEUE:
dGTrace("vgId:%d, msg:%p put into vnode-stream queue", pVnode->vgId, pMsg);
- taosWriteQitem(pVnode->pStreamQ, pMsg);
+ if (pMsg->msgType == TDMT_STREAM_TASK_DISPATCH) {
+ vnodeEnqueueStreamMsg(pVnode->pImpl, pMsg);
+ } else {
+ taosWriteQitem(pVnode->pStreamQ, pMsg);
+ }
break;
case FETCH_QUEUE:
dGTrace("vgId:%d, msg:%p put into vnode-fetch queue", pVnode->vgId, pMsg);
taosWriteQitem(pVnode->pFetchQ, pMsg);
break;
case WRITE_QUEUE:
- if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
+ if (!osDataSpaceAvailable()) {
+ terrno = TSDB_CODE_VND_NO_DISKSPACE;
+ code = terrno;
+ dError("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr());
+ } else if ((pMsg->msgType == TDMT_VND_SUBMIT) && (grantCheck(TSDB_GRANT_STORAGE) != TSDB_CODE_SUCCESS)) {
terrno = TSDB_CODE_VND_NO_WRITE_AUTH;
code = terrno;
dDebug("vgId:%d, msg:%p put into vnode-write queue failed since %s", pVnode->vgId, pMsg, terrstr());
diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
index 119d521827..5d72ce3b18 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
@@ -49,8 +49,26 @@ static int32_t dmInitMonitor() {
return 0;
}
+static bool dmCheckDiskSpace() {
+ osUpdate();
+ if (!osDataSpaceAvailable()) {
+ dError("free disk size: %f GB, too little, require %f GB at least at least , quit", (double)tsDataSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsDataSpace.reserved / 1024.0 / 1024.0 / 1024.0);
+ return false;
+ }
+ if (!osLogSpaceAvailable()) {
+ dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsLogSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsLogSpace.reserved / 1024.0 / 1024.0 / 1024.0);
+ return false;
+ }
+ if (!osTempSpaceAvailable()) {
+ dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsTempSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsTempSpace.reserved / 1024.0 / 1024.0 / 1024.0);
+ return false;
+ }
+ return true;
+}
+
int32_t dmInit(int8_t rtype) {
dInfo("start to init dnode env");
+ if (!dmCheckDiskSpace()) return -1;
if (dmCheckRepeatInit(dmInstance()) != 0) return -1;
if (dmInitSystem() != 0) return -1;
if (dmInitMonitor() != 0) return -1;
diff --git a/source/dnode/mgmt/node_mgmt/src/dmNodes.c b/source/dnode/mgmt/node_mgmt/src/dmNodes.c
index ecbb695e02..99ffd73a7a 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmNodes.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmNodes.c
@@ -265,6 +265,7 @@ static void dmWatchNodes(SDnode *pDnode) {
}
int32_t dmRunDnode(SDnode *pDnode) {
+ int count = 0;
if (dmOpenNodes(pDnode) != 0) {
dError("failed to open nodes since %s", terrstr());
return -1;
@@ -274,7 +275,6 @@ int32_t dmRunDnode(SDnode *pDnode) {
dError("failed to start nodes since %s", terrstr());
return -1;
}
-
while (1) {
if (pDnode->stop) {
dInfo("TDengine is about to stop");
@@ -285,6 +285,9 @@ int32_t dmRunDnode(SDnode *pDnode) {
}
dmWatchNodes(pDnode);
+ if (count == 0) osUpdate();
+ count %= 10;
+ count++;
taosMsleep(100);
}
}
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index f7387f7e88..39b57f2966 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -878,14 +878,14 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
pShow->pIter = sdbFetch(pSdb, SDB_CONSUMER, pShow->pIter, (void **)&pConsumer);
if (pShow->pIter == NULL) break;
if (taosArrayGetSize(pConsumer->assignedTopics) == 0) {
- mDebug("showing consumer %ld no assigned topic, skip", pConsumer->consumerId);
+ mDebug("showing consumer %" PRId64 " no assigned topic, skip", pConsumer->consumerId);
sdbRelease(pSdb, pConsumer);
continue;
}
taosRLockLatch(&pConsumer->lock);
- mDebug("showing consumer %ld", pConsumer->consumerId);
+ mDebug("showing consumer %" PRId64, pConsumer->consumerId);
int32_t topicSz = taosArrayGetSize(pConsumer->assignedTopics);
bool hasTopic = true;
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 9d7fa537bb..218f82df18 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -98,13 +98,11 @@ END:
}
int32_t mndAddSinkToTask(SMnode* pMnode, SStreamObj* pStream, SStreamTask* pTask) {
- pTask->dispatchType = TASK_DISPATCH__NONE;
- // sink
if (pStream->smaId != 0) {
- pTask->sinkType = TASK_SINK__SMA;
+ pTask->outputType = TASK_OUTPUT__SMA;
pTask->smaSink.smaId = pStream->smaId;
} else {
- pTask->sinkType = TASK_SINK__TABLE;
+ pTask->outputType = TASK_OUTPUT__TABLE;
pTask->tbSink.stbUid = pStream->targetStbUid;
memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
@@ -113,8 +111,6 @@ int32_t mndAddSinkToTask(SMnode* pMnode, SStreamObj* pStream, SStreamTask* pTask
}
int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStreamTask* pTask) {
- pTask->sinkType = TASK_SINK__NONE;
-
bool isShuffle = false;
if (pStream->fixedSinkVgId == 0) {
@@ -122,7 +118,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
ASSERT(pDb);
if (pDb->cfg.numOfVgroups > 1) {
isShuffle = true;
- pTask->dispatchType = TASK_DISPATCH__SHUFFLE;
+ pTask->outputType = TASK_OUTPUT__SHUFFLE_DISPATCH;
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) {
ASSERT(0);
@@ -152,7 +148,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream
}
}
} else {
- pTask->dispatchType = TASK_DISPATCH__FIXED;
+ pTask->outputType = TASK_OUTPUT__FIXED_DISPATCH;
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
SArray* pArray = taosArrayGetP(pStream->tasks, 0);
// one sink only
@@ -178,7 +174,6 @@ int32_t mndAssignTaskToVg(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, co
terrno = TSDB_CODE_QRY_INVALID_INPUT;
return -1;
}
- ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE || pTask->sinkType != TASK_SINK__NONE);
return 0;
}
@@ -249,26 +244,20 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) {
pTask->nodeId = pVgroup->vgId;
pTask->epSet = mndGetVgroupEpset(pMnode, pVgroup);
- // source
- pTask->isDataScan = 0;
-
- // exec
- pTask->execType = TASK_EXEC__NONE;
+ // type
+ pTask->taskLevel = TASK_LEVEL__SINK;
// sink
if (pStream->smaId != 0) {
- pTask->sinkType = TASK_SINK__SMA;
+ pTask->outputType = TASK_OUTPUT__SMA;
pTask->smaSink.smaId = pStream->smaId;
} else {
- pTask->sinkType = TASK_SINK__TABLE;
+ pTask->outputType = TASK_OUTPUT__TABLE;
pTask->tbSink.stbUid = pStream->targetStbUid;
memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
ASSERT(pTask->tbSink.pSchemaWrapper);
}
-
- // dispatch
- pTask->dispatchType = TASK_DISPATCH__NONE;
}
return 0;
}
@@ -295,25 +284,19 @@ int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) {
#endif
pTask->epSet = mndGetVgroupEpset(pMnode, &pStream->fixedSinkVg);
- // source
- pTask->isDataScan = 0;
-
- // exec
- pTask->execType = TASK_EXEC__NONE;
+ pTask->taskLevel = TASK_LEVEL__SINK;
// sink
if (pStream->smaId != 0) {
- pTask->sinkType = TASK_SINK__SMA;
+ pTask->outputType = TASK_OUTPUT__SMA;
pTask->smaSink.smaId = pStream->smaId;
} else {
- pTask->sinkType = TASK_SINK__TABLE;
+ pTask->outputType = TASK_OUTPUT__TABLE;
pTask->tbSink.stbUid = pStream->targetStbUid;
memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN);
pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema);
}
- // dispatch
- pTask->dispatchType = TASK_DISPATCH__NONE;
return 0;
}
@@ -338,6 +321,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
bool multiTarget = pDbObj->cfg.numOfVgroups > 1;
if (totLevel == 2 || externalTargetDB || multiTarget) {
+ /*if (true) {*/
SArray* taskOneLevel = taosArrayInit(0, sizeof(void*));
taosArrayPush(pStream->tasks, &taskOneLevel);
// add extra sink
@@ -376,8 +360,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
pInnerTask->childEpInfo = taosArrayInit(0, sizeof(void*));
- // source
- pInnerTask->isDataScan = 0;
+ pInnerTask->taskLevel = TASK_LEVEL__AGG;
// trigger
pInnerTask->triggerParam = pStream->triggerParam;
@@ -388,9 +371,6 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
return -1;
}
- // exec
- pInnerTask->execType = TASK_EXEC__PIPE;
-
#if 0
SDbObj* pSourceDb = mndAcquireDb(pMnode, pStream->sourceDb);
ASSERT(pDbObj != NULL);
@@ -452,19 +432,16 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
mndAddTaskToTaskSet(taskSourceLevel, pTask);
// source
- pTask->isDataScan = 1;
+ pTask->taskLevel = TASK_LEVEL__SOURCE;
// add fixed vg dispatch
- pTask->sinkType = TASK_SINK__NONE;
pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH;
- pTask->dispatchType = TASK_DISPATCH__FIXED;
+ pTask->outputType = TASK_OUTPUT__FIXED_DISPATCH;
pTask->fixedEpDispatcher.taskId = pInnerTask->taskId;
pTask->fixedEpDispatcher.nodeId = pInnerTask->nodeId;
pTask->fixedEpDispatcher.epSet = pInnerTask->epSet;
- // exec
- pTask->execType = TASK_EXEC__PIPE;
if (mndAssignTaskToVg(pMnode, pTask, plan, pVgroup) < 0) {
sdbRelease(pSdb, pVgroup);
qDestroyQueryPlan(pPlan);
@@ -515,7 +492,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
mndAddTaskToTaskSet(taskOneLevel, pTask);
// source
- pTask->isDataScan = 1;
+ pTask->taskLevel = TASK_LEVEL__SOURCE;
// trigger
pTask->triggerParam = pStream->triggerParam;
@@ -527,8 +504,6 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
mndAddSinkToTask(pMnode, pStream, pTask);
}
- // exec
- pTask->execType = TASK_EXEC__PIPE;
if (mndAssignTaskToVg(pMnode, pTask, plan, pVgroup) < 0) {
sdbRelease(pSdb, pVgroup);
qDestroyQueryPlan(pPlan);
diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c
index 0711f7e06d..05d0fe66c3 100644
--- a/source/dnode/mnode/impl/src/mndShow.c
+++ b/source/dnode/mnode/impl/src/mndShow.c
@@ -66,21 +66,21 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type = TSDB_MGMT_TABLE_SNODE;
} else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, len) == 0) {
type = TSDB_MGMT_TABLE_CLUSTER;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_DATABASES, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_DATABASES, len) == 0) {
type = TSDB_MGMT_TABLE_DB;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_FUNCTIONS, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_FUNCTIONS, len) == 0) {
type = TSDB_MGMT_TABLE_FUNC;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_INDEXES, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_INDEXES, len) == 0) {
type = TSDB_MGMT_TABLE_INDEX;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_STABLES, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_STABLES, len) == 0) {
type = TSDB_MGMT_TABLE_STB;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_TABLES, len) == 0) {
type = TSDB_MGMT_TABLE_TABLE;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_TAGS, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_TAGS, len) == 0) {
type = TSDB_MGMT_TABLE_TAG;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_TABLE_DISTRIBUTED, len) == 0) {
// type = TSDB_MGMT_TABLE_DIST;
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_USERS, len) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_USERS, len) == 0) {
type = TSDB_MGMT_TABLE_USER;
} else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, len) == 0) {
type = TSDB_MGMT_TABLE_GRANTS;
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index e82e5e0870..74cada7cac 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -812,12 +812,14 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
+ ASSERT(0);
goto _OVER;
}
// drop stream
if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
sdbRelease(pMnode->pSdb, pStream);
+ ASSERT(0);
goto _OVER;
}
}
@@ -832,6 +834,9 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
code = 0;
_OVER:
+ if(code != 0) {
+ ASSERT(0);
+ }
mndTransDrop(pTrans);
mndReleaseVgroup(pMnode, pVgroup);
mndReleaseStb(pMnode, pStb);
@@ -930,6 +935,7 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
goto _OVER;
} else {
terrno = TSDB_CODE_MND_SMA_NOT_EXIST;
+ ASSERT(0);
goto _OVER;
}
}
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 1b0a2c2a13..3e747b66c8 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -531,7 +531,7 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
}
if (pCreate->numOfColumns < TSDB_MIN_COLUMNS || pCreate->numOfColumns > TSDB_MAX_COLUMNS) {
- terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
+ terrno = TSDB_CODE_PAR_INVALID_COLUMNS_NUM;
return -1;
}
@@ -542,7 +542,7 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
SField *pField = taosArrayGet(pCreate->pColumns, 0);
if (pField->type != TSDB_DATA_TYPE_TIMESTAMP) {
- terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
+ terrno = TSDB_CODE_PAR_INVALID_FIRST_COLUMN;
return -1;
}
@@ -1011,6 +1011,11 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
goto _OVER;
}
+ if ((terrno = grantCheck(TSDB_GRANT_STABLE)) < 0) {
+ code = -1;
+ goto _OVER;
+ }
+
if (isAlter) {
bool needRsp = false;
SStbObj pDst = {0};
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 5e8867fdfb..902879701c 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -323,8 +323,7 @@ FAIL:
}
int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) {
- ASSERT(pTask->isDataScan == 0 || pTask->isDataScan == 1);
- if (pTask->isDataScan == 0 && pTask->sinkType == TASK_SINK__NONE) {
+ if (pTask->taskLevel == TASK_LEVEL__AGG) {
ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0);
}
SEncoder encoder;
@@ -437,7 +436,6 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
pField->bytes = 8;
if (mndCheckCreateStbReq(&createReq) != 0) {
- terrno = TSDB_CODE_INVALID_MSG;
goto _OVER;
}
@@ -549,7 +547,7 @@ int32_t mndRecoverStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStrea
SArray *pTasks = taosArrayGetP(pStream->tasks, i);
int32_t sz = taosArrayGetSize(pTasks);
SStreamTask *pTask = taosArrayGetP(pTasks, 0);
- if (!pTask->isDataScan && pTask->execType != TASK_EXEC__NONE) {
+ if (pTask->taskLevel == TASK_LEVEL__AGG) {
ASSERT(sz == 1);
if (mndPersistTaskRecoverReq(pTrans, pTask) < 0) {
return -1;
@@ -565,8 +563,8 @@ int32_t mndRecoverStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pStrea
int32_t sz = taosArrayGetSize(pTasks);
for (int32_t j = 0; j < sz; j++) {
SStreamTask *pTask = taosArrayGetP(pTasks, j);
- if (!pTask->isDataScan) break;
- ASSERT(pTask->execType != TASK_EXEC__NONE);
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) break;
+ ASSERT(pTask->taskLevel != TASK_LEVEL__SINK);
if (mndPersistTaskRecoverReq(pTrans, pTask) < 0) {
return -1;
}
diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c
index 810dcb9049..b8ff7be46a 100644
--- a/source/dnode/mnode/impl/src/mndSync.c
+++ b/source/dnode/mnode/impl/src/mndSync.c
@@ -149,7 +149,7 @@ int32_t mndSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void **ppWrit
int32_t mndSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
mInfo("stop to apply snapshot to sdb, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64, isApply,
- pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastApplyIndex);
+ pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastConfigIndex);
SMnode *pMnode = pFsm->data;
return sdbStopWrite(pMnode->pSdb, pWriter, isApply, pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm,
pSnapshot->lastConfigIndex);
diff --git a/source/dnode/mnode/impl/test/db/db.cpp b/source/dnode/mnode/impl/test/db/db.cpp
index 06916b375c..94ba7f2968 100644
--- a/source/dnode/mnode/impl/test/db/db.cpp
+++ b/source/dnode/mnode/impl/test/db/db.cpp
@@ -26,7 +26,7 @@ class MndTestDb : public ::testing::Test {
Testbase MndTestDb::test;
TEST_F(MndTestDb, 01_ShowDb) {
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -64,10 +64,10 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 3);
- test.SendShowReq(TSDB_MGMT_TABLE_VGROUP, "vgroups", "1.d1");
+ test.SendShowReq(TSDB_MGMT_TABLE_VGROUP, "ins_vgroups", "1.d1");
EXPECT_EQ(test.GetShowRows(), 2);
{
@@ -96,13 +96,13 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ(pRsp->code, TSDB_CODE_OPS_NOT_SUPPORT);
}
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 3);
// restart
test.Restart();
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 3);
{
@@ -122,7 +122,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
EXPECT_STREQ(dropdbRsp.db, "1.d1");
}
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -160,7 +160,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_DB, "ins_databases", "");
EXPECT_EQ(test.GetShowRows(), 3);
uint64_t d2_uid = 0;
diff --git a/source/dnode/mnode/impl/test/func/func.cpp b/source/dnode/mnode/impl/test/func/func.cpp
index 2bebe7ef19..53029f5963 100644
--- a/source/dnode/mnode/impl/test/func/func.cpp
+++ b/source/dnode/mnode/impl/test/func/func.cpp
@@ -46,7 +46,7 @@ void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) {
}
TEST_F(MndTestFunc, 01_Show_Func) {
- test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
EXPECT_EQ(test.GetShowRows(), 0);
}
@@ -159,7 +159,7 @@ TEST_F(MndTestFunc, 02_Create_Func) {
}
}
- test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -270,7 +270,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -435,13 +435,13 @@ TEST_F(MndTestFunc, 04_Drop_Func) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
EXPECT_EQ(test.GetShowRows(), 1);
// restart
test.Restart();
- test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp
index e784a41d6f..2ae113e051 100644
--- a/source/dnode/mnode/impl/test/profile/profile.cpp
+++ b/source/dnode/mnode/impl/test/profile/profile.cpp
@@ -87,7 +87,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
}
TEST_F(MndTestProfile, 03_ConnectMsg_Show) {
- test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "perf_connections", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -307,6 +307,6 @@ TEST_F(MndTestProfile, 08_KillQueryMsg_InvalidConn) {
}
TEST_F(MndTestProfile, 09_KillQueryMsg) {
- test.SendShowReq(TSDB_MGMT_TABLE_QUERIES, "queries", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_QUERIES, "perf_queries", "");
EXPECT_EQ(test.GetShowRows(), 0);
}
diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp
index 0de8c9dca8..0ccefa7ca2 100644
--- a/source/dnode/mnode/impl/test/show/show.cpp
+++ b/source/dnode/mnode/impl/test/show/show.cpp
@@ -73,11 +73,11 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "perf_connections", "");
// EXPECT_EQ(test.GetShowRows(), 1);
}
TEST_F(MndTestShow, 04_ShowMsg_Cluster) {
- test.SendShowReq(TSDB_MGMT_TABLE_CLUSTER, "cluster", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_CLUSTER, "ins_cluster", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp
index 06bb735f54..9a2372d904 100644
--- a/source/dnode/mnode/impl/test/sma/sma.cpp
+++ b/source/dnode/mnode/impl/test/sma/sma.cpp
@@ -259,7 +259,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) {
pReq = BuildCreateBSmaStbReq(stbname, &contLen);
pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -275,7 +275,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) {
pReq = BuildDropStbReq(stbname, &contLen);
pRsp = test.SendReq(TDMT_MND_DROP_STB, pReq, contLen);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 0);
}
diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp
index d275231c70..64982951c9 100644
--- a/source/dnode/mnode/impl/test/stb/stb.cpp
+++ b/source/dnode/mnode/impl/test/stb/stb.cpp
@@ -313,7 +313,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
}
{
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -394,7 +394,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
test.Restart();
{
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -412,7 +412,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
}
{
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 0);
}
@@ -474,7 +474,7 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
}
{
@@ -514,7 +514,7 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -578,7 +578,7 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -630,7 +630,7 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) {
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -691,7 +691,7 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -751,7 +751,7 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -809,7 +809,7 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) {
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -818,7 +818,7 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) {
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen);
ASSERT_EQ(pRsp->code, TSDB_CODE_MND_COLUMN_NOT_EXIST);
- test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname);
+ test.SendShowReq(TSDB_MGMT_TABLE_STB, "ins_stables", dbname);
EXPECT_EQ(test.GetShowRows(), 1);
}
diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp
index dd2bda6b19..eb8b1d18e9 100644
--- a/source/dnode/mnode/impl/test/user/user.cpp
+++ b/source/dnode/mnode/impl/test/user/user.cpp
@@ -26,7 +26,7 @@ class MndTestUser : public ::testing::Test {
Testbase MndTestUser::test;
TEST_F(MndTestUser, 01_Show_User) {
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -94,7 +94,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -110,7 +110,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -130,7 +130,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -146,7 +146,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
}
@@ -168,7 +168,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
@@ -414,7 +414,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE(pRsp, nullptr);
ASSERT_EQ(pRsp->code, 0);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
}
@@ -475,7 +475,7 @@ TEST_F(MndTestUser, 05_Drop_User) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 1);
}
@@ -512,7 +512,7 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 3);
{
@@ -530,7 +530,7 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 3);
{
SDropUserReq dropReq = {0};
@@ -545,13 +545,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ(pRsp->code, 0);
}
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 2);
// restart
test.Restart();
taosMsleep(1000);
- test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
+ test.SendShowReq(TSDB_MGMT_TABLE_USER, "ins_users", "");
EXPECT_EQ(test.GetShowRows(), 2);
}
diff --git a/source/dnode/snode/inc/sndInt.h b/source/dnode/snode/inc/sndInt.h
index 1f0019ef46..5ee5507981 100644
--- a/source/dnode/snode/inc/sndInt.h
+++ b/source/dnode/snode/inc/sndInt.h
@@ -30,15 +30,15 @@
extern "C" {
#endif
+typedef struct SSnode {
+ SMsgCb msgCb;
+} SSnode;
+
+#if 0
typedef struct {
SHashObj* pHash; // taskId -> SStreamTask
} SStreamMeta;
-typedef struct SSnode {
- SStreamMeta* pMeta;
- SMsgCb msgCb;
-} SSnode;
-
SStreamMeta* sndMetaNew();
void sndMetaDelete(SStreamMeta* pMeta);
@@ -49,6 +49,7 @@ int32_t sndMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId);
int32_t sndDropTaskOfStream(SStreamMeta* pMeta, int64_t streamId);
int32_t sndStopTaskOfStream(SStreamMeta* pMeta, int64_t streamId);
int32_t sndResumeTaskOfStream(SStreamMeta* pMeta, int64_t streamId);
+#endif
#ifdef __cplusplus
}
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index 352fb51a53..cda4663285 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -16,6 +16,10 @@
#include "executor.h"
#include "sndInt.h"
#include "tuuid.h"
+/*SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) { return NULL; }*/
+/*void sndClose(SSnode *pSnode) {}*/
+int32_t sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg) { return 0; }
+int32_t sndProcessSMsg(SSnode *pSnode, SRpcMsg *pMsg) { return 0; }
SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) {
SSnode *pSnode = taosMemoryCalloc(1, sizeof(SSnode));
@@ -23,21 +27,24 @@ SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) {
return NULL;
}
pSnode->msgCb = pOption->msgCb;
+#if 0
pSnode->pMeta = sndMetaNew();
if (pSnode->pMeta == NULL) {
taosMemoryFree(pSnode);
return NULL;
}
+#endif
return pSnode;
}
void sndClose(SSnode *pSnode) {
- sndMetaDelete(pSnode->pMeta);
+ /*sndMetaDelete(pSnode->pMeta);*/
taosMemoryFree(pSnode);
}
int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad) { return 0; }
+#if 0
SStreamMeta *sndMetaNew() {
SStreamMeta *pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta));
if (pMeta == NULL) {
@@ -103,9 +110,6 @@ static int32_t sndProcessTaskDeployReq(SSnode *pNode, SRpcMsg *pMsg) {
pTask->pMsgCb = &pNode->msgCb;
- ASSERT(pTask->execType != TASK_EXEC__NONE);
-
- ASSERT(pTask->isDataScan == 0);
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, NULL);
ASSERT(pTask->exec.executor);
@@ -151,7 +155,7 @@ static int32_t sndProcessTaskDispatchReq(SSnode *pNode, SRpcMsg *pMsg) {
.info = pMsg->info,
.code = 0,
};
- streamProcessDispatchReq(pTask, &req, &rsp);
+ streamProcessDispatchReq(pTask, &req, &rsp, true);
return 0;
}
@@ -263,3 +267,4 @@ int32_t sndProcessSMsg(SSnode *pSnode, SRpcMsg *pMsg) {
}
return 0;
}
+#endif
diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h
index c84b3e6972..eb4c87ad31 100644
--- a/source/dnode/vnode/inc/vnode.h
+++ b/source/dnode/vnode/inc/vnode.h
@@ -207,6 +207,8 @@ int32_t tqRetrieveDataBlock(SSDataBlock *pBlock, STqReader *pReader);
int64_t tqFetchLog(SWalReader *pWalReader, bool fetchMeta, int64_t* fetchOffset, SWalCkHead** ppCkHead);
SSDataBlock* tqLogScanExec(int8_t subType, STqReader* pReader, SHashObj* pFilterOutTbUid, SSDataBlock* block);
+void vnodeEnqueueStreamMsg(SVnode *pVnode, SRpcMsg *pMsg);
+
// sma
int32_t smaGetTSmaDays(SVnodeCfg *pCfg, void *pCont, uint32_t contLen, int32_t *days);
diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h
index c825ab6731..1aee08027c 100644
--- a/source/dnode/vnode/src/inc/sma.h
+++ b/source/dnode/vnode/src/inc/sma.h
@@ -41,6 +41,9 @@ typedef struct SRSmaStat SRSmaStat;
typedef struct SSmaKey SSmaKey;
typedef struct SRSmaInfo SRSmaInfo;
typedef struct SRSmaInfoItem SRSmaInfoItem;
+typedef struct SQTaskFile SQTaskFile;
+typedef struct SQTaskFReader SQTaskFReader;
+typedef struct SQTaskFWriter SQTaskFWriter;
struct SSmaEnv {
SRWLatch lock;
@@ -64,12 +67,32 @@ struct STSmaStat {
STSchema *pTSchema;
};
+struct SQTaskFile {
+ volatile int32_t nRef;
+ int64_t commitID;
+ int64_t size;
+};
+
+struct SQTaskFReader {
+ SSma *pSma;
+ SQTaskFile fTask;
+ TdFilePtr pReadH;
+};
+struct SQTaskFWriter {
+ SSma *pSma;
+ SQTaskFile fTask;
+ TdFilePtr pWriteH;
+ char *fname;
+};
+
struct SRSmaStat {
SSma *pSma;
int64_t commitAppliedVer; // vnode applied version for async commit
int64_t refId; // shared by fetch tasks
+ SRWLatch lock; // r/w lock for rsma fs(e.g. qtaskinfo)
int8_t triggerStat; // shared by fetch tasks
int8_t commitStat; // 0 not in committing, 1 in committing
+ SArray *aTaskFile; // qTaskFiles committed recently(for recovery/snapshot r/w)
SHashObj *rsmaInfoHash; // key: stbUid, value: SRSmaInfo;
SHashObj *iRsmaInfoHash; // key: stbUid, value: SRSmaInfo; immutable rsmaInfoHash
};
@@ -89,6 +112,7 @@ struct SSmaStat {
#define RSMA_TRIGGER_STAT(r) (&(r)->triggerStat)
#define RSMA_COMMIT_STAT(r) (&(r)->commitStat)
#define RSMA_REF_ID(r) ((r)->refId)
+#define RSMA_FS_LOCK(r) (&(r)->lock)
struct SRSmaInfoItem {
void *taskInfo; // qTaskInfo_t
@@ -127,6 +151,11 @@ enum {
RSMA_ROLE_ITERATE = 4,
};
+enum {
+ RSMA_RESTORE_REBOOT = 1,
+ RSMA_RESTORE_SYNC = 2,
+};
+
void tdDestroySmaEnv(SSmaEnv *pSmaEnv);
void *tdFreeSmaEnv(SSmaEnv *pSmaEnv);
@@ -192,6 +221,8 @@ static FORCE_INLINE void tdSmaStatSetDropped(STSmaStat *pTStat) {
}
}
+void tdRSmaQTaskInfoGetFileName(int32_t vid, int64_t version, char *outputName);
+void tdRSmaQTaskInfoGetFullName(int32_t vid, int64_t version, const char *path, char *outputName);
int32_t tdCloneRSmaInfo(SSma *pSma, SRSmaInfo *pDest, SRSmaInfo *pSrc);
void tdFreeQTaskInfo(qTaskInfo_t *taskHandle, int32_t vgId, int32_t level);
static int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType);
@@ -201,7 +232,8 @@ void tdRemoveRSmaInfoBySuid(SSma *pSma, int64_t suid);
int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash);
int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, const char *tbName);
-int32_t tdProcessRSmaRestoreImpl(SSma *pSma);
+int32_t tdProcessRSmaRestoreImpl(SSma *pSma, int8_t type, int64_t qtaskFileVer);
+int32_t tdRsmaRestore(SSma *pSma, int8_t type, int64_t committedVer);
int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t version, const char *pMsg);
int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg);
@@ -209,9 +241,6 @@ int32_t tdProcessTSmaGetDaysImpl(SVnodeCfg *pCfg, void *pCont, uint32_t contLen,
// smaFileUtil ================
-typedef struct SQTaskFReader SQTaskFReader;
-typedef struct SQTaskFWriter SQTaskFWriter;
-
#define TD_FILE_HEAD_SIZE 512
typedef struct STFInfo STFInfo;
diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h
index 99ac85c3c3..8c8b9966ec 100644
--- a/source/dnode/vnode/src/inc/tq.h
+++ b/source/dnode/vnode/src/inc/tq.h
@@ -113,15 +113,23 @@ typedef struct {
} STqHandle;
struct STQ {
- char* path;
- SHashObj* pushMgr; // consumerId -> STqHandle*
- SHashObj* handles; // subKey -> STqHandle
- SHashObj* pStreamTasks; // taksId -> SStreamTask
- SHashObj* pAlterInfo; // topic -> SAlterCheckInfo
+ SVnode* pVnode;
+ char* path;
+ SHashObj* pushMgr; // consumerId -> STqHandle*
+ SHashObj* handles; // subKey -> STqHandle
+ SHashObj* pStreamTasks; // taksId -> SStreamTask
+ SHashObj* pAlterInfo; // topic -> SAlterCheckInfo
+
STqOffsetStore* pOffsetStore;
- SVnode* pVnode;
- TDB* pMetaStore;
- TTB* pExecStore;
+
+ TDB* pMetaStore;
+ TTB* pExecStore;
+
+ TTB* pAlterInfoStore;
+
+ TDB* pStreamStore;
+ TTB* pTaskDb;
+ TTB* pTaskState;
};
typedef struct {
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index b90254e543..4c6320ecb5 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -163,7 +163,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t tqProcessTaskDropReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* data, int64_t ver);
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg);
-int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg);
+int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec);
int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRecoverRsp(STQ* pTq, SRpcMsg* pMsg);
@@ -186,6 +186,7 @@ int32_t smaSyncPostCommit(SSma* pSma);
int32_t smaAsyncPreCommit(SSma* pSma);
int32_t smaAsyncCommit(SSma* pSma);
int32_t smaAsyncPostCommit(SSma* pSma);
+int32_t smaDoRetention(SSma* pSma, int64_t now);
int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg);
int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg);
@@ -354,16 +355,16 @@ struct SSma {
void smaHandleRes(void* pVnode, int64_t smaId, const SArray* data);
enum {
- SNAP_DATA_META = 0,
- SNAP_DATA_TSDB = 1,
- SNAP_DATA_DEL = 2,
- SNAP_DATA_RSMA1 = 3,
- SNAP_DATA_RSMA2 = 4,
- SNAP_DATA_QTASK = 5,
- SNAP_DATA_TQ_HANDLE = 6,
- SNAP_DATA_TQ_OFFSET = 7,
- SNAP_DATA_STREAM_TASK = 8,
- SNAP_DATA_STREAM_STATE = 9,
+ SNAP_DATA_META = 1,
+ SNAP_DATA_TSDB = 2,
+ SNAP_DATA_DEL = 3,
+ SNAP_DATA_RSMA1 = 4,
+ SNAP_DATA_RSMA2 = 5,
+ SNAP_DATA_QTASK = 6,
+ SNAP_DATA_TQ_HANDLE = 7,
+ SNAP_DATA_TQ_OFFSET = 8,
+ SNAP_DATA_STREAM_TASK = 9,
+ SNAP_DATA_STREAM_STATE = 10,
};
struct SSnapDataHdr {
diff --git a/source/dnode/vnode/src/meta/metaCommit.c b/source/dnode/vnode/src/meta/metaCommit.c
index 456c4fd7ee..b4987aea2b 100644
--- a/source/dnode/vnode/src/meta/metaCommit.c
+++ b/source/dnode/vnode/src/meta/metaCommit.c
@@ -18,6 +18,7 @@
static FORCE_INLINE void *metaMalloc(void *pPool, size_t size) { return vnodeBufPoolMalloc((SVBufPool *)pPool, size); }
static FORCE_INLINE void metaFree(void *pPool, void *p) { vnodeBufPoolFree((SVBufPool *)pPool, p); }
+// begin a meta txn
int metaBegin(SMeta *pMeta) {
tdbTxnOpen(&pMeta->txn, 0, metaMalloc, metaFree, pMeta->pVnode->inUse, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED);
@@ -28,4 +29,8 @@ int metaBegin(SMeta *pMeta) {
return 0;
}
+// commit the meta txn
int metaCommit(SMeta *pMeta) { return tdbCommit(pMeta->pEnv, &pMeta->txn); }
+
+// abort the meta txn
+int metaAbort(SMeta *pMeta) { return tdbAbort(pMeta->pEnv, &pMeta->txn); }
diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c
index 85293eff30..941d2c6d72 100644
--- a/source/dnode/vnode/src/meta/metaOpen.c
+++ b/source/dnode/vnode/src/meta/metaOpen.c
@@ -133,7 +133,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
ret = tdbTbOpen("stream.task.db", sizeof(int64_t), -1, taskIdxKeyCmpr, pMeta->pEnv, &pMeta->pStreamDb);
if (ret < 0) {
- metaError("vgId: %d, failed to open meta stream task index since %s", TD_VID(pVnode), tstrerror(terrno));
+ metaError("vgId:%d, failed to open meta stream task index since %s", TD_VID(pVnode), tstrerror(terrno));
goto _err;
}
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index dc16c2321b..797a60baf6 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -599,9 +599,11 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
for (int i = 0; i < pSW->number; ++i) {
smaId = *(tb_uid_t *)taosArrayGet(pSmaIds, i);
if (metaGetTableEntryByUid(&mr, smaId) < 0) {
- metaWarn("vgId:%d, no entry for tbId: %" PRIi64 ", smaId: %" PRIi64, TD_VID(pMeta->pVnode), uid, smaId);
+ tDecoderClear(&mr.coder);
+ metaWarn("vgId:%d, no entry for tbId:%" PRIi64 ", smaId:%" PRIi64, TD_VID(pMeta->pVnode), uid, smaId);
continue;
}
+ tDecoderClear(&mr.coder);
pTSma = pSW->tSma + smaIdx;
memcpy(pTSma, mr.me.smaEntry.tsma, sizeof(STSma));
if (deepCopy) {
@@ -647,7 +649,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
SMetaReader mr = {0};
metaReaderInit(&mr, pMeta, 0);
if (metaGetTableEntryByUid(&mr, indexUid) < 0) {
- metaWarn("vgId:%d, failed to get table entry for smaId: %" PRIi64, TD_VID(pMeta->pVnode), indexUid);
+ metaWarn("vgId:%d, failed to get table entry for smaId:%" PRIi64, TD_VID(pMeta->pVnode), indexUid);
metaReaderClear(&mr);
return NULL;
}
diff --git a/source/dnode/vnode/src/meta/metaSma.c b/source/dnode/vnode/src/meta/metaSma.c
index 0b6a526d8c..1e5b699fce 100644
--- a/source/dnode/vnode/src/meta/metaSma.c
+++ b/source/dnode/vnode/src/meta/metaSma.c
@@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
if (metaHandleSmaEntry(pMeta, &me) < 0) goto _err;
- metaDebug("vgId:%d, tsma is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pCfg->indexName, pCfg->indexUid);
+ metaDebug("vgId:%d, tsma is created, name:%s uid:%" PRId64, TD_VID(pMeta->pVnode), pCfg->indexName, pCfg->indexUid);
return 0;
_err:
- metaError("vgId:%d, failed to create tsma: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pCfg->indexName,
+ metaError("vgId:%d, failed to create tsma:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pCfg->indexName,
pCfg->indexUid, tstrerror(terrno));
return -1;
}
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index 7236ef9991..fdf2da5558 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -204,12 +204,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
++pMeta->pVnode->config.vndStats.numOfSTables;
- metaDebug("vgId:%d, super table is created, name:%s uid: %" PRId64, TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
+ metaDebug("vgId:%d, stb:%s is created, suid:%" PRId64, TD_VID(pMeta->pVnode), pReq->name, pReq->suid);
return 0;
_err:
- metaError("vgId:%d, failed to create super table: %s uid: %" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
+ metaError("vgId:%d, failed to create stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
pReq->suid, tstrerror(terrno));
return -1;
}
@@ -411,7 +411,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
- metaDebug("vgId:%d, table %s uid %" PRId64 " is created, type:%" PRId8, TD_VID(pMeta->pVnode), pReq->name, pReq->uid,
+ metaDebug("vgId:%d, table:%s uid %" PRId64 " is created, type:%" PRId8, TD_VID(pMeta->pVnode), pReq->name, pReq->uid,
pReq->type);
return 0;
@@ -996,7 +996,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
tbDbKey.version = pME->version;
tbDbKey.uid = pME->uid;
- metaDebug("vgId:%d, start to save table version:%" PRId64 "uid: %" PRId64, TD_VID(pMeta->pVnode), pME->version,
+ metaDebug("vgId:%d, start to save table version:%" PRId64 " uid:%" PRId64, TD_VID(pMeta->pVnode), pME->version,
pME->uid);
pKey = &tbDbKey;
@@ -1031,7 +1031,7 @@ static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME) {
return 0;
_err:
- metaError("vgId:%d, failed to save table version:%" PRId64 "uid: %" PRId64 " %s", TD_VID(pMeta->pVnode), pME->version,
+ metaError("vgId:%d, failed to save table version:%" PRId64 "uid:%" PRId64 " %s", TD_VID(pMeta->pVnode), pME->version,
pME->uid, tstrerror(terrno));
taosMemoryFree(pVal);
diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c
index a0e3932245..3c88b6f5cb 100644
--- a/source/dnode/vnode/src/sma/smaCommit.c
+++ b/source/dnode/vnode/src/sma/smaCommit.c
@@ -241,6 +241,41 @@ static int32_t tdCleanupQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat) {
return TSDB_CODE_SUCCESS;
}
+// SQTaskFile ======================================================
+// int32_t tCmprQTaskFile(void const *lhs, void const *rhs) {
+// int64_t *lCommitted = *(int64_t *)lhs;
+// SQTaskFile *rQTaskF = (SQTaskFile *)rhs;
+
+// if (lCommitted < rQTaskF->commitID) {
+// return -1;
+// } else if (lCommitted > rQTaskF->commitID) {
+// return 1;
+// }
+
+// return 0;
+// }
+
+#if 0
+/**
+ * @brief At most time, there is only one qtaskinfo file committed latest in aTaskFile. Sometimes, there would be
+ * multiple qtaskinfo files supporting snapshot replication.
+ *
+ * @param pSma
+ * @param pRSmaStat
+ * @return int32_t
+ */
+static int32_t tdCleanupQTaskInfoFiles(SSma *pSma, SRSmaStat *pRSmaStat) {
+ SVnode *pVnode = pSma->pVnode;
+ int64_t committed = pRSmaStat->commitAppliedVer;
+ SArray *aTaskFile = pRSmaStat->aTaskFile;
+
+ void *qTaskFile = taosArraySearch(aTaskFile, committed, tCmprQTaskFile, TD_LE);
+
+
+ return TSDB_CODE_SUCCESS;
+}
+#endif
+
/**
* @brief post-commit for rollup sma
* 1) clean up the outdated qtaskinfo files
diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c
index 31e57db5be..4b831225bc 100644
--- a/source/dnode/vnode/src/sma/smaEnv.c
+++ b/source/dnode/vnode/src/sma/smaEnv.c
@@ -295,6 +295,9 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
nLoops = 0;
}
}
+
+ // step 4: free pStat
+ taosMemoryFreeClear(pStat);
}
}
@@ -321,12 +324,13 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
tdDestroyTSmaStat(SMA_TSMA_STAT(pSmaStat));
} else if (smaType == TSDB_SMA_TYPE_ROLLUP) {
SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSmaStat);
+ int32_t vid = SMA_VID(pRSmaStat->pSma);
+ int64_t refId = RSMA_REF_ID(pRSmaStat);
if (taosRemoveRef(smaMgmt.rsetId, RSMA_REF_ID(pRSmaStat)) < 0) {
- smaError("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " failed since %s", SMA_VID(pRSmaStat->pSma),
- RSMA_REF_ID(pRSmaStat), smaMgmt.rsetId, terrstr());
+ smaError("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " failed since %s", vid, refId,
+ smaMgmt.rsetId, terrstr());
} else {
- smaDebug("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " succeed", SMA_VID(pRSmaStat->pSma),
- RSMA_REF_ID(pRSmaStat), smaMgmt.rsetId);
+ smaDebug("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " succeed", vid, refId, smaMgmt.rsetId);
}
} else {
ASSERT(0);
diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c
index d260b11a55..235fb1f941 100644
--- a/source/dnode/vnode/src/sma/smaOpen.c
+++ b/source/dnode/vnode/src/sma/smaOpen.c
@@ -123,7 +123,7 @@ int32_t smaOpen(SVnode *pVnode) {
}
// restore the rsma
- if (rsmaRestore(pSma) < 0) {
+ if (tdRsmaRestore(pSma, RSMA_RESTORE_REBOOT, pVnode->state.committed) < 0) {
goto _err;
}
}
@@ -148,12 +148,14 @@ int32_t smaClose(SSma *pSma) {
/**
* @brief rsma env restore
- *
- * @param pSma
- * @return int32_t
+ *
+ * @param pSma
+ * @param type
+ * @param committedVer
+ * @return int32_t
*/
-static int32_t rsmaRestore(SSma *pSma) {
+int32_t tdRsmaRestore(SSma *pSma, int8_t type, int64_t committedVer) {
ASSERT(VND_IS_RSMA(pSma->pVnode));
- return tdProcessRSmaRestoreImpl(pSma);
+ return tdProcessRSmaRestoreImpl(pSma, type, committedVer);
}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 3505711cd0..1c6d65c4d8 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -38,16 +38,15 @@ static SRSmaInfo *tdGetRSmaInfoBySuid(SSma *pSma, int64_t suid);
static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSchema, int64_t suid, SRSmaStat *pStat,
int8_t blkType);
static void tdRSmaFetchTrigger(void *param, void *tmrId);
-static void tdRSmaQTaskInfoGetFName(int32_t vid, int64_t version, char *outputName);
static int32_t tdRSmaQTaskInfoIterInit(SRSmaQTaskInfoIter *pIter, STFile *pTFile);
static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isFinish);
-static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter);
+static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, int8_t type, SRSmaQTaskInfoIter *pIter);
static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *infoItem);
static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables);
-static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int64_t *committed);
-static int32_t tdRSmaRestoreTSDataReload(SSma *pSma, int64_t committed);
+static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int8_t type, int64_t qTaskFileVer);
+static int32_t tdRSmaRestoreTSDataReload(SSma *pSma);
static SRSmaInfo *tdGetRSmaInfoByItem(SRSmaInfoItem *pItem) {
// adapt accordingly if definition of SRSmaInfo update
@@ -77,10 +76,14 @@ struct SRSmaQTaskInfoIter {
int32_t nBufPos;
};
-static void tdRSmaQTaskInfoGetFName(int32_t vgId, int64_t version, char *outputName) {
+void tdRSmaQTaskInfoGetFileName(int32_t vgId, int64_t version, char *outputName) {
tdGetVndFileName(vgId, NULL, VNODE_RSMA_DIR, TD_QTASKINFO_FNAME_PREFIX, version, outputName);
}
+void tdRSmaQTaskInfoGetFullName(int32_t vgId, int64_t version, const char *path, char *outputName) {
+ tdGetVndFileName(vgId, path, VNODE_RSMA_DIR, TD_QTASKINFO_FNAME_PREFIX, version, outputName);
+}
+
static FORCE_INLINE int32_t tdRSmaQTaskInfoContLen(int32_t lenWithHead) {
return lenWithHead - RSMA_QTASKINFO_HEAD_LEN;
}
@@ -89,7 +92,7 @@ static FORCE_INLINE void tdRSmaQTaskInfoIterDestroy(SRSmaQTaskInfoIter *pIter) {
void tdFreeQTaskInfo(qTaskInfo_t *taskHandle, int32_t vgId, int32_t level) {
// Note: free/kill may in RC
- if (!taskHandle) return;
+ if (!taskHandle || !(*taskHandle)) return;
qTaskInfo_t otaskHandle = atomic_load_ptr(taskHandle);
if (otaskHandle && atomic_val_compare_exchange_ptr(taskHandle, otaskHandle, NULL)) {
smaDebug("vgId:%d, free qTaskInfo_t %p of level %d", vgId, otaskHandle, level);
@@ -125,7 +128,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree) {
}
}
if (isDeepFree) {
- taosMemoryFree(pInfo->pTSchema);
+ taosMemoryFreeClear(pInfo->pTSchema);
}
taosMemoryFree(pInfo);
}
@@ -316,9 +319,13 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con
pRSmaInfo = taosHashGet(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t));
if (pRSmaInfo) {
- ASSERT(0); // TODO: free original pRSmaInfo if exists abnormally
- smaDebug("vgId:%d, rsma info already exists for table %s, %" PRIi64, SMA_VID(pSma), tbName, suid);
- return TSDB_CODE_SUCCESS;
+ // TODO: free original pRSmaInfo if exists abnormally
+ tdFreeRSmaInfo(pSma, *(SRSmaInfo **)pRSmaInfo, true);
+ if (taosHashRemove(RSMA_INFO_HASH(pStat), &suid, sizeof(tb_uid_t)) < 0) {
+ terrno = TSDB_CODE_RSMA_REMOVE_EXISTS;
+ goto _err;
+ }
+ smaWarn("vgId:%d, remove the rsma info already exists for table %s, %" PRIi64, SMA_VID(pSma), tbName, suid);
}
// from write queue: single thead
@@ -597,10 +604,10 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche
#endif
STsdb *sinkTsdb = (pItem->level == TSDB_RETENTION_L1 ? pSma->pRSmaTsdb[0] : pSma->pRSmaTsdb[1]);
SSubmitReq *pReq = NULL;
- // TODO: the schema update should be handled
+ // TODO: the schema update should be handled later(TD-17965)
if (buildSubmitReqFromDataBlock(&pReq, pResult, pTSchema, SMA_VID(pSma), suid) < 0) {
- smaError("vgId:%d, build submit req for rsma stable %" PRIi64 " level %" PRIi8 " failed since %s", SMA_VID(pSma),
- suid, pItem->level, terrstr());
+ smaError("vgId:%d, build submit req for rsma stable %" PRIi64 " level %" PRIi8 " failed since %s",
+ SMA_VID(pSma), suid, pItem->level, terrstr());
goto _err;
}
@@ -619,7 +626,7 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche
} else if (terrno == 0) {
smaDebug("vgId:%d, no rsma %" PRIi8 " data fetched yet", SMA_VID(pSma), pItem->level);
} else {
- smaDebug("vgId:%d, no rsma %" PRIi8 " data fetched since %s", SMA_VID(pSma), pItem->level, tstrerror(terrno));
+ smaDebug("vgId:%d, no rsma %" PRIi8 " data fetched since %s", SMA_VID(pSma), pItem->level, terrstr());
}
}
@@ -645,7 +652,7 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType
pItem->taskInfo, suid);
if (qSetMultiStreamInput(pItem->taskInfo, pMsg, 1, inputType) < 0) { // INPUT__DATA_SUBMIT
- smaError("vgId:%d, rsma % " PRIi8 " qSetStreamInput failed since %s", SMA_VID(pSma), level, tstrerror(terrno));
+ smaError("vgId:%d, rsma %" PRIi8 " qSetStreamInput failed since %s", SMA_VID(pSma), level, tstrerror(terrno));
return TSDB_CODE_FAILED;
}
@@ -841,6 +848,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
terrstr());
goto _err;
}
+ tDecoderClear(&mr.coder);
ASSERT(mr.me.type == TSDB_SUPER_TABLE);
ASSERT(mr.me.uid == suid);
if (TABLE_IS_ROLLUP(mr.me.flags)) {
@@ -869,24 +877,23 @@ _err:
return TSDB_CODE_FAILED;
}
-static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int64_t *committed) {
+static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int8_t type, int64_t qTaskFileVer) {
SVnode *pVnode = pSma->pVnode;
STFile tFile = {0};
char qTaskInfoFName[TSDB_FILENAME_LEN] = {0};
- tdRSmaQTaskInfoGetFName(TD_VID(pVnode), pVnode->state.committed, qTaskInfoFName);
+ tdRSmaQTaskInfoGetFileName(TD_VID(pVnode), qTaskFileVer, qTaskInfoFName);
if (tdInitTFile(&tFile, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFName) < 0) {
goto _err;
}
if (!taosCheckExistFile(TD_TFILE_FULL_NAME(&tFile))) {
- *committed = 0;
- if (pVnode->state.committed > 0) {
- smaWarn("vgId:%d, rsma restore for version %" PRIi64 ", not start as %s not exist", TD_VID(pVnode),
- pVnode->state.committed, TD_TFILE_FULL_NAME(&tFile));
+ if (qTaskFileVer > 0) {
+ smaWarn("vgId:%d, restore rsma task %" PRIi8 " for version %" PRIi64 ", not start as %s not exist",
+ TD_VID(pVnode), type, qTaskFileVer, TD_TFILE_FULL_NAME(&tFile));
} else {
- smaDebug("vgId:%d, rsma restore for version %" PRIi64 ", no need as %s not exist", TD_VID(pVnode),
- pVnode->state.committed, TD_TFILE_FULL_NAME(&tFile));
+ smaDebug("vgId:%d, restore rsma task %" PRIi8 " for version %" PRIi64 ", no need as %s not exist", TD_VID(pVnode),
+ type, qTaskFileVer, TD_TFILE_FULL_NAME(&tFile));
}
return TSDB_CODE_SUCCESS;
}
@@ -911,7 +918,7 @@ static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int64_t *committed) {
goto _err;
}
- if (tdRSmaQTaskInfoRestore(pSma, &fIter) < 0) {
+ if (tdRSmaQTaskInfoRestore(pSma, type, &fIter) < 0) {
tdRSmaQTaskInfoIterDestroy(&fIter);
tdCloseTFile(&tFile);
tdDestroyTFile(&tFile);
@@ -922,13 +929,13 @@ static int32_t tdRSmaRestoreQTaskInfoReload(SSma *pSma, int64_t *committed) {
tdCloseTFile(&tFile);
tdDestroyTFile(&tFile);
- // restored successfully from committed
- *committed = pVnode->state.committed;
-
+ // restored successfully from committed or sync
+ smaInfo("vgId:%d, restore rsma task %" PRIi8 " for version %" PRIi64 ", qtaskinfo reload succeed", TD_VID(pVnode),
+ type, qTaskFileVer);
return TSDB_CODE_SUCCESS;
_err:
- smaError("vgId:%d, rsma restore for version %" PRIi64 ", qtaskinfo reload failed since %s", TD_VID(pVnode),
- pVnode->state.committed, terrstr());
+ smaError("vgId:%d, restore rsma task %" PRIi8 " for version %" PRIi64 ", qtaskinfo reload failed since %s",
+ TD_VID(pVnode), type, qTaskFileVer, terrstr());
return TSDB_CODE_FAILED;
}
@@ -936,15 +943,14 @@ _err:
* @brief reload ts data from checkpoint
*
* @param pSma
- * @param committed restore from committed version
* @return int32_t
*/
-static int32_t tdRSmaRestoreTSDataReload(SSma *pSma, int64_t committed) {
+static int32_t tdRSmaRestoreTSDataReload(SSma *pSma) {
// NOTHING TODO: the data would be restored from the unified WAL replay procedure
return TSDB_CODE_SUCCESS;
}
-int32_t tdProcessRSmaRestoreImpl(SSma *pSma) {
+int32_t tdProcessRSmaRestoreImpl(SSma *pSma, int8_t type, int64_t qtaskFileVer) {
// step 1: iterate all stables to restore the rsma env
int64_t nTables = 0;
if (tdRSmaRestoreQTaskInfoInit(pSma, &nTables) < 0) {
@@ -952,24 +958,24 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) {
}
if (nTables <= 0) {
- smaDebug("vgId:%d, no need to restore rsma task since no tables", SMA_VID(pSma));
+ smaDebug("vgId:%d, no need to restore rsma task %" PRIi8 " since no tables", SMA_VID(pSma), type);
return TSDB_CODE_SUCCESS;
}
// step 2: retrieve qtaskinfo items from the persistence file(rsma/qtaskinfo) and restore
- int64_t committed = -1;
- if (tdRSmaRestoreQTaskInfoReload(pSma, &committed) < 0) {
+ if (tdRSmaRestoreQTaskInfoReload(pSma, type, qtaskFileVer) < 0) {
goto _err;
}
// step 3: reload ts data from checkpoint
- if (tdRSmaRestoreTSDataReload(pSma, committed) < 0) {
+ if (tdRSmaRestoreTSDataReload(pSma) < 0) {
goto _err;
}
-
+ smaInfo("vgId:%d, restore rsma task %" PRIi8 " from qtaskf %" PRIi64 " succeed", SMA_VID(pSma), type, qtaskFileVer);
return TSDB_CODE_SUCCESS;
_err:
- smaError("vgId:%d, failed to restore rsma task since %s", SMA_VID(pSma), terrstr());
+ smaError("vgId:%d, restore rsma task %" PRIi8 "from qtaskf %" PRIi64 " failed since %s", SMA_VID(pSma), type,
+ qtaskFileVer, terrstr());
return TSDB_CODE_FAILED;
}
@@ -1098,7 +1104,7 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF
return TSDB_CODE_SUCCESS;
}
-static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter) {
+static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, int8_t type, SRSmaQTaskInfoIter *pIter) {
while (1) {
// block iter
bool isFinish = false;
@@ -1114,7 +1120,7 @@ static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter) {
pIter->qBuf = taosDecodeFixedI32(pIter->qBuf, &qTaskInfoLenWithHead);
if (qTaskInfoLenWithHead < RSMA_QTASKINFO_HEAD_LEN) {
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
- smaError("vgId:%d, restore rsma qtaskinfo file %s failed since %s", SMA_VID(pSma),
+ smaError("vgId:%d, restore rsma task %" PRIi8 " from qtaskinfo file %s failed since %s", SMA_VID(pSma), type,
TD_TFILE_FULL_NAME(pIter->pTFile), terrstr());
return TSDB_CODE_FAILED;
}
@@ -1127,8 +1133,8 @@ static int32_t tdRSmaQTaskInfoRestore(SSma *pSma, SRSmaQTaskInfoIter *pIter) {
infoItem.qTaskInfo = pIter->qBuf;
infoItem.len = tdRSmaQTaskInfoContLen(qTaskInfoLenWithHead);
// do the restore job
- smaDebug("vgId:%d, restore the qtask info %s offset:%" PRIi64 "\n", SMA_VID(pSma),
- TD_TFILE_FULL_NAME(pIter->pTFile), pIter->offset - pIter->nBytes + pIter->nBufPos);
+ smaDebug("vgId:%d, restore rsma task %" PRIi8 " from qtaskinfo file %s offset:%" PRIi64 "\n", SMA_VID(pSma),
+ type, TD_TFILE_FULL_NAME(pIter->pTFile), pIter->offset - pIter->nBytes + pIter->nBufPos);
tdRSmaQTaskInfoItemRestore(pSma, &infoItem);
pIter->qBuf = POINTER_SHIFT(pIter->qBuf, infoItem.len);
@@ -1172,7 +1178,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
#if 0
if (pRSmaStat->commitAppliedVer > 0) {
char qTaskInfoFName[TSDB_FILENAME_LEN];
- tdRSmaQTaskInfoGetFName(vid, pRSmaStat->commitAppliedVer, qTaskInfoFName);
+ tdRSmaQTaskInfoGetFileName(vid, pRSmaStat->commitAppliedVer, qTaskInfoFName);
if (tdInitTFile(&tFile, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFName) < 0) {
smaError("vgId:%d, rsma persit, init %s failed since %s", vid, qTaskInfoFName, terrstr());
goto _err;
@@ -1217,7 +1223,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
if (!isFileCreated) {
char qTaskInfoFName[TSDB_FILENAME_LEN];
- tdRSmaQTaskInfoGetFName(vid, pRSmaStat->commitAppliedVer, qTaskInfoFName);
+ tdRSmaQTaskInfoGetFileName(vid, pRSmaStat->commitAppliedVer, qTaskInfoFName);
if (tdInitTFile(&tFile, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFName) < 0) {
smaError("vgId:%d, rsma persit, init %s failed since %s", vid, qTaskInfoFName, terrstr());
goto _err;
@@ -1331,6 +1337,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
SSDataBlock dataBlock = {.info.type = STREAM_GET_ALL};
qSetMultiStreamInput(pItem->taskInfo, &dataBlock, 1, STREAM_INPUT__DATA_BLOCK);
tdRSmaFetchAndSubmitResult(pItem, pRSmaInfo->pTSchema, pRSmaInfo->suid, pStat, STREAM_INPUT__DATA_BLOCK);
+ tdCleanupStreamInputDataBlock(pItem->taskInfo);
tdUnRefRSmaInfo(pSma, pRSmaInfo);
// atomic_store_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE);
@@ -1357,3 +1364,20 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) {
_end:
tdReleaseSmaRef(smaMgmt.rsetId, pItem->refId, __func__, __LINE__);
}
+
+int32_t smaDoRetention(SSma *pSma, int64_t now) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ if (VND_IS_RSMA(pSma->pVnode)) {
+ return code;
+ }
+
+ for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
+ if (pSma->pRSmaTsdb[i]) {
+ code = tsdbDoRetention(pSma->pRSmaTsdb[i], now);
+ if (code) goto _end;
+ }
+ }
+
+_end:
+ return code;
+}
\ No newline at end of file
diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c
index 06fe0074f3..fbcd2af751 100644
--- a/source/dnode/vnode/src/sma/smaSnapshot.c
+++ b/source/dnode/vnode/src/sma/smaSnapshot.c
@@ -35,6 +35,7 @@ struct SRsmaSnapReader {
int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapReader** ppReader) {
int32_t code = 0;
+ SVnode* pVnode = pSma->pVnode;
SRsmaSnapReader* pReader = NULL;
// alloc
@@ -47,6 +48,7 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapRead
pReader->sver = sver;
pReader->ever = ever;
+ // rsma1/rsma2
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
if (pSma->pRSmaTsdb[i]) {
code = tsdbSnapReaderOpen(pSma->pRSmaTsdb[i], sver, ever, i == 0 ? SNAP_DATA_RSMA1 : SNAP_DATA_RSMA2,
@@ -56,23 +58,98 @@ int32_t rsmaSnapReaderOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapRead
}
}
}
+
+ // qtaskinfo
+ // 1. add ref to qtaskinfo.v${ever} if exists and then start to replicate
+ char qTaskInfoFullName[TSDB_FILENAME_LEN];
+ tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), ever, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFullName);
+
+ if (!taosCheckExistFile(qTaskInfoFullName)) {
+ smaInfo("vgId:%d, vnode snapshot rsma reader for qtaskinfo not need as %s not exists", TD_VID(pVnode),
+ qTaskInfoFullName);
+ } else {
+ pReader->pQTaskFReader = taosMemoryCalloc(1, sizeof(SQTaskFReader));
+ if (!pReader->pQTaskFReader) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ TdFilePtr qTaskF = taosOpenFile(qTaskInfoFullName, TD_FILE_READ);
+ if (!qTaskF) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ pReader->pQTaskFReader->pReadH = qTaskF;
+#if 0
+ SQTaskFile* pQTaskF = &pReader->pQTaskFReader->fTask;
+ pQTaskF->nRef = 1;
+#endif
+ }
+
*ppReader = pReader;
- smaInfo("vgId:%d, vnode snapshot rsma reader opened succeed", SMA_VID(pSma));
+ smaInfo("vgId:%d, vnode snapshot rsma reader opened %s succeed", TD_VID(pVnode), qTaskInfoFullName);
return TSDB_CODE_SUCCESS;
_err:
- smaError("vgId:%d, vnode snapshot rsma reader opened failed since %s", SMA_VID(pSma), tstrerror(code));
+ smaError("vgId:%d, vnode snapshot rsma reader opened failed since %s", TD_VID(pVnode), tstrerror(code));
return TSDB_CODE_FAILED;
}
-static int32_t rsmaSnapReadQTaskInfo(SRsmaSnapReader* pReader, uint8_t** ppData) {
- int32_t code = 0;
- SSma* pSma = pReader->pSma;
+static int32_t rsmaSnapReadQTaskInfo(SRsmaSnapReader* pReader, uint8_t** ppBuf) {
+ int32_t code = 0;
+ SSma* pSma = pReader->pSma;
+ int64_t n = 0;
+ uint8_t* pBuf = NULL;
+ SQTaskFReader* qReader = pReader->pQTaskFReader;
+
+ if (!qReader->pReadH) {
+ *ppBuf = NULL;
+ smaInfo("vgId:%d, vnode snapshot rsma reader qtaskinfo, readh is empty", SMA_VID(pSma));
+ return 0;
+ }
+
+ int64_t size = 0;
+ if (taosFStatFile(qReader->pReadH, &size, NULL) < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+
+ // seek
+ if (taosLSeekFile(qReader->pReadH, 0, SEEK_SET) < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+
+ ASSERT(!(*ppBuf));
+ // alloc
+ *ppBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + size);
+ if (!(*ppBuf)) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ // read
+ n = taosReadFile(qReader->pReadH, POINTER_SHIFT(*ppBuf, sizeof(SSnapDataHdr)), size);
+ if (n < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ } else if (n != size) {
+ code = TSDB_CODE_FILE_CORRUPTED;
+ goto _err;
+ }
+
+ smaInfo("vgId:%d, vnode snapshot rsma read qtaskinfo, size:%" PRIi64, SMA_VID(pSma), size);
+
+
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppBuf);
+ pHdr->type = SNAP_DATA_QTASK;
+ pHdr->size = size;
_exit:
smaInfo("vgId:%d, vnode snapshot rsma read qtaskinfo succeed", SMA_VID(pSma));
return code;
_err:
+ *ppBuf = NULL;
smaError("vgId:%d, vnode snapshot rsma read qtaskinfo failed since %s", SMA_VID(pSma), tstrerror(code));
return code;
}
@@ -108,14 +185,14 @@ int32_t rsmaSnapRead(SRsmaSnapReader* pReader, uint8_t** ppData) {
// read qtaskinfo file
if (!pReader->qTaskDone) {
+ smaInfo("vgId:%d, vnode snapshot rsma qtaskinfo not done", SMA_VID(pReader->pSma));
code = rsmaSnapReadQTaskInfo(pReader, ppData);
if (code) {
goto _err;
} else {
+ pReader->qTaskDone = 1;
if (*ppData) {
goto _exit;
- } else {
- pReader->qTaskDone = 1;
}
}
}
@@ -140,11 +217,11 @@ int32_t rsmaSnapReaderClose(SRsmaSnapReader** ppReader) {
}
if (pReader->pQTaskFReader) {
- // TODO: close for qtaskinfo
+ taosCloseFile(&pReader->pQTaskFReader->pReadH);
+ taosMemoryFreeClear(pReader->pQTaskFReader);
smaInfo("vgId:%d, vnode snapshot rsma reader closed for qTaskInfo", SMA_VID(pReader->pSma));
}
-
smaInfo("vgId:%d, vnode snapshot rsma reader closed", SMA_VID(pReader->pSma));
taosMemoryFreeClear(*ppReader);
@@ -171,6 +248,7 @@ struct SRsmaSnapWriter {
int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapWriter** ppWriter) {
int32_t code = 0;
SRsmaSnapWriter* pWriter = NULL;
+ SVnode* pVnode = pSma->pVnode;
// alloc
pWriter = (SRsmaSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
@@ -182,6 +260,7 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapWrit
pWriter->sver = sver;
pWriter->ever = ever;
+ // rsma1/rsma2
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
if (pSma->pRSmaTsdb[i]) {
code = tsdbSnapWriterOpen(pSma->pRSmaTsdb[i], sver, ever, &pWriter->pDataWriter[i]);
@@ -192,8 +271,25 @@ int32_t rsmaSnapWriterOpen(SSma* pSma, int64_t sver, int64_t ever, SRsmaSnapWrit
}
// qtaskinfo
- // TODO
+ SQTaskFWriter* qWriter = (SQTaskFWriter*)taosMemoryCalloc(1, sizeof(SQTaskFWriter));
+ qWriter->pSma = pSma;
+ char qTaskInfoFullName[TSDB_FILENAME_LEN];
+ tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), 0, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFullName);
+ TdFilePtr qTaskF = taosCreateFile(qTaskInfoFullName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
+ if (!qTaskF) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ smaError("vgId:%d, rsma snapshot writer open %s failed since %s", TD_VID(pSma->pVnode), qTaskInfoFullName, tstrerror(code));
+ goto _err;
+ }
+ qWriter->pWriteH = qTaskF;
+ int32_t fnameLen = strlen(qTaskInfoFullName) + 1;
+ qWriter->fname = taosMemoryCalloc(1, fnameLen);
+ strncpy(qWriter->fname, qTaskInfoFullName, fnameLen);
+ pWriter->pQTaskFWriter = qWriter;
+ smaDebug("vgId:%d, rsma snapshot writer open succeed for %s", TD_VID(pSma->pVnode), qTaskInfoFullName);
+
+ // snapWriter
*ppWriter = pWriter;
smaInfo("vgId:%d, rsma snapshot writer open succeed", TD_VID(pSma->pVnode));
@@ -208,18 +304,39 @@ _err:
int32_t rsmaSnapWriterClose(SRsmaSnapWriter** ppWriter, int8_t rollback) {
int32_t code = 0;
SRsmaSnapWriter* pWriter = *ppWriter;
+ SVnode* pVnode = pWriter->pSma->pVnode;
if (rollback) {
- ASSERT(0);
- // code = tsdbFSRollback(pWriter->pTsdb->pFS);
- // if (code) goto _err;
+ // TODO: rsma1/rsma2
+ // qtaskinfo
+ if(pWriter->pQTaskFWriter) {
+ taosRemoveFile(pWriter->pQTaskFWriter->fname);
+ }
} else {
+ // rsma1/rsma2
for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) {
if (pWriter->pDataWriter[i]) {
code = tsdbSnapWriterClose(&pWriter->pDataWriter[i], rollback);
if (code) goto _err;
}
}
+ // qtaskinfo
+ if (pWriter->pQTaskFWriter) {
+ char qTaskInfoFullName[TSDB_FILENAME_LEN];
+ tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), pWriter->ever, tfsGetPrimaryPath(pVnode->pTfs), qTaskInfoFullName);
+ if (taosRenameFile(pWriter->pQTaskFWriter->fname, qTaskInfoFullName) < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ smaInfo("vgId:%d, vnode snapshot rsma writer rename %s to %s", SMA_VID(pWriter->pSma),
+ pWriter->pQTaskFWriter->fname, qTaskInfoFullName);
+
+ // rsma restore
+ if ((code = tdRsmaRestore(pWriter->pSma, RSMA_RESTORE_SYNC, pWriter->ever)) < 0) {
+ goto _err;
+ }
+ smaInfo("vgId:%d, vnode snapshot rsma writer restore from %s succeed", SMA_VID(pWriter->pSma), qTaskInfoFullName);
+ }
}
smaInfo("vgId:%d, vnode snapshot rsma writer close succeed", SMA_VID(pWriter->pSma));
@@ -261,26 +378,23 @@ _err:
}
static int32_t rsmaSnapWriteQTaskInfo(SRsmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
- int32_t code = 0;
+ int32_t code = 0;
+ SQTaskFWriter* qWriter = pWriter->pQTaskFWriter;
- if (pWriter->pQTaskFWriter == NULL) {
- // SDelFile* pDelFile = pWriter->fs.pDelFile;
-
- // // reader
- // if (pDelFile) {
- // code = tsdbDelFReaderOpen(&pWriter->pDelFReader, pDelFile, pTsdb, NULL);
- // if (code) goto _err;
-
- // code = tsdbReadDelIdx(pWriter->pDelFReader, pWriter->aDelIdxR, NULL);
- // if (code) goto _err;
- // }
-
- // // writer
- // SDelFile delFile = {.commitID = pWriter->commitID, .offset = 0, .size = 0};
- // code = tsdbDelFWriterOpen(&pWriter->pDelFWriter, &delFile, pTsdb);
- // if (code) goto _err;
+ if (qWriter && qWriter->pWriteH) {
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)pData;
+ int64_t size = pHdr->size;
+ ASSERT(size == (nData - sizeof(SSnapDataHdr)));
+ int64_t contLen = taosWriteFile(qWriter->pWriteH, pHdr->data, size);
+ if (contLen != size) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ goto _err;
+ }
+ } else {
+ smaInfo("vgId:%d, vnode snapshot rsma write qtaskinfo is not needed", SMA_VID(pWriter->pSma));
}
- smaInfo("vgId:%d, vnode snapshot rsma write qtaskinfo succeed", SMA_VID(pWriter->pSma));
+
+ smaInfo("vgId:%d, vnode snapshot rsma write qtaskinfo %s succeed", SMA_VID(pWriter->pSma), qWriter->fname);
_exit:
return code;
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index b755fcd4ff..fac2f7cee1 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -225,9 +225,11 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, char* msg, int32_t msgLen) {
if (offset.val.type == TMQ_OFFSET__LOG) {
STqHandle* pHandle = taosHashGet(pTq->handles, offset.subKey, strlen(offset.subKey));
- if (walRefVer(pHandle->pRef, offset.val.version) < 0) {
- ASSERT(0);
- return -1;
+ if (pHandle) {
+ if (walRefVer(pHandle->pRef, offset.val.version) < 0) {
+ ASSERT(0);
+ return -1;
+ }
}
}
@@ -289,8 +291,6 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su
return 0;
}
-static int32_t tqInitMetaRsp(SMqMetaRsp* pRsp, const SMqPollReq* pReq) { return 0; }
-
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
SMqPollReq* pReq = pMsg->pCont;
int64_t consumerId = pReq->consumerId;
@@ -324,7 +324,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
char buf[80];
tFormatOffset(buf, 80, &reqOffset);
- tqDebug("tmq poll: consumer %ld (epoch %d), subkey %s, recv poll req in vg %d, req offset %s", consumerId,
+ tqDebug("tmq poll: consumer %" PRId64 " (epoch %d), subkey %s, recv poll req in vg %d, req offset %s", consumerId,
pReq->epoch, pHandle->subKey, TD_VID(pTq->pVnode), buf);
SMqMetaRsp metaRsp = {0};
@@ -355,8 +355,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
}
} else if (reqOffset.type == TMQ_OFFSET__RESET_LATEST) {
tqOffsetResetToLog(&dataRsp.rspOffset, walGetLastVer(pTq->pVnode->pWal));
- tqDebug("tmq poll: consumer %ld, subkey %s, vg %d, offset reset to %ld", consumerId, pHandle->subKey,
- TD_VID(pTq->pVnode), dataRsp.rspOffset.version);
+ tqDebug("tmq poll: consumer %" PRId64 ", subkey %s, vg %d, offset reset to %" PRId64, consumerId,
+ pHandle->subKey, TD_VID(pTq->pVnode), dataRsp.rspOffset.version);
if (tqSendDataRsp(pTq, pMsg, pReq, &dataRsp) < 0) {
code = -1;
}
@@ -445,7 +445,10 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
// todo lock
STqHandle* pHandle = taosHashGet(pTq->handles, req.subKey, strlen(req.subKey));
if (pHandle == NULL) {
- ASSERT(req.oldConsumerId == -1);
+ if (req.oldConsumerId != -1) {
+ tqError("vgId:%d, build new consumer handle %s for consumer %d, but old consumerId is %ld", req.vgId, req.subKey,
+ req.newConsumerId, req.oldConsumerId);
+ }
ASSERT(req.newConsumerId != -1);
STqHandle tqHandle = {0};
pHandle = &tqHandle;
@@ -518,7 +521,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
qCreateQueueExecTaskInfo(NULL, &handle, NULL, NULL);
}
taosHashPut(pTq->handles, req.subKey, strlen(req.subKey), pHandle, sizeof(STqHandle));
- tqDebug("try to persist handle %s consumer %ld", req.subKey, pHandle->consumerId);
+ tqDebug("try to persist handle %s consumer %" PRId64, req.subKey, pHandle->consumerId);
if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) {
// TODO
ASSERT(0);
@@ -537,59 +540,52 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
return 0;
}
-int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
- SStreamTask* pTask = taosMemoryCalloc(1, sizeof(SStreamTask));
- if (pTask == NULL) {
- return -1;
- }
- SDecoder decoder;
- tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
- if (tDecodeSStreamTask(&decoder, pTask) < 0) {
- ASSERT(0);
- }
- tDecoderClear(&decoder);
- ASSERT(pTask->isDataScan == 0 || pTask->isDataScan == 1);
- if (pTask->isDataScan == 0 && pTask->sinkType == TASK_SINK__NONE) {
+int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask) {
+ int32_t code = 0;
+
+ if (pTask->taskLevel == TASK_LEVEL__AGG) {
ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0);
}
- pTask->execStatus = TASK_EXEC_STATUS__IDLE;
+ pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->inputQueue = streamQueueOpen();
pTask->outputQueue = streamQueueOpen();
+
+ if (pTask->inputQueue == NULL || pTask->outputQueue == NULL) {
+ code = -1;
+ goto FAIL;
+ }
+
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_OUTPUT_STATUS__NORMAL;
- if (pTask->inputQueue == NULL || pTask->outputQueue == NULL) goto FAIL;
-
pTask->pMsgCb = &pTq->pVnode->msgCb;
- // exec
- if (pTask->execType != TASK_EXEC__NONE) {
- // expand runners
- if (pTask->isDataScan) {
- SReadHandle handle = {
- .meta = pTq->pVnode->pMeta,
- .vnode = pTq->pVnode,
- .initTqReader = 1,
- };
- pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle);
- } else {
- SReadHandle mgHandle = {
- .vnode = NULL,
- .numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo),
- };
- pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle);
- }
+ // expand executor
+ if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
+ SReadHandle handle = {
+ .meta = pTq->pVnode->pMeta,
+ .vnode = pTq->pVnode,
+ .initTqReader = 1,
+ };
+ pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle);
+ ASSERT(pTask->exec.executor);
+ } else if (pTask->taskLevel == TASK_LEVEL__AGG) {
+ SReadHandle mgHandle = {
+ .vnode = NULL,
+ .numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo),
+ };
+ pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle);
ASSERT(pTask->exec.executor);
}
// sink
/*pTask->ahandle = pTq->pVnode;*/
- if (pTask->sinkType == TASK_SINK__SMA) {
+ if (pTask->outputType == TASK_OUTPUT__SMA) {
pTask->smaSink.vnode = pTq->pVnode;
pTask->smaSink.smaSink = smaHandleRes;
- } else if (pTask->sinkType == TASK_SINK__TABLE) {
+ } else if (pTask->outputType == TASK_OUTPUT__TABLE) {
pTask->tbSink.vnode = pTq->pVnode;
pTask->tbSink.tbSinkFunc = tqTableSink;
@@ -606,15 +602,35 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
tqInfo("deploy stream task on vg %d, task id %d, child id %d", TD_VID(pTq->pVnode), pTask->taskId,
pTask->selfChildId);
- taosHashPut(pTq->pStreamTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*));
-
- /*SMeta* pMeta = pTq->pVnode->pMeta;*/
- /*tdbTbUpsert(pMeta->pTaskIdx, &pTask->taskId, sizeof(int32_t), msg, msgLen, &pMeta->txn);*/
-
- return 0;
FAIL:
if (pTask->inputQueue) streamQueueClose(pTask->inputQueue);
if (pTask->outputQueue) streamQueueClose(pTask->outputQueue);
+ // TODO free executor
+ return code;
+}
+
+int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
+ SStreamTask* pTask = taosMemoryCalloc(1, sizeof(SStreamTask));
+ if (pTask == NULL) {
+ return -1;
+ }
+ SDecoder decoder;
+ tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
+ if (tDecodeSStreamTask(&decoder, pTask) < 0) {
+ ASSERT(0);
+ goto FAIL;
+ }
+ tDecoderClear(&decoder);
+
+ if (tqExpandTask(pTq, pTask) < 0) {
+ goto FAIL;
+ }
+
+ taosHashPut(pTq->pStreamTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*));
+
+ return 0;
+
+FAIL:
if (pTask) taosMemoryFree(pTask);
return -1;
}
@@ -635,9 +651,9 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
pIter = taosHashIterate(pTq->pStreamTasks, pIter);
if (pIter == NULL) break;
SStreamTask* pTask = *(SStreamTask**)pIter;
- if (!pTask->isDataScan) continue;
+ if (pTask->taskLevel != TASK_LEVEL__SOURCE) continue;
- qDebug("data submit enqueue stream task: %d, ver: %ld", pTask->taskId, ver);
+ qDebug("data submit enqueue stream task: %d, ver: %" PRId64, pTask->taskId, ver);
if (!failed) {
if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) {
@@ -645,7 +661,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
continue;
}
- if (streamLaunchByWrite(pTask, TD_VID(pTq->pVnode)) < 0) {
+ if (streamSchedExec(pTask) < 0) {
qError("stream task launch failed, task id %d", pTask->taskId);
continue;
}
@@ -675,13 +691,14 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
}
}
-int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
+int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
+ ASSERT(0);
char* msgStr = pMsg->pCont;
char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
SStreamDispatchReq req;
SDecoder decoder;
- tDecoderInit(&decoder, msgBody, msgLen);
+ tDecoderInit(&decoder, (uint8_t*)msgBody, msgLen);
tDecodeStreamDispatchReq(&decoder, &req);
int32_t taskId = req.taskId;
SStreamTask** ppTask = (SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t));
@@ -690,7 +707,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
.info = pMsg->info,
.code = 0,
};
- streamProcessDispatchReq(*ppTask, &req, &rsp);
+ streamProcessDispatchReq(*ppTask, &req, &rsp, exec);
return 0;
} else {
return -1;
@@ -748,16 +765,6 @@ int32_t tqProcessTaskDropReq(STQ* pTq, char* msg, int32_t msgLen) {
// launch exec to free memory
// remove from hash
return 0;
-
-#if 0
- int32_t code = taosHashRemove(pTq->pStreamTasks, &pReq->taskId, sizeof(int32_t));
- // set status dropping
- ASSERT(code == 0);
- if (code == 0) {
- // sendrsp
- }
- return code;
-#endif
}
int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) {
@@ -786,3 +793,37 @@ int32_t tqProcessTaskRetrieveRsp(STQ* pTq, SRpcMsg* pMsg) {
//
return 0;
}
+
+void vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
+ STQ* pTq = pVnode->pTq;
+ char* msgStr = pMsg->pCont;
+ char* msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
+ int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
+ int32_t code = 0;
+
+ SStreamDispatchReq req;
+ SDecoder decoder;
+ tDecoderInit(&decoder, msgBody, msgLen);
+ if (tDecodeStreamDispatchReq(&decoder, &req) < 0) {
+ code = TSDB_CODE_MSG_DECODE_ERROR;
+ goto FAIL;
+ }
+
+ int32_t taskId = req.taskId;
+ SStreamTask** ppTask = (SStreamTask**)taosHashGet(pTq->pStreamTasks, &taskId, sizeof(int32_t));
+ if (ppTask) {
+ SRpcMsg rsp = {
+ .info = pMsg->info,
+ .code = 0,
+ };
+ streamProcessDispatchReq(*ppTask, &req, &rsp, false);
+ return;
+ }
+FAIL:
+ if (pMsg->info.handle == NULL) return;
+ SRpcMsg rsp = {
+ .code = code,
+ .info = pMsg->info,
+ };
+ tmsgSendRsp(&rsp);
+}
diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c
index 7fc9838f2b..7d94b2ed88 100644
--- a/source/dnode/vnode/src/tq/tqExec.c
+++ b/source/dnode/vnode/src/tq/tqExec.c
@@ -115,7 +115,8 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqMetaRsp*
}
if (pRsp->blockNum == 0 && pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
- tqDebug("vgId: %d, tsdb consume over, switch to wal, ver %ld", TD_VID(pTq->pVnode), pHandle->snapshotVer + 1);
+ tqDebug("vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode),
+ pHandle->snapshotVer + 1);
tqOffsetResetToLog(pOffset, pHandle->snapshotVer);
qStreamPrepareScan(task, pOffset, pHandle->execHandle.subType);
continue;
diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c
index 2ccea3449a..f7309b93ea 100644
--- a/source/dnode/vnode/src/tq/tqMeta.c
+++ b/source/dnode/vnode/src/tq/tqMeta.c
@@ -102,7 +102,7 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
handle.execHandle.execDb.pFilterOutTbUid =
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
}
- tqDebug("tq restore %s consumer %ld vgId:%d", handle.subKey, handle.consumerId, TD_VID(pTq->pVnode));
+ tqDebug("tq restore %s consumer %" PRId64 " vgId:%d", handle.subKey, handle.consumerId, TD_VID(pTq->pVnode));
taosHashPut(pTq->handles, pKey, kLen, &handle, sizeof(STqHandle));
}
@@ -142,7 +142,7 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) {
tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code);
ASSERT(code == 0);
- tqDebug("tq save %s(%d) consumer %ld vgId:%d", pHandle->subKey, strlen(pHandle->subKey), pHandle->consumerId,
+ tqDebug("tq save %s(%d) consumer %" PRId64 " vgId:%d", pHandle->subKey, strlen(pHandle->subKey), pHandle->consumerId,
TD_VID(pTq->pVnode));
void* buf = taosMemoryCalloc(1, vlen);
diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
index cacb82b702..292c234f49 100644
--- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c
@@ -37,7 +37,7 @@ int32_t tqOffsetReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqOffsetReader
pReader->sver = sver;
pReader->ever = ever;
- tqInfo("vgId:%d vnode snapshot tq offset reader opened", TD_VID(pTq->pVnode));
+ tqInfo("vgId:%d, vnode snapshot tq offset reader opened", TD_VID(pTq->pVnode));
*ppReader = pReader;
return 0;
@@ -109,7 +109,7 @@ int32_t tqOffsetWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqOffsetWriter
return code;
_err:
- tqError("vgId:%d tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
*ppWriter = NULL;
return code;
}
diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c
index 0debeaef90..1c48ef7535 100644
--- a/source/dnode/vnode/src/tq/tqPush.c
+++ b/source/dnode/vnode/src/tq/tqPush.c
@@ -136,31 +136,6 @@ int32_t tqSendExecReq(STQ* pTq, STqHandle* pHandle) {
return 0;
}
-int32_t tqEnqueueAll(STQ* pTq, SSubmitReq* pReq) {
- void* pIter = NULL;
- SStreamDataSubmit* pSubmit = streamDataSubmitNew(pReq);
- if (pSubmit == NULL) {
- return -1;
- }
-
- while (1) {
- pIter = taosHashIterate(pTq->handles, pIter);
- if (pIter == NULL) break;
- STqHandle* pHandle = (STqHandle*)pIter;
- if (tqEnqueue(pHandle, pSubmit) < 0) {
- continue;
- }
- int8_t execStatus = atomic_load_8(&pHandle->pushHandle.execStatus);
- if (execStatus == TASK_EXEC_STATUS__IDLE || execStatus == TASK_EXEC_STATUS__CLOSING) {
- tqSendExecReq(pTq, pHandle);
- }
- }
-
- streamDataSubmitRefDec(pSubmit);
-
- return 0;
-}
-
int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver, SRpcHandleInfo handleInfo) {
if (msgType != TDMT_VND_SUBMIT) return 0;
void* pIter = NULL;
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 04a40451ec..42349bc274 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -136,7 +136,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
ret->offset.type = TMQ_OFFSET__LOG;
ret->offset.version = pReader->ver;
ret->fetchType = FETCH_TYPE__NONE;
- tqDebug("return offset %ld, no more valid", ret->offset.version);
+ tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version);
ASSERT(ret->offset.version >= 0);
return -1;
}
@@ -168,7 +168,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
ret->offset.version = pReader->ver;
ASSERT(pReader->ver >= 0);
ret->fetchType = FETCH_TYPE__NONE;
- tqDebug("return offset %ld, processed finish", ret->offset.version);
+ tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version);
return 0;
}
}
@@ -415,7 +415,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
pIter = taosHashIterate(pTq->pStreamTasks, pIter);
if (pIter == NULL) break;
SStreamTask* pTask = *(SStreamTask**)pIter;
- if (pTask->isDataScan) {
+ if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
int32_t code = qUpdateQualifiedTableId(pTask->exec.executor, tbUidList, isAdd);
ASSERT(code == 0);
}
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index 850394b15d..6b4d5a2f3e 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -117,7 +117,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
for (int32_t i = 0; i < sz; i++) {
SSDataBlock* pDataBlock = taosArrayGet(pBlocks, i);
- blkHead->numOfRows = htons(pDataBlock->info.rows);
+ blkHead->numOfRows = htonl(pDataBlock->info.rows);
blkHead->sversion = htonl(pTSchema->version);
// TODO
blkHead->suid = htobe64(suid);
diff --git a/source/dnode/vnode/src/tq/tqSnapshot.c b/source/dnode/vnode/src/tq/tqSnapshot.c
index 21172134ba..b4a7ce7737 100644
--- a/source/dnode/vnode/src/tq/tqSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqSnapshot.c
@@ -52,13 +52,13 @@ int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapReader** p
goto _err;
}
- tqInfo("vgId:%d vnode snapshot tq reader opened", TD_VID(pTq->pVnode));
+ tqInfo("vgId:%d, vnode snapshot tq reader opened", TD_VID(pTq->pVnode));
*ppReader = pReader;
return code;
_err:
- tqError("vgId:%d vnode snapshot tq reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, vnode snapshot tq reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
*ppReader = NULL;
return code;
}
@@ -113,14 +113,14 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
pHdr->size = vLen;
memcpy(pHdr->data, pVal, vLen);
- tqInfo("vgId:%d vnode snapshot tq read data, version:%" PRId64 " subKey: %s vLen:%d", TD_VID(pReader->pTq->pVnode),
+ tqInfo("vgId:%d, vnode snapshot tq read data, version:%" PRId64 " subKey: %s vLen:%d", TD_VID(pReader->pTq->pVnode),
handle.snapshotVer, handle.subKey, vLen);
_exit:
return code;
_err:
- tqError("vgId:%d vnode snapshot tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, vnode snapshot tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code));
return code;
}
@@ -154,7 +154,7 @@ int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** p
return code;
_err:
- tqError("vgId:%d tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
*ppWriter = NULL;
return code;
}
@@ -182,7 +182,7 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
return code;
_err:
- tqError("vgId:%d tq snapshot writer close failed since %s", TD_VID(pWriter->pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, tq snapshot writer close failed since %s", TD_VID(pWriter->pTq->pVnode), tstrerror(code));
return code;
}
@@ -204,6 +204,6 @@ int32_t tqSnapWrite(STqSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
_err:
tDecoderClear(pDecoder);
- tqError("vgId:%d vnode snapshot tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ tqError("vgId:%d, vnode snapshot tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
return code;
}
diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c
new file mode 100644
index 0000000000..21172134ba
--- /dev/null
+++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "meta.h"
+#include "tdbInt.h"
+#include "tq.h"
+
+// STqSnapReader ========================================
+struct STqSnapReader {
+ STQ* pTq;
+ int64_t sver;
+ int64_t ever;
+ TBC* pCur;
+};
+
+int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapReader** ppReader) {
+ int32_t code = 0;
+ STqSnapReader* pReader = NULL;
+
+ // alloc
+ pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
+ if (pReader == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ pReader->pTq = pTq;
+ pReader->sver = sver;
+ pReader->ever = ever;
+
+ // impl
+ code = tdbTbcOpen(pTq->pExecStore, &pReader->pCur, NULL);
+ if (code) {
+ taosMemoryFree(pReader);
+ goto _err;
+ }
+
+ code = tdbTbcMoveToFirst(pReader->pCur);
+ if (code) {
+ taosMemoryFree(pReader);
+ goto _err;
+ }
+
+ tqInfo("vgId:%d vnode snapshot tq reader opened", TD_VID(pTq->pVnode));
+
+ *ppReader = pReader;
+ return code;
+
+_err:
+ tqError("vgId:%d vnode snapshot tq reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ *ppReader = NULL;
+ return code;
+}
+
+int32_t tqSnapReaderClose(STqSnapReader** ppReader) {
+ int32_t code = 0;
+
+ tdbTbcClose((*ppReader)->pCur);
+ taosMemoryFree(*ppReader);
+ *ppReader = NULL;
+
+ return code;
+}
+
+int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
+ int32_t code = 0;
+ const void* pKey = NULL;
+ const void* pVal = NULL;
+ int32_t kLen = 0;
+ int32_t vLen = 0;
+ SDecoder decoder;
+ STqHandle handle;
+
+ *ppData = NULL;
+ for (;;) {
+ if (tdbTbcGet(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) {
+ goto _exit;
+ }
+
+ tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
+ tDecodeSTqHandle(&decoder, &handle);
+ tDecoderClear(&decoder);
+
+ if (handle.snapshotVer <= pReader->sver && handle.snapshotVer >= pReader->ever) {
+ tdbTbcMoveToNext(pReader->pCur);
+ break;
+ } else {
+ tdbTbcMoveToNext(pReader->pCur);
+ }
+ }
+
+ ASSERT(pVal && vLen);
+
+ *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
+ if (*ppData == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
+ pHdr->type = SNAP_DATA_TQ_HANDLE;
+ pHdr->size = vLen;
+ memcpy(pHdr->data, pVal, vLen);
+
+ tqInfo("vgId:%d vnode snapshot tq read data, version:%" PRId64 " subKey: %s vLen:%d", TD_VID(pReader->pTq->pVnode),
+ handle.snapshotVer, handle.subKey, vLen);
+
+_exit:
+ return code;
+
+_err:
+ tqError("vgId:%d vnode snapshot tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code));
+ return code;
+}
+
+// STqSnapWriter ========================================
+struct STqSnapWriter {
+ STQ* pTq;
+ int64_t sver;
+ int64_t ever;
+ TXN txn;
+};
+
+int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
+ int32_t code = 0;
+ STqSnapWriter* pWriter;
+
+ // alloc
+ pWriter = (STqSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
+ if (pWriter == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ pWriter->pTq = pTq;
+ pWriter->sver = sver;
+ pWriter->ever = ever;
+
+ if (tdbTxnOpen(&pWriter->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
+ ASSERT(0);
+ }
+
+ *ppWriter = pWriter;
+ return code;
+
+_err:
+ tqError("vgId:%d tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ *ppWriter = NULL;
+ return code;
+}
+
+int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
+ int32_t code = 0;
+ STqSnapWriter* pWriter = *ppWriter;
+ STQ* pTq = pWriter->pTq;
+
+ if (rollback) {
+ ASSERT(0);
+ } else {
+ code = tdbCommit(pWriter->pTq->pMetaStore, &pWriter->txn);
+ if (code) goto _err;
+ }
+
+ taosMemoryFree(pWriter);
+ *ppWriter = NULL;
+
+ // restore from metastore
+ if (tqMetaRestoreHandle(pTq) < 0) {
+ goto _err;
+ }
+
+ return code;
+
+_err:
+ tqError("vgId:%d tq snapshot writer close failed since %s", TD_VID(pWriter->pTq->pVnode), tstrerror(code));
+ return code;
+}
+
+int32_t tqSnapWrite(STqSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
+ int32_t code = 0;
+ STQ* pTq = pWriter->pTq;
+ SDecoder decoder = {0};
+ SDecoder* pDecoder = &decoder;
+ STqHandle handle;
+
+ tDecoderInit(pDecoder, pData + sizeof(SSnapDataHdr), nData - sizeof(SSnapDataHdr));
+ code = tDecodeSTqHandle(pDecoder, &handle);
+ if (code) goto _err;
+ code = tqMetaSaveHandle(pTq, handle.subKey, &handle);
+ if (code < 0) goto _err;
+ tDecoderClear(pDecoder);
+
+ return code;
+
+_err:
+ tDecoderClear(pDecoder);
+ tqError("vgId:%d vnode snapshot tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ return code;
+}
diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
new file mode 100644
index 0000000000..21172134ba
--- /dev/null
+++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "meta.h"
+#include "tdbInt.h"
+#include "tq.h"
+
+// STqSnapReader ========================================
+struct STqSnapReader {
+ STQ* pTq;
+ int64_t sver;
+ int64_t ever;
+ TBC* pCur;
+};
+
+int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapReader** ppReader) {
+ int32_t code = 0;
+ STqSnapReader* pReader = NULL;
+
+ // alloc
+ pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
+ if (pReader == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ pReader->pTq = pTq;
+ pReader->sver = sver;
+ pReader->ever = ever;
+
+ // impl
+ code = tdbTbcOpen(pTq->pExecStore, &pReader->pCur, NULL);
+ if (code) {
+ taosMemoryFree(pReader);
+ goto _err;
+ }
+
+ code = tdbTbcMoveToFirst(pReader->pCur);
+ if (code) {
+ taosMemoryFree(pReader);
+ goto _err;
+ }
+
+ tqInfo("vgId:%d vnode snapshot tq reader opened", TD_VID(pTq->pVnode));
+
+ *ppReader = pReader;
+ return code;
+
+_err:
+ tqError("vgId:%d vnode snapshot tq reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ *ppReader = NULL;
+ return code;
+}
+
+int32_t tqSnapReaderClose(STqSnapReader** ppReader) {
+ int32_t code = 0;
+
+ tdbTbcClose((*ppReader)->pCur);
+ taosMemoryFree(*ppReader);
+ *ppReader = NULL;
+
+ return code;
+}
+
+int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
+ int32_t code = 0;
+ const void* pKey = NULL;
+ const void* pVal = NULL;
+ int32_t kLen = 0;
+ int32_t vLen = 0;
+ SDecoder decoder;
+ STqHandle handle;
+
+ *ppData = NULL;
+ for (;;) {
+ if (tdbTbcGet(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) {
+ goto _exit;
+ }
+
+ tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
+ tDecodeSTqHandle(&decoder, &handle);
+ tDecoderClear(&decoder);
+
+ if (handle.snapshotVer <= pReader->sver && handle.snapshotVer >= pReader->ever) {
+ tdbTbcMoveToNext(pReader->pCur);
+ break;
+ } else {
+ tdbTbcMoveToNext(pReader->pCur);
+ }
+ }
+
+ ASSERT(pVal && vLen);
+
+ *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
+ if (*ppData == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
+ pHdr->type = SNAP_DATA_TQ_HANDLE;
+ pHdr->size = vLen;
+ memcpy(pHdr->data, pVal, vLen);
+
+ tqInfo("vgId:%d vnode snapshot tq read data, version:%" PRId64 " subKey: %s vLen:%d", TD_VID(pReader->pTq->pVnode),
+ handle.snapshotVer, handle.subKey, vLen);
+
+_exit:
+ return code;
+
+_err:
+ tqError("vgId:%d vnode snapshot tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code));
+ return code;
+}
+
+// STqSnapWriter ========================================
+struct STqSnapWriter {
+ STQ* pTq;
+ int64_t sver;
+ int64_t ever;
+ TXN txn;
+};
+
+int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter) {
+ int32_t code = 0;
+ STqSnapWriter* pWriter;
+
+ // alloc
+ pWriter = (STqSnapWriter*)taosMemoryCalloc(1, sizeof(*pWriter));
+ if (pWriter == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+ pWriter->pTq = pTq;
+ pWriter->sver = sver;
+ pWriter->ever = ever;
+
+ if (tdbTxnOpen(&pWriter->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) {
+ ASSERT(0);
+ }
+
+ *ppWriter = pWriter;
+ return code;
+
+_err:
+ tqError("vgId:%d tq snapshot writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ *ppWriter = NULL;
+ return code;
+}
+
+int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) {
+ int32_t code = 0;
+ STqSnapWriter* pWriter = *ppWriter;
+ STQ* pTq = pWriter->pTq;
+
+ if (rollback) {
+ ASSERT(0);
+ } else {
+ code = tdbCommit(pWriter->pTq->pMetaStore, &pWriter->txn);
+ if (code) goto _err;
+ }
+
+ taosMemoryFree(pWriter);
+ *ppWriter = NULL;
+
+ // restore from metastore
+ if (tqMetaRestoreHandle(pTq) < 0) {
+ goto _err;
+ }
+
+ return code;
+
+_err:
+ tqError("vgId:%d tq snapshot writer close failed since %s", TD_VID(pWriter->pTq->pVnode), tstrerror(code));
+ return code;
+}
+
+int32_t tqSnapWrite(STqSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
+ int32_t code = 0;
+ STQ* pTq = pWriter->pTq;
+ SDecoder decoder = {0};
+ SDecoder* pDecoder = &decoder;
+ STqHandle handle;
+
+ tDecoderInit(pDecoder, pData + sizeof(SSnapDataHdr), nData - sizeof(SSnapDataHdr));
+ code = tDecodeSTqHandle(pDecoder, &handle);
+ if (code) goto _err;
+ code = tqMetaSaveHandle(pTq, handle.subKey, &handle);
+ if (code < 0) goto _err;
+ tDecoderClear(pDecoder);
+
+ return code;
+
+_err:
+ tDecoderClear(pDecoder);
+ tqError("vgId:%d vnode snapshot tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code));
+ return code;
+}
diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c
index 3c832e9c2a..be2828d187 100644
--- a/source/dnode/vnode/src/tsdb/tsdbOpen.c
+++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c
@@ -71,7 +71,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
goto _err;
}
- tsdbDebug("vgId:%d, tsdb is opened for %s, days:%d, keep:%d,%d,%d", TD_VID(pVnode), pTsdb->path, pTsdb->keepCfg.days,
+ tsdbDebug("vgId:%d, tsdb is opened at %s, days:%d, keep:%d,%d,%d", TD_VID(pVnode), pTsdb->path, pTsdb->keepCfg.days,
pTsdb->keepCfg.keep0, pTsdb->keepCfg.keep1, pTsdb->keepCfg.keep2);
*ppTsdb = pTsdb;
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index a88da59d4a..3659faa603 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -146,7 +146,8 @@ static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanI
static int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDelList, SRowMerger* pMerger,
STsdbReader* pReader);
static int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, STSRow* pTSRow);
-static int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData, int32_t rowIndex);
+static int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBlockData* pBlockData,
+ int32_t rowIndex);
static void setComposedBlockFlag(STsdbReader* pReader, bool composed);
static void updateSchema(TSDBROW* pRow, uint64_t uid, STsdbReader* pReader);
static bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order);
@@ -407,6 +408,10 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
goto _end;
}
+ if (VND_IS_TSMA(pVnode)) {
+ tsdbDebug("vgId:%d, tsma is selected to query", TD_VID(pVnode));
+ }
+
initReaderStatus(&pReader->status);
pReader->pTsdb = getTsdbByRetentions(pVnode, pCond->twindows.skey, pVnode->config.tsdbCfg.retentions, idstr, &level);
@@ -758,7 +763,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn
pReader->cost.blockLoadTime += elapsedTime;
int32_t unDumpedRows = asc ? pBlock->nRow - pDumpInfo->rowIndex : pDumpInfo->rowIndex + 1;
- tsdbDebug("%p load file block into buffer, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
+ tsdbDebug("%p copy file block to sdatablock, global index:%d, table index:%d, brange:%" PRId64 "-%" PRId64
", rows:%d, remain:%d, minVer:%" PRId64 ", maxVer:%" PRId64 ", elapsed time:%.2f ms, %s",
pReader, pBlockIter->index, pFBlock->tbBlockIdx, pBlock->minKey.ts, pBlock->maxKey.ts, remain, unDumpedRows,
pBlock->minVersion, pBlock->maxVersion, elapsedTime, pReader->idStr);
@@ -1196,7 +1201,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
setComposedBlockFlag(pReader, true);
double elapsedTime = (taosGetTimestampUs() - st) / 1000.0;
- tsdbDebug("%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange: %" PRId64
+ tsdbDebug("%p build data block from cache completed, elapsed time:%.2f ms, numOfRows:%d, brange:%" PRId64
" - %" PRId64 " %s",
pReader, elapsedTime, pBlock->info.rows, pBlock->info.window.skey, pBlock->info.window.ekey,
pReader->idStr);
@@ -1444,9 +1449,9 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI
// 2. the direct next point is not an duplicated timestamp
if ((pDumpInfo->rowIndex < pDumpInfo->totalRows - 1 && pReader->order == TSDB_ORDER_ASC) ||
(pDumpInfo->rowIndex > 0 && pReader->order == TSDB_ORDER_DESC)) {
- int32_t step = pReader->order == TSDB_ORDER_ASC? 1:-1;
+ int32_t step = pReader->order == TSDB_ORDER_ASC ? 1 : -1;
int64_t nextKey = pBlockData->aTSKEY[pDumpInfo->rowIndex + step];
- if (nextKey != key) { // merge is not needed
+ if (nextKey != key) { // merge is not needed
doAppendRowFromBlock(pReader->pResBlock, pReader, pBlockData, pDumpInfo->rowIndex);
pDumpInfo->rowIndex += step;
return TSDB_CODE_SUCCESS;
@@ -1905,20 +1910,19 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret
++level;
}
- int32_t vgId = TD_VID(pVnode);
const char* str = (idStr != NULL) ? idStr : "";
if (level == TSDB_RETENTION_L0) {
*pLevel = TSDB_RETENTION_L0;
- tsdbDebug("vgId:%d, rsma level %d is selected to query %s", vgId, TSDB_RETENTION_L0, str);
+ tsdbDebug("vgId:%d, rsma level %d is selected to query %s", TD_VID(pVnode), TSDB_RETENTION_L0, str);
return VND_RSMA0(pVnode);
} else if (level == TSDB_RETENTION_L1) {
*pLevel = TSDB_RETENTION_L1;
- tsdbDebug("vgId:%d, rsma level %d is selected to query %s", vgId, TSDB_RETENTION_L1, str);
+ tsdbDebug("vgId:%d, rsma level %d is selected to query %s", TD_VID(pVnode), TSDB_RETENTION_L1, str);
return VND_RSMA1(pVnode);
} else {
*pLevel = TSDB_RETENTION_L2;
- tsdbDebug("vgId:%d, rsma level %d is selected to query %s", vgId, TSDB_RETENTION_L2, str);
+ tsdbDebug("vgId:%d, rsma level %d is selected to query %s", TD_VID(pVnode), TSDB_RETENTION_L2, str);
return VND_RSMA2(pVnode);
}
}
@@ -2134,15 +2138,18 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
int32_t sversion = TSDBROW_SVERSION(pRow);
STSchema* pTSchema = NULL;
- if (sversion != pReader->pSchema->version) {
+ if (pReader->pSchema == NULL || sversion != pReader->pSchema->version) {
metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pTSchema);
+ if (pReader->pSchema == NULL) {
+ pReader->pSchema = pTSchema;
+ }
} else {
pTSchema = pReader->pSchema;
}
tRowMergerAdd(pMerger, pRow, pTSchema);
- if (sversion != pReader->pSchema->version) {
+ if (pTSchema != pReader->pSchema) {
taosMemoryFree(pTSchema);
}
}
@@ -2230,7 +2237,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc
int32_t step = asc ? 1 : -1;
pDumpInfo->rowIndex += step;
- if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) ||(pDumpInfo->rowIndex >= 0 && !asc)) {
+ if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) || (pDumpInfo->rowIndex >= 0 && !asc)) {
pDumpInfo->rowIndex =
doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step);
}
@@ -2271,8 +2278,11 @@ void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDe
// updateSchema(pRow, uid, pReader);
int32_t sversion = TSDBROW_SVERSION(pRow);
STSchema* pTSchema = NULL;
- if (sversion != pReader->pSchema->version) {
+ if (pReader->pSchema == NULL || sversion != pReader->pSchema->version) {
metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pTSchema);
+ if (pReader->pSchema == NULL) {
+ pReader->pSchema = pTSchema;
+ }
} else {
pTSchema = pReader->pSchema;
}
@@ -2282,7 +2292,7 @@ void doMergeMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter, SArray* pDe
tRowMergerGetRow(&merge, pTSRow);
tRowMergerClear(&merge);
- if (sversion != pReader->pSchema->version) {
+ if (pTSchema != pReader->pSchema) {
taosMemoryFree(pTSchema);
}
}
@@ -2425,9 +2435,9 @@ int32_t doAppendRowFromBlock(SSDataBlock* pResBlock, STsdbReader* pReader, SBloc
int32_t numOfInputCols = taosArrayGetSize(pBlockData->aIdx);
int32_t numOfOutputCols = blockDataGetNumOfCols(pResBlock);
- while(i < numOfOutputCols && j < numOfInputCols) {
+ while (i < numOfOutputCols && j < numOfInputCols) {
SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, i);
- SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
+ SColData* pData = tBlockDataGetColDataByIdx(pBlockData, j);
if (pData->cid == pCol->info.colId) {
tColDataGetValue(pData, rowIndex, &cv);
@@ -2640,7 +2650,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
return code;
_err:
- tsdbError("failed to create data reader, code: %s %s", tstrerror(code), pReader->idStr);
+ tsdbError("failed to create data reader, code:%s %s", tstrerror(code), pReader->idStr);
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
index 97ab410c1b..a9f07cbf24 100644
--- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c
@@ -1215,11 +1215,11 @@ int32_t tsdbSnapWrite(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData)
}
_exit:
- tsdbDebug("vgId:%d, tsdb snapshow write for %s succeed", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
+ tsdbDebug("vgId:%d, tsdb snapshot write for %s succeed", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path);
return code;
_err:
- tsdbError("vgId:%d, tsdb snapshow write for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path,
+ tsdbError("vgId:%d, tsdb snapshot write for %s failed since %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path,
tstrerror(code));
return code;
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c
index a221bc1795..383652531e 100644
--- a/source/dnode/vnode/src/tsdb/tsdbWrite.c
+++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c
@@ -111,7 +111,7 @@ int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) {
// pBlock->sversion = htonl(pBlock->sversion);
// pBlock->dataLen = htonl(pBlock->dataLen);
// pBlock->schemaLen = htonl(pBlock->schemaLen);
- // pBlock->numOfRows = htons(pBlock->numOfRows);
+ // pBlock->numOfRows = htonl(pBlock->numOfRows);
#if 0
if (pBlock->tid <= 0 || pBlock->tid >= pMeta->maxTables) {
diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c
index d1584f701e..0623b3bd10 100644
--- a/source/dnode/vnode/src/vnd/vnodeBufPool.c
+++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c
@@ -40,7 +40,7 @@ int vnodeOpenBufPool(SVnode *pVnode, int64_t size) {
pVnode->pPool = pPool;
}
- vDebug("vgId:%d, vnode buffer pool is opened, pool size: %" PRId64, TD_VID(pVnode), size);
+ vDebug("vgId:%d, vnode buffer pool is opened, size:%" PRId64, TD_VID(pVnode), size);
return 0;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c
index e8d029a88f..650c98eb88 100644
--- a/source/dnode/vnode/src/vnd/vnodeCommit.c
+++ b/source/dnode/vnode/src/vnd/vnodeCommit.c
@@ -95,19 +95,19 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
// save info to a vnode_tmp.json
pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
if (pFile == NULL) {
- vError("failed to open info file: %s for write: %s", fname, terrstr());
+ vError("failed to open info file:%s for write:%s", fname, terrstr());
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
if (taosWriteFile(pFile, data, strlen(data)) < 0) {
- vError("failed to write info file: %s data: %s", fname, terrstr());
+ vError("failed to write info file:%s data:%s", fname, terrstr());
terrno = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
if (taosFsyncFile(pFile) < 0) {
- vError("failed to fsync info file: %s error: %s", fname, terrstr());
+ vError("failed to fsync info file:%s error:%s", fname, terrstr());
terrno = TAOS_SYSTEM_ERROR(errno);
goto _err;
}
@@ -117,7 +117,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) {
// free info binary
taosMemoryFree(data);
- vInfo("vgId:%d, vnode info is saved, fname: %s", pInfo->config.vgId, fname);
+ vInfo("vgId:%d, vnode info is saved, fname:%s", pInfo->config.vgId, fname);
return 0;
diff --git a/source/dnode/vnode/src/vnd/vnodeModule.c b/source/dnode/vnode/src/vnd/vnodeModule.c
index 69f87a2c1a..314c0e7390 100644
--- a/source/dnode/vnode/src/vnd/vnodeModule.c
+++ b/source/dnode/vnode/src/vnd/vnodeModule.c
@@ -55,7 +55,7 @@ int vnodeInit(int nthreads) {
vnodeGlobal.threads = taosMemoryCalloc(nthreads, sizeof(TdThread));
if (vnodeGlobal.threads == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
- vError("failed to init vnode module since: %s", tstrerror(terrno));
+ vError("failed to init vnode module since:%s", tstrerror(terrno));
return -1;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c
index e273a41f48..1ba74ac3be 100644
--- a/source/dnode/vnode/src/vnd/vnodeOpen.c
+++ b/source/dnode/vnode/src/vnd/vnodeOpen.c
@@ -23,13 +23,13 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) {
// check config
if (vnodeCheckCfg(pCfg) < 0) {
- vError("vgId:%d, failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
+ vError("vgId:%d, failed to create vnode since:%s", pCfg->vgId, tstrerror(terrno));
return -1;
}
// create vnode env
if (tfsMkdirAt(pTfs, path, (SDiskID){0}) < 0) {
- vError("vgId:%d, failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno));
+ vError("vgId:%d, failed to create vnode since:%s", pCfg->vgId, tstrerror(terrno));
return -1;
}
diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
index d1b1b68ce4..5a81f91919 100644
--- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c
+++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c
@@ -194,7 +194,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
if (*ppData) {
goto _exit;
} else {
- pReader->tsdbDone = 1;
+ pReader->rsmaDone = 1;
code = rsmaSnapReaderClose(&pReader->pRsmaReader);
if (code) goto _err;
}
@@ -373,18 +373,9 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) {
case SNAP_DATA_STREAM_STATE: {
} break;
case SNAP_DATA_RSMA1:
- case SNAP_DATA_RSMA2: {
- // rsma1/rsma2
- if (pWriter->pRsmaSnapWriter == NULL) {
- code = rsmaSnapWriterOpen(pVnode->pSma, pWriter->sver, pWriter->ever, &pWriter->pRsmaSnapWriter);
- if (code) goto _err;
- }
-
- code = rsmaSnapWrite(pWriter->pRsmaSnapWriter, pData, nData);
- if (code) goto _err;
- } break;
+ case SNAP_DATA_RSMA2:
case SNAP_DATA_QTASK: {
- // qtask for rsma
+ // rsma1/rsma2/qtask for rsma
if (pWriter->pRsmaSnapWriter == NULL) {
code = rsmaSnapWriterOpen(pVnode->pSma, pWriter->sver, pWriter->ever, &pWriter->pRsmaSnapWriter);
if (code) goto _err;
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 8aa3a7d296..fbbe5bc695 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -262,7 +262,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
return 0;
_err:
- vError("vgId:%d, process %s request failed since %s, version: %" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
+ vError("vgId:%d, process %s request failed since %s, version:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType),
tstrerror(terrno), version);
return -1;
}
@@ -296,7 +296,7 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
}
int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
- vTrace("message in fetch queue is processing");
+ vTrace("vgId:%d, msg:%p in fetch queue is processing", pVnode->config.vgId, pMsg);
if ((pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_VND_TABLE_META || pMsg->msgType == TDMT_VND_TABLE_CFG ||
pMsg->msgType == TDMT_VND_BATCH_META) &&
!vnodeIsLeader(pVnode)) {
@@ -330,7 +330,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
case TDMT_STREAM_TASK_RUN:
return tqProcessTaskRunReq(pVnode->pTq, pMsg);
case TDMT_STREAM_TASK_DISPATCH:
- return tqProcessTaskDispatchReq(pVnode->pTq, pMsg);
+ // return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, pInfo->workerId != 0);
+ return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, true);
case TDMT_STREAM_TASK_RECOVER:
return tqProcessTaskRecoverReq(pVnode->pTq, pMsg);
case TDMT_STREAM_RETRIEVE:
@@ -378,6 +379,9 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp);
if (code) goto _exit;
+ code = smaDoRetention(pVnode->pSma, trimReq.timestamp);
+ if (code) goto _exit;
+
_exit:
return code;
}
@@ -433,14 +437,10 @@ static int32_t vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *p
goto _err;
}
- // taosMemoryFree(req.schemaRow.pSchema);
- // taosMemoryFree(req.schemaTag.pSchema);
tDecoderClear(&coder);
return 0;
_err:
- taosMemoryFree(req.schemaRow.pSchema);
- taosMemoryFree(req.schemaTag.pSchema);
tDecoderClear(&coder);
return -1;
}
@@ -487,6 +487,11 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pR
goto _exit;
}
+ if ((terrno = grantCheck(TSDB_GRANT_TABLE)) < 0) {
+ rcode = -1;
+ goto _exit;
+ }
+
// validate hash
sprintf(tbName, "%s.%s", pVnode->config.dbname, pCreateReq->name);
if (vnodeValidateTableHash(pVnode, tbName) < 0) {
@@ -837,6 +842,13 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
goto _exit;
}
+ if ((terrno = grantCheck(TSDB_GRANT_TABLE)) < 0) {
+ pRsp->code = terrno;
+ tDecoderClear(&decoder);
+ taosArrayDestroy(createTbReq.ctb.tagName);
+ goto _exit;
+ }
+
if (metaCreateTable(pVnode->pMeta, version, &createTbReq) < 0) {
if (terrno != TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
submitBlkRsp.code = terrno;
@@ -901,14 +913,13 @@ _exit:
tdProcessRSmaSubmit(pVnode->pSma, pReq, STREAM_INPUT__DATA_SUBMIT);
}
- vDebug("successful submit in vg %d version %ld", pVnode->config.vgId, version);
-
+ vDebug("vgId:%d, submit success, index:%" PRId64, pVnode->config.vgId, version);
return 0;
}
static int32_t vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
SVCreateTSmaReq req = {0};
- SDecoder coder;
+ SDecoder coder = {0};
if (pRsp) {
pRsp->msgType = TDMT_VND_CREATE_SMA_RSP;
diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c
index 99173e87d7..1586143319 100644
--- a/source/dnode/vnode/src/vnd/vnodeSync.c
+++ b/source/dnode/vnode/src/vnd/vnodeSync.c
@@ -19,9 +19,8 @@
#define BATCH_DISABLE 1
static inline bool vnodeIsMsgBlock(tmsg_t type) {
- return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_CREATE_TABLE) ||
- (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL) ||
- (type == TDMT_VND_ALTER_REPLICA);
+ return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) ||
+ (type == TDMT_VND_UPDATE_TAG_VAL) || (type == TDMT_VND_ALTER_REPLICA);
}
static inline bool vnodeIsMsgWeak(tmsg_t type) { return false; }
@@ -325,16 +324,7 @@ int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
return -1;
}
-#if 1
- do {
- char *syncNodeStr = sync2SimpleStr(pVnode->sync);
- static int64_t vndTick = 0;
- if (++vndTick % 10 == 1) {
- vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr);
- }
- taosMemoryFree(syncNodeStr);
- } while (0);
-#endif
+ vGTrace("vgId:%d, sync msg:%p will be processed, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType));
if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_NO_SNAPSHOT) {
if (pMsg->msgType == TDMT_SYNC_TIMEOUT) {
@@ -458,6 +448,8 @@ int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
}
+ vTrace("vgId:%d, sync msg:%p is processed, type:%s code:0x%x", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType),
+ code);
syncNodeRelease(pSyncNode);
if (code != 0 && terrno == 0) {
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
@@ -518,15 +510,15 @@ static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta c
rpcMsg.info.conn.applyTerm = cbMeta.term;
vInfo("vgId:%d, commit-cb is excuted, fsm:%p, index:%" PRId64 ", term:%" PRIu64 ", msg-index:%" PRId64
- ", isWeak:%d, code:%d, state:%d %s, msgtype:%d %s",
+ ", weak:%d, code:%d, state:%d %s, type:%s",
syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.term, rpcMsg.info.conn.applyIndex, cbMeta.isWeak,
- cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType));
+ cbMeta.code, cbMeta.state, syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg);
} else {
SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info};
- vError("vgId:%d, sync commit error, msgtype:%d,%s, index:%ld, error:0x%X, errmsg:%s", syncGetVgId(pVnode->sync),
- pMsg->msgType, TMSG_INFO(pMsg->msgType), cbMeta.index, cbMeta.code, tstrerror(cbMeta.code));
+ vError("vgId:%d, commit-cb execute error, type:%s, index:%" PRId64 ", error:0x%x %s", syncGetVgId(pVnode->sync),
+ TMSG_INFO(pMsg->msgType), cbMeta.index, cbMeta.code, tstrerror(cbMeta.code));
if (rsp.info.handle != NULL) {
tmsgSendRsp(&rsp);
}
@@ -537,10 +529,9 @@ static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta c
static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
if (cbMeta.isWeak == 1) {
SVnode *pVnode = pFsm->data;
- vTrace("vgId:%d, pre-commit-cb is excuted, fsm:%p, index:%" PRId64
- ", isWeak:%d, code:%d, state:%d %s, msgtype:%d %s",
+ vTrace("vgId:%d, pre-commit-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state,
- syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType));
+ syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
if (cbMeta.code == 0) {
SRpcMsg rpcMsg = {.msgType = pMsg->msgType, .contLen = pMsg->contLen};
@@ -552,8 +543,8 @@ static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMet
tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, &rpcMsg);
} else {
SRpcMsg rsp = {.code = cbMeta.code, .info = pMsg->info};
- vError("vgId:%d, sync pre-commit error, msgtype:%d,%s, error:0x%X, errmsg:%s", syncGetVgId(pVnode->sync),
- pMsg->msgType, TMSG_INFO(pMsg->msgType), cbMeta.code, tstrerror(cbMeta.code));
+ vError("vgId:%d, pre-commit-cb execute error, type:%s, error:0x%x %s", syncGetVgId(pVnode->sync),
+ TMSG_INFO(pMsg->msgType), cbMeta.code, tstrerror(cbMeta.code));
if (rsp.info.handle != NULL) {
tmsgSendRsp(&rsp);
}
@@ -563,9 +554,9 @@ static void vnodeSyncPreCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMet
static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) {
SVnode *pVnode = pFsm->data;
- vTrace("vgId:%d, rollback-cb is excuted, fsm:%p, index:%" PRId64 ", isWeak:%d, code:%d, state:%d %s, msgtype:%d %s",
+ vTrace("vgId:%d, rollback-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
syncGetVgId(pVnode->sync), pFsm, cbMeta.index, cbMeta.isWeak, cbMeta.code, cbMeta.state,
- syncUtilState2String(cbMeta.state), pMsg->msgType, TMSG_INFO(pMsg->msgType));
+ syncUtilState2String(cbMeta.state), TMSG_INFO(pMsg->msgType));
}
#define USE_TSDB_SNAPSHOT
@@ -620,10 +611,10 @@ static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void
do {
int32_t itemSize = tmsgGetQueueSize(&pVnode->msgCb, pVnode->config.vgId, APPLY_QUEUE);
if (itemSize == 0) {
- vDebug("vgId:%d, apply queue is empty, start write snapshot", pVnode->config.vgId);
+ vInfo("vgId:%d, start write vnode snapshot since apply queue is empty", pVnode->config.vgId);
break;
} else {
- vDebug("vgId:%d, %d items in apply queue, write snapshot later", pVnode->config.vgId);
+ vInfo("vgId:%d, write vnode snapshot later since %d items in apply queue", pVnode->config.vgId);
taosMsleep(10);
}
} while (true);
@@ -639,10 +630,11 @@ static int32_t vnodeSnapshotStartWrite(struct SSyncFSM *pFsm, void *pParam, void
static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
- vDebug("vgId:%d, stop write snapshot, isApply:%d", pVnode->config.vgId, isApply);
+ vInfo("vgId:%d, stop write vnode snapshot, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64,
+ pVnode->config.vgId, isApply, pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastConfigIndex);
int32_t code = vnodeSnapWriterClose(pWriter, !isApply, pSnapshot);
- vDebug("vgId:%d, apply snapshot to vnode, code:0x%x", pVnode->config.vgId, code);
+ vInfo("vgId:%d, apply vnode snapshot finished, code:0x%x", pVnode->config.vgId, code);
return code;
#else
taosMemoryFree(pWriter);
@@ -653,8 +645,9 @@ static int32_t vnodeSnapshotStopWrite(struct SSyncFSM *pFsm, void *pWriter, bool
static int32_t vnodeSnapshotDoWrite(struct SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
#ifdef USE_TSDB_SNAPSHOT
SVnode *pVnode = pFsm->data;
+ vDebug("vgId:%d, continue write vnode snapshot, len:%d", pVnode->config.vgId, len);
int32_t code = vnodeSnapWrite(pWriter, pBuf, len);
- vTrace("vgId:%d, write snapshot, len:%d", pVnode->config.vgId, len);
+ vDebug("vgId:%d, continue write vnode snapshot finished, len:%d", pVnode->config.vgId, len);
return code;
#else
return 0;
@@ -715,7 +708,7 @@ int32_t vnodeSyncOpen(SVnode *pVnode, char *path) {
}
setPingTimerMS(pVnode->sync, 5000);
- setElectTimerMS(pVnode->sync, 1300);
+ setElectTimerMS(pVnode->sync, 2800);
setHeartbeatTimerMS(pVnode->sync, 900);
return 0;
}
diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp
index 2a8c7a583c..33623f1bdd 100644
--- a/source/dnode/vnode/test/tsdbSmaTest.cpp
+++ b/source/dnode/vnode/test/tsdbSmaTest.cpp
@@ -395,9 +395,8 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
pBlk->uid = htobe64(tbUid);
pBlk->suid = htobe64(tbUid);
pBlk->sversion = htonl(schemaVer);
- pBlk->padding = htonl(0);
pBlk->schemaLen = htonl(0);
- pBlk->numOfRows = htons(mockRowNum);
+ pBlk->numOfRows = htonl(mockRowNum);
pBlk->dataLen = htonl(mockRowNum * mockRowLen);
for (uint32_t r = 0; r < mockRowNum; ++r) {
pRow = (STSRow *)POINTER_SHIFT(pBlk, sizeof(SSubmitBlk) + r * mockRowLen);
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index 5b5c6010e8..816309beb1 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -416,6 +416,7 @@ typedef struct SCtgCacheOperation {
bool syncOp;
tsem_t rspSem;
bool stopQueue;
+ bool unLocked;
} SCtgCacheOperation;
typedef struct SCtgQNode {
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index 06e8216e87..2e8e259151 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -674,7 +674,13 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
tsem_post(&gCtgMgmt.queue.reqSem);
if (syncOp) {
+ if (!operation->unLocked) {
+ CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock);
+ }
tsem_wait(&operation->rspSem);
+ if (!operation->unLocked) {
+ CTG_LOCK(CTG_READ, &gCtgMgmt.lock);
+ }
taosMemoryFree(operation);
}
@@ -1011,6 +1017,7 @@ int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool
op->opId = CTG_OP_CLEAR_CACHE;
op->syncOp = syncOp;
op->stopQueue = stopQueue;
+ op->unLocked = true;
SCtgClearCacheMsg *msg = taosMemoryMalloc(sizeof(SCtgClearCacheMsg));
if (NULL == msg) {
diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c
index bd3402dc39..8333cb28c0 100644
--- a/source/libs/catalog/src/ctgDbg.c
+++ b/source/libs/catalog/src/ctgDbg.c
@@ -19,7 +19,7 @@
#include "catalogInt.h"
extern SCatalogMgmt gCtgMgmt;
-SCtgDebug gCTGDebug = {0};
+SCtgDebug gCTGDebug = {.lockEnable = true};
void ctgdUserCallback(SMetaData* pResult, void* param, int32_t code) {
ASSERT(*(int32_t*)param == 1);
diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c
index 55bfc88a49..4652c66ebc 100644
--- a/source/libs/catalog/src/ctgRemote.c
+++ b/source/libs/catalog/src/ctgRemote.c
@@ -13,24 +13,25 @@
* along with this program. If not, see .
*/
-#include "trpc.h"
-#include "query.h"
-#include "tname.h"
#include "catalogInt.h"
+#include "query.h"
#include "systable.h"
+#include "tname.h"
#include "tref.h"
+#include "trpc.h"
-int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBuf *pMsg, int32_t rspCode) {
- int32_t code = 0;
- SArray* pTaskId = cbParam->taskId;
+int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBuf* pMsg, int32_t rspCode) {
+ int32_t code = 0;
+ SArray* pTaskId = cbParam->taskId;
SCatalog* pCtg = pJob->pCtg;
- int32_t taskNum = taosArrayGetSize(pTaskId);
- SDataBuf taskMsg = *pMsg;
- int32_t offset = 0;
+ int32_t taskNum = taosArrayGetSize(pTaskId);
+ SDataBuf taskMsg = *pMsg;
+ int32_t offset = 0;
int32_t msgNum = (TSDB_CODE_SUCCESS == rspCode && pMsg->pData && (pMsg->len > 0)) ? ntohl(*(int32_t*)pMsg->pData) : 0;
ASSERT(taskNum == msgNum || 0 == msgNum);
- ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1));
+ ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId,
+ TMSG_INFO(cbParam->reqType + 1));
offset += sizeof(msgNum);
SBatchRsp rsp = {0};
@@ -39,10 +40,10 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
ctgError("taosHashInit %d batch failed", taskNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
for (int32_t i = 0; i < taskNum; ++i) {
- int32_t* taskId = taosArrayGet(pTaskId, i);
- SCtgTask *pTask = taosArrayGet(pJob->pTasks, *taskId);
+ int32_t* taskId = taosArrayGet(pTaskId, i);
+ SCtgTask* pTask = taosArrayGet(pJob->pTasks, *taskId);
if (msgNum > 0) {
rsp.reqType = ntohl(*(int32_t*)((char*)pMsg->pData + offset));
offset += sizeof(rsp.reqType);
@@ -52,7 +53,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
offset += sizeof(rsp.rspCode);
rsp.msg = ((char*)pMsg->pData) + offset;
offset += rsp.msgLen;
-
+
taskMsg.msgType = rsp.reqType;
taskMsg.pData = rsp.msg;
taskMsg.len = rsp.msgLen;
@@ -64,9 +65,10 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
}
pTask->pBatchs = pBatchs;
-
- ctgDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(taskMsg.msgType + 1));
-
+
+ ctgDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId,
+ TMSG_INFO(taskMsg.msgType + 1));
+
(*gCtgAsyncFps[pTask->type].handleRspFp)(pTask, rsp.reqType, &taskMsg, (rsp.rspCode ? rsp.rspCode : rspCode));
}
@@ -78,23 +80,22 @@ _return:
CTG_RET(code);
}
-
int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, int32_t rspCode, char* target) {
int32_t code = 0;
-
+
switch (reqType) {
case TDMT_MND_QNODE_LIST: {
if (TSDB_CODE_SUCCESS != rspCode) {
qError("error rsp for qnode list, error:%s", tstrerror(rspCode));
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process qnode list rsp failed, error:%s", tstrerror(rspCode));
CTG_ERR_RET(code);
}
-
+
qDebug("Got qnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(out));
break;
}
@@ -103,13 +104,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for dnode list, error:%s", tstrerror(rspCode));
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process dnode list rsp failed, error:%s", tstrerror(rspCode));
CTG_ERR_RET(code);
}
-
+
qDebug("Got dnode list from mnode, listNum:%d", (int32_t)taosArrayGetSize(*(SArray**)out));
break;
}
@@ -118,13 +119,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for use db, error:%s, dbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process use db rsp failed, error:%s, dbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got db vgInfo from mnode, dbFName:%s", target);
break;
}
@@ -133,13 +134,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for get db cfg, error:%s, db:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process get db cfg rsp failed, error:%s, db:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got db cfg from mnode, dbFName:%s", target);
break;
}
@@ -148,13 +149,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for get index, error:%s, indexName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process get index rsp failed, error:%s, indexName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got index from mnode, indexName:%s", target);
break;
}
@@ -163,13 +164,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for get table index, error:%s, tbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process get table index rsp failed, error:%s, tbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got table index from mnode, tbFName:%s", target);
break;
}
@@ -178,13 +179,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for get udf, error:%s, funcName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process get udf rsp failed, error:%s, funcName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got udf from mnode, funcName:%s", target);
break;
}
@@ -193,13 +194,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for get user auth, error:%s, user:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process get user auth rsp failed, error:%s, user:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got user auth from mnode, user:%s", target);
break;
}
@@ -210,17 +211,17 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug("stablemeta not exist in mnode, tbFName:%s", target);
return TSDB_CODE_SUCCESS;
}
-
+
qError("error rsp for stablemeta from mnode, error:%s, tbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process mnode stablemeta rsp failed, error:%s, tbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got table meta from mnode, tbFName:%s", target);
break;
}
@@ -231,17 +232,17 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug("tablemeta not exist in vnode, tbFName:%s", target);
return TSDB_CODE_SUCCESS;
}
-
+
qError("error rsp for table meta from vnode, code:%s, tbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process vnode tablemeta rsp failed, code:%s, tbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got table meta from vnode, tbFName:%s", target);
break;
}
@@ -250,13 +251,13 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for table cfg from vnode, code:%s, tbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process vnode tb cfg rsp failed, code:%s, tbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got table cfg from vnode, tbFName:%s", target);
break;
}
@@ -265,28 +266,28 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("error rsp for stb cfg from mnode, error:%s, tbFName:%s", tstrerror(rspCode), target);
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process mnode stb cfg rsp failed, error:%s, tbFName:%s", tstrerror(code), target);
CTG_ERR_RET(code);
}
-
+
qDebug("Got stb cfg from mnode, tbFName:%s", target);
break;
- }
+ }
case TDMT_MND_SERVER_VERSION: {
if (TSDB_CODE_SUCCESS != rspCode) {
qError("error rsp for svr ver from mnode, error:%s", tstrerror(rspCode));
CTG_ERR_RET(rspCode);
}
-
+
code = queryProcessMsgRsp[TMSG_INDEX(reqType)](out, msg, msgSize);
if (code) {
qError("Process svr ver rsp failed, error:%s", tstrerror(code));
CTG_ERR_RET(code);
}
-
+
qDebug("Got svr ver from mnode");
break;
}
@@ -295,7 +296,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qError("Got error rsp, error:%s", tstrerror(rspCode));
CTG_ERR_RET(rspCode);
}
-
+
qError("invalid req type %s", TMSG_INFO(reqType));
return TSDB_CODE_APP_ERROR;
}
@@ -303,12 +304,11 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
+int32_t ctgHandleMsgCallback(void* param, SDataBuf* pMsg, int32_t rspCode) {
SCtgTaskCallbackParam* cbParam = (SCtgTaskCallbackParam*)param;
- int32_t code = 0;
- SCtgJob* pJob = NULL;
-
+ int32_t code = 0;
+ SCtgJob* pJob = NULL;
+
CTG_API_JENTER();
pJob = taosAcquireRef(gCtgMgmt.jobPool, cbParam->refId);
@@ -322,16 +322,18 @@ int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
if (TDMT_VND_BATCH_META == cbParam->reqType || TDMT_MND_BATCH_META == cbParam->reqType) {
CTG_ERR_JRET(ctgHandleBatchRsp(pJob, cbParam, pMsg, rspCode));
} else {
- int32_t *taskId = taosArrayGet(cbParam->taskId, 0);
- SCtgTask *pTask = taosArrayGet(pJob->pTasks, *taskId);
+ int32_t* taskId = taosArrayGet(cbParam->taskId, 0);
+ SCtgTask* pTask = taosArrayGet(pJob->pTasks, *taskId);
- qDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(cbParam->reqType + 1));
+ qDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId,
+ TMSG_INFO(cbParam->reqType + 1));
#if CTG_BATCH_FETCH
- SHashObj* pBatchs = taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
+ SHashObj* pBatchs =
+ taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (NULL == pBatchs) {
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
- CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
+ CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
pTask->pBatchs = pBatchs;
#endif
@@ -339,10 +341,10 @@ int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].handleRspFp)(pTask, cbParam->reqType, pMsg, rspCode));
#if CTG_BATCH_FETCH
- CTG_ERR_JRET(ctgLaunchBatchs(pJob->pCtg, pJob, pBatchs));
-#endif
+ CTG_ERR_JRET(ctgLaunchBatchs(pJob->pCtg, pJob, pBatchs));
+#endif
}
-
+
_return:
taosMemoryFree(pMsg->pData);
@@ -354,16 +356,16 @@ _return:
CTG_API_LEAVE(code);
}
-
-int32_t ctgMakeMsgSendInfo(SCtgJob* pJob, SArray* pTaskId, int32_t batchId, int32_t msgType, SMsgSendInfo **pMsgSendInfo) {
+int32_t ctgMakeMsgSendInfo(SCtgJob* pJob, SArray* pTaskId, int32_t batchId, int32_t msgType,
+ SMsgSendInfo** pMsgSendInfo) {
int32_t code = 0;
- SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
+ SMsgSendInfo* msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
if (NULL == msgSendInfo) {
qError("calloc %d failed", (int32_t)sizeof(SMsgSendInfo));
CTG_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- SCtgTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SCtgTaskCallbackParam));
+ SCtgTaskCallbackParam* param = taosMemoryCalloc(1, sizeof(SCtgTaskCallbackParam));
if (NULL == param) {
qError("calloc %d failed", (int32_t)sizeof(SCtgTaskCallbackParam));
CTG_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -391,10 +393,10 @@ _return:
CTG_RET(code);
}
-int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob* pJob, SArray* pTaskId,
- int32_t batchId, char* dbFName, int32_t vgId, int32_t msgType, void *msg, uint32_t msgSize) {
- int32_t code = 0;
- SMsgSendInfo *pMsgSendInfo = NULL;
+int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob, SArray* pTaskId, int32_t batchId,
+ char* dbFName, int32_t vgId, int32_t msgType, void* msg, uint32_t msgSize) {
+ int32_t code = 0;
+ SMsgSendInfo* pMsgSendInfo = NULL;
CTG_ERR_JRET(ctgMakeMsgSendInfo(pJob, pTaskId, batchId, msgType, &pMsgSendInfo));
ctgUpdateSendTargetInfo(pMsgSendInfo, msgType, dbFName, vgId);
@@ -426,22 +428,23 @@ _return:
CTG_RET(code);
}
-int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo *pConn, SCtgTask* pTask, int32_t msgType, void *msg, uint32_t msgSize) {
- int32_t code = 0;
- SHashObj* pBatchs = pTask->pBatchs;
- SCtgJob* pJob = pTask->pJob;
+int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo* pConn, SCtgTask* pTask, int32_t msgType, void* msg,
+ uint32_t msgSize) {
+ int32_t code = 0;
+ SHashObj* pBatchs = pTask->pBatchs;
+ SCtgJob* pJob = pTask->pJob;
SCtgBatch* pBatch = taosHashGet(pBatchs, &vgId, sizeof(vgId));
- int32_t taskNum = taosArrayGetSize(pTask->pJob->pTasks);
- SCtgBatch newBatch = {0};
- SBatchMsg req = {0};
-
+ int32_t taskNum = taosArrayGetSize(pTask->pJob->pTasks);
+ SCtgBatch newBatch = {0};
+ SBatchMsg req = {0};
+
if (NULL == pBatch) {
newBatch.pMsgs = taosArrayInit(taskNum, sizeof(SBatchMsg));
newBatch.pTaskIds = taosArrayInit(taskNum, sizeof(int32_t));
if (NULL == newBatch.pMsgs || NULL == newBatch.pTaskIds) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
newBatch.conn = *pConn;
req.msgType = msgType;
@@ -475,7 +478,8 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo *pConn, SCtgT
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
}
- ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), newBatch.batchId, vgId);
+ ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), newBatch.batchId,
+ vgId);
return TSDB_CODE_SUCCESS;
}
@@ -504,7 +508,8 @@ int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo *pConn, SCtgT
}
}
- ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), pBatch->batchId, vgId);
+ ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), pBatch->batchId,
+ vgId);
return TSDB_CODE_SUCCESS;
@@ -512,24 +517,24 @@ _return:
ctgFreeBatch(&newBatch);
taosMemoryFree(msg);
-
+
return code;
}
int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg) {
- *msg = taosMemoryMalloc(pBatch->msgSize);
+ *msg = taosMemoryCalloc(1, pBatch->msgSize);
if (NULL == (*msg)) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
- int32_t offset = 0;
- int32_t num = taosArrayGetSize(pBatch->pMsgs);
- SBatchReq *pBatchReq = (SBatchReq*)(*msg);
+ int32_t offset = 0;
+ int32_t num = taosArrayGetSize(pBatch->pMsgs);
+ SBatchReq* pBatchReq = (SBatchReq*)(*msg);
pBatchReq->header.vgId = htonl(vgId);
pBatchReq->msgNum = htonl(num);
offset += sizeof(SBatchReq);
-
+
for (int32_t i = 0; i < num; ++i) {
SBatchMsg* pReq = taosArrayGet(pBatch->pMsgs, i);
*(int32_t*)((char*)(*msg) + offset) = htonl(pReq->msgType);
@@ -547,23 +552,23 @@ int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg) {
return TSDB_CODE_SUCCESS;
}
-int32_t ctgLaunchBatchs(SCatalog* pCtg, SCtgJob *pJob, SHashObj* pBatchs) {
+int32_t ctgLaunchBatchs(SCatalog* pCtg, SCtgJob* pJob, SHashObj* pBatchs) {
int32_t code = 0;
- void* msg = NULL;
- void* p = taosHashIterate(pBatchs, NULL);
+ void* msg = NULL;
+ void* p = taosHashIterate(pBatchs, NULL);
while (NULL != p) {
- size_t len = 0;
- int32_t* vgId = taosHashGetKey(p, &len);
+ size_t len = 0;
+ int32_t* vgId = taosHashGetKey(p, &len);
SCtgBatch* pBatch = (SCtgBatch*)p;
ctgDebug("QID:0x%" PRIx64 " ctg start to launch batch %d", pJob->queryId, pBatch->batchId);
-
+
CTG_ERR_JRET(ctgBuildBatchReqMsg(pBatch, *vgId, &msg));
- code = ctgAsyncSendMsg(pCtg, &pBatch->conn, pJob, pBatch->pTaskIds, pBatch->batchId,
- pBatch->dbFName, *vgId, pBatch->msgType, msg, pBatch->msgSize);
+ code = ctgAsyncSendMsg(pCtg, &pBatch->conn, pJob, pBatch->pTaskIds, pBatch->batchId, pBatch->dbFName, *vgId,
+ pBatch->msgType, msg, pBatch->msgSize);
pBatch->pTaskIds = NULL;
CTG_ERR_JRET(code);
-
+
p = taosHashIterate(pBatchs, p);
}
@@ -575,16 +580,15 @@ _return:
taosHashCancelIterate(pBatchs, p);
}
taosMemoryFree(msg);
-
+
CTG_RET(code);
}
-
-int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray* out, SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_QNODE_LIST;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get qnode list from mnode, mgmtEpInUse:%d", pConn->mgmtEps.inUse);
@@ -609,14 +613,14 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -630,11 +634,11 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray **out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SArray** out, SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_DNODE_LIST;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get dnode list from mnode, mgmtEpInUse:%d", pConn->mgmtEps.inUse);
@@ -655,14 +659,14 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -676,12 +680,12 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SBuildUseDBInput *input, SUseDbOutput *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SBuildUseDBInput* input, SUseDbOutput* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_USE_DB;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get db vgInfo from mnode, dbFName:%s", input->db);
@@ -706,14 +710,14 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SBuildU
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -721,21 +725,22 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SBuildU
rpcSendRecv(pConn->pTrans, &pConn->mgmtEps, &rpcMsg, &rpcRsp);
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, input->db));
-
+
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char *dbFName, SDbCfgInfo *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char* dbFName, SDbCfgInfo* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_GET_DB_CFG;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get db cfg from mnode, dbFName:%s", dbFName);
- int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void *)dbFName, &msg, 0, &msgLen, mallocFp);
+ int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)dbFName, &msg, 0, &msgLen, mallocFp);
if (code) {
ctgError("Build get db cfg msg failed, code:%x, db:%s", code, dbFName);
CTG_ERR_RET(code);
@@ -756,14 +761,14 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = TDMT_MND_GET_DB_CFG,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -777,15 +782,16 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char *indexName, SIndexInfo *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char* indexName, SIndexInfo* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_GET_INDEX;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get index from mnode, indexName:%s", indexName);
- int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void *)indexName, &msg, 0, &msgLen, mallocFp);
+ int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)indexName, &msg, 0, &msgLen, mallocFp);
if (code) {
ctgError("Build get index msg failed, code:%x, db:%s", code, indexName);
CTG_ERR_RET(code);
@@ -800,20 +806,20 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -823,21 +829,22 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, (char*)indexName));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *name, STableIndex* out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, SName* name, STableIndex* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_GET_TABLE_INDEX;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
char tbFName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(name, tbFName);
ctgDebug("try to get tb index from mnode, tbFName:%s", tbFName);
- int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void *)tbFName, &msg, 0, &msgLen, mallocFp);
+ int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)tbFName, &msg, 0, &msgLen, mallocFp);
if (code) {
ctgError("Build get index msg failed, code:%s, tbFName:%s", tstrerror(code), tbFName);
CTG_ERR_RET(code);
@@ -848,25 +855,25 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *n
if (NULL == pOut) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
-
+
CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)tbFName));
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -876,19 +883,20 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *n
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, (char*)tbFName));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char *funcName, SFuncInfo *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_RETRIEVE_FUNC;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get udf info from mnode, funcName:%s", funcName);
- int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void *)funcName, &msg, 0, &msgLen, mallocFp);
+ int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)funcName, &msg, 0, &msgLen, mallocFp);
if (code) {
ctgError("Build get udf msg failed, code:%x, db:%s", code, funcName);
CTG_ERR_RET(code);
@@ -909,14 +917,14 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const ch
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -930,15 +938,16 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const ch
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char *user, SGetUserAuthRsp *out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, SGetUserAuthRsp* out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_GET_USER_AUTH;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get user auth from mnode, user:%s", user);
- int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void *)user, &msg, 0, &msgLen, mallocFp);
+ int32_t code = queryBuildMsg[TMSG_INDEX(reqType)]((void*)user, &msg, 0, &msgLen, mallocFp);
if (code) {
ctgError("Build get user auth msg failed, code:%x, db:%s", code, user);
CTG_ERR_RET(code);
@@ -953,20 +962,20 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -976,20 +985,20 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, (char*)user));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo *pConn, char *dbFName, char* tbName, STableMetaOutput* out, SCtgTask* pTask) {
+int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo* pConn, char* dbFName, char* tbName,
+ STableMetaOutput* out, SCtgTask* pTask) {
SBuildTableInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = tbName};
- char *msg = NULL;
- SEpSet *pVnodeEpSet = NULL;
- int32_t msgLen = 0;
- int32_t reqType = TDMT_MND_TABLE_META;
- char tbFName[TSDB_TABLE_FNAME_LEN];
+ char* msg = NULL;
+ SEpSet* pVnodeEpSet = NULL;
+ int32_t msgLen = 0;
+ int32_t reqType = TDMT_MND_TABLE_META;
+ char tbFName[TSDB_TABLE_FNAME_LEN];
sprintf(tbFName, "%s.%s", dbFName, tbName);
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
ctgDebug("try to get table meta from mnode, tbFName:%s", tbFName);
@@ -1007,26 +1016,26 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo *pConn, char
CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, tbFName));
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
SRpcMsg rpcRsp = {0};
rpcSendRecv(pConn->pTrans, &pConn->mgmtEps, &rpcMsg, &rpcRsp);
-
+
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, tbFName));
rpcFreeCont(rpcRsp.pCont);
@@ -1034,27 +1043,30 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo *pConn, char
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetTbMetaFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, STableMetaOutput* out, SCtgTask* pTask) {
+int32_t ctgGetTbMetaFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableMetaOutput* out,
+ SCtgTask* pTask) {
char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(pTableName, dbFName);
- return ctgGetTbMetaFromMnodeImpl(pCtg, pConn, dbFName, (char *)pTableName->tname, out, pTask);
+ return ctgGetTbMetaFromMnodeImpl(pCtg, pConn, dbFName, (char*)pTableName->tname, out, pTask);
}
-int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, SVgroupInfo *vgroupInfo, STableMetaOutput* out, SCtgTask* pTask) {
+int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SVgroupInfo* vgroupInfo,
+ STableMetaOutput* out, SCtgTask* pTask) {
char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(pTableName, dbFName);
int32_t reqType = TDMT_VND_TABLE_META;
- char tbFName[TSDB_TABLE_FNAME_LEN];
+ char tbFName[TSDB_TABLE_FNAME_LEN];
sprintf(tbFName, "%s.%s", dbFName, pTableName->tname);
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
SEp* pEp = &vgroupInfo->epSet.eps[vgroupInfo->epSet.inUse];
- ctgDebug("try to get table meta from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s",
- vgroupInfo->vgId, vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
+ ctgDebug("try to get table meta from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s", vgroupInfo->vgId,
+ vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
- SBuildTableInput bInput = {.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char *)tNameGetTableName(pTableName)};
- char *msg = NULL;
+ SBuildTableInput bInput = {
+ .vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char*)tNameGetTableName(pTableName)};
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
@@ -1070,16 +1082,16 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa
}
CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, tbFName));
- SRequestConnInfo vConn = {.pTrans = pConn->pTrans,
- .requestId = pConn->requestId,
- .requestObjRefId = pConn->requestObjRefId,
- .mgmtEps = vgroupInfo->epSet};
+ SRequestConnInfo vConn = {.pTrans = pConn->pTrans,
+ .requestId = pConn->requestId,
+ .requestObjRefId = pConn->requestObjRefId,
+ .mgmtEps = vgroupInfo->epSet};
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, vgroupInfo->vgId, &vConn, pTask, reqType, msg, msgLen));
-#else
+#else
SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx;
- char dbFName[TSDB_DB_FNAME_LEN];
+ char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(ctx->pName, dbFName);
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
@@ -1087,40 +1099,41 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa
}
taosArrayPush(pTaskId, &pTask->taskId);
- CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, dbFName, ctx->vgId, reqType, msg, msgLen));
-#endif
+ CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, dbFName, ctx->vgId, reqType, msg, msgLen));
+#endif
}
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
SRpcMsg rpcRsp = {0};
rpcSendRecv(pConn->pTrans, &vgroupInfo->epSet, &rpcMsg, &rpcRsp);
- CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, tbFName));
+ CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, tbFName));
rpcFreeCont(rpcRsp.pCont);
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, SVgroupInfo *vgroupInfo, STableCfg **out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName,
+ SVgroupInfo* vgroupInfo, STableCfg** out, SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_VND_TABLE_CFG;
- char tbFName[TSDB_TABLE_FNAME_LEN];
+ char tbFName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(pTableName, tbFName);
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(pTableName, dbFName);
SBuildTableInput bInput = {.vgId = vgroupInfo->vgId, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
SEp* pEp = &vgroupInfo->epSet.eps[vgroupInfo->epSet.inUse];
- ctgDebug("try to get table cfg from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s",
- vgroupInfo->vgId, vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
+ ctgDebug("try to get table cfg from vnode, vgId:%d, ep num:%d, ep %s:%d, tbFName:%s", vgroupInfo->vgId,
+ vgroupInfo->epSet.numOfEps, pEp->fqdn, pEp->port, tbFName);
int32_t code = queryBuildMsg[TMSG_INDEX(reqType)](&bInput, &msg, 0, &msgLen, mallocFp);
if (code) {
@@ -1131,29 +1144,29 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
if (pTask) {
CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, NULL, (char*)tbFName));
- SRequestConnInfo vConn = {.pTrans = pConn->pTrans,
- .requestId = pConn->requestId,
- .requestObjRefId = pConn->requestObjRefId,
- .mgmtEps = vgroupInfo->epSet};
+ SRequestConnInfo vConn = {.pTrans = pConn->pTrans,
+ .requestId = pConn->requestId,
+ .requestObjRefId = pConn->requestObjRefId,
+ .mgmtEps = vgroupInfo->epSet};
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, vgroupInfo->vgId, &vConn, pTask, reqType, msg, msgLen));
#else
SCtgTbCfgCtx* ctx = (SCtgTbCfgCtx*)pTask->taskCtx;
- char dbFName[TSDB_DB_FNAME_LEN];
+ char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(ctx->pName, dbFName);
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, dbFName, ctx->pVgInfo->vgId, reqType, msg, msgLen));
-#endif
+#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -1163,18 +1176,18 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, (char*)tbFName));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-
-int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, STableCfg **out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableCfg** out,
+ SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_TABLE_CFG;
- char tbFName[TSDB_TABLE_FNAME_LEN];
+ char tbFName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(pTableName, tbFName);
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
char dbFName[TSDB_DB_FNAME_LEN];
tNameGetFullDbName(pTableName, dbFName);
SBuildTableInput bInput = {.vgId = 0, .dbFName = dbFName, .tbName = (char*)pTableName->tname};
@@ -1191,20 +1204,20 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, NULL, (char*)tbFName));
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -1214,15 +1227,15 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, (char*)tbFName));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **out, SCtgTask* pTask) {
- char *msg = NULL;
+int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo* pConn, char** out, SCtgTask* pTask) {
+ char* msg = NULL;
int32_t msgLen = 0;
int32_t reqType = TDMT_MND_SERVER_VERSION;
- void*(*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
+ void* (*mallocFp)(int32_t) = pTask ? taosMemoryMalloc : rpcMallocCont;
qDebug("try to get svr ver from mnode");
@@ -1237,20 +1250,20 @@ int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **ou
#if CTG_BATCH_FETCH
CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen));
-#else
+#else
SArray* pTaskId = taosArrayInit(1, sizeof(int32_t));
if (NULL == pTaskId) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
taosArrayPush(pTaskId, &pTask->taskId);
-
+
CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen));
#endif
}
-
+
SRpcMsg rpcMsg = {
.msgType = reqType,
- .pCont = msg,
+ .pCont = msg,
.contLen = msgLen,
};
@@ -1260,8 +1273,6 @@ int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **ou
CTG_ERR_RET(ctgProcessRspMsg(out, reqType, rpcRsp.pCont, rpcRsp.contLen, rpcRsp.code, NULL));
rpcFreeCont(rpcRsp.pCont);
-
+
return TSDB_CODE_SUCCESS;
}
-
-
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 2ff76f937d..1b2489acd6 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -192,6 +192,26 @@ char* buildRetension(SArray* pRetension) {
return p1;
}
+static const char* cacheModelStr(int8_t cacheModel) {
+ switch (cacheModel) {
+ case TSDB_CACHE_MODEL_NONE:
+ return TSDB_CACHE_MODEL_NONE_STR;
+ case TSDB_CACHE_MODEL_LAST_ROW:
+ return TSDB_CACHE_MODEL_LAST_ROW_STR;
+ case TSDB_CACHE_MODEL_LAST_VALUE:
+ return TSDB_CACHE_MODEL_LAST_VALUE_STR;
+ case TSDB_CACHE_MODEL_BOTH:
+ return TSDB_CACHE_MODEL_BOTH_STR;
+ default:
+ break;
+ }
+ return TSDB_CACHE_MODEL_NONE_STR;
+}
+
+static const char* strictStr(int8_t strict) {
+ return TSDB_DB_STRICT_ON == strict ? TSDB_DB_STRICT_ON_STR : TSDB_DB_STRICT_OFF_STR;
+}
+
static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, SDbCfgInfo* pCfg) {
blockDataEnsureCapacity(pBlock, 1);
pBlock->info.rows = 1;
@@ -222,14 +242,15 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
char* retentions = buildRetension(pCfg->pRetensions);
- len += sprintf(buf2 + VARSTR_HEADER_SIZE,
- "CREATE DATABASE `%s` BUFFER %d CACHEMODEL %d COMP %d DURATION %dm "
- "FSYNC %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
- "STRICT %d WAL %d VGROUPS %d SINGLE_STABLE %d",
- dbFName, pCfg->buffer, pCfg->cacheLast, pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod,
- pCfg->maxRows, pCfg->minRows, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages,
- pCfg->pageSize, prec, pCfg->replications, pCfg->strict, pCfg->walLevel, pCfg->numOfVgroups,
- 1 == pCfg->numOfStables);
+ len += sprintf(
+ buf2 + VARSTR_HEADER_SIZE,
+ "CREATE DATABASE `%s` BUFFER %d CACHEMODEL '%s' COMP %d DURATION %dm "
+ "WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
+ "STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d",
+ dbFName, pCfg->buffer, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod,
+ pCfg->maxRows, pCfg->minRows, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages,
+ pCfg->pageSize, prec, pCfg->replications, strictStr(pCfg->strict), pCfg->walLevel, pCfg->numOfVgroups,
+ 1 == pCfg->numOfStables);
if (retentions) {
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
@@ -383,21 +404,21 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
return TSDB_CODE_SUCCESS;
}
-void appendTableOptions(char* buf, int32_t* len, STableCfg* pCfg) {
+void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg* pCfg) {
if (pCfg->commentLen > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " COMMENT '%s'", pCfg->pComment);
} else if (0 == pCfg->commentLen) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " COMMENT ''");
}
- if (pCfg->watermark1 > 0) {
+ if (NULL != pDbCfg->pRetensions && pCfg->watermark1 > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " WATERMARK %" PRId64 "a", pCfg->watermark1);
if (pCfg->watermark2 > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ", %" PRId64 "a", pCfg->watermark2);
}
}
- if (pCfg->delay1 > 0) {
+ if (NULL != pDbCfg->pRetensions && pCfg->delay1 > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " MAX_DELAY %" PRId64 "a", pCfg->delay1);
if (pCfg->delay2 > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ", %" PRId64 "a", pCfg->delay2);
@@ -405,7 +426,7 @@ void appendTableOptions(char* buf, int32_t* len, STableCfg* pCfg) {
}
int32_t funcNum = taosArrayGetSize(pCfg->pFuncs);
- if (funcNum > 0) {
+ if (NULL != pDbCfg->pRetensions && funcNum > 0) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " ROLLUP(");
for (int32_t i = 0; i < funcNum; ++i) {
char* pFunc = taosArrayGet(pCfg->pFuncs, i);
@@ -419,7 +440,7 @@ void appendTableOptions(char* buf, int32_t* len, STableCfg* pCfg) {
}
}
-static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName, STableCfg* pCfg) {
+static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* pDbCfg, char* tbName, STableCfg* pCfg) {
int32_t code = 0;
blockDataEnsureCapacity(pBlock, 1);
pBlock->info.rows = 1;
@@ -439,7 +460,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ") TAGS (");
appendTagFields(buf2, &len, pCfg);
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ")");
- appendTableOptions(buf2, &len, pCfg);
+ appendTableOptions(buf2, &len, pDbCfg, pCfg);
} else if (TSDB_CHILD_TABLE == pCfg->tableType) {
len += sprintf(buf2 + VARSTR_HEADER_SIZE, "CREATE TABLE `%s` USING `%s` (", tbName, pCfg->stbName);
appendTagNameFields(buf2, &len, pCfg);
@@ -449,7 +470,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
return code;
}
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, ")");
- appendTableOptions(buf2, &len, pCfg);
+ appendTableOptions(buf2, &len, pDbCfg, pCfg);
} else {
len += sprintf(buf2 + VARSTR_HEADER_SIZE, "CREATE TABLE `%s` (", tbName);
appendColumnFields(buf2, &len, pCfg);
@@ -465,7 +486,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, char* tbName,
static int32_t execShowCreateTable(SShowCreateTableStmt* pStmt, SRetrieveTableRsp** pRsp) {
SSDataBlock* pBlock = buildCreateTbResultDataBlock();
- int32_t code = setCreateTBResultIntoDataBlock(pBlock, pStmt->tableName, pStmt->pCfg);
+ int32_t code = setCreateTBResultIntoDataBlock(pBlock, pStmt->pDbCfg, pStmt->tableName, pStmt->pTableCfg);
if (code) {
return code;
}
@@ -473,7 +494,7 @@ static int32_t execShowCreateTable(SShowCreateTableStmt* pStmt, SRetrieveTableRs
}
static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableRsp** pRsp) {
- STableCfg* pCfg = (STableCfg*)pStmt->pCfg;
+ STableCfg* pCfg = (STableCfg*)pStmt->pTableCfg;
if (TSDB_SUPER_TABLE != pCfg->tableType) {
terrno = TSDB_CODE_TSC_NOT_STABLE_ERROR;
return terrno;
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index c3dad1ed7c..52c73f85f5 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -88,8 +88,11 @@ bool isResultRowClosed(SResultRow* pResultRow);
struct SResultRowEntryInfo* getResultEntryInfo(const SResultRow* pRow, int32_t index, const int32_t* offset);
-static FORCE_INLINE SResultRow* getResultRowByPos(SDiskbasedBuf* pBuf, SResultRowPosition* pos) {
+static FORCE_INLINE SResultRow* getResultRowByPos(SDiskbasedBuf* pBuf, SResultRowPosition* pos, bool forUpdate) {
SFilePage* bufPage = (SFilePage*)getBufPage(pBuf, pos->pageId);
+ if (forUpdate) {
+ setBufPageDirty(bufPage, true);
+ }
SResultRow* pRow = (SResultRow*)((char*)bufPage + pos->offset);
return pRow;
}
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index b33c244a5c..c393b17c0d 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -224,6 +224,7 @@ typedef struct SOperatorInfo {
struct SOperatorInfo** pDownstream; // downstram pointer list
int32_t numOfDownstream; // number of downstream. The value is always ONE expect for join operator
SOperatorFpSet fpSet;
+ int16_t resultDataBlockId;
} SOperatorInfo;
typedef enum {
@@ -859,6 +860,7 @@ void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock);
void cleanupBasicInfo(SOptrBasicInfo* pInfo);
int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr);
void cleanupExprSupp(SExprSupp* pSup);
+void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs);
int32_t initAggInfo(SExprSupp *pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, size_t keyBufSize,
const char* pkey);
void initResultSizeInfo(SResultInfo * pResultInfo, int32_t numOfRows);
@@ -933,9 +935,8 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlotId,
STimeWindowAggSupp *pTwAggSupp, SExecTaskInfo* pTaskInfo);
-SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
- SSDataBlock* pResBlock, int64_t gap, int32_t tsSlotId, STimeWindowAggSupp* pTwAggSupp,
- SNode* pCondition, SExecTaskInfo* pTaskInfo);
+SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPhysiNode* pSessionNode,
+ SExecTaskInfo* pTaskInfo);
SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
SSDataBlock* pResultBlock, SArray* pGroupColList, SNode* pCondition,
SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo);
diff --git a/source/libs/executor/src/dataInserter.c b/source/libs/executor/src/dataInserter.c
index 1c08fafaa3..b30fce4988 100644
--- a/source/libs/executor/src/dataInserter.c
+++ b/source/libs/executor/src/dataInserter.c
@@ -225,7 +225,7 @@ int32_t dataBlockToSubmit(SDataInserterHandle* pInserter, SSubmitReq** pReq) {
}
blkHead->dataLen = htonl(dataLen);
- blkHead->numOfRows = htons(rows);
+ blkHead->numOfRows = htonl(rows);
ret->length += sizeof(SSubmitBlk) + dataLen;
blkHead = POINTER_SHIFT(blkHead, sizeof(SSubmitBlk) + dataLen);
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index d8b0983811..3e1581c53d 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -571,6 +571,10 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
}
*numOfExprs = numOfFuncs + numOfGroupKeys;
+ if (*numOfExprs == 0) {
+ return NULL;
+ }
+
SExprInfo* pExprs = taosMemoryCalloc(*numOfExprs, sizeof(SExprInfo));
for (int32_t i = 0; i < (*numOfExprs); ++i) {
@@ -628,7 +632,7 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t*
tListLen(pExp->pExpr->_function.functionName));
#if 1
// todo refactor: add the parameter for tbname function
- if (strcmp(pExp->pExpr->_function.functionName, "tbname") == 0) {
+ if (!pFuncNode->pParameterList && (strcmp(pExp->pExpr->_function.functionName, "tbname") == 0)) {
pFuncNode->pParameterList = nodesMakeList();
ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0);
SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
@@ -950,7 +954,7 @@ STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowI
return w;
}
- w = getResultRowByPos(pBuf, &pResultRowInfo->cur)->win;
+ w = getResultRowByPos(pBuf, &pResultRowInfo->cur, false)->win;
// in case of typical time window, we can calculate time window directly.
if (w.skey > ts || w.ekey < ts) {
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 51caa33093..21b7043200 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -93,6 +93,29 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
}
}
+void tdCleanupStreamInputDataBlock(qTaskInfo_t tinfo) {
+ SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
+ if (!pTaskInfo || !pTaskInfo->pRoot || pTaskInfo->pRoot->numOfDownstream <= 0) {
+ return;
+ }
+ SOperatorInfo* pOptrInfo = pTaskInfo->pRoot->pDownstream[0];
+
+ if (pOptrInfo->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
+ SStreamScanInfo* pInfo = pOptrInfo->info;
+ if (pInfo->blockType == STREAM_INPUT__DATA_BLOCK) {
+ for (int32_t i = 0; i < taosArrayGetSize(pInfo->pBlockLists); ++i) {
+ SSDataBlock* p = *(SSDataBlock**)taosArrayGet(pInfo->pBlockLists, i);
+ taosArrayDestroy(p->pDataBlock);
+ taosMemoryFreeClear(p);
+ }
+ } else {
+ ASSERT(0);
+ }
+ } else {
+ ASSERT(0);
+ }
+}
+
int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) {
if (tinfo == NULL) {
return TSDB_CODE_QRY_APP_ERROR;
@@ -104,7 +127,7 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- int32_t code = doSetStreamBlock(pTaskInfo->pRoot, (void**)pBlocks, numOfBlocks, type, GET_TASKID(pTaskInfo));
+ int32_t code = doSetStreamBlock(pTaskInfo->pRoot, (void*)pBlocks, numOfBlocks, type, GET_TASKID(pTaskInfo));
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed to set the stream block data", GET_TASKID(pTaskInfo));
} else {
@@ -209,6 +232,8 @@ static SArray* filterUnqualifiedTables(const SStreamScanInfo* pScanInfo, const S
continue;
}
+ tDecoderClear(&mr.coder);
+
// TODO handle ntb case
if (mr.me.type != TSDB_CHILD_TABLE || mr.me.ctbEntry.suid != pScanInfo->tableUid) {
continue;
@@ -257,7 +282,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
}
// todo refactor STableList
- bool assignUid = false;
+ bool assignUid = false;
size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0;
char* keyBuf = NULL;
if (bufLen > 0) {
@@ -647,12 +672,12 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
tsdbReaderClose(pTSInfo->dataReader);
pTSInfo->dataReader = NULL;
#if 0
- if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
- pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
- qError("prepare scan ver %ld actual ver %ld, last %ld", pOffset->version,
- pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version);
- ASSERT(0);
- }
+ if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
+ pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
+ qError("prepare scan ver %" PRId64 " actual ver %" PRId64 ", last %" PRId64, pOffset->version,
+ pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version);
+ ASSERT(0);
+ }
#endif
if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) {
return -1;
@@ -679,9 +704,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList);
#ifndef NDEBUG
-
- qDebug("switch to next table %ld (cursor %d), %ld rows returned", uid, pTableScanInfo->currentTable,
- pInfo->pTableScanOp->resultInfo.totalRows);
+ qDebug("switch to next table %" PRId64 " (cursor %d), %" PRId64 " rows returned", uid,
+ pTableScanInfo->currentTable, pInfo->pTableScanOp->resultInfo.totalRows);
pInfo->pTableScanOp->resultInfo.totalRows = 0;
#endif
@@ -713,10 +737,9 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pTableScanInfo->cond.twindows.skey = oldSkey;
pTableScanInfo->scanTimes = 0;
- qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts,
- pTableScanInfo->currentTable, tableSz);
+ qDebug("tsdb reader offset seek to uid %" PRId64 " ts %" PRId64 ", table cur set to %d , all table num %d", uid,
+ ts, pTableScanInfo->currentTable, tableSz);
/*}*/
-
} else {
ASSERT(0);
}
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index 2a65156bb3..679997289b 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -258,7 +258,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// in case of repeat scan/reverse scan, no new time window added.
if (isIntervalQuery) {
if (masterscan && p1 != NULL) { // the *p1 may be NULL in case of sliding+offset exists.
- pResult = getResultRowByPos(pResultBuf, p1);
+ pResult = getResultRowByPos(pResultBuf, p1, true);
ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset);
}
} else {
@@ -266,7 +266,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// pResultRowInfo object.
if (p1 != NULL) {
// todo
- pResult = getResultRowByPos(pResultBuf, p1);
+ pResult = getResultRowByPos(pResultBuf, p1, true);
ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset);
}
}
@@ -301,7 +301,8 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
pResultRowInfo->cur = (SResultRowPosition){.pageId = pResult->pageId, .offset = pResult->offset};
// too many time window in query
- if (taosHashGetSize(pSup->pResultRowHashTable) > MAX_INTERVAL_TIME_WINDOW) {
+ if (pTaskInfo->execModel == OPTR_EXEC_MODEL_BATCH &&
+ taosHashGetSize(pSup->pResultRowHashTable) > MAX_INTERVAL_TIME_WINDOW) {
longjmp(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
}
@@ -3328,7 +3329,7 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) {
return fillResult;
}
-static void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) {
+void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs) {
for (int32_t i = 0; i < numOfExprs; ++i) {
SExprInfo* pExprInfo = &pExpr[i];
for (int32_t j = 0; j < pExprInfo->base.numOfParams; ++j) {
@@ -3395,7 +3396,12 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
uint32_t defaultBufsz = 0;
getBufferPgSize(pAggSup->resultRowSize, &defaultPgsz, &defaultBufsz);
- int32_t code = createDiskbasedBuf(&pAggSup->pResultBuf, defaultPgsz, defaultBufsz, pKey, TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ qError("Init stream agg supporter failed since %s", terrstr(terrno));
+ return terrno;
+ }
+ int32_t code = createDiskbasedBuf(&pAggSup->pResultBuf, defaultPgsz, defaultBufsz, pKey, tsTempDir);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -3475,9 +3481,8 @@ void cleanupExprSupp(SExprSupp* pSupp) {
destroySqlFunctionCtx(pSupp->pCtx, pSupp->numOfExprs);
if (pSupp->pExprInfo != NULL) {
destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs);
+ taosMemoryFreeClear(pSupp->pExprInfo);
}
-
- taosMemoryFreeClear(pSupp->pExprInfo);
taosMemoryFree(pSupp->rowEntryInfoOffset);
}
@@ -3596,7 +3601,8 @@ void doDestroyExchangeOperatorInfo(void* param) {
}
static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t numOfCols, SNodeListNode* pValNode,
- STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType, int32_t order) {
+ STimeWindow win, int32_t capacity, const char* id, SInterval* pInterval, int32_t fillType,
+ int32_t order) {
SFillColInfo* pColInfo = createFillColInfo(pExpr, numOfCols, pValNode);
STimeWindow w = getAlignQueryTimeWindow(pInterval, pInterval->precision, win.skey);
@@ -3633,7 +3639,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
? &((SMergeAlignedIntervalAggOperatorInfo*)downstream->info)->intervalAggOperatorInfo->interval
: &((SIntervalAggOperatorInfo*)downstream->info)->interval;
- int32_t order = (pPhyFillNode->inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
+ int32_t order = (pPhyFillNode->inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC;
int32_t type = convertFillType(pPhyFillNode->mode);
SResultInfo* pResultInfo = &pOperator->resultInfo;
@@ -3768,11 +3774,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
static void cleanupTableSchemaInfo(SSchemaInfo* pSchemaInfo) {
taosMemoryFreeClear(pSchemaInfo->dbname);
- if (pSchemaInfo->sw == NULL) {
- return;
- }
-
- taosMemoryFree(pSchemaInfo->tablename);
+ taosMemoryFreeClear(pSchemaInfo->tablename);
tDeleteSSchemaWrapper(pSchemaInfo->sw);
tDeleteSSchemaWrapper(pSchemaInfo->qsw);
}
@@ -3835,7 +3837,7 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo, int32_t groupNum)
return TDB_CODE_SUCCESS;
}
-bool groupbyTbname(SNodeList* pGroupList) {
+bool groupbyTbname(SNodeList* pGroupList) {
bool bytbname = false;
if (LIST_LENGTH(pGroupList) > 0) {
SNode* p = nodesListGetNode(pGroupList, 0);
@@ -3877,7 +3879,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
bool assignUid = groupbyTbname(group);
int32_t groupNum = 0;
- size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
+ size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList);
for (int32_t i = 0; i < numOfTables; i++) {
STableKeyInfo* info = taosArrayGet(pTableListInfo->pTableList, i);
@@ -3935,6 +3937,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t type = nodeType(pPhyNode);
if (pPhyNode->pChildren == NULL || LIST_LENGTH(pPhyNode->pChildren) == 0) {
+ SOperatorInfo* pOperator = NULL;
if (QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN == type) {
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
@@ -3952,11 +3955,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return NULL;
}
- SOperatorInfo* pOperator = createTableScanOperatorInfo(pTableScanNode, pHandle, pTaskInfo);
+ pOperator = createTableScanOperatorInfo(pTableScanNode, pHandle, pTaskInfo);
STableScanInfo* pScanInfo = pOperator->info;
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
- return pOperator;
-
} else if (QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == type) {
STableMergeScanPhysiNode* pTableScanNode = (STableMergeScanPhysiNode*)pPhyNode;
int32_t code =
@@ -3973,14 +3974,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return NULL;
}
- SOperatorInfo* pOperator = createTableMergeScanOperatorInfo(pTableScanNode, pTableListInfo, pHandle, pTaskInfo);
+ pOperator = createTableMergeScanOperatorInfo(pTableScanNode, pTableListInfo, pHandle, pTaskInfo);
STableScanInfo* pScanInfo = pOperator->info;
pTaskInfo->cost.pRecoder = &pScanInfo->readRecorder;
- return pOperator;
-
} else if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == type) {
- return createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
+ pOperator = createExchangeOperatorInfo(pHandle->pMsgCb->clientRpc, (SExchangePhysiNode*)pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) {
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
if (pHandle->vnode) {
@@ -3996,18 +3995,16 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t sz = taosArrayGetSize(pTableListInfo->pTableList);
for (int32_t i = 0; i < sz; i++) {
STableKeyInfo* pKeyInfo = taosArrayGet(pTableListInfo->pTableList, i);
- qDebug("creating stream task: add table %ld", pKeyInfo->uid);
+ qDebug("creating stream task: add table %" PRId64, pKeyInfo->uid);
}
}
#endif
pTaskInfo->schemaInfo.qsw = extractQueriedColumnSchema(&pTableScanNode->scan);
- SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle, pTableScanNode, pTagCond, pTaskInfo);
- return pOperator;
-
+ pOperator = createStreamScanOperatorInfo(pHandle, pTableScanNode, pTagCond, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN == type) {
SSystemTableScanPhysiNode* pSysScanPhyNode = (SSystemTableScanPhysiNode*)pPhyNode;
- return createSysTableScanOperatorInfo(pHandle, pSysScanPhyNode, pUser, pTaskInfo);
+ pOperator = createSysTableScanOperatorInfo(pHandle, pSysScanPhyNode, pUser, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN == type) {
STagScanPhysiNode* pScanPhyNode = (STagScanPhysiNode*)pPhyNode;
int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanPhyNode, pTagCond, pTagIndexCond, pTableListInfo);
@@ -4016,7 +4013,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return NULL;
}
- return createTagScanOperatorInfo(pHandle, pScanPhyNode, pTableListInfo, pTaskInfo);
+ pOperator = createTagScanOperatorInfo(pHandle, pScanPhyNode, pTableListInfo, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN == type) {
SBlockDistScanPhysiNode* pBlockNode = (SBlockDistScanPhysiNode*)pPhyNode;
pTableListInfo->pTableList = taosArrayInit(4, sizeof(STableKeyInfo));
@@ -4042,7 +4039,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
tsdbReaderOpen(pHandle->vnode, &cond, pTableListInfo->pTableList, &pReader, "");
cleanupQueryTableDataCond(&cond);
- return createDataBlockInfoScanOperator(pReader, pHandle, cond.suid, pBlockNode, pTaskInfo);
+ pOperator = createDataBlockInfoScanOperator(pReader, pHandle, cond.suid, pBlockNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN == type) {
SLastRowScanPhysiNode* pScanNode = (SLastRowScanPhysiNode*)pPhyNode;
@@ -4059,12 +4056,14 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return NULL;
}
- return createLastrowScanOperator(pScanNode, pHandle, pTaskInfo);
+ pOperator = createLastrowScanOperator(pScanNode, pHandle, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) {
- return createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo);
+ pOperator = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo);
} else {
ASSERT(0);
}
+ pOperator->resultDataBlockId = pPhyNode->pOutputDataBlockDesc->dataBlockId;
+ return pOperator;
}
int32_t num = 0;
@@ -4075,7 +4074,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, i);
ops[i] = createOperatorTree(pChildNode, pTaskInfo, pHandle, pTableListInfo, pTagCond, pTagIndexCond, pUser);
if (ops[i] == NULL) {
+ taosMemoryFree(ops);
return NULL;
+ } else {
+ ops[i]->resultDataBlockId = pChildNode->pOutputDataBlockDesc->dataBlockId;
}
}
@@ -4172,16 +4174,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pOptr = createMultiwayMergeOperatorInfo(ops, size, pMergePhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION == type) {
SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode;
-
- STimeWindowAggSupp as = {.waterMark = pSessionNode->window.watermark,
- .calTrigger = pSessionNode->window.triggerType};
-
- SExprInfo* pExprInfo = createExprInfo(pSessionNode->window.pFuncs, NULL, &num);
- SSDataBlock* pResBlock = createResDataBlock(pPhyNode->pOutputDataBlockDesc);
- int32_t tsSlotId = ((SColumnNode*)pSessionNode->window.pTspk)->slotId;
-
- pOptr = createSessionAggOperatorInfo(ops[0], pExprInfo, num, pResBlock, pSessionNode->gap, tsSlotId, &as,
- pPhyNode->pConditions, pTaskInfo);
+ pOptr = createSessionAggOperatorInfo(ops[0], pSessionNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION == type) {
pOptr = createStreamSessionAggOperatorInfo(ops[0], pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION == type) {
@@ -4218,8 +4211,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else {
ASSERT(0);
}
-
taosMemoryFree(ops);
+
+ pOptr->resultDataBlockId = pPhyNode->pOutputDataBlockDesc->dataBlockId;
return pOptr;
}
@@ -4522,7 +4516,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
return code;
_complete:
- taosMemoryFreeClear(*pTaskInfo);
+ doDestroyTask(*pTaskInfo);
terrno = code;
return code;
}
@@ -4620,7 +4614,7 @@ void releaseQueryBuf(size_t numOfTables) {
}
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInfoList) {
- SExplainExecInfo execInfo = {0};
+ SExplainExecInfo execInfo = {0};
SExplainExecInfo* pExplainInfo = taosArrayPush(pExecInfoList, &execInfo);
pExplainInfo->numOfRows = operatorInfo->resultInfo.totalRows;
@@ -4630,7 +4624,8 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
pExplainInfo->verboseInfo = NULL;
if (operatorInfo->fpSet.getExplainFn) {
- int32_t code = operatorInfo->fpSet.getExplainFn(operatorInfo, &pExplainInfo->verboseInfo, &pExplainInfo->verboseLen);
+ int32_t code =
+ operatorInfo->fpSet.getExplainFn(operatorInfo, &pExplainInfo->verboseInfo, &pExplainInfo->verboseLen);
if (code) {
qError("%s operator getExplainFn failed, code:%s", GET_TASKID(operatorInfo->pTaskInfo), tstrerror(code));
return code;
@@ -4641,7 +4636,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SArray* pExecInf
for (int32_t i = 0; i < operatorInfo->numOfDownstream; ++i) {
code = getOperatorExplainExecInfo(operatorInfo->pDownstream[i], pExecInfoList);
if (code != TSDB_CODE_SUCCESS) {
-// taosMemoryFreeClear(*pRes);
+ // taosMemoryFreeClear(*pRes);
return TSDB_CODE_QRY_OUT_OF_MEMORY;
}
}
@@ -4671,7 +4666,12 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, const char* pKey, SqlF
if (bufSize <= pageSize) {
bufSize = pageSize * 4;
}
- int32_t code = createDiskbasedBuf(&pSup->pResultBuf, pageSize, bufSize, pKey, TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ qError("Init stream agg supporter failed since %s", terrstr(terrno));
+ return terrno;
+ }
+ int32_t code = createDiskbasedBuf(&pSup->pResultBuf, pageSize, bufSize, pKey, tsTempDir);
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].pBuf = pSup->pResultBuf;
}
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index c1e5252089..938134c167 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -764,7 +764,13 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition
uint32_t defaultBufsz = 0;
getBufferPgSize(pResBlock->info.rowSize, &defaultPgsz, &defaultBufsz);
- int32_t code = createDiskbasedBuf(&pInfo->pBuf, defaultPgsz, defaultBufsz, pTaskInfo->id.str, TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ pTaskInfo->code = terrno;
+ qError("Create partition operator info failed since %s", terrstr(terrno));
+ goto _error;
+ }
+ int32_t code = createDiskbasedBuf(&pInfo->pBuf, defaultPgsz, defaultBufsz, pTaskInfo->id.str, tsTempDir);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
}
diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c
index 4134ce5dbf..e96844f1e3 100644
--- a/source/libs/executor/src/joinoperator.c
+++ b/source/libs/executor/src/joinoperator.c
@@ -26,7 +26,34 @@
static void setJoinColumnInfo(SColumnInfo* pColumn, const SColumnNode* pColumnNode);
static SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator);
static void destroyMergeJoinOperator(void* param, int32_t numOfOutput);
-static void extractTimeCondition(SJoinOperatorInfo* Info, SLogicConditionNode* pLogicConditionNode);
+static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream,
+ SSortMergeJoinPhysiNode* pJoinNode);
+
+static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDownstream, int32_t numOfDownstream,
+ SSortMergeJoinPhysiNode* pJoinNode) {
+ SNode* pMergeCondition = pJoinNode->pMergeCondition;
+ if (nodeType(pMergeCondition) == QUERY_NODE_OPERATOR) {
+ SOperatorNode* pNode = (SOperatorNode*)pMergeCondition;
+ SColumnNode* col1 = (SColumnNode*)pNode->pLeft;
+ SColumnNode* col2 = (SColumnNode*)pNode->pRight;
+ SColumnNode* leftTsCol = NULL;
+ SColumnNode* rightTsCol = NULL;
+ if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) {
+ ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId);
+ leftTsCol = col1;
+ rightTsCol = col2;
+ } else {
+ ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId);
+ ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId);
+ leftTsCol = col2;
+ rightTsCol = col1;
+ }
+ setJoinColumnInfo(&pInfo->leftCol, leftTsCol);
+ setJoinColumnInfo(&pInfo->rightCol, rightTsCol);
+ } else {
+ ASSERT(false);
+ }
+}
SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream,
SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo) {
@@ -53,14 +80,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t
pOperator->info = pInfo;
pOperator->pTaskInfo = pTaskInfo;
- SNode* pMergeCondition = pJoinNode->pMergeCondition;
- if (nodeType(pMergeCondition) == QUERY_NODE_OPERATOR) {
- SOperatorNode* pNode = (SOperatorNode*)pMergeCondition;
- setJoinColumnInfo(&pInfo->leftCol, (SColumnNode*)pNode->pLeft);
- setJoinColumnInfo(&pInfo->rightCol, (SColumnNode*)pNode->pRight);
- } else {
- ASSERT(false);
- }
+ extractTimeCondition(pInfo, pDownstream, numOfDownstream, pJoinNode);
if (pJoinNode->pOnConditions != NULL && pJoinNode->node.pConditions != NULL) {
pInfo->pCondAfterMerge = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
@@ -173,16 +193,16 @@ static int32_t mergeJoinGetBlockRowsEqualTs(SSDataBlock* pBlock, int16_t tsSlotI
}
SSDataBlock* block = pBlock;
- bool createdNewBlock = false;
+ bool createdNewBlock = false;
if (endPos == numRows) {
- block = blockDataExtractBlock(pBlock, startPos, endPos-startPos);
+ block = blockDataExtractBlock(pBlock, startPos, endPos - startPos);
taosArrayPush(createdBlocks, &block);
createdNewBlock = true;
}
SRowLocation location = {0};
for (int32_t j = startPos; j < endPos; ++j) {
location.pDataBlock = block;
- location.pos = ( createdNewBlock ? j - startPos : j);
+ location.pos = (createdNewBlock ? j - startPos : j);
taosArrayPush(rowLocations, &location);
}
return 0;
@@ -367,17 +387,3 @@ SSDataBlock* doMergeJoin(struct SOperatorInfo* pOperator) {
}
return (pRes->info.rows > 0) ? pRes : NULL;
}
-
-static void extractTimeCondition(SJoinOperatorInfo* pInfo, SLogicConditionNode* pLogicConditionNode) {
- int32_t len = LIST_LENGTH(pLogicConditionNode->pParameterList);
-
- for (int32_t i = 0; i < len; ++i) {
- SNode* pNode = nodesListGetNode(pLogicConditionNode->pParameterList, i);
- if (nodeType(pNode) == QUERY_NODE_OPERATOR) {
- SOperatorNode* pn1 = (SOperatorNode*)pNode;
- setJoinColumnInfo(&pInfo->leftCol, (SColumnNode*)pn1->pLeft);
- setJoinColumnInfo(&pInfo->rightCol, (SColumnNode*)pn1->pRight);
- break;
- }
- }
-}
diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c
index 53e25c7e97..9a7c3cf7fb 100644
--- a/source/libs/executor/src/projectoperator.c
+++ b/source/libs/executor/src/projectoperator.c
@@ -56,6 +56,8 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
+
int32_t numOfCols = 0;
SExprInfo* pExprInfo = createExprInfo(pProjPhyNode->pProjections, NULL, &numOfCols);
@@ -63,7 +65,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
initLimitInfo(pProjPhyNode->node.pLimit, pProjPhyNode->node.pSlimit, &pInfo->limitInfo);
pInfo->binfo.pRes = pResBlock;
- pInfo->pFinalRes = createOneDataBlock(pResBlock, false);
+ pInfo->pFinalRes = createOneDataBlock(pResBlock, false);
pInfo->pFilterNode = pProjPhyNode->node.pConditions;
pInfo->mergeDataBlocks = pProjPhyNode->mergeDataBlock;
@@ -73,7 +75,6 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pInfo->mergeDataBlocks = false;
}
-
int32_t numOfRows = 4096;
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
@@ -89,12 +90,11 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
setFunctionResultOutput(pOperator, &pInfo->binfo, &pInfo->aggSup, MAIN_SCAN, numOfCols);
pInfo->pPseudoColInfo = setRowTsColumnOutputInfo(pOperator->exprSupp.pCtx, numOfCols);
- pOperator->name = "ProjectOperator";
+ pOperator->name = "ProjectOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_PROJECT;
- pOperator->blocking = false;
- pOperator->status = OP_NOT_OPENED;
- pOperator->info = pInfo;
- pOperator->pTaskInfo = pTaskInfo;
+ pOperator->blocking = false;
+ pOperator->status = OP_NOT_OPENED;
+ pOperator->info = pInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL,
destroyProjectOperatorInfo, NULL, NULL, NULL);
@@ -106,7 +106,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
return pOperator;
- _error:
+_error:
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
@@ -156,7 +156,8 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
return PROJECT_RETRIEVE_DONE;
}
-static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SSDataBlock* pBlock, SOperatorInfo* pOperator) {
+static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SSDataBlock* pBlock,
+ SOperatorInfo* pOperator) {
// set current group id
pLimitInfo->currentGroupId = groupId;
@@ -170,8 +171,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
}
// check for the limitation in each group
- if (pLimitInfo->limit.limit >= 0 &&
- pLimitInfo->numOfOutputRows + pBlock->info.rows >= pLimitInfo->limit.limit) {
+ if (pLimitInfo->limit.limit >= 0 && pLimitInfo->numOfOutputRows + pBlock->info.rows >= pLimitInfo->limit.limit) {
int32_t keepRows = (int32_t)(pLimitInfo->limit.limit - pLimitInfo->numOfOutputRows);
blockDataKeepFirstNRows(pBlock, keepRows);
if (pLimitInfo->slimit.limit > 0 && pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups) {
@@ -222,7 +222,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
}
SOperatorInfo* downstream = pOperator->pDownstream[0];
- SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo;
+ SLimitInfo* pLimitInfo = &pProjectInfo->limitInfo;
if (downstream == NULL) {
return doGenerateSourceData(pOperator);
@@ -317,7 +317,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
if (pOperator->cost.openCost == 0) {
pOperator->cost.openCost = (taosGetTimestampUs() - st) / 1000.0;
}
-
+
// printDataBlock1(p, "project");
return (p->info.rows > 0) ? p : NULL;
}
@@ -330,6 +330,8 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
+
SExprSupp* pSup = &pOperator->exprSupp;
SIndefRowsFuncPhysiNode* pPhyNode = (SIndefRowsFuncPhysiNode*)pNode;
@@ -373,7 +375,6 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
pOperator->blocking = false;
pOperator->status = OP_NOT_OPENED;
pOperator->info = pInfo;
- pOperator->pTaskInfo = pTaskInfo;
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL,
destroyIndefinitOperatorInfo, NULL, NULL, NULL);
@@ -385,7 +386,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy
return pOperator;
- _error:
+_error:
taosMemoryFree(pInfo);
taosMemoryFree(pOperator);
pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY;
@@ -593,7 +594,7 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
pRes->info.rows = 1;
doFilter(pProjectInfo->pFilterNode, pRes, NULL);
- /*int32_t status = */doIngroupLimitOffset(&pProjectInfo->limitInfo, 0, pRes, pOperator);
+ /*int32_t status = */ doIngroupLimitOffset(&pProjectInfo->limitInfo, 0, pRes, pOperator);
pOperator->resultInfo.totalRows += pRes->info.rows;
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index 9744b14870..f8c9247ce3 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -405,9 +405,15 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
data = (char*)p;
}
- for (int32_t i = 0; i < pBlock->info.rows; ++i) {
- colDataAppend(pColInfoData, i, data,
- (data == NULL) || (pColInfoData->info.type == TSDB_DATA_TYPE_JSON && tTagIsJsonNull(data)));
+ bool isNullVal = (data == NULL) || (pColInfoData->info.type == TSDB_DATA_TYPE_JSON && tTagIsJsonNull(data));
+ if (isNullVal) {
+ colDataAppendNNULL(pColInfoData, 0, pBlock->info.rows);
+ } else if (pColInfoData->info.type != TSDB_DATA_TYPE_JSON) {
+ colDataAppendNItems(pColInfoData, 0, data, pBlock->info.rows);
+ } else { // todo opt for json tag
+ for (int32_t i = 0; i < pBlock->info.rows; ++i) {
+ colDataAppend(pColInfoData, i, data, false);
+ }
}
if (data && (pColInfoData->info.type != TSDB_DATA_TYPE_JSON) && p != NULL &&
@@ -752,6 +758,7 @@ static int32_t doGetTableRowSize(void* pMeta, uint64_t uid, int32_t* rowLen, con
}
} else if (mr.me.type == TSDB_CHILD_TABLE) {
uint64_t suid = mr.me.ctbEntry.suid;
+ tDecoderClear(&mr.coder);
code = metaGetTableEntryByUid(&mr, suid);
if (code != TSDB_CODE_SUCCESS) {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", suid, tstrerror(terrno), idstr);
@@ -1632,6 +1639,11 @@ static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) {
if (pStreamScan->pColMatchInfo) {
taosArrayDestroy(pStreamScan->pColMatchInfo);
}
+ if (pStreamScan->pPseudoExpr) {
+ destroyExprInfo(pStreamScan->pPseudoExpr, pStreamScan->numOfPseudoExpr);
+ taosMemoryFreeClear(pStreamScan->pPseudoExpr);
+ }
+
updateInfoDestroy(pStreamScan->pUpdateInfo);
blockDataDestroy(pStreamScan->pRes);
blockDataDestroy(pStreamScan->pUpdateRes);
@@ -1778,8 +1790,8 @@ static void destroySysScanOperator(void* param, int32_t numOfOutput) {
blockDataDestroy(pInfo->pRes);
const char* name = tNameGetTableName(&pInfo->name);
- if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, TSDB_TABLE_FNAME_LEN) == 0 ||
- strncasecmp(name, TSDB_INS_TABLE_USER_TAGS, TSDB_TABLE_FNAME_LEN) == 0 || pInfo->pCur != NULL) {
+ if (strncasecmp(name, TSDB_INS_TABLE_TABLES, TSDB_TABLE_FNAME_LEN) == 0 ||
+ strncasecmp(name, TSDB_INS_TABLE_TAGS, TSDB_TABLE_FNAME_LEN) == 0 || pInfo->pCur != NULL) {
metaCloseTbCursor(pInfo->pCur);
pInfo->pCur = NULL;
}
@@ -1791,7 +1803,7 @@ static void destroySysScanOperator(void* param, int32_t numOfOutput) {
}
static int32_t getSysTableDbNameColId(const char* pTable) {
- // if (0 == strcmp(TSDB_INS_TABLE_USER_INDEXES, pTable)) {
+ // if (0 == strcmp(TSDB_INS_TABLE_INDEXES, pTable)) {
// return 1;
// }
return TSDB_INS_USER_STABLES_DBNAME_COLID;
@@ -2007,7 +2019,7 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
tNameGetDbName(&sn, varDataVal(dbname));
varDataSetLen(dbname, strlen(varDataVal(dbname)));
- SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_USER_TAGS);
+ SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_TAGS);
blockDataEnsureCapacity(p, pOperator->resultInfo.capacity);
int32_t ret = 0;
@@ -2178,7 +2190,7 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
tNameGetDbName(&sn, varDataVal(dbname));
varDataSetLen(dbname, strlen(varDataVal(dbname)));
- SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_USER_TABLES);
+ SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_TABLES);
blockDataEnsureCapacity(p, pOperator->resultInfo.capacity);
char n[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
@@ -2345,11 +2357,11 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName);
}
- if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, TSDB_TABLE_FNAME_LEN) == 0) {
+ if (strncasecmp(name, TSDB_INS_TABLE_TABLES, TSDB_TABLE_FNAME_LEN) == 0) {
return sysTableScanUserTables(pOperator);
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_TAGS, TSDB_TABLE_FNAME_LEN) == 0) {
+ } else if (strncasecmp(name, TSDB_INS_TABLE_TAGS, TSDB_TABLE_FNAME_LEN) == 0) {
return sysTableScanUserTags(pOperator);
- } else if (strncasecmp(name, TSDB_INS_TABLE_USER_STABLES, TSDB_TABLE_FNAME_LEN) == 0 &&
+ } else if (strncasecmp(name, TSDB_INS_TABLE_STABLES, TSDB_TABLE_FNAME_LEN) == 0 &&
IS_SYS_DBNAME(pInfo->req.db)) {
return sysTableScanUserSTables(pOperator);
} else { // load the meta from mnode of the given epset
@@ -2425,7 +2437,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
}
int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity) {
- SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_USER_TABLES);
+ SSDataBlock* p = buildInfoSchemaTableMetaBlock(TSDB_INS_TABLE_TABLES);
blockDataEnsureCapacity(p, capacity);
size_t size = 0;
@@ -2514,8 +2526,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
tNameAssign(&pInfo->name, &pScanNode->tableName);
const char* name = tNameGetTableName(&pInfo->name);
- if (strncasecmp(name, TSDB_INS_TABLE_USER_TABLES, TSDB_TABLE_FNAME_LEN) == 0 ||
- strncasecmp(name, TSDB_INS_TABLE_USER_TAGS, TSDB_TABLE_FNAME_LEN) == 0) {
+ if (strncasecmp(name, TSDB_INS_TABLE_TABLES, TSDB_TABLE_FNAME_LEN) == 0 ||
+ strncasecmp(name, TSDB_INS_TABLE_TAGS, TSDB_TABLE_FNAME_LEN) == 0) {
pInfo->readHandle = *(SReadHandle*)readHandle;
blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
} else {
@@ -2644,6 +2656,7 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
while (pInfo->curPos < size && count < pOperator->resultInfo.capacity) {
STableKeyInfo* item = taosArrayGet(pInfo->pTableList->pTableList, pInfo->curPos);
int32_t code = metaGetTableEntryByUid(&mr, item->uid);
+ tDecoderClear(&mr.coder);
if (code != TSDB_CODE_SUCCESS) {
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", item->uid, tstrerror(terrno),
GET_TASKID(pTaskInfo));
diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c
index 26dd772292..16f35b1b0d 100644
--- a/source/libs/executor/src/sortoperator.c
+++ b/source/libs/executor/src/sortoperator.c
@@ -30,6 +30,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
SDataBlockDescNode* pDescNode = pSortNode->node.pOutputDataBlockDesc;
int32_t numOfCols = 0;
@@ -45,7 +46,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
initResultSizeInfo(&pOperator->resultInfo, 1024);
pInfo->binfo.pRes = pResBlock;
- pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys);
+ pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys);
pInfo->pCondition = pSortNode->node.pConditions;
pInfo->pColMatchInfo = pColMatchColInfo;
initLimitInfo(pSortNode->node.pLimit, pSortNode->node.pSlimit, &pInfo->limitInfo);
@@ -57,7 +58,6 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
pOperator->info = pInfo;
pOperator->exprSupp.pExprInfo = pExprInfo;
pOperator->exprSupp.numOfExprs = numOfCols;
- pOperator->pTaskInfo = pTaskInfo;
// lazy evaluation for the following parameter since the input datablock is not known till now.
// pInfo->bufPageSize = rowSize < 1024 ? 1024 * 2 : rowSize * 2;
@@ -152,7 +152,7 @@ SSDataBlock* loadNextDataBlock(void* param) {
void applyScalarFunction(SSDataBlock* pBlock, void* param) {
SOperatorInfo* pOperator = param;
SSortOperatorInfo* pSort = pOperator->info;
- if (pOperator->exprSupp.pExprInfo != NULL) {
+ if (pOperator->exprSupp.pExprInfo != NULL && pOperator->exprSupp.numOfExprs > 0) {
int32_t code = projectApplyFunctions(pOperator->exprSupp.pExprInfo, pBlock, pBlock, pOperator->exprSupp.pCtx,
pOperator->exprSupp.numOfExprs, NULL);
if (code != TSDB_CODE_SUCCESS) {
@@ -222,7 +222,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
}
// todo add the limit/offset info
- if (pInfo->limitInfo.remainOffset > 0) {
+ if (pInfo->limitInfo.remainOffset > 0) {
if (pInfo->limitInfo.remainOffset >= blockDataGetNumOfRows(pBlock)) {
pInfo->limitInfo.remainOffset -= pBlock->info.rows;
continue;
@@ -247,7 +247,7 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) {
}
}
- return blockDataGetNumOfRows(pBlock) > 0? pBlock:NULL;
+ return blockDataGetNumOfRows(pBlock) > 0 ? pBlock : NULL;
}
void destroyOrderOperatorInfo(void* param, int32_t numOfOutput) {
@@ -474,7 +474,7 @@ void destroyGroupSortOperatorInfo(void* param, int32_t numOfOutput) {
taosArrayDestroy(pInfo->pSortInfo);
taosArrayDestroy(pInfo->pColMatchInfo);
-
+
taosMemoryFreeClear(param);
}
@@ -609,8 +609,7 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
pInfo->groupId = tsortGetGroupId(pTupleHandle);
pInfo->prefetchedTuple = NULL;
}
- }
- else {
+ } else {
pTupleHandle = tsortNextTuple(pHandle);
pInfo->groupId = 0;
}
@@ -694,7 +693,7 @@ void destroyMultiwayMergeOperatorInfo(void* param, int32_t numOfOutput) {
tsortDestroySortHandle(pInfo->pSortHandle);
taosArrayDestroy(pInfo->pSortInfo);
taosArrayDestroy(pInfo->pColMatchInfo);
-
+
taosMemoryFreeClear(param);
}
@@ -711,7 +710,7 @@ int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplai
}
SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numStreams,
- SMergePhysiNode* pMergePhyNode, SExecTaskInfo* pTaskInfo) {
+ SMergePhysiNode* pMergePhyNode, SExecTaskInfo* pTaskInfo) {
SPhysiNode* pPhyNode = (SPhysiNode*)pMergePhyNode;
SMultiwayMergeOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SMultiwayMergeOperatorInfo));
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index 802e1f2306..0fccc40889 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -611,7 +611,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
break;
}
- SResultRow* pr = getResultRowByPos(pInfo->aggSup.pResultBuf, p1);
+ SResultRow* pr = getResultRowByPos(pInfo->aggSup.pResultBuf, p1, false);
ASSERT(pr->offset == p1->offset && pr->pageId == p1->pageId);
if (pr->closed) {
@@ -928,8 +928,9 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols);
SResultRow* pResult = NULL;
- STimeWindow win = getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->inputOrder);
- int32_t ret = TSDB_CODE_SUCCESS;
+ STimeWindow win =
+ getActiveTimeWindow(pInfo->aggSup.pResultBuf, pResultRowInfo, ts, &pInfo->interval, pInfo->inputOrder);
+ int32_t ret = TSDB_CODE_SUCCESS;
if ((!pInfo->ignoreExpiredData || !isCloseWindow(&win, &pInfo->twAggSup)) &&
inSlidingWindow(&pInfo->interval, &win, &pBlock->info)) {
ret = setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx,
@@ -1091,8 +1092,8 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pSup->pCtx, pBlock, pInfo->inputOrder, scanFlag, true);
- blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex);
-
+ blockDataUpdateTsWindow(pBlock, pInfo->primaryTsIndex);
+
hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, scanFlag, NULL);
}
@@ -1344,7 +1345,7 @@ static void setInverFunction(SqlFunctionCtx* pCtx, int32_t num, EStreamType type
}
void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprSupp* pSup, int32_t numOfOutput) {
- SResultRow* pResult = getResultRowByPos(pResultBuf, p1);
+ SResultRow* pResult = getResultRowByPos(pResultBuf, p1, false);
SqlFunctionCtx* pCtx = pSup->pCtx;
for (int32_t i = 0; i < numOfOutput; ++i) {
pCtx[i].resultInfo = getResultEntryInfo(pResult, i, pSup->rowEntryInfoOffset);
@@ -1790,9 +1791,10 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
pInfo->win = pTaskInfo->window;
- pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
- pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC)? TSDB_ORDER_ASC:TSDB_ORDER_DESC;
+ pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC;
+ pInfo->resultTsOrder = (pPhyNode->window.outputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC;
pInfo->interval = *pInterval;
pInfo->execModel = pTaskInfo->execModel;
pInfo->twAggSup = *pTwAggSupp;
@@ -1845,7 +1847,6 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->pTaskInfo = pTaskInfo;
pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
@@ -1880,6 +1881,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExpr
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
pInfo->inputOrder = TSDB_ORDER_ASC;
pInfo->interval = *pInterval;
pInfo->execModel = OPTR_EXEC_MODEL_STREAM;
@@ -1906,7 +1908,6 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SExpr
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->pTaskInfo = pTaskInfo;
pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
@@ -2180,7 +2181,6 @@ static void genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
break;
}
}
-
}
static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pBlock) {
@@ -2375,6 +2375,8 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode
pOperator->fpSet =
createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, NULL, destroyBasicOperatorInfo, NULL, NULL, NULL);
+ blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
+
code = appendDownstream(pOperator, &downstream, 1);
return pOperator;
@@ -2439,12 +2441,14 @@ void destroySWindowOperatorInfo(void* param, int32_t numOfOutput) {
SSessionAggOperatorInfo* pInfo = (SSessionAggOperatorInfo*)param;
cleanupBasicInfo(&pInfo->binfo);
+ colDataDestroy(&pInfo->twAggSup.timeWindowData);
+
+ cleanupAggSup(&pInfo->aggSup);
+ cleanupGroupResInfo(&pInfo->groupResInfo);
taosMemoryFreeClear(param);
}
-SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
- SSDataBlock* pResBlock, int64_t gap, int32_t tsSlotId,
- STimeWindowAggSupp* pTwAggSupp, SNode* pCondition,
+SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPhysiNode* pSessionNode,
SExecTaskInfo* pTaskInfo) {
SSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSessionAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
@@ -2455,6 +2459,10 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo
size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
initResultSizeInfo(&pOperator->resultInfo, 4096);
+ int32_t numOfCols = 0;
+ SExprInfo* pExprInfo = createExprInfo(pSessionNode->window.pFuncs, NULL, &numOfCols);
+ SSDataBlock* pResBlock = createResDataBlock(pSessionNode->window.node.pOutputDataBlockDesc);
+
int32_t code = initAggInfo(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str);
if (code != TSDB_CODE_SUCCESS) {
goto _error;
@@ -2462,16 +2470,19 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo
initBasicInfo(&pInfo->binfo, pResBlock);
- pInfo->twAggSup = *pTwAggSupp;
+ pInfo->twAggSup.waterMark = pSessionNode->window.watermark;
+ pInfo->twAggSup.calTrigger = pSessionNode->window.triggerType;
+ pInfo->gap = pSessionNode->gap;
+
initResultRowInfo(&pInfo->binfo.resultRowInfo);
initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
- pInfo->tsSlotId = tsSlotId;
- pInfo->gap = gap;
+ pInfo->tsSlotId = ((SColumnNode*)pSessionNode->window.pTspk)->slotId;
pInfo->binfo.pRes = pResBlock;
pInfo->winSup.prevTs = INT64_MIN;
pInfo->reptScan = false;
- pInfo->pCondition = pCondition;
+ pInfo->pCondition = pSessionNode->window.node.pConditions;
+
pOperator->name = "SessionWindowAggOperator";
pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION;
pOperator->blocking = true;
@@ -3019,6 +3030,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
pInfo->order = TSDB_ORDER_ASC;
pInfo->interval = (SInterval){.interval = pIntervalPhyNode->interval,
.sliding = pIntervalPhyNode->sliding,
@@ -3105,7 +3117,6 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
pOperator->blocking = true;
pOperator->status = OP_NOT_OPENED;
pOperator->exprSupp.pExprInfo = pExprInfo;
- pOperator->pTaskInfo = pTaskInfo;
pOperator->exprSupp.numOfExprs = numOfCols;
pOperator->info = pInfo;
@@ -3146,7 +3157,7 @@ void destroyStateWinInfo(void* ptr) {
if (ptr == NULL) {
return;
}
- SStateWindowInfo* pWin = (SStateWindowInfo*) ptr;
+ SStateWindowInfo* pWin = (SStateWindowInfo*)ptr;
taosMemoryFreeClear(pWin->stateKey.pData);
}
@@ -3237,6 +3248,8 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
goto _error;
}
+ pOperator->pTaskInfo = pTaskInfo;
+
initResultSizeInfo(&pOperator->resultInfo, 4096);
if (pSessionNode->window.pExprs != NULL) {
int32_t numOfScalar = 0;
@@ -3299,7 +3312,6 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
pOperator->fpSet =
createOperatorFpSet(operatorDummyOpenFn, doStreamSessionAgg, NULL, NULL, destroyStreamSessionAggOperatorInfo,
aggEncodeResultRow, aggDecodeResultRow, NULL);
- pOperator->pTaskInfo = pTaskInfo;
if (downstream) {
initDownStream(downstream, &pInfo->streamAggSup, pInfo->gap, pInfo->twAggSup.waterMark, pOperator->operatorType);
code = appendDownstream(pOperator, &downstream, 1);
@@ -3456,7 +3468,7 @@ static int32_t setWindowOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pRes
assert(pWinInfo->win.skey <= pWinInfo->win.ekey);
// too many time window in query
int32_t size = taosArrayGetSize(pAggSup->pCurWins);
- if (size > MAX_INTERVAL_TIME_WINDOW) {
+ if (pTaskInfo->execModel == OPTR_EXEC_MODEL_BATCH && size > MAX_INTERVAL_TIME_WINDOW) {
longjmp(pTaskInfo->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
}
@@ -3471,7 +3483,7 @@ static int32_t setWindowOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pRes
pWinInfo->pos.pageId = (*pResult)->pageId;
pWinInfo->pos.offset = (*pResult)->offset;
} else {
- *pResult = getResultRowByPos(pAggSup->pResultBuf, &pWinInfo->pos);
+ *pResult = getResultRowByPos(pAggSup->pResultBuf, &pWinInfo->pos, true);
if (!(*pResult)) {
qError("getResultRowByPos return NULL, TID:%s", GET_TASKID(pTaskInfo));
return TSDB_CODE_FAILED;
@@ -3638,8 +3650,8 @@ void deleteWindow(SArray* pWinInfos, int32_t index, FDelete fp) {
taosArrayRemove(pWinInfos, index);
}
-static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, int64_t gap,
- SArray* result, FDelete fp) {
+static void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, int64_t gap, SArray* result,
+ FDelete fp) {
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
TSKEY* startDatas = (TSKEY*)pStartTsCol->pData;
SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
@@ -4664,7 +4676,8 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
currTs = tsCols[currPos];
currWin.skey = currTs;
currWin.ekey = taosTimeAdd(currWin.skey, iaInfo->interval.interval, iaInfo->interval.intervalUnit,
- iaInfo->interval.precision) - 1;
+ iaInfo->interval.precision) -
+ 1;
startPos = currPos;
ret = setTimeWindowOutputBuf(pResultRowInfo, &currWin, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pSup->pCtx,
@@ -4924,8 +4937,8 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols);
SResultRow* pResult = NULL;
- STimeWindow win =
- getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval, iaInfo->inputOrder);
+ STimeWindow win = getActiveTimeWindow(iaInfo->aggSup.pResultBuf, pResultRowInfo, blockStartTs, &iaInfo->interval,
+ iaInfo->inputOrder);
int32_t ret =
setTimeWindowOutputBuf(pResultRowInfo, &win, (scanFlag == MAIN_SCAN), &pResult, tableGroupId, pExprSup->pCtx,
@@ -4966,7 +4979,8 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
STimeWindow nextWin = win;
while (1) {
int32_t prevEndPos = forwardRows - 1 + startPos;
- startPos = getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->inputOrder);
+ startPos =
+ getNextQualifiedWindow(&iaInfo->interval, &nextWin, &pBlock->info, tsCols, prevEndPos, iaInfo->inputOrder);
if (startPos < 0) {
break;
}
diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c
index 00a9f3ae6c..ad97d79f7e 100644
--- a/source/libs/executor/src/tlinearhash.c
+++ b/source/libs/executor/src/tlinearhash.c
@@ -247,7 +247,12 @@ SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_
return NULL;
}
- int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, 0, TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ printf("tHash Init failed since %s", terrstr(terrno));
+ return NULL;
+ }
+ int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, 0, tsTempDir);
if (code != 0) {
terrno = code;
return NULL;
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 4f525441b9..48af951773 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -159,7 +159,12 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
int32_t start = 0;
if (pHandle->pBuf == NULL) {
- int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "doAddToBuf", TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ qError("Add to buf failed since %s", terrstr(terrno));
+ return terrno;
+ }
+ int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "doAddToBuf", tsTempDir);
dBufSetPrintInfo(pHandle->pBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -233,7 +238,13 @@ static int32_t sortComparInit(SMsortComparParam* cmpParam, SArray* pSources, int
} else {
// multi-pass internal merge sort is required
if (pHandle->pBuf == NULL) {
- code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "sortComparInit", TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ code = terrno;
+ qError("Sort compare init failed since %s", terrstr(terrno));
+ return code;
+ }
+ code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "sortComparInit", tsTempDir);
dBufSetPrintInfo(pHandle->pBuf);
if (code != TSDB_CODE_SUCCESS) {
return code;
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 6383179fee..86cd0b495d 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -19,6 +19,7 @@
#include "querynodes.h"
#include "scalar.h"
#include "taoserror.h"
+#include "ttime.h"
static int32_t buildFuncErrMsg(char* pErrBuf, int32_t len, int32_t errCode, const char* pFormat, ...) {
va_list vArgList;
@@ -1442,6 +1443,57 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len)
return TSDB_CODE_SUCCESS;
}
+static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
+ int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
+ uint8_t dbPrec = pFunc->node.resType.precision;
+
+ if (1 != numOfParams && 3 != numOfParams && 4 != numOfParams) {
+ return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+
+ if (3 <= numOfParams) {
+ int64_t timeVal[2] = {0};
+ for (int32_t i = 1; i < 3; ++i) {
+ uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, i));
+ uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, i))->resType.type;
+ if (!IS_VAR_DATA_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+
+ SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, i);
+ int32_t ret = convertStringToTimestamp(paraType, pValue->datum.p, dbPrec, &timeVal[i - 1]);
+ if (ret != TSDB_CODE_SUCCESS) {
+ return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+ }
+
+ if (timeVal[0] > timeVal[1]) {
+ return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "INTERP function invalid time range");
+ }
+ }
+
+ if (4 == numOfParams) {
+ uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 3));
+ uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 3))->resType.type;
+ if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
+ }
+
+ int32_t ret = validateTimeUnitParam(dbPrec, (SValueNode*)nodesListGetNode(pFunc->pParameterList, 3));
+ if (ret == TIME_UNIT_TOO_SMALL) {
+ return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
+ "INTERP function time interval parameter should be greater than db precision");
+ } else if (ret == TIME_UNIT_INVALID) {
+ return buildFuncErrMsg(
+ pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
+ "INTERP function time interval parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]");
+ }
+ }
+
+ pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType;
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
// forbid null as first/last input, since first(c0, null, 1) may have different number of input
int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
@@ -2083,7 +2135,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "apercentile",
.type = FUNCTION_TYPE_APERCENTILE,
- .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
+ .classification = FUNC_MGT_AGG_FUNC,
.translateFunc = translateApercentile,
.getEnvFunc = getApercentileFuncEnv,
.initFunc = apercentileFunctionSetup,
@@ -2237,7 +2289,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "interp",
.type = FUNCTION_TYPE_INTERP,
.classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_INTERVAL_INTERPO_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
- .translateFunc = translateFirstLast,
+ .translateFunc = translateInterp,
.getEnvFunc = getSelectivityFuncEnv,
.initFunc = functionSetup,
.processFunc = NULL,
@@ -2246,7 +2298,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "derivative",
.type = FUNCTION_TYPE_DERIVATIVE,
- .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
+ .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
+ FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
.translateFunc = translateDerivative,
.getEnvFunc = getDerivativeFuncEnv,
.initFunc = derivativeFuncSetup,
@@ -2453,7 +2506,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "diff",
.type = FUNCTION_TYPE_DIFF,
- .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC,
+ .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC |
+ FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC,
.translateFunc = translateDiff,
.getEnvFunc = getDiffFuncEnv,
.initFunc = diffFunctionSetup,
@@ -2487,7 +2541,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "csum",
.type = FUNCTION_TYPE_CSUM,
- .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC,
+ .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC |
+ FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateCsum,
.getEnvFunc = getCsumFuncEnv,
.initFunc = functionSetup,
@@ -2856,7 +2911,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "tbname",
.type = FUNCTION_TYPE_TBNAME,
- .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateTbnameColumn,
.getEnvFunc = NULL,
.initFunc = NULL,
@@ -2896,7 +2951,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_wstart",
.type = FUNCTION_TYPE_WSTART,
- .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv,
.initFunc = NULL,
@@ -2906,7 +2961,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_wend",
.type = FUNCTION_TYPE_WEND,
- .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateTimePseudoColumn,
.getEnvFunc = getTimePseudoFuncEnv,
.initFunc = NULL,
@@ -2916,7 +2971,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_wduration",
.type = FUNCTION_TYPE_WDURATION,
- .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_WINDOW_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateWduration,
.getEnvFunc = getTimePseudoFuncEnv,
.initFunc = NULL,
@@ -2964,7 +3019,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_group_key",
.type = FUNCTION_TYPE_GROUP_KEY,
- .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC,
+ .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateGroupKey,
.getEnvFunc = getGroupKeyFuncEnv,
.initFunc = functionSetup,
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index b5cbaa1796..e78a78e7d8 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -28,7 +28,6 @@
#define HISTOGRAM_MAX_BINS_NUM 1000
#define MAVG_MAX_POINTS_NUM 1000
-#define SAMPLE_MAX_POINTS_NUM 1000
#define TAIL_MAX_POINTS_NUM 100
#define TAIL_MAX_OFFSET 100
@@ -2494,6 +2493,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
} else {
buildHistogramInfo(pInfo);
pInfo->pHisto = tHistogramCreateFrom(tmp, MAX_HISTOGRAM_BIN);
+ qDebug("%s set up histogram, numOfElems:%" PRId64 ", numOfEntry:%d, pHisto:%p, elems:%p", __FUNCTION__,
+ pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto, pInfo->pHisto->elems);
}
return true;
@@ -2524,6 +2525,12 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
tdigestAdd(pInfo->pTDigest, v, w);
}
} else {
+ qDebug("%s before add %d elements into histogram, total:%d, numOfEntry:%d, pHisto:%p, elems: %p", __FUNCTION__,
+ numOfElems, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto, pInfo->pHisto->elems);
+
+ // might be a race condition here that pHisto can be overwritten or setup function
+ // has not been called, need to relink the buffer pHisto points to.
+ buildHistogramInfo(pInfo);
for (int32_t i = start; i < pInput->numOfRows + start; ++i) {
if (colDataIsNull_f(pCol->nullbitmap, i)) {
continue;
@@ -2536,8 +2543,8 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
tHistogramAdd(&pInfo->pHisto, v);
}
- qDebug("add %d elements into histogram, total:%d, numOfEntry:%d, %p", numOfElems, pInfo->pHisto->numOfElems,
- pInfo->pHisto->numOfEntries, pInfo->pHisto);
+ qDebug("%s after add %d elements into histogram, total:%d, numOfEntry:%d, pHisto:%p, elems: %p", __FUNCTION__,
+ numOfElems, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto, pInfo->pHisto->elems);
}
SET_VAL(pResInfo, numOfElems, 1);
@@ -2577,17 +2584,19 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
memcpy(pHisto, pInput->pHisto, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1));
pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo));
- qDebug("merge histo, total:%" PRId64 ", entry:%d, %p", pHisto->numOfElems, pHisto->numOfEntries, pHisto);
+ qDebug("%s merge histo, total:%" PRId64 ", entry:%d, %p", __FUNCTION__, pHisto->numOfElems,
+ pHisto->numOfEntries, pHisto);
} else {
pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo));
- qDebug("input histogram, elem:%" PRId64 ", entry:%d, %p", pHisto->numOfElems, pHisto->numOfEntries,
- pInput->pHisto);
+ qDebug("%s input histogram, elem:%" PRId64 ", entry:%d, %p", __FUNCTION__, pHisto->numOfElems,
+ pHisto->numOfEntries, pInput->pHisto);
SHistogramInfo* pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN);
memcpy(pHisto, pRes, sizeof(SHistogramInfo) + sizeof(SHistBin) * MAX_HISTOGRAM_BIN);
pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo));
- qDebug("merge histo, total:%" PRId64 ", entry:%d, %p", pHisto->numOfElems, pHisto->numOfEntries, pHisto);
+ qDebug("%s merge histo, total:%" PRId64 ", entry:%d, %p", __FUNCTION__, pHisto->numOfElems,
+ pHisto->numOfEntries, pHisto);
tHistogramDestroy(&pRes);
}
}
@@ -2603,7 +2612,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo);
- qDebug("total %d rows will merge, %p", pInput->numOfRows, pInfo->pHisto);
+ qDebug("%s total %d rows will merge, %p", __FUNCTION__, pInput->numOfRows, pInfo->pHisto);
int32_t start = pInput->startRowIndex;
for (int32_t i = start; i < start + pInput->numOfRows; ++i) {
@@ -2614,7 +2623,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
}
if (pInfo->algo != APERCT_ALGO_TDIGEST) {
- qDebug("after merge, total:%d, numOfEntry:%d, %p", pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries,
+ qDebug("%s after merge, total:%d, numOfEntry:%d, %p", __FUNCTION__, pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries,
pInfo->pHisto);
}
@@ -2637,8 +2646,8 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
} else {
buildHistogramInfo(pInfo);
if (pInfo->pHisto->numOfElems > 0) {
- qDebug("get the final res:%d, elements:%" PRId64 ", entry:%d", pInfo->pHisto->numOfElems,
- pInfo->pHisto->numOfEntries);
+ qDebug("%s get the final res, elements:%" PRId64 ", numOfEntry:%d, pHisto:%p, elems:%p", __FUNCTION__,
+ pInfo->pHisto->numOfElems, pInfo->pHisto->numOfEntries, pInfo->pHisto, pInfo->pHisto->elems);
double ratio[] = {pInfo->percent};
double* res = tHistogramUniform(pInfo->pHisto, ratio, 1);
@@ -2685,7 +2694,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx)
SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx);
SAPercentileInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo);
- qDebug("start to combine apercentile, %p", pDBuf->pHisto);
+ qDebug("%s start to combine apercentile, %p", __FUNCTION__, pDBuf->pHisto);
apercentileTransferInfo(pSBuf, pDBuf);
pDResInfo->numOfRes = TMAX(pDResInfo->numOfRes, pSResInfo->numOfRes);
@@ -4888,9 +4897,7 @@ bool sampleFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo)
pInfo->numSampled = 0;
pInfo->colType = pCtx->resDataInfo.type;
pInfo->colBytes = pCtx->resDataInfo.bytes;
- if (pInfo->samples < 1 || pInfo->samples > SAMPLE_MAX_POINTS_NUM) {
- return false;
- }
+
pInfo->data = (char*)pInfo + sizeof(SSampleInfo);
pInfo->tuplePos = (STuplePos*)((char*)pInfo + sizeof(SSampleInfo) + pInfo->samples * pInfo->colBytes);
diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c
index 057d2bc7dc..517253dc01 100644
--- a/source/libs/function/src/tpercentile.c
+++ b/source/libs/function/src/tpercentile.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#include "taoserror.h"
#include "tglobal.h"
#include "tcompare.h"
@@ -257,7 +258,14 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
resetSlotInfo(pBucket);
- int32_t ret = createDiskbasedBuf(&pBucket->pBuffer, pBucket->bufPageSize, pBucket->bufPageSize * 512, "1", TD_TMP_DIR_PATH);
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ // qError("MemBucket create disk based Buf failed since %s", terrstr(terrno));
+ tMemBucketDestroy(pBucket);
+ return NULL;
+ }
+
+ int32_t ret = createDiskbasedBuf(&pBucket->pBuffer, pBucket->bufPageSize, pBucket->bufPageSize * 512, "1", tsTempDir);
if (ret != 0) {
tMemBucketDestroy(pBucket);
return NULL;
diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c
index afacb50d35..d5a3e91eea 100644
--- a/source/libs/function/src/tudf.c
+++ b/source/libs/function/src/tudf.c
@@ -976,8 +976,12 @@ int32_t cleanUpUdfs() {
}
uv_mutex_lock(&gUdfdProxy.udfStubsMutex);
- int32_t i = 0;
+ if (gUdfdProxy.udfStubs == NULL || taosArrayGetSize(gUdfdProxy.udfStubs) == 0) {
+ uv_mutex_unlock(&gUdfdProxy.udfStubsMutex);
+ return TSDB_CODE_SUCCESS;
+ }
SArray* udfStubs = taosArrayInit(16, sizeof(SUdfcFuncStub));
+ int32_t i = 0;
while (i < taosArrayGetSize(gUdfdProxy.udfStubs)) {
SUdfcFuncStub *stub = taosArrayGet(gUdfdProxy.udfStubs, i);
if (stub->refCount == 0) {
diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c
index 24749729c0..1cbc78df48 100644
--- a/source/libs/function/src/udfd.c
+++ b/source/libs/function/src/udfd.c
@@ -412,22 +412,31 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
udf->outputLen = pFuncInfo->outputLen;
udf->bufSize = pFuncInfo->bufSize;
+ if (!osTempSpaceAvailable()) {
+ terrno = TSDB_CODE_NO_AVAIL_DISK;
+ msgInfo->code = terrno;
+ fnError("udfd create shared library failed since %s", terrstr(terrno));
+ goto _return;
+ }
+
char path[PATH_MAX] = {0};
#ifdef WINDOWS
- snprintf(path, sizeof(path), "%s%s.dll", TD_TMP_DIR_PATH, pFuncInfo->name);
+ snprintf(path, sizeof(path), "%s%s.dll", tsTempDir, pFuncInfo->name);
#else
- snprintf(path, sizeof(path), "%s/lib%s.so", TD_TMP_DIR_PATH, pFuncInfo->name);
+ snprintf(path, sizeof(path), "%s/lib%s.so", tsTempDir, pFuncInfo->name);
#endif
TdFilePtr file =
taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC | TD_FILE_AUTO_DEL);
if (file == NULL) {
fnError("udfd write udf shared library: %s failed, error: %d %s", path, errno, strerror(errno));
msgInfo->code = TSDB_CODE_FILE_CORRUPTED;
+ goto _return;
}
int64_t count = taosWriteFile(file, pFuncInfo->pCode, pFuncInfo->codeSize);
if (count != pFuncInfo->codeSize) {
fnError("udfd write udf shared library failed");
msgInfo->code = TSDB_CODE_FILE_CORRUPTED;
+ goto _return;
}
taosCloseFile(&file);
strncpy(udf->path, path, strlen(path));
@@ -686,7 +695,6 @@ void udfdAllocBuffer(uv_handle_t *handle, size_t suggestedSize, uv_buf_t *buf) {
buf->len = 0;
}
}
- fnDebug("allocate buf. input buf cap - len - total : %d - %d - %d", ctx->inputCap, ctx->inputLen, ctx->inputTotal);
}
bool isUdfdUvMsgComplete(SUdfdUvConn *pipe) {
diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c
index 2468dca86c..d61cd871ee 100644
--- a/source/libs/index/src/index.c
+++ b/source/libs/index/src/index.c
@@ -220,7 +220,7 @@ int indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
char buf[128] = {0};
ICacheKey key = {.suid = p->suid, .colName = p->colName, .nColName = strlen(p->colName), .colType = p->colType};
int32_t sz = idxSerialCacheKey(&key, buf);
- indexDebug("w suid: %" PRIu64 ", colName: %s, colType: %d", key.suid, key.colName, key.colType);
+ indexDebug("w suid:%" PRIu64 ", colName:%s, colType:%d", key.suid, key.colName, key.colType);
IndexCache** cache = taosHashGet(index->colObj, buf, sz);
assert(*cache != NULL);
@@ -395,7 +395,7 @@ static int idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result)
char buf[128] = {0};
ICacheKey key = {
.suid = term->suid, .colName = term->colName, .nColName = strlen(term->colName), .colType = term->colType};
- indexDebug("r suid: %" PRIu64 ", colName: %s, colType: %d", key.suid, key.colName, key.colType);
+ indexDebug("r suid:%" PRIu64 ", colName:%s, colType:%d", key.suid, key.colName, key.colType);
int32_t sz = idxSerialCacheKey(&key, buf);
taosThreadMutexLock(&sIdx->mtx);
diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c
index b4e59d0f63..0a47fc0f16 100644
--- a/source/libs/index/src/indexTfile.c
+++ b/source/libs/index/src/indexTfile.c
@@ -141,7 +141,7 @@ void tfileCacheDestroy(TFileCache* tcache) {
TFileReader** reader = taosHashIterate(tcache->tableCache, NULL);
while (reader) {
TFileReader* p = *reader;
- indexInfo("drop table cache suid: %" PRIu64 ", colName: %s, colType: %d", p->header.suid, p->header.colName,
+ indexInfo("drop table cache suid:%" PRIu64 ", colName:%s, colType:%d", p->header.suid, p->header.colName,
p->header.colType);
tfileReaderUnRef(p);
reader = taosHashIterate(tcache->tableCache, reader);
@@ -185,20 +185,20 @@ TFileReader* tfileReaderCreate(IFileCtx* ctx) {
reader->ctx = ctx;
if (0 != tfileReaderVerify(reader)) {
- indexError("invalid tfile, suid: %" PRIu64 ", colName: %s", reader->header.suid, reader->header.colName);
+ indexError("invalid tfile, suid:%" PRIu64 ", colName:%s", reader->header.suid, reader->header.colName);
tfileReaderDestroy(reader);
return NULL;
}
// T_REF_INC(reader);
if (0 != tfileReaderLoadHeader(reader)) {
- indexError("failed to load index header, suid: %" PRIu64 ", colName: %s", reader->header.suid,
+ indexError("failed to load index header, suid:%" PRIu64 ", colName:%s", reader->header.suid,
reader->header.colName);
tfileReaderDestroy(reader);
return NULL;
}
if (0 != tfileReaderLoadFst(reader)) {
- indexError("failed to load index fst, suid: %" PRIu64 ", colName: %s, errno: %d", reader->header.suid,
+ indexError("failed to load index fst, suid:%" PRIu64 ", colName:%s, code:0x%x", reader->header.suid,
reader->header.colName, errno);
tfileReaderDestroy(reader);
return NULL;
@@ -874,7 +874,7 @@ static int tfileReaderLoadHeader(TFileReader* reader) {
int64_t nread = reader->ctx->readFrom(reader->ctx, buf, sizeof(buf), 0);
if (nread == -1) {
- indexError("actual Read: %d, to read: %d, errno: %d, filename: %s", (int)(nread), (int)sizeof(buf), errno,
+ indexError("actual Read: %d, to read: %d, code:0x%x, filename: %s", (int)(nread), (int)sizeof(buf), errno,
reader->ctx->file.buf);
} else {
indexInfo("actual Read: %d, to read: %d, filename: %s", (int)(nread), (int)sizeof(buf), reader->ctx->file.buf);
diff --git a/source/libs/nodes/src/nodesEqualFuncs.c b/source/libs/nodes/src/nodesEqualFuncs.c
index 2442bd8c16..9cb7e8b66d 100644
--- a/source/libs/nodes/src/nodesEqualFuncs.c
+++ b/source/libs/nodes/src/nodesEqualFuncs.c
@@ -82,7 +82,9 @@ static bool columnNodeEqual(const SColumnNode* a, const SColumnNode* b) {
COMPARE_STRING_FIELD(dbName);
COMPARE_STRING_FIELD(tableName);
COMPARE_STRING_FIELD(colName);
- COMPARE_STRING_FIELD(tableAlias);
+ if (0 == a->tableId) {
+ COMPARE_STRING_FIELD(tableAlias);
+ }
return true;
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index abab2126c0..6f71b58aef 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -713,7 +713,8 @@ void nodesDestroyNode(SNode* pNode) {
break;
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
- destroyTableCfg((STableCfg*)(((SShowCreateTableStmt*)pNode)->pCfg));
+ taosMemoryFreeClear(((SShowCreateTableStmt*)pNode)->pDbCfg);
+ destroyTableCfg((STableCfg*)(((SShowCreateTableStmt*)pNode)->pTableCfg));
break;
case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: // no pointer field
case QUERY_NODE_KILL_CONNECTION_STMT: // no pointer field
@@ -1817,3 +1818,19 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc) {
return TSDB_CODE_SUCCESS;
}
+
+const char* dataOrderStr(EDataOrderLevel order) {
+ switch (order) {
+ case DATA_ORDER_LEVEL_NONE:
+ return "no order required";
+ case DATA_ORDER_LEVEL_IN_BLOCK:
+ return "in-datablock order";
+ case DATA_ORDER_LEVEL_IN_GROUP:
+ return "in-group order";
+ case DATA_ORDER_LEVEL_GLOBAL:
+ return "global order";
+ default:
+ break;
+ }
+ return "unknown";
+}
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index d0c994e210..2a4f4c194d 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -176,11 +176,11 @@ SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort);
SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode);
SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue);
-SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
+SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName,
SNode* pRealTable, SNodeList* pCols, SNode* pOptions);
SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pStreamOptions);
-SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName);
+SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pIndexName);
SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId);
SNode* createCreateTopicStmtUseQuery(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName,
diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h
index ea78735d5e..ddfcd3a249 100644
--- a/source/libs/parser/inc/parInsertData.h
+++ b/source/libs/parser/inc/parInsertData.h
@@ -122,7 +122,7 @@ static FORCE_INLINE int32_t setBlockInfo(SSubmitBlk *pBlocks, STableDataBlocks *
pBlocks->sversion = dataBuf->pTableMeta->sversion;
pBlocks->schemaLen = dataBuf->createTbReqLen;
- if (pBlocks->numOfRows + numOfRows >= INT16_MAX) {
+ if (pBlocks->numOfRows + numOfRows >= INT32_MAX) {
return TSDB_CODE_TSC_INVALID_OPERATION;
} else {
pBlocks->numOfRows += numOfRows;
diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h
index 896e2bc239..b010e4b9e3 100644
--- a/source/libs/parser/inc/parUtil.h
+++ b/source/libs/parser/inc/parUtil.h
@@ -31,7 +31,8 @@ extern "C" {
#define parserDebug(param, ...) qDebug("PARSER: " param, ##__VA_ARGS__)
#define parserTrace(param, ...) qTrace("PARSER: " param, ##__VA_ARGS__)
-#define PK_TS_COL_INTERNAL_NAME "_rowts"
+#define ROWTS_PSEUDO_COLUMN_NAME "_rowts"
+#define C0_PSEUDO_COLUMN_NAME "_c0"
typedef struct SMsgBuf {
int32_t len;
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 21cb310f10..45bbea1707 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -424,8 +424,8 @@ from_db_opt(A) ::= FROM db_name(B).
/************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D)
- index_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, B, NULL, C); }
-cmd ::= DROP INDEX exists_opt(B) index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, &A); }
+ full_table_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
+cmd ::= DROP INDEX exists_opt(B) full_table_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, A); }
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL
NK_LP duration_literal(C) NK_RP sliding_opt(D) sma_stream_opt(E). { A = createIndexOption(pCxt, B, releaseRawExprNode(pCxt, C), NULL, D, E); }
@@ -608,10 +608,6 @@ column_alias(A) ::= NK_ID(B).
%destructor user_name { }
user_name(A) ::= NK_ID(B). { A = B; }
-%type index_name { SToken }
-%destructor index_name { }
-index_name(A) ::= NK_ID(B). { A = B; }
-
%type topic_name { SToken }
%destructor topic_name { }
topic_name(A) ::= NK_ID(B). { A = B; }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 41c614eba8..d19c203ffe 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -443,19 +443,23 @@ SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft,
createOperatorNode(pCxt, OP_TYPE_GREATER_THAN, nodesCloneNode(pExpr), pRight));
}
-static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt) {
+static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt, const SToken* pFuncName) {
CHECK_PARSER_STATUS(pCxt);
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
CHECK_OUT_OF_MEM(pCol);
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- strcpy(pCol->colName, PK_TS_COL_INTERNAL_NAME);
+ if (NULL == pFuncName) {
+ strcpy(pCol->colName, ROWTS_PSEUDO_COLUMN_NAME);
+ } else {
+ strncpy(pCol->colName, pFuncName->z, pFuncName->n);
+ }
return (SNode*)pCol;
}
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList) {
CHECK_PARSER_STATUS(pCxt);
if (0 == strncasecmp("_rowts", pFuncName->z, pFuncName->n) || 0 == strncasecmp("_c0", pFuncName->z, pFuncName->n)) {
- return createPrimaryKeyCol(pCxt);
+ return createPrimaryKeyCol(pCxt, pFuncName);
}
SFunctionNode* func = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
CHECK_OUT_OF_MEM(func);
@@ -586,7 +590,7 @@ SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr) {
CHECK_PARSER_STATUS(pCxt);
SStateWindowNode* state = (SStateWindowNode*)nodesMakeNode(QUERY_NODE_STATE_WINDOW);
CHECK_OUT_OF_MEM(state);
- state->pCol = createPrimaryKeyCol(pCxt);
+ state->pCol = createPrimaryKeyCol(pCxt, NULL);
if (NULL == state->pCol) {
nodesDestroyNode((SNode*)state);
CHECK_OUT_OF_MEM(state->pCol);
@@ -600,7 +604,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
CHECK_PARSER_STATUS(pCxt);
SIntervalWindowNode* interval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW);
CHECK_OUT_OF_MEM(interval);
- interval->pCol = createPrimaryKeyCol(pCxt);
+ interval->pCol = createPrimaryKeyCol(pCxt, NULL);
if (NULL == interval->pCol) {
nodesDestroyNode((SNode*)interval);
CHECK_OUT_OF_MEM(interval->pCol);
@@ -639,7 +643,7 @@ SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode) {
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd) {
CHECK_PARSER_STATUS(pCxt);
- return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt), pStart, pEnd);
+ return createBetweenAnd(pCxt, createPrimaryKeyCol(pCxt, NULL), pStart, pEnd);
}
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias) {
@@ -752,7 +756,7 @@ SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill) {
if (QUERY_NODE_SELECT_STMT == nodeType(pStmt) && NULL != pFill) {
SFillNode* pFillClause = (SFillNode*)pFill;
nodesDestroyNode(pFillClause->pWStartTs);
- pFillClause->pWStartTs = createPrimaryKeyCol(pCxt);
+ pFillClause->pWStartTs = createPrimaryKeyCol(pCxt, NULL);
((SSelectStmt*)pStmt)->pFill = (SNode*)pFillClause;
}
return pStmt;
@@ -767,6 +771,7 @@ SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pPr
select->pFromTable = pTable;
sprintf(select->stmtName, "%p", select);
select->isTimeLineResult = true;
+ select->onlyHasKeepOrderFunc = true;
select->timeRange = TSWINDOW_INITIALIZER;
return (SNode*)select;
}
@@ -1402,19 +1407,18 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
return (SNode*)pStmt;
}
-SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
+SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName,
SNode* pRealTable, SNodeList* pCols, SNode* pOptions) {
CHECK_PARSER_STATUS(pCxt);
- if (!checkIndexName(pCxt, pIndexName)) {
- return NULL;
- }
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT);
CHECK_OUT_OF_MEM(pStmt);
pStmt->indexType = type;
pStmt->ignoreExists = ignoreExists;
- COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName);
+ strcpy(pStmt->indexDbName, ((SRealTableNode*)pIndexName)->table.dbName);
+ strcpy(pStmt->indexName, ((SRealTableNode*)pIndexName)->table.tableName);
strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName);
strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName);
+ nodesDestroyNode(pIndexName);
nodesDestroyNode(pRealTable);
pStmt->pCols = pCols;
pStmt->pOptions = (SIndexOptions*)pOptions;
@@ -1434,15 +1438,14 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt
return (SNode*)pOptions;
}
-SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName) {
+SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pIndexName) {
CHECK_PARSER_STATUS(pCxt);
- if (!checkDbName(pCxt, NULL, true) || !checkIndexName(pCxt, pIndexName)) {
- return NULL;
- }
SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT);
CHECK_OUT_OF_MEM(pStmt);
pStmt->ignoreNotExists = ignoreNotExists;
- COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName);
+ strcpy(pStmt->indexDbName, ((SRealTableNode*)pIndexName)->table.dbName);
+ strcpy(pStmt->indexName, ((SRealTableNode*)pIndexName)->table.tableName);
+ nodesDestroyNode(pIndexName);
return (SNode*)pStmt;
}
@@ -1732,7 +1735,7 @@ SNode* createCountFuncForDelete(SAstCreateContext* pCxt) {
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
CHECK_OUT_OF_MEM(pFunc);
strcpy(pFunc->functionName, "count");
- if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createPrimaryKeyCol(pCxt))) {
+ if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createPrimaryKeyCol(pCxt, NULL))) {
nodesDestroyNode((SNode*)pFunc);
CHECK_OUT_OF_MEM(NULL);
}
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index 2d4e29a553..f5f44da9db 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -269,16 +269,15 @@ static int32_t collectMetaKeyFromUseDatabase(SCollectMetaKeyCxt* pCxt, SUseDatab
static int32_t collectMetaKeyFromCreateIndex(SCollectMetaKeyCxt* pCxt, SCreateIndexStmt* pStmt) {
int32_t code = TSDB_CODE_SUCCESS;
if (INDEX_TYPE_SMA == pStmt->indexType) {
- code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->tableName, pCxt->pMetaCache);
+ code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
- code =
- reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->tableName, pCxt->pMetaCache);
+ code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pCxt->pMetaCache);
+ code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) {
- code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pCxt->pMetaCache);
+ code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
}
}
return code;
@@ -341,22 +340,22 @@ static int32_t collectMetaKeyFromShowBnodes(SCollectMetaKeyCxt* pCxt, SShowStmt*
}
static int32_t collectMetaKeyFromShowDatabases(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_DATABASES,
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DATABASES,
pCxt->pMetaCache);
}
static int32_t collectMetaKeyFromShowFunctions(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_FUNCTIONS,
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_FUNCTIONS,
pCxt->pMetaCache);
}
static int32_t collectMetaKeyFromShowIndexes(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_INDEXES,
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_INDEXES,
pCxt->pMetaCache);
}
static int32_t collectMetaKeyFromShowStables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_STABLES,
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES,
pCxt->pMetaCache);
}
@@ -366,8 +365,8 @@ static int32_t collectMetaKeyFromShowStreams(SCollectMetaKeyCxt* pCxt, SShowStmt
}
static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB,
- TSDB_INS_TABLE_USER_TABLES, pCxt->pMetaCache);
+ int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLES,
+ pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
if (NULL != pStmt->pDbName) {
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache);
@@ -379,7 +378,7 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt*
}
static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_TAGS,
+ int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TAGS,
pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
if (NULL != pStmt->pDbName) {
@@ -392,7 +391,7 @@ static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* p
}
static int32_t collectMetaKeyFromShowUsers(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
- return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_USERS,
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USERS,
pCxt->pMetaCache);
}
@@ -457,6 +456,9 @@ static int32_t collectMetaKeyFromShowCreateTable(SCollectMetaKeyCxt* pCxt, SShow
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
+ }
return code;
}
diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c
index fbc5e1b4b0..85f73f0663 100644
--- a/source/libs/parser/src/parInsert.c
+++ b/source/libs/parser/src/parInsert.c
@@ -21,6 +21,7 @@
#include "tglobal.h"
#include "ttime.h"
#include "ttypes.h"
+#include "query.h"
#define NEXT_TOKEN(pSql, sToken) \
do { \
@@ -291,11 +292,10 @@ static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) {
int32_t schemaLen = blk->schemaLen;
blk->uid = htobe64(blk->uid);
blk->suid = htobe64(blk->suid);
- blk->padding = htonl(blk->padding);
blk->sversion = htonl(blk->sversion);
blk->dataLen = htonl(blk->dataLen);
blk->schemaLen = htonl(blk->schemaLen);
- blk->numOfRows = htons(blk->numOfRows);
+ blk->numOfRows = htonl(blk->numOfRows);
blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen);
}
}
@@ -1266,7 +1266,7 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da
SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData);
if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) {
- return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than 32767");
+ return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than INT32_MAX");
}
dataBuf->numOfTables = 1;
@@ -1338,7 +1338,7 @@ static int32_t parseDataFromFile(SInsertParseContext* pCxt, SToken filePath, STa
SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData);
if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) {
- return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than 32767");
+ return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than INT32_MAX");
}
dataBuf->numOfTables = 1;
@@ -1488,6 +1488,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
}
+ qDebug("0x%" PRIx64 " insert input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum);
+
if (TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT)) {
SParsedDataColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
if (NULL == tags) {
@@ -1983,7 +1985,7 @@ int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, in
SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData);
if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, bind->num)) {
- return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than 32767");
+ return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX");
}
return TSDB_CODE_SUCCESS;
@@ -2071,7 +2073,7 @@ int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBu
SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData);
if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, bind->num)) {
- return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than 32767");
+ return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX");
}
}
@@ -2408,9 +2410,9 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
} else {
int32_t colLen = kv->length;
if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) {
- // uError("SML:data before:%ld, precision:%d", kv->i, pTableMeta->tableInfo.precision);
+ // uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
kv->i = convertTimePrecision(kv->i, TSDB_TIME_PRECISION_NANO, pTableMeta->tableInfo.precision);
- // uError("SML:data after:%ld, precision:%d", kv->i, pTableMeta->tableInfo.precision);
+ // uError("SML:data after:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
}
if (IS_VAR_DATA_TYPE(kv->type)) {
@@ -2441,7 +2443,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData);
if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, rowNum)) {
- return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than 32767");
+ return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX");
}
return TSDB_CODE_SUCCESS;
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index e54bc9eb4c..db14a4f1c3 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -81,10 +81,8 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel);
taosArrayPush(pTables, &pTable);
if (hasSameTableAlias(pTables)) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf,
- TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
- "Not unique table/alias: '%s'",
- ((STableNode*)pTable)->tableAlias);
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
+ "Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
}
} else {
do {
@@ -92,10 +90,8 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
if (pCxt->currLevel == currTotalLevel) {
taosArrayPush(pTables, &pTable);
if (hasSameTableAlias(pTables)) {
- return generateSyntaxErrMsgExt(&pCxt->msgBuf,
- TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
- "Not unique table/alias: '%s'",
- ((STableNode*)pTable)->tableAlias);
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
+ "Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
}
}
taosArrayPush(pCxt->pNsLevel, &pTables);
@@ -616,7 +612,8 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p
}
static bool isInternalPrimaryKey(const SColumnNode* pCol) {
- return PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId && 0 == strcmp(pCol->colName, PK_TS_COL_INTERNAL_NAME);
+ return PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId &&
+ (0 == strcmp(pCol->colName, ROWTS_PSEUDO_COLUMN_NAME) || 0 == strcmp(pCol->colName, C0_PSEUDO_COLUMN_NAME));
}
static int32_t findAndSetColumn(STranslateContext* pCxt, SColumnNode** pColRef, const STableNode* pTable,
@@ -1175,6 +1172,44 @@ static int32_t translateMultiRowsFunc(STranslateContext* pCxt, SFunctionNode* pF
return TSDB_CODE_SUCCESS;
}
+static int32_t translateInterpFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
+ if (!fmIsInterpFunc(pFunc->funcId)) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+ }
+ SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
+ if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || pSelect->hasIndefiniteRowsFunc) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+ }
+ if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s function is not supported in window query or group query", pFunc->functionName);
+ }
+ if (hasInvalidFuncNesting(pFunc->pParameterList)) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_AGG_FUNC_NESTING);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
+ if (!fmIsTimelineFunc(pFunc->funcId)) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (!isSelectStmt(pCxt->pCurrStmt)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s function must be used in select statements", pFunc->functionName);
+ }
+ SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
+ if (QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
+ !isTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s function requires valid time series input", pFunc->functionName);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static bool hasFillClause(SNode* pCurrStmt) {
if (!isSelectStmt(pCurrStmt)) {
return false;
@@ -1295,6 +1330,7 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
+ pSelect->onlyHasKeepOrderFunc = pSelect->onlyHasKeepOrderFunc ? fmIsKeepOrderFunc(pFunc->funcId) : false;
}
}
@@ -1413,6 +1449,12 @@ static int32_t translateNoramlFunction(STranslateContext* pCxt, SFunctionNode* p
if (TSDB_CODE_SUCCESS == code) {
code = translateMultiRowsFunc(pCxt, pFunc);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateInterpFunc(pCxt, pFunc);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateTimelineFunc(pCxt, pFunc);
+ }
if (TSDB_CODE_SUCCESS == code) {
setFuncClassification(pCxt->pCurrStmt, pFunc);
}
@@ -1587,6 +1629,7 @@ static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode
strcpy(pFunc->functionName, "_group_key");
strcpy(pFunc->node.aliasName, ((SExprNode*)*pNode)->aliasName);
+ strcpy(pFunc->node.userAlias, ((SExprNode*)*pNode)->userAlias);
pCxt->errCode = nodesListMakeAppend(&pFunc->pParameterList, *pNode);
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
*pNode = (SNode*)pFunc;
@@ -1688,6 +1731,9 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
(!pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc && !pSelect->hasInterpFunc)) {
return TSDB_CODE_SUCCESS;
}
+ if (!pSelect->onlyHasKeepOrderFunc) {
+ pSelect->isTimeLineResult = false;
+ }
CheckAggColCoexistCxt cxt = {.pTranslateCxt = pCxt, .existCol = false};
nodesRewriteExprs(pSelect->pProjectionList, doCheckAggColCoexist, &cxt);
if (!pSelect->isDistinct) {
@@ -1753,9 +1799,8 @@ static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
}
static bool sysTableFromVnode(const char* pTable) {
- return (0 == strcmp(pTable, TSDB_INS_TABLE_USER_TABLES)) ||
- (0 == strcmp(pTable, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED) ||
- (0 == strcmp(pTable, TSDB_INS_TABLE_USER_TAGS)));
+ return (0 == strcmp(pTable, TSDB_INS_TABLE_TABLES)) ||
+ (0 == strcmp(pTable, TSDB_INS_TABLE_TABLE_DISTRIBUTED) || (0 == strcmp(pTable, TSDB_INS_TABLE_TAGS)));
}
static bool sysTableFromDnode(const char* pTable) { return 0 == strcmp(pTable, TSDB_INS_TABLE_DNODE_VARIABLES); }
@@ -1771,7 +1816,7 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
code = getDBVgInfoImpl(pCxt, pName, &vgroupList);
}
- if (TSDB_CODE_SUCCESS == code && 0 == strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES)) {
+ if (TSDB_CODE_SUCCESS == code && 0 == strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_TABLES)) {
code = addMnodeToVgroupList(&pCxt->pParseCxt->mgmtEpSet, &vgroupList);
}
@@ -1859,9 +1904,9 @@ static bool joinTableIsSingleTable(SJoinTableNode* pJoinTable) {
static bool isSingleTable(SRealTableNode* pRealTable) {
int8_t tableType = pRealTable->pMeta->tableType;
if (TSDB_SYSTEM_TABLE == tableType) {
- return 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLES) &&
- 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED) &&
- 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_USER_TAGS);
+ return 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_TABLES) &&
+ 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_TABLE_DISTRIBUTED) &&
+ 0 != strcmp(pRealTable->table.tableName, TSDB_INS_TABLE_TAGS);
}
return (TSDB_CHILD_TABLE == tableType || TSDB_NORMAL_TABLE == tableType);
}
@@ -2185,9 +2230,9 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
pCxt->currClause = SQL_CLAUSE_ORDER_BY;
code = translateExprList(pCxt, pSelect->pOrderByList);
- if (TSDB_CODE_SUCCESS == code) {
- code = checkExprListForGroupBy(pCxt, pSelect, pSelect->pOrderByList);
- }
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = checkExprListForGroupBy(pCxt, pSelect, pSelect->pOrderByList);
}
return code;
}
@@ -2268,15 +2313,15 @@ static int32_t translateHaving(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
static int32_t translateGroupBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
- if (NULL != pSelect->pGroupByList && NULL != pSelect->pWindow) {
+ if (NULL == pSelect->pGroupByList) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (NULL != pSelect->pWindow) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUPBY_WINDOW_COEXIST);
}
- if (NULL != pSelect->pGroupByList) {
- pCxt->currClause = SQL_CLAUSE_GROUP_BY;
- pSelect->isTimeLineResult = false;
- return translateExprList(pCxt, pSelect->pGroupByList);
- }
- return TSDB_CODE_SUCCESS;
+ pCxt->currClause = SQL_CLAUSE_GROUP_BY;
+ pSelect->isTimeLineResult = false;
+ return translateExprList(pCxt, pSelect->pGroupByList);
}
static int32_t getTimeRange(SNode** pPrimaryKeyCond, STimeWindow* pTimeRange, bool* pIsStrict) {
@@ -2499,6 +2544,7 @@ static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (NULL == pSelect->pWindow) {
return TSDB_CODE_SUCCESS;
}
+ pSelect->isTimeLineResult = true;
pCxt->currClause = SQL_CLAUSE_WINDOW;
int32_t code = translateExpr(pCxt, &pSelect->pWindow);
if (TSDB_CODE_SUCCESS == code) {
@@ -2521,7 +2567,7 @@ static int32_t createDefaultFillNode(STranslateContext* pCxt, SNode** pOutput) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- strcpy(pCol->colName, PK_TS_COL_INTERNAL_NAME);
+ strcpy(pCol->colName, ROWTS_PSEUDO_COLUMN_NAME);
pFill->pWStartTs = (SNode*)pCol;
*pOutput = (SNode*)pFill;
@@ -2565,12 +2611,13 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
return code;
}
-static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartitionByList) {
- if (NULL == pPartitionByList) {
+static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ if (NULL == pSelect->pPartitionByList) {
return TSDB_CODE_SUCCESS;
}
+ pSelect->isTimeLineResult = false;
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
- return translateExprList(pCxt, pPartitionByList);
+ return translateExprList(pCxt, pSelect->pPartitionByList);
}
static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) {
@@ -2606,7 +2653,7 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
return TSDB_CODE_OUT_OF_MEMORY;
}
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- strcpy(pCol->colName, PK_TS_COL_INTERNAL_NAME);
+ strcpy(pCol->colName, ROWTS_PSEUDO_COLUMN_NAME);
bool found = false;
int32_t code = findAndSetColumn(pCxt, &pCol, pTable, &found);
if (TSDB_CODE_SUCCESS != code || !found) {
@@ -2644,27 +2691,6 @@ static int32_t appendTsForImplicitTsFunc(STranslateContext* pCxt, SSelectStmt* p
return pCxt->errCode;
}
-typedef struct SRwriteUniqueCxt {
- STranslateContext* pTranslateCxt;
- SNode* pExpr;
-} SRwriteUniqueCxt;
-
-static EDealRes rewriteSeletcValueFunc(STranslateContext* pCxt, SNode** pNode) {
- SFunctionNode* pFirst = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
- if (NULL == pFirst) {
- pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
- return DEAL_RES_ERROR;
- }
- strcpy(pFirst->functionName, "first");
- TSWAP(pFirst->pParameterList, ((SFunctionNode*)*pNode)->pParameterList);
- strcpy(pFirst->node.aliasName, ((SExprNode*)*pNode)->aliasName);
- nodesDestroyNode(*pNode);
- *pNode = (SNode*)pFirst;
- pCxt->errCode = fmGetFuncInfo(pFirst, pCxt->msgBuf.buf, pCxt->msgBuf.len);
- ((SSelectStmt*)pCxt->pCurrStmt)->hasAggFuncs = true;
- return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR;
-}
-
typedef struct SReplaceOrderByAliasCxt {
STranslateContext* pTranslateCxt;
SNodeList* pProjectionList;
@@ -2694,11 +2720,36 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) {
}
static int32_t replaceOrderByAlias(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pOrderByList) {
+ if (NULL == pOrderByList) {
+ return TSDB_CODE_SUCCESS;
+ }
SReplaceOrderByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pProjectionList};
nodesRewriteExprsPostOrder(pOrderByList, replaceOrderByAliasImpl, &cxt);
return pCxt->errCode;
}
+static void resetResultTimeline(SSelectStmt* pSelect) {
+ if (NULL == pSelect->pOrderByList) {
+ return;
+ }
+ SNode* pOrder = ((SOrderByExprNode*)nodesListGetNode(pSelect->pOrderByList, 0))->pExpr;
+ if ((QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
+ isPrimaryKey((STempTableNode*)pSelect->pFromTable, pOrder)) ||
+ (QUERY_NODE_TEMP_TABLE != nodeType(pSelect->pFromTable) && isPrimaryKeyImpl(pOrder))) {
+ pSelect->isTimeLineResult = true;
+ } else {
+ pSelect->isTimeLineResult = false;
+ }
+}
+
+static int32_t replaceOrderByAliasForSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ int32_t code = replaceOrderByAlias(pCxt, pSelect->pProjectionList, pSelect->pOrderByList);
+ if (TSDB_CODE_SUCCESS == pCxt->errCode) {
+ resetResultTimeline(pSelect);
+ }
+ return code;
+}
+
static int32_t translateSelectWithoutFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->pCurrStmt = (SNode*)pSelect;
pCxt->currClause = SQL_CLAUSE_SELECT;
@@ -2713,7 +2764,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
code = translateWhere(pCxt, pSelect);
}
if (TSDB_CODE_SUCCESS == code) {
- code = translatePartitionBy(pCxt, pSelect->pPartitionByList);
+ code = translatePartitionBy(pCxt, pSelect);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateWindow(pCxt, pSelect);
@@ -2746,7 +2797,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
code = appendTsForImplicitTsFunc(pCxt, pSelect);
}
if (TSDB_CODE_SUCCESS == code) {
- code = replaceOrderByAlias(pCxt, pSelect->pProjectionList, pSelect->pOrderByList);
+ code = replaceOrderByAliasForSelect(pCxt, pSelect);
}
return code;
}
@@ -3729,6 +3780,11 @@ static int32_t checkTableWatermarkOption(STranslateContext* pCxt, STableOptions*
}
static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt, bool createStable) {
+ if (NULL != strchr(pStmt->tableName, '.')) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME,
+ "The table name cannot contain '.'");
+ }
+
SDbCfgInfo dbCfg = {0};
int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg);
if (TSDB_CODE_SUCCESS == code && !createStable && NULL != dbCfg.pRetensions) {
@@ -3823,7 +3879,7 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
return TSDB_CODE_OUT_OF_MEMORY;
}
((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
- strcpy(((SColumnNode*)pInterval->pCol)->colName, PK_TS_COL_INTERNAL_NAME);
+ strcpy(((SColumnNode*)pInterval->pCol)->colName, ROWTS_PSEUDO_COLUMN_NAME);
pCxt->createStream = true;
int32_t code = translateQuery(pCxt, (SNode*)pSelect);
@@ -4306,9 +4362,10 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt
return buildCmdMsg(pCxt, TDMT_MND_CONFIG_DNODE, (FSerializeFunc)tSerializeSMCfgDnodeReq, &cfgReq);
}
-static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, char* pTableName, int32_t* pVgId) {
+static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, const char* pDbName, const char* pTableName,
+ int32_t* pVgId) {
SVgroupInfo vg = {0};
- int32_t code = getTableHashVgroup(pCxt, pCxt->pParseCxt->db, pTableName, &vg);
+ int32_t code = getTableHashVgroup(pCxt, pDbName, pTableName, &vg);
if (TSDB_CODE_SUCCESS == code) {
*pVgId = vg.vgId;
}
@@ -4325,7 +4382,7 @@ static int32_t getSmaIndexSql(STranslateContext* pCxt, char** pSql, int32_t* pLe
}
static int32_t buildSampleAstInfoByIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SSampleAstInfo* pInfo) {
- pInfo->pDbName = pCxt->pParseCxt->db;
+ pInfo->pDbName = pStmt->dbName;
pInfo->pTableName = pStmt->tableName;
pInfo->pFuncs = nodesCloneList(pStmt->pOptions->pFuncs);
pInfo->pInterval = nodesCloneNode(pStmt->pOptions->pInterval);
@@ -4352,7 +4409,7 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt,
static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) {
SName name;
- tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), pReq->name);
+ tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->indexDbName, pStmt->indexName, &name), pReq->name);
memset(&name, 0, sizeof(SName));
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb);
pReq->igExists = pStmt->ignoreExists;
@@ -4376,7 +4433,7 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
}
}
- int32_t code = getSmaIndexDstVgId(pCxt, pStmt->tableName, &pReq->dstVgId);
+ int32_t code = getSmaIndexDstVgId(pCxt, pStmt->dbName, pStmt->tableName, &pReq->dstVgId);
if (TSDB_CODE_SUCCESS == code) {
code = getSmaIndexSql(pCxt, &pReq->sql, &pReq->sqlLen);
}
@@ -4389,7 +4446,7 @@ static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStm
static int32_t checkCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
SDbCfgInfo dbCfg = {0};
- int32_t code = getDBCfg(pCxt, pCxt->pParseCxt->db, &dbCfg);
+ int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg);
if (TSDB_CODE_SUCCESS == code && NULL != dbCfg.pRetensions) {
code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_SMA_INDEX,
"Tables configured with the 'ROLLUP' option do not support creating sma index");
@@ -4907,10 +4964,17 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
}
static int32_t translateShowCreateTable(STranslateContext* pCxt, SShowCreateTableStmt* pStmt) {
- SName name;
- toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
-
- return getTableCfg(pCxt, &name, (STableCfg**)&pStmt->pCfg);
+ pStmt->pDbCfg = taosMemoryCalloc(1, sizeof(SDbCfgInfo));
+ if (NULL == pStmt->pDbCfg) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ int32_t code = getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pDbCfg);
+ if (TSDB_CODE_SUCCESS == code) {
+ SName name;
+ toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
+ code = getTableCfg(pCxt, &name, (STableCfg**)&pStmt->pTableCfg);
+ }
+ return code;
}
static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
@@ -5268,15 +5332,15 @@ static const char* getSysDbName(ENodeType type) {
static const char* getSysTableName(ENodeType type) {
switch (type) {
case QUERY_NODE_SHOW_DATABASES_STMT:
- return TSDB_INS_TABLE_USER_DATABASES;
+ return TSDB_INS_TABLE_DATABASES;
case QUERY_NODE_SHOW_TABLES_STMT:
- return TSDB_INS_TABLE_USER_TABLES;
+ return TSDB_INS_TABLE_TABLES;
case QUERY_NODE_SHOW_TAGS_STMT:
- return TSDB_INS_TABLE_USER_TAGS;
+ return TSDB_INS_TABLE_TAGS;
case QUERY_NODE_SHOW_STABLES_STMT:
- return TSDB_INS_TABLE_USER_STABLES;
+ return TSDB_INS_TABLE_STABLES;
case QUERY_NODE_SHOW_USERS_STMT:
- return TSDB_INS_TABLE_USER_USERS;
+ return TSDB_INS_TABLE_USERS;
case QUERY_NODE_SHOW_DNODES_STMT:
return TSDB_INS_TABLE_DNODES;
case QUERY_NODE_SHOW_VGROUPS_STMT:
@@ -5288,9 +5352,9 @@ static const char* getSysTableName(ENodeType type) {
case QUERY_NODE_SHOW_QNODES_STMT:
return TSDB_INS_TABLE_QNODES;
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
- return TSDB_INS_TABLE_USER_FUNCTIONS;
+ return TSDB_INS_TABLE_FUNCTIONS;
case QUERY_NODE_SHOW_INDEXES_STMT:
- return TSDB_INS_TABLE_USER_INDEXES;
+ return TSDB_INS_TABLE_INDEXES;
case QUERY_NODE_SHOW_STREAMS_STMT:
return TSDB_PERFS_TABLE_STREAMS;
case QUERY_NODE_SHOW_BNODES_STMT:
@@ -5782,11 +5846,16 @@ static int32_t createTagValFromExpr(STranslateContext* pCxt, SDataType targetDt,
}
static int32_t createTagValFromVal(STranslateContext* pCxt, SDataType targetDt, SNode* pNode, SValueNode** pVal) {
- *pVal = (SValueNode*)nodesCloneNode(pNode);
- if (NULL == *pVal) {
+ SValueNode* pTempVal = (SValueNode*)nodesCloneNode(pNode);
+ if (NULL == pTempVal) {
return TSDB_CODE_OUT_OF_MEMORY;
}
- return DEAL_RES_ERROR == translateValueImpl(pCxt, *pVal, targetDt, true) ? pCxt->errCode : TSDB_CODE_SUCCESS;
+ if (DEAL_RES_ERROR == translateValueImpl(pCxt, pTempVal, targetDt, true)) {
+ nodesDestroyNode((SNode*)pTempVal);
+ return pCxt->errCode;
+ }
+ *pVal = pTempVal;
+ return TSDB_CODE_SUCCESS;
}
static int32_t createTagVal(STranslateContext* pCxt, uint8_t precision, SSchema* pSchema, SNode* pNode,
@@ -5941,6 +6010,10 @@ static int32_t checkCreateSubTable(STranslateContext* pCxt, SCreateSubTableClaus
if (0 != strcmp(pStmt->dbName, pStmt->useDbName)) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR);
}
+ if (NULL != strchr(pStmt->tableName, '.')) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME,
+ "The table name cannot contain '.'");
+ }
return TSDB_CODE_SUCCESS;
}
static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableClause* pStmt, SHashObj* pVgroupHashmap) {
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 549e8d68ff..e3ebb85f68 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -104,26 +104,26 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 380
+#define YYNOCODE 379
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EOperatorType yy60;
- EFillMode yy94;
- SToken yy129;
- SDataType yy184;
- bool yy337;
- ENullOrder yy338;
- SAlterOption yy405;
- SNodeList* yy464;
- int32_t yy500;
- EJoinType yy532;
- int8_t yy543;
- int64_t yy549;
- EOrder yy658;
- SNode* yy712;
+ EOrder yy58;
+ bool yy151;
+ int8_t yy285;
+ SNodeList* yy356;
+ SToken yy361;
+ SAlterOption yy409;
+ int64_t yy457;
+ EFillMode yy494;
+ EJoinType yy504;
+ EOperatorType yy526;
+ SDataType yy600;
+ ENullOrder yy613;
+ SNode* yy616;
+ int32_t yy734;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -140,16 +140,16 @@ typedef union {
#define ParseCTX_STORE
#define YYFALLBACK 1
#define YYNSTATE 666
-#define YYNRULE 492
+#define YYNRULE 491
#define YYNTOKEN 257
#define YY_MAX_SHIFT 665
-#define YY_MIN_SHIFTREDUCE 973
-#define YY_MAX_SHIFTREDUCE 1464
-#define YY_ERROR_ACTION 1465
-#define YY_ACCEPT_ACTION 1466
-#define YY_NO_ACTION 1467
-#define YY_MIN_REDUCE 1468
-#define YY_MAX_REDUCE 1959
+#define YY_MIN_SHIFTREDUCE 972
+#define YY_MAX_SHIFTREDUCE 1462
+#define YY_ERROR_ACTION 1463
+#define YY_ACCEPT_ACTION 1464
+#define YY_NO_ACTION 1465
+#define YY_MIN_REDUCE 1466
+#define YY_MAX_REDUCE 1956
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -216,664 +216,676 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2395)
+#define YY_ACTTAB_COUNT (2458)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 433, 1937, 434, 1503, 1654, 1655, 1599, 326, 441, 548,
- /* 10 */ 434, 1503, 39, 37, 1936, 144, 1709, 1776, 1934, 1937,
- /* 20 */ 339, 1469, 1264, 513, 1610, 40, 38, 36, 35, 34,
- /* 30 */ 1793, 325, 164, 1341, 1706, 1262, 1934, 125, 1290, 1023,
- /* 40 */ 1006, 1022, 105, 1772, 1778, 104, 103, 102, 101, 100,
- /* 50 */ 99, 98, 97, 96, 157, 570, 1336, 73, 1811, 344,
- /* 60 */ 148, 14, 1653, 1655, 1568, 89, 577, 1647, 1270, 1024,
- /* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 123, 122, 1604,
- /* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 146, 1,
- /* 90 */ 1480, 550, 159, 1879, 1880, 1341, 1884, 1262, 1825, 551,
- /* 100 */ 1024, 64, 92, 1794, 579, 1796, 1797, 575, 1660, 570,
- /* 110 */ 1291, 662, 1871, 1408, 1937, 312, 306, 1867, 1336, 1289,
- /* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 105,
- /* 130 */ 1270, 1934, 104, 103, 102, 101, 100, 99, 98, 97,
- /* 140 */ 96, 165, 450, 1161, 1162, 1934, 639, 638, 637, 636,
- /* 150 */ 349, 2, 635, 634, 126, 629, 628, 627, 626, 625,
- /* 160 */ 624, 623, 137, 619, 618, 617, 348, 347, 614, 613,
- /* 170 */ 1265, 316, 1263, 662, 1491, 33, 32, 1466, 1937, 40,
- /* 180 */ 38, 36, 35, 34, 30, 261, 63, 1343, 1344, 432,
- /* 190 */ 1290, 164, 436, 1268, 1269, 1934, 1318, 1319, 1321, 1322,
- /* 200 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338,
- /* 210 */ 1339, 1340, 1342, 1345, 1468, 1762, 33, 32, 612, 551,
- /* 220 */ 40, 38, 36, 35, 34, 1289, 317, 166, 315, 314,
- /* 230 */ 610, 473, 1265, 210, 1263, 475, 1425, 354, 114, 113,
- /* 240 */ 112, 111, 110, 109, 108, 107, 106, 253, 384, 135,
- /* 250 */ 134, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319,
- /* 260 */ 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335,
- /* 270 */ 1337, 1338, 1339, 1340, 1342, 1345, 39, 37, 1937, 534,
- /* 280 */ 1423, 1424, 1426, 1427, 339, 303, 1264, 378, 43, 75,
- /* 290 */ 305, 163, 222, 515, 1793, 1934, 1320, 1341, 1435, 1262,
- /* 300 */ 1119, 601, 600, 599, 1123, 598, 1125, 1126, 597, 1128,
- /* 310 */ 594, 487, 1134, 591, 1136, 1137, 588, 585, 440, 1811,
- /* 320 */ 1336, 436, 1811, 537, 166, 14, 497, 541, 1937, 1461,
- /* 330 */ 577, 1699, 1270, 551, 377, 1762, 376, 576, 39, 37,
- /* 340 */ 209, 163, 171, 63, 548, 1934, 339, 49, 1264, 525,
- /* 350 */ 665, 1244, 1245, 2, 490, 1490, 223, 224, 484, 1341,
- /* 360 */ 55, 1262, 1825, 208, 268, 540, 94, 1794, 579, 1796,
- /* 370 */ 1797, 575, 125, 570, 1289, 662, 1871, 1608, 155, 144,
- /* 380 */ 1870, 1867, 1336, 655, 651, 647, 643, 266, 1611, 1343,
- /* 390 */ 1344, 1270, 166, 1264, 1270, 58, 1762, 217, 57, 1489,
- /* 400 */ 543, 538, 42, 39, 37, 1346, 1262, 1780, 496, 1488,
- /* 410 */ 548, 339, 123, 1264, 305, 8, 1460, 515, 1776, 90,
- /* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 160, 1879, 1880,
- /* 430 */ 63, 1884, 77, 120, 1265, 1351, 1263, 662, 125, 1270,
- /* 440 */ 1762, 1289, 1603, 63, 1772, 1778, 328, 1336, 479, 478,
- /* 450 */ 1762, 1343, 1344, 11, 10, 522, 570, 1268, 1269, 1270,
- /* 460 */ 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568,
- /* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 123, 216,
- /* 480 */ 9, 166, 662, 482, 481, 166, 172, 219, 1586, 196,
- /* 490 */ 121, 633, 631, 161, 1879, 1880, 1265, 1884, 1263, 1660,
- /* 500 */ 477, 480, 662, 150, 61, 1236, 327, 212, 467, 463,
- /* 510 */ 459, 455, 195, 1585, 76, 1658, 1343, 1344, 71, 1268,
- /* 520 */ 1269, 70, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326,
- /* 530 */ 572, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345,
- /* 540 */ 166, 1265, 1377, 1263, 74, 1583, 1288, 193, 450, 82,
- /* 550 */ 33, 32, 342, 166, 40, 38, 36, 35, 34, 1533,
- /* 560 */ 144, 1265, 1584, 1263, 1268, 1269, 621, 512, 166, 1610,
- /* 570 */ 1601, 1699, 33, 32, 1010, 1011, 40, 38, 36, 35,
- /* 580 */ 34, 166, 174, 604, 1268, 1269, 1081, 1318, 1319, 1321,
- /* 590 */ 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337,
- /* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 192,
- /* 610 */ 185, 1793, 190, 339, 610, 1264, 446, 1597, 1320, 1083,
- /* 620 */ 513, 163, 612, 482, 481, 1934, 1341, 525, 1262, 1593,
- /* 630 */ 121, 1707, 183, 135, 134, 607, 606, 605, 115, 1811,
- /* 640 */ 477, 480, 7, 345, 548, 471, 610, 577, 1487, 1336,
- /* 650 */ 438, 144, 1762, 525, 576, 1608, 1287, 1595, 419, 352,
- /* 660 */ 1610, 1270, 351, 1365, 168, 135, 134, 607, 606, 605,
- /* 670 */ 33, 32, 125, 1486, 40, 38, 36, 35, 34, 1825,
- /* 680 */ 1485, 1608, 9, 280, 1794, 579, 1796, 1797, 575, 1762,
- /* 690 */ 570, 33, 32, 553, 505, 40, 38, 36, 35, 34,
- /* 700 */ 1937, 33, 32, 1937, 662, 40, 38, 36, 35, 34,
- /* 710 */ 176, 175, 123, 163, 1762, 498, 163, 1934, 1343, 1344,
- /* 720 */ 1934, 1762, 1705, 307, 300, 27, 1484, 251, 1879, 547,
- /* 730 */ 525, 546, 39, 37, 1937, 1370, 1483, 302, 1886, 1287,
- /* 740 */ 339, 115, 1264, 525, 307, 555, 412, 165, 476, 424,
- /* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 213, 1608, 373,
- /* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 163,
- /* 770 */ 399, 1608, 1482, 1934, 1479, 1292, 1336, 1762, 375, 371,
- /* 780 */ 1704, 1363, 300, 1415, 1478, 1882, 1268, 1269, 1270, 1318,
- /* 790 */ 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334,
- /* 800 */ 1335, 1337, 1338, 1339, 1340, 1342, 1345, 390, 1477, 2,
- /* 810 */ 26, 1660, 657, 1762, 1364, 1762, 33, 32, 343, 386,
- /* 820 */ 40, 38, 36, 35, 34, 1762, 28, 1658, 1660, 1397,
- /* 830 */ 1476, 662, 33, 32, 1475, 1364, 40, 38, 36, 35,
- /* 840 */ 34, 622, 1289, 1580, 1659, 1343, 1344, 423, 1474, 1762,
+ /* 0 */ 525, 30, 261, 525, 548, 433, 525, 434, 1501, 11,
+ /* 10 */ 10, 117, 39, 37, 55, 1652, 1653, 117, 471, 378,
+ /* 20 */ 339, 1467, 1263, 1005, 476, 1022, 551, 1021, 1606, 1790,
+ /* 30 */ 1597, 1606, 127, 1339, 1606, 1261, 441, 74, 434, 1501,
+ /* 40 */ 469, 1774, 107, 1778, 1289, 106, 105, 104, 103, 102,
+ /* 50 */ 101, 100, 99, 98, 1774, 1023, 1334, 1808, 150, 1602,
+ /* 60 */ 1934, 14, 1566, 1009, 1010, 552, 1770, 1776, 1269, 450,
+ /* 70 */ 1760, 125, 576, 165, 39, 37, 1402, 1931, 570, 1770,
+ /* 80 */ 1776, 328, 339, 1528, 1263, 550, 161, 1876, 1877, 1,
+ /* 90 */ 1881, 570, 1658, 63, 1288, 1339, 1822, 1261, 1375, 327,
+ /* 100 */ 95, 1791, 579, 1793, 1794, 575, 496, 570, 1656, 344,
+ /* 110 */ 1868, 662, 1651, 1653, 330, 1864, 160, 513, 1334, 494,
+ /* 120 */ 146, 492, 551, 14, 325, 1341, 1342, 1704, 164, 1609,
+ /* 130 */ 1269, 40, 38, 36, 35, 34, 1894, 33, 32, 479,
+ /* 140 */ 478, 40, 38, 36, 35, 34, 639, 638, 637, 636,
+ /* 150 */ 349, 2, 635, 634, 128, 629, 628, 627, 626, 625,
+ /* 160 */ 624, 623, 139, 619, 618, 617, 348, 347, 614, 613,
+ /* 170 */ 1264, 107, 1262, 662, 106, 105, 104, 103, 102, 101,
+ /* 180 */ 100, 99, 98, 174, 1808, 49, 1080, 1341, 1342, 224,
+ /* 190 */ 225, 42, 541, 1267, 1268, 218, 1316, 1317, 1319, 1320,
+ /* 200 */ 1321, 1322, 1323, 1324, 572, 568, 1332, 1333, 1335, 1336,
+ /* 210 */ 1337, 1338, 1340, 1343, 1466, 71, 33, 32, 70, 1082,
+ /* 220 */ 40, 38, 36, 35, 34, 1289, 525, 168, 63, 540,
+ /* 230 */ 78, 168, 1264, 373, 1262, 1263, 84, 170, 116, 115,
+ /* 240 */ 114, 113, 112, 111, 110, 109, 108, 305, 1261, 1583,
+ /* 250 */ 515, 548, 375, 371, 1606, 1267, 1268, 1599, 1316, 1317,
+ /* 260 */ 1319, 1320, 1321, 1322, 1323, 1324, 572, 568, 1332, 1333,
+ /* 270 */ 1335, 1336, 1337, 1338, 1340, 1343, 39, 37, 542, 127,
+ /* 280 */ 64, 1269, 551, 1290, 339, 1363, 1263, 1288, 33, 32,
+ /* 290 */ 384, 1459, 40, 38, 36, 35, 34, 1339, 1433, 1261,
+ /* 300 */ 1118, 601, 600, 599, 1122, 598, 1124, 1125, 597, 1127,
+ /* 310 */ 594, 487, 1133, 591, 1135, 1136, 588, 585, 125, 1022,
+ /* 320 */ 1334, 1021, 610, 168, 662, 14, 497, 303, 1287, 168,
+ /* 330 */ 1160, 1161, 1269, 162, 1876, 1877, 211, 1881, 39, 37,
+ /* 340 */ 210, 137, 136, 607, 606, 605, 339, 27, 1263, 1023,
+ /* 350 */ 610, 43, 432, 2, 490, 436, 63, 1368, 484, 1339,
+ /* 360 */ 1658, 1261, 1707, 209, 1934, 63, 168, 312, 1531, 137,
+ /* 370 */ 136, 607, 606, 605, 612, 662, 1656, 1933, 1458, 61,
+ /* 380 */ 1778, 1931, 1334, 1264, 148, 1262, 1478, 74, 159, 1341,
+ /* 390 */ 1342, 1774, 76, 305, 1269, 58, 515, 1934, 57, 1269,
+ /* 400 */ 122, 1645, 1489, 39, 37, 1344, 1267, 1268, 1934, 1601,
+ /* 410 */ 166, 339, 1790, 1263, 1931, 8, 1770, 1776, 334, 604,
+ /* 420 */ 253, 1932, 223, 537, 1339, 1931, 1261, 326, 570, 1934,
+ /* 430 */ 633, 631, 482, 481, 1264, 146, 1262, 662, 440, 123,
+ /* 440 */ 1808, 436, 166, 1760, 1608, 1291, 1931, 1334, 574, 477,
+ /* 450 */ 480, 1341, 1342, 1760, 1488, 576, 1487, 1267, 1268, 1269,
+ /* 460 */ 1316, 1317, 1319, 1320, 1321, 1322, 1323, 1324, 572, 568,
+ /* 470 */ 1332, 1333, 1335, 1336, 1337, 1338, 1340, 1343, 621, 1822,
+ /* 480 */ 9, 1243, 1244, 294, 1791, 579, 1793, 1794, 575, 573,
+ /* 490 */ 570, 567, 1840, 548, 168, 1760, 1264, 1760, 1262, 1658,
+ /* 500 */ 543, 538, 662, 168, 1584, 33, 32, 1582, 438, 40,
+ /* 510 */ 38, 36, 35, 34, 1286, 1657, 1341, 1342, 1595, 1267,
+ /* 520 */ 1268, 127, 1316, 1317, 1319, 1320, 1321, 1322, 1323, 1324,
+ /* 530 */ 572, 568, 1332, 1333, 1335, 1336, 1337, 1338, 1340, 1343,
+ /* 540 */ 22, 33, 32, 1591, 26, 40, 38, 36, 35, 34,
+ /* 550 */ 33, 32, 475, 168, 40, 38, 36, 35, 34, 28,
+ /* 560 */ 125, 1264, 1406, 1262, 450, 33, 32, 612, 1288, 40,
+ /* 570 */ 38, 36, 35, 34, 474, 163, 1876, 1877, 1703, 1881,
+ /* 580 */ 300, 1790, 233, 1593, 1267, 1268, 316, 1316, 1317, 1319,
+ /* 590 */ 1320, 1321, 1322, 1323, 1324, 572, 568, 1332, 1333, 1335,
+ /* 600 */ 1336, 1337, 1338, 1340, 1343, 39, 37, 1581, 505, 1808,
+ /* 610 */ 342, 419, 1507, 339, 525, 1263, 1589, 552, 146, 525,
+ /* 620 */ 555, 1464, 1760, 1413, 576, 382, 1339, 1608, 1261, 63,
+ /* 630 */ 383, 33, 32, 214, 1883, 40, 38, 36, 35, 34,
+ /* 640 */ 1423, 317, 1606, 315, 314, 1349, 473, 1606, 1822, 1334,
+ /* 650 */ 475, 1288, 95, 1791, 579, 1793, 1794, 575, 1880, 570,
+ /* 660 */ 657, 1269, 1868, 178, 177, 1486, 330, 1864, 160, 571,
+ /* 670 */ 33, 32, 474, 345, 40, 38, 36, 35, 34, 665,
+ /* 680 */ 354, 146, 9, 534, 1421, 1422, 1424, 1425, 1895, 603,
+ /* 690 */ 1608, 33, 32, 268, 525, 40, 38, 36, 35, 34,
+ /* 700 */ 36, 35, 34, 1479, 662, 389, 1760, 157, 610, 377,
+ /* 710 */ 1658, 376, 655, 651, 647, 643, 266, 343, 1341, 1342,
+ /* 720 */ 256, 1934, 1606, 307, 535, 1779, 1656, 137, 136, 607,
+ /* 730 */ 606, 605, 39, 37, 165, 1883, 1774, 302, 1931, 1286,
+ /* 740 */ 339, 1485, 1263, 525, 307, 1318, 412, 608, 92, 424,
+ /* 750 */ 1649, 231, 1301, 1339, 404, 1261, 7, 482, 481, 1879,
+ /* 760 */ 1361, 1770, 1776, 1264, 123, 1262, 397, 168, 425, 512,
+ /* 770 */ 399, 1606, 352, 570, 477, 480, 1334, 1484, 1399, 351,
+ /* 780 */ 145, 1361, 1760, 1483, 522, 1288, 1267, 1268, 1269, 1316,
+ /* 790 */ 1317, 1319, 1320, 1321, 1322, 1323, 1324, 572, 568, 1332,
+ /* 800 */ 1333, 1335, 1336, 1337, 1338, 1340, 1343, 390, 91, 2,
+ /* 810 */ 1934, 525, 1567, 1934, 1362, 513, 220, 1883, 1760, 386,
+ /* 820 */ 1934, 124, 405, 165, 1760, 1705, 165, 1931, 1318, 1598,
+ /* 830 */ 1931, 662, 1482, 165, 1235, 1362, 213, 1931, 1702, 1606,
+ /* 840 */ 300, 1878, 622, 499, 1578, 1341, 1342, 423, 1481, 468,
/* 850 */ 418, 417, 416, 415, 414, 411, 410, 409, 408, 407,
- /* 860 */ 403, 402, 401, 400, 394, 393, 392, 391, 1473, 388,
- /* 870 */ 387, 1762, 475, 1401, 1472, 1762, 29, 337, 1358, 1359,
- /* 880 */ 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1886, 608, 1762,
- /* 890 */ 1265, 1651, 1263, 609, 474, 571, 1651, 29, 337, 1358,
- /* 900 */ 1359, 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1471, 1762,
- /* 910 */ 1793, 1881, 233, 1268, 1269, 1762, 1318, 1319, 1321, 1322,
- /* 920 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338,
- /* 930 */ 1339, 1340, 1342, 1345, 525, 145, 525, 525, 1811, 1273,
- /* 940 */ 279, 525, 1891, 1397, 548, 383, 577, 389, 404, 1762,
- /* 950 */ 603, 1762, 405, 576, 277, 60, 273, 133, 59, 1638,
- /* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 201, 1608,
- /* 970 */ 525, 199, 125, 1520, 179, 429, 427, 1780, 1825, 1515,
- /* 980 */ 560, 449, 92, 1794, 579, 1796, 1797, 575, 1776, 570,
- /* 990 */ 566, 203, 1871, 553, 202, 483, 306, 1867, 1608, 336,
- /* 1000 */ 335, 485, 525, 41, 54, 557, 63, 221, 1937, 1278,
- /* 1010 */ 361, 1513, 123, 1605, 1772, 1778, 334, 53, 509, 1320,
- /* 1020 */ 1341, 163, 1271, 11, 10, 1934, 570, 251, 1879, 547,
- /* 1030 */ 1608, 546, 256, 488, 1937, 525, 205, 1781, 207, 204,
- /* 1040 */ 129, 206, 1793, 1336, 91, 132, 1737, 163, 1776, 51,
- /* 1050 */ 1213, 1934, 33, 32, 225, 1270, 40, 38, 36, 35,
- /* 1060 */ 34, 33, 32, 1608, 133, 40, 38, 36, 35, 34,
- /* 1070 */ 1811, 525, 1463, 1464, 1772, 1778, 1276, 1569, 552, 68,
- /* 1080 */ 67, 381, 506, 1762, 170, 576, 570, 518, 468, 1783,
- /* 1090 */ 615, 535, 230, 1272, 88, 245, 1371, 1400, 565, 1608,
- /* 1100 */ 301, 499, 51, 369, 85, 367, 363, 359, 356, 353,
- /* 1110 */ 1825, 1112, 1069, 237, 93, 1794, 579, 1796, 1797, 575,
- /* 1120 */ 525, 570, 1355, 525, 1871, 525, 525, 525, 330, 1867,
- /* 1130 */ 158, 510, 1785, 1050, 227, 525, 523, 524, 262, 616,
- /* 1140 */ 41, 1793, 162, 1303, 166, 350, 346, 1504, 1608, 1422,
- /* 1150 */ 1897, 1608, 41, 1608, 1608, 1608, 1812, 1279, 583, 1274,
- /* 1160 */ 240, 1067, 1648, 1608, 1901, 132, 1051, 549, 255, 1811,
- /* 1170 */ 250, 258, 3, 260, 133, 117, 355, 552, 132, 5,
- /* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 360, 1327, 313, 269,
- /* 1190 */ 173, 1229, 568, 1334, 1335, 1337, 1338, 1339, 1340, 272,
- /* 1200 */ 385, 143, 1287, 406, 1701, 1140, 421, 413, 558, 1825,
- /* 1210 */ 426, 1811, 1144, 93, 1794, 579, 1796, 1797, 575, 577,
- /* 1220 */ 570, 1151, 1149, 1871, 1762, 136, 576, 330, 1867, 158,
- /* 1230 */ 1275, 420, 422, 428, 430, 1293, 1793, 431, 1296, 439,
- /* 1240 */ 182, 443, 442, 184, 444, 1295, 1297, 447, 445, 1898,
- /* 1250 */ 187, 1825, 189, 1793, 1294, 93, 1794, 579, 1796, 1797,
- /* 1260 */ 575, 448, 570, 191, 1811, 1871, 72, 451, 194, 330,
- /* 1270 */ 1867, 1950, 577, 472, 470, 304, 1598, 1762, 198, 576,
- /* 1280 */ 1905, 1811, 116, 1594, 1742, 211, 200, 500, 138, 577,
- /* 1290 */ 270, 139, 1596, 507, 1762, 1592, 576, 140, 141, 214,
- /* 1300 */ 511, 218, 322, 501, 1825, 533, 519, 1292, 93, 1794,
- /* 1310 */ 579, 1796, 1797, 575, 1609, 570, 1793, 228, 1871, 504,
- /* 1320 */ 130, 1825, 330, 1867, 1950, 93, 1794, 579, 1796, 1797,
- /* 1330 */ 575, 514, 570, 1928, 1741, 1871, 1711, 516, 131, 330,
- /* 1340 */ 1867, 1950, 324, 521, 1811, 271, 81, 520, 1902, 529,
- /* 1350 */ 1890, 235, 577, 536, 239, 6, 1912, 1762, 531, 576,
- /* 1360 */ 545, 532, 530, 329, 539, 1911, 1793, 528, 527, 1397,
- /* 1370 */ 124, 249, 1291, 553, 562, 559, 1793, 48, 331, 1887,
- /* 1380 */ 83, 581, 1652, 246, 1825, 248, 1893, 265, 286, 1794,
- /* 1390 */ 579, 1796, 1797, 575, 1811, 570, 658, 274, 1581, 659,
- /* 1400 */ 247, 1933, 577, 661, 1811, 52, 244, 1762, 151, 576,
- /* 1410 */ 152, 1852, 577, 276, 1937, 287, 297, 1762, 1793, 576,
- /* 1420 */ 278, 1756, 296, 553, 254, 1755, 556, 165, 257, 1953,
- /* 1430 */ 65, 1934, 1754, 1753, 1825, 66, 1750, 259, 286, 1794,
- /* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 563, 94, 1794,
- /* 1450 */ 579, 1796, 1797, 575, 574, 570, 358, 357, 1871, 1762,
- /* 1460 */ 362, 576, 564, 1867, 1937, 1256, 1257, 1748, 1747, 169,
- /* 1470 */ 364, 366, 1793, 365, 1746, 370, 368, 163, 1745, 372,
- /* 1480 */ 1744, 1934, 374, 1232, 1793, 1231, 1825, 1722, 1721, 380,
- /* 1490 */ 294, 1794, 579, 1796, 1797, 575, 573, 570, 567, 1843,
- /* 1500 */ 1811, 379, 1720, 1719, 1201, 1694, 127, 1693, 577, 1692,
- /* 1510 */ 1691, 69, 1811, 1762, 1690, 576, 1689, 1688, 1687, 1686,
- /* 1520 */ 577, 395, 1685, 398, 396, 1762, 1684, 576, 1683, 1682,
- /* 1530 */ 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672,
- /* 1540 */ 1825, 1793, 1671, 128, 147, 1794, 579, 1796, 1797, 575,
- /* 1550 */ 1670, 570, 1825, 180, 177, 1534, 94, 1794, 579, 1796,
- /* 1560 */ 1797, 575, 1669, 570, 1668, 1793, 1871, 1203, 1664, 1811,
- /* 1570 */ 1667, 1868, 1666, 1665, 323, 1663, 1662, 577, 1661, 1535,
- /* 1580 */ 178, 1532, 1762, 1793, 576, 1500, 118, 156, 554, 1951,
- /* 1590 */ 1499, 1013, 435, 1811, 1012, 437, 181, 119, 526, 1735,
- /* 1600 */ 1729, 577, 1718, 188, 186, 1717, 1762, 1703, 576, 1825,
- /* 1610 */ 1587, 1811, 1531, 295, 1794, 579, 1796, 1797, 575, 577,
- /* 1620 */ 570, 1043, 1529, 452, 1762, 454, 576, 1527, 456, 453,
- /* 1630 */ 457, 458, 1525, 1825, 461, 462, 460, 295, 1794, 579,
- /* 1640 */ 1796, 1797, 575, 1523, 570, 1793, 464, 466, 1512, 1511,
- /* 1650 */ 465, 1825, 1496, 1589, 1588, 290, 1794, 579, 1796, 1797,
- /* 1660 */ 575, 50, 570, 1793, 1155, 197, 1154, 630, 1080, 632,
- /* 1670 */ 1077, 1076, 1075, 1811, 1521, 1516, 1514, 318, 319, 486,
- /* 1680 */ 320, 577, 489, 1495, 1494, 1493, 1762, 495, 576, 95,
- /* 1690 */ 1734, 1811, 491, 544, 493, 1238, 1728, 56, 142, 574,
- /* 1700 */ 502, 1716, 1714, 1715, 1762, 503, 576, 1713, 215, 321,
- /* 1710 */ 508, 1712, 15, 1825, 226, 1793, 1710, 147, 1794, 579,
- /* 1720 */ 1796, 1797, 575, 1248, 570, 1702, 517, 220, 78, 80,
- /* 1730 */ 79, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797,
- /* 1740 */ 575, 85, 570, 1811, 1844, 243, 16, 229, 338, 41,
- /* 1750 */ 1783, 577, 1437, 234, 17, 238, 1762, 1793, 576, 252,
- /* 1760 */ 236, 1811, 1952, 1419, 47, 242, 340, 1421, 149, 577,
- /* 1770 */ 241, 24, 25, 46, 1762, 1449, 576, 1414, 84, 1782,
- /* 1780 */ 153, 18, 1394, 1825, 1393, 1811, 45, 295, 1794, 579,
- /* 1790 */ 1796, 1797, 575, 577, 570, 1454, 1448, 13, 1762, 1443,
- /* 1800 */ 576, 1825, 332, 1453, 1452, 295, 1794, 579, 1796, 1797,
- /* 1810 */ 575, 333, 570, 1793, 10, 1280, 19, 1828, 154, 1311,
- /* 1820 */ 569, 1356, 582, 167, 31, 1825, 1331, 1793, 12, 281,
- /* 1830 */ 1794, 579, 1796, 1797, 575, 1329, 570, 1328, 20, 21,
- /* 1840 */ 341, 1811, 580, 1141, 584, 587, 578, 1138, 586, 577,
- /* 1850 */ 1135, 589, 590, 592, 1762, 1811, 576, 595, 1118, 1133,
- /* 1860 */ 1129, 1127, 1150, 577, 593, 1132, 602, 596, 1762, 1793,
- /* 1870 */ 576, 1131, 1130, 263, 86, 87, 1146, 62, 611, 1793,
- /* 1880 */ 1072, 1825, 1041, 1071, 1070, 282, 1794, 579, 1796, 1797,
- /* 1890 */ 575, 1068, 570, 1066, 1065, 1825, 1064, 1811, 620, 289,
- /* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1087, 264,
- /* 1910 */ 1762, 1062, 576, 1061, 1060, 577, 1059, 1058, 1057, 1056,
- /* 1920 */ 1762, 1793, 576, 1084, 1082, 1047, 1053, 1528, 1052, 1049,
- /* 1930 */ 1526, 1048, 1046, 640, 641, 644, 1524, 1825, 642, 648,
- /* 1940 */ 646, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811,
- /* 1950 */ 650, 283, 1794, 579, 1796, 1797, 575, 577, 570, 645,
- /* 1960 */ 649, 1522, 1762, 652, 576, 653, 1510, 656, 654, 1003,
- /* 1970 */ 1492, 267, 660, 663, 1793, 1266, 275, 664, 1467, 1467,
- /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1825,
- /* 1990 */ 1467, 1467, 1793, 292, 1794, 579, 1796, 1797, 575, 1467,
- /* 2000 */ 570, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2010 */ 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467,
- /* 2020 */ 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467,
- /* 2030 */ 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467, 1467, 1467,
- /* 2040 */ 1467, 1467, 1825, 1467, 1793, 1467, 284, 1794, 579, 1796,
- /* 2050 */ 1797, 575, 1467, 570, 1793, 1467, 1467, 1467, 1467, 1467,
- /* 2060 */ 1825, 1467, 1467, 1467, 293, 1794, 579, 1796, 1797, 575,
- /* 2070 */ 1793, 570, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2080 */ 577, 1467, 1811, 1467, 1467, 1762, 1467, 576, 1467, 1467,
- /* 2090 */ 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1811, 1467,
- /* 2100 */ 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467, 1467, 1467,
- /* 2110 */ 1467, 1762, 1825, 576, 1467, 1467, 285, 1794, 579, 1796,
- /* 2120 */ 1797, 575, 1825, 570, 1793, 1467, 298, 1794, 579, 1796,
- /* 2130 */ 1797, 575, 1467, 570, 1467, 1467, 1467, 1467, 1825, 1467,
- /* 2140 */ 1793, 1467, 299, 1794, 579, 1796, 1797, 575, 1467, 570,
- /* 2150 */ 1793, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2160 */ 577, 1467, 1467, 1467, 1467, 1762, 1793, 576, 1811, 1467,
- /* 2170 */ 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467, 1811, 1467,
- /* 2180 */ 1467, 1762, 1467, 576, 1467, 1467, 577, 1467, 1467, 1467,
- /* 2190 */ 1467, 1762, 1825, 576, 1811, 1467, 1805, 1794, 579, 1796,
- /* 2200 */ 1797, 575, 577, 570, 1467, 1467, 1467, 1762, 1825, 576,
- /* 2210 */ 1467, 1467, 1804, 1794, 579, 1796, 1797, 575, 1825, 570,
- /* 2220 */ 1467, 1467, 1803, 1794, 579, 1796, 1797, 575, 1467, 570,
- /* 2230 */ 1467, 1467, 1467, 1467, 1825, 1793, 1467, 1467, 310, 1794,
- /* 2240 */ 579, 1796, 1797, 575, 1467, 570, 1467, 1467, 1467, 1467,
- /* 2250 */ 1467, 1467, 1467, 1793, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2260 */ 1467, 1467, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2270 */ 1467, 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467,
- /* 2280 */ 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 577,
- /* 2290 */ 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467, 1467,
- /* 2300 */ 1467, 1467, 1467, 1825, 1467, 1793, 1467, 309, 1794, 579,
- /* 2310 */ 1796, 1797, 575, 1467, 570, 1793, 1467, 1467, 1467, 1467,
- /* 2320 */ 1467, 1825, 1467, 1467, 1467, 311, 1794, 579, 1796, 1797,
- /* 2330 */ 575, 1467, 570, 1811, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2340 */ 1467, 577, 1467, 1811, 1467, 1467, 1762, 1467, 576, 1467,
- /* 2350 */ 1467, 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467,
- /* 2360 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467,
- /* 2370 */ 1467, 1467, 1467, 1825, 1467, 1467, 1467, 308, 1794, 579,
- /* 2380 */ 1796, 1797, 575, 1825, 570, 1467, 1467, 288, 1794, 579,
- /* 2390 */ 1796, 1797, 575, 1467, 570,
+ /* 860 */ 403, 402, 401, 400, 394, 393, 392, 391, 1480, 388,
+ /* 870 */ 387, 1477, 609, 1760, 1476, 1649, 29, 337, 1356, 1357,
+ /* 880 */ 1358, 1359, 1360, 1364, 1365, 1366, 1367, 1009, 1010, 1760,
+ /* 890 */ 1264, 273, 1262, 1475, 1636, 44, 4, 29, 337, 1356,
+ /* 900 */ 1357, 1358, 1359, 1360, 1364, 1365, 1366, 1367, 1474, 1760,
+ /* 910 */ 1790, 1473, 1760, 1267, 1268, 1760, 1316, 1317, 1319, 1320,
+ /* 920 */ 1321, 1322, 1323, 1324, 572, 568, 1332, 1333, 1335, 1336,
+ /* 930 */ 1337, 1338, 1340, 1343, 1760, 147, 1697, 1790, 1808, 1697,
+ /* 940 */ 279, 1888, 1395, 1395, 217, 135, 577, 173, 1472, 1760,
+ /* 950 */ 176, 1760, 1760, 576, 277, 60, 1471, 1470, 59, 1469,
+ /* 960 */ 53, 509, 1318, 33, 32, 1808, 553, 40, 38, 36,
+ /* 970 */ 35, 34, 1747, 577, 181, 429, 427, 1822, 1760, 77,
+ /* 980 */ 576, 94, 1791, 579, 1793, 1794, 575, 202, 570, 1760,
+ /* 990 */ 200, 1868, 54, 553, 245, 306, 1864, 1760, 1760, 1518,
+ /* 1000 */ 1760, 498, 1398, 557, 1822, 525, 63, 1934, 94, 1791,
+ /* 1010 */ 579, 1793, 1794, 575, 204, 570, 448, 203, 1868, 361,
+ /* 1020 */ 167, 483, 306, 1864, 1931, 206, 1272, 208, 205, 525,
+ /* 1030 */ 207, 336, 335, 1606, 1934, 525, 1513, 525, 525, 1271,
+ /* 1040 */ 449, 1277, 1934, 560, 93, 1301, 1603, 165, 1735, 506,
+ /* 1050 */ 1790, 1931, 1339, 350, 1270, 165, 1809, 1606, 485, 1931,
+ /* 1060 */ 525, 525, 525, 1606, 566, 1606, 1606, 41, 1049, 222,
+ /* 1070 */ 1898, 510, 228, 521, 525, 1334, 1511, 1502, 1808, 68,
+ /* 1080 */ 67, 381, 131, 525, 172, 523, 577, 1269, 1606, 1606,
+ /* 1090 */ 1606, 1760, 134, 576, 524, 135, 51, 1646, 488, 525,
+ /* 1100 */ 301, 1050, 1606, 369, 525, 367, 363, 359, 356, 353,
+ /* 1110 */ 262, 1606, 1790, 237, 1212, 346, 226, 1822, 11, 10,
+ /* 1120 */ 51, 95, 1791, 579, 1793, 1794, 575, 1606, 570, 518,
+ /* 1130 */ 565, 1868, 1606, 1461, 1462, 330, 1864, 1947, 1781, 230,
+ /* 1140 */ 1808, 549, 1111, 1420, 168, 5, 1902, 41, 577, 90,
+ /* 1150 */ 615, 616, 250, 1760, 41, 576, 583, 134, 255, 87,
+ /* 1160 */ 240, 313, 135, 1275, 1790, 3, 258, 1369, 119, 260,
+ /* 1170 */ 134, 355, 1068, 1066, 1228, 360, 1274, 269, 175, 1822,
+ /* 1180 */ 385, 1783, 1286, 95, 1791, 579, 1793, 1794, 575, 1278,
+ /* 1190 */ 570, 1273, 1808, 1868, 1325, 406, 1353, 330, 1864, 1947,
+ /* 1200 */ 577, 272, 421, 1139, 1143, 1760, 558, 576, 1925, 1150,
+ /* 1210 */ 1699, 413, 1281, 1283, 420, 1148, 1790, 138, 422, 426,
+ /* 1220 */ 428, 430, 1292, 431, 568, 1332, 1333, 1335, 1336, 1337,
+ /* 1230 */ 1338, 1822, 439, 1294, 184, 95, 1791, 579, 1793, 1794,
+ /* 1240 */ 575, 442, 570, 1790, 1808, 1868, 443, 186, 561, 330,
+ /* 1250 */ 1864, 1947, 577, 1293, 444, 1295, 189, 1760, 445, 576,
+ /* 1260 */ 1887, 447, 191, 451, 72, 73, 195, 470, 472, 1596,
+ /* 1270 */ 199, 1808, 553, 1592, 201, 140, 141, 1594, 304, 577,
+ /* 1280 */ 118, 270, 500, 1822, 1760, 1590, 576, 286, 1791, 579,
+ /* 1290 */ 1793, 1794, 575, 212, 570, 1790, 507, 142, 143, 553,
+ /* 1300 */ 501, 504, 1740, 533, 215, 511, 519, 132, 219, 271,
+ /* 1310 */ 1822, 1790, 514, 1934, 286, 1791, 579, 1793, 1794, 575,
+ /* 1320 */ 536, 570, 322, 1808, 133, 81, 167, 520, 1739, 83,
+ /* 1330 */ 1931, 577, 1709, 516, 1291, 6, 1760, 1607, 576, 1808,
+ /* 1340 */ 1934, 324, 1890, 529, 1899, 545, 531, 577, 532, 530,
+ /* 1350 */ 528, 527, 1760, 165, 576, 235, 1395, 1931, 329, 239,
+ /* 1360 */ 126, 1290, 1822, 539, 48, 1909, 96, 1791, 579, 1793,
+ /* 1370 */ 1794, 575, 331, 570, 559, 85, 1868, 246, 1822, 562,
+ /* 1380 */ 1867, 1864, 96, 1791, 579, 1793, 1794, 575, 249, 570,
+ /* 1390 */ 1884, 1790, 1868, 1908, 244, 1930, 564, 1864, 1950, 1650,
+ /* 1400 */ 658, 1790, 581, 274, 1579, 659, 154, 247, 661, 1849,
+ /* 1410 */ 265, 153, 52, 278, 248, 287, 297, 1754, 276, 1808,
+ /* 1420 */ 1753, 296, 65, 1752, 1751, 66, 1748, 577, 254, 1808,
+ /* 1430 */ 357, 556, 1760, 358, 576, 1255, 1256, 577, 257, 171,
+ /* 1440 */ 563, 362, 1760, 259, 576, 1746, 364, 365, 366, 1745,
+ /* 1450 */ 1790, 368, 1744, 370, 1743, 372, 1742, 374, 1822, 1231,
+ /* 1460 */ 1230, 1720, 149, 1791, 579, 1793, 1794, 575, 1822, 570,
+ /* 1470 */ 1719, 379, 96, 1791, 579, 1793, 1794, 575, 1808, 570,
+ /* 1480 */ 380, 1718, 1868, 323, 1717, 1200, 577, 1865, 1692, 129,
+ /* 1490 */ 1691, 1760, 1690, 576, 1689, 69, 1688, 1687, 1686, 1790,
+ /* 1500 */ 395, 396, 1683, 398, 1682, 1681, 554, 1948, 1685, 1684,
+ /* 1510 */ 1680, 1790, 1679, 1678, 1677, 1676, 1675, 1822, 1674, 1673,
+ /* 1520 */ 1672, 295, 1791, 579, 1793, 1794, 575, 1808, 570, 1671,
+ /* 1530 */ 1670, 1669, 526, 130, 1668, 577, 1667, 1666, 1665, 1808,
+ /* 1540 */ 1760, 1664, 576, 1663, 1202, 1662, 1661, 577, 1660, 1659,
+ /* 1550 */ 1533, 179, 1760, 1532, 576, 180, 1530, 1498, 1012, 182,
+ /* 1560 */ 1790, 1011, 120, 1497, 158, 183, 1822, 121, 1733, 1727,
+ /* 1570 */ 295, 1791, 579, 1793, 1794, 575, 1790, 570, 1822, 435,
+ /* 1580 */ 1716, 437, 290, 1791, 579, 1793, 1794, 575, 1808, 570,
+ /* 1590 */ 188, 1715, 190, 1701, 1585, 1529, 577, 1527, 454, 452,
+ /* 1600 */ 1525, 1760, 1042, 576, 1808, 453, 456, 457, 1523, 458,
+ /* 1610 */ 460, 462, 574, 461, 1521, 466, 464, 1760, 1510, 576,
+ /* 1620 */ 544, 465, 1509, 1494, 1587, 50, 1153, 1822, 198, 1790,
+ /* 1630 */ 630, 149, 1791, 579, 1793, 1794, 575, 1154, 570, 1586,
+ /* 1640 */ 1079, 1790, 632, 1822, 1076, 1075, 1519, 294, 1791, 579,
+ /* 1650 */ 1793, 1794, 575, 1074, 570, 1514, 1841, 1808, 318, 319,
+ /* 1660 */ 486, 1512, 338, 320, 489, 577, 197, 1493, 1492, 1808,
+ /* 1670 */ 1760, 1491, 576, 491, 340, 493, 1949, 577, 495, 97,
+ /* 1680 */ 152, 1732, 1760, 56, 576, 467, 463, 459, 455, 196,
+ /* 1690 */ 1790, 502, 1237, 1726, 1714, 1712, 1822, 144, 508, 503,
+ /* 1700 */ 295, 1791, 579, 1793, 1794, 575, 216, 570, 1822, 1713,
+ /* 1710 */ 1711, 321, 295, 1791, 579, 1793, 1794, 575, 1808, 570,
+ /* 1720 */ 1710, 75, 1708, 15, 194, 221, 577, 1700, 517, 80,
+ /* 1730 */ 232, 1760, 227, 576, 79, 229, 82, 1247, 16, 1790,
+ /* 1740 */ 41, 23, 234, 87, 1435, 47, 242, 243, 236, 1447,
+ /* 1750 */ 1417, 238, 1781, 1419, 151, 241, 25, 1822, 252, 24,
+ /* 1760 */ 1790, 280, 1791, 579, 1793, 1794, 575, 1808, 570, 1412,
+ /* 1770 */ 1392, 86, 46, 1391, 1780, 577, 155, 1452, 18, 1441,
+ /* 1780 */ 1760, 1446, 576, 332, 1451, 1450, 193, 187, 1808, 192,
+ /* 1790 */ 45, 333, 10, 446, 1279, 19, 577, 1825, 17, 1354,
+ /* 1800 */ 569, 1760, 1309, 576, 156, 1329, 1822, 1327, 31, 185,
+ /* 1810 */ 281, 1791, 579, 1793, 1794, 575, 1326, 570, 580, 13,
+ /* 1820 */ 12, 1790, 20, 169, 1140, 21, 582, 1822, 341, 1137,
+ /* 1830 */ 584, 282, 1791, 579, 1793, 1794, 575, 1790, 570, 586,
+ /* 1840 */ 587, 589, 590, 578, 1134, 1128, 592, 1126, 593, 1808,
+ /* 1850 */ 595, 596, 1117, 548, 88, 1132, 1131, 577, 1130, 89,
+ /* 1860 */ 1129, 602, 1760, 1149, 576, 1808, 263, 62, 1145, 1040,
+ /* 1870 */ 611, 1071, 1070, 577, 1069, 1067, 1065, 1064, 1760, 1063,
+ /* 1880 */ 576, 127, 1086, 620, 1061, 1060, 264, 1059, 1822, 1058,
+ /* 1890 */ 1790, 1057, 289, 1791, 579, 1793, 1794, 575, 1056, 570,
+ /* 1900 */ 548, 553, 1790, 1055, 1822, 1081, 1083, 1052, 291, 1791,
+ /* 1910 */ 579, 1793, 1794, 575, 1051, 570, 1048, 1047, 1808, 1046,
+ /* 1920 */ 125, 1045, 1526, 640, 641, 1524, 577, 644, 127, 642,
+ /* 1930 */ 1808, 1760, 645, 576, 646, 251, 1876, 547, 577, 546,
+ /* 1940 */ 1522, 648, 1934, 1760, 650, 576, 649, 1520, 553, 652,
+ /* 1950 */ 653, 1790, 654, 1508, 656, 167, 1002, 1822, 1490, 1931,
+ /* 1960 */ 267, 283, 1791, 579, 1793, 1794, 575, 125, 570, 1822,
+ /* 1970 */ 660, 664, 1265, 292, 1791, 579, 1793, 1794, 575, 1808,
+ /* 1980 */ 570, 275, 251, 1876, 547, 663, 546, 577, 1465, 1934,
+ /* 1990 */ 1465, 1465, 1760, 1465, 576, 1465, 1465, 1465, 1465, 1465,
+ /* 2000 */ 1790, 1465, 165, 1465, 1465, 1465, 1931, 1465, 1465, 1465,
+ /* 2010 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1822, 1465,
+ /* 2020 */ 1465, 1790, 284, 1791, 579, 1793, 1794, 575, 1808, 570,
+ /* 2030 */ 1465, 1465, 1465, 1465, 1465, 1465, 577, 1465, 1465, 1465,
+ /* 2040 */ 1465, 1760, 1465, 576, 1465, 1465, 1465, 1465, 1465, 1808,
+ /* 2050 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 577, 1465, 1465,
+ /* 2060 */ 1465, 1465, 1760, 1465, 576, 1465, 1465, 1822, 1465, 1465,
+ /* 2070 */ 1790, 293, 1791, 579, 1793, 1794, 575, 1465, 570, 1465,
+ /* 2080 */ 1465, 1465, 1790, 1465, 1465, 1465, 1465, 1465, 1822, 1465,
+ /* 2090 */ 1465, 1465, 285, 1791, 579, 1793, 1794, 575, 1808, 570,
+ /* 2100 */ 1465, 1465, 1465, 1465, 1465, 1465, 577, 1465, 1465, 1465,
+ /* 2110 */ 1808, 1760, 1465, 576, 1465, 1465, 1465, 1465, 577, 1465,
+ /* 2120 */ 1465, 1465, 1465, 1760, 1465, 576, 1465, 1465, 1465, 1465,
+ /* 2130 */ 1465, 1465, 1465, 1465, 1790, 1465, 1465, 1822, 1465, 1465,
+ /* 2140 */ 1465, 298, 1791, 579, 1793, 1794, 575, 1465, 570, 1822,
+ /* 2150 */ 1465, 1790, 1465, 299, 1791, 579, 1793, 1794, 575, 1465,
+ /* 2160 */ 570, 1465, 1808, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2170 */ 577, 1465, 1465, 1465, 1465, 1760, 1465, 576, 1465, 1808,
+ /* 2180 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 577, 1465, 1465,
+ /* 2190 */ 1465, 1465, 1760, 1465, 576, 1465, 1465, 1465, 1465, 1465,
+ /* 2200 */ 1465, 1822, 1465, 1465, 1790, 1802, 1791, 579, 1793, 1794,
+ /* 2210 */ 575, 1465, 570, 1465, 1465, 1465, 1465, 1465, 1822, 1465,
+ /* 2220 */ 1465, 1465, 1801, 1791, 579, 1793, 1794, 575, 1465, 570,
+ /* 2230 */ 1465, 1465, 1808, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2240 */ 577, 1465, 1465, 1465, 1465, 1760, 1465, 576, 1465, 1465,
+ /* 2250 */ 1465, 1465, 1465, 1790, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2260 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2270 */ 1465, 1822, 1465, 1465, 1465, 1800, 1791, 579, 1793, 1794,
+ /* 2280 */ 575, 1808, 570, 1465, 1465, 1465, 1465, 1465, 1465, 577,
+ /* 2290 */ 1465, 1465, 1465, 1465, 1760, 1465, 576, 1465, 1465, 1465,
+ /* 2300 */ 1465, 1465, 1790, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2310 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1790, 1465,
+ /* 2320 */ 1822, 1465, 1465, 1465, 310, 1791, 579, 1793, 1794, 575,
+ /* 2330 */ 1808, 570, 1465, 1465, 1465, 1465, 1465, 1465, 577, 1465,
+ /* 2340 */ 1465, 1465, 1465, 1760, 1465, 576, 1808, 1465, 1465, 1465,
+ /* 2350 */ 1465, 1465, 1465, 1465, 577, 1465, 1465, 1465, 1465, 1760,
+ /* 2360 */ 1465, 576, 1465, 1465, 1465, 1465, 1465, 1790, 1465, 1822,
+ /* 2370 */ 1465, 1465, 1465, 309, 1791, 579, 1793, 1794, 575, 1790,
+ /* 2380 */ 570, 1465, 1465, 1465, 1465, 1822, 1465, 1465, 1465, 311,
+ /* 2390 */ 1791, 579, 1793, 1794, 575, 1808, 570, 1465, 1465, 1465,
+ /* 2400 */ 1465, 1465, 1465, 577, 1465, 1465, 1465, 1808, 1760, 1465,
+ /* 2410 */ 576, 1465, 1465, 1465, 1465, 577, 1465, 1465, 1465, 1465,
+ /* 2420 */ 1760, 1465, 576, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 2430 */ 1465, 1465, 1465, 1465, 1822, 1465, 1465, 1465, 308, 1791,
+ /* 2440 */ 579, 1793, 1794, 575, 1465, 570, 1822, 1465, 1465, 1465,
+ /* 2450 */ 288, 1791, 579, 1793, 1794, 575, 1465, 570,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 264, 358, 266, 267, 302, 303, 290, 280, 264, 268,
- /* 10 */ 266, 267, 12, 13, 371, 288, 0, 301, 375, 358,
- /* 20 */ 20, 0, 22, 303, 297, 12, 13, 14, 15, 16,
- /* 30 */ 260, 311, 371, 33, 314, 35, 375, 296, 20, 20,
- /* 40 */ 4, 22, 21, 327, 328, 24, 25, 26, 27, 28,
- /* 50 */ 29, 30, 31, 32, 287, 339, 56, 272, 288, 299,
- /* 60 */ 273, 61, 302, 303, 277, 270, 296, 300, 68, 50,
- /* 70 */ 20, 301, 22, 303, 12, 13, 14, 336, 283, 294,
- /* 80 */ 44, 45, 20, 0, 22, 35, 291, 317, 259, 89,
- /* 90 */ 261, 350, 351, 352, 353, 33, 355, 35, 328, 20,
- /* 100 */ 50, 4, 332, 333, 334, 335, 336, 337, 288, 339,
- /* 110 */ 20, 111, 342, 14, 358, 295, 346, 347, 56, 20,
- /* 120 */ 14, 15, 16, 61, 304, 125, 126, 371, 358, 21,
- /* 130 */ 68, 375, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 140 */ 32, 371, 60, 125, 126, 375, 63, 64, 65, 66,
+ /* 0 */ 268, 342, 343, 268, 268, 264, 268, 266, 267, 1,
+ /* 10 */ 2, 279, 12, 13, 279, 302, 303, 279, 286, 316,
+ /* 20 */ 20, 0, 22, 4, 286, 20, 20, 22, 296, 260,
+ /* 30 */ 290, 296, 296, 33, 296, 35, 264, 272, 266, 267,
+ /* 40 */ 35, 301, 21, 290, 20, 24, 25, 26, 27, 28,
+ /* 50 */ 29, 30, 31, 32, 301, 50, 56, 288, 273, 294,
+ /* 60 */ 357, 61, 277, 44, 45, 296, 326, 327, 68, 60,
+ /* 70 */ 301, 335, 303, 370, 12, 13, 14, 374, 338, 326,
+ /* 80 */ 327, 328, 20, 0, 22, 349, 350, 351, 352, 89,
+ /* 90 */ 354, 338, 288, 89, 20, 33, 327, 35, 90, 295,
+ /* 100 */ 331, 332, 333, 334, 335, 336, 21, 338, 304, 299,
+ /* 110 */ 341, 111, 302, 303, 345, 346, 347, 303, 56, 34,
+ /* 120 */ 288, 36, 20, 61, 310, 125, 126, 313, 359, 297,
+ /* 130 */ 68, 12, 13, 14, 15, 16, 367, 8, 9, 274,
+ /* 140 */ 275, 12, 13, 14, 15, 16, 63, 64, 65, 66,
/* 150 */ 67, 89, 69, 70, 71, 72, 73, 74, 75, 76,
/* 160 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
- /* 170 */ 170, 37, 172, 111, 260, 8, 9, 257, 358, 12,
- /* 180 */ 13, 14, 15, 16, 343, 344, 89, 125, 126, 265,
- /* 190 */ 20, 371, 268, 193, 194, 375, 196, 197, 198, 199,
+ /* 170 */ 170, 21, 172, 111, 24, 25, 26, 27, 28, 29,
+ /* 180 */ 30, 31, 32, 56, 288, 89, 35, 125, 126, 120,
+ /* 190 */ 121, 89, 296, 193, 194, 56, 196, 197, 198, 199,
/* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 210 */ 210, 211, 212, 213, 0, 301, 8, 9, 60, 20,
- /* 220 */ 12, 13, 14, 15, 16, 20, 92, 227, 94, 95,
- /* 230 */ 101, 97, 170, 121, 172, 101, 193, 317, 24, 25,
- /* 240 */ 26, 27, 28, 29, 30, 31, 32, 157, 268, 120,
- /* 250 */ 121, 122, 123, 124, 89, 193, 194, 123, 196, 197,
+ /* 210 */ 210, 211, 212, 213, 0, 88, 8, 9, 91, 68,
+ /* 220 */ 12, 13, 14, 15, 16, 20, 268, 227, 89, 333,
+ /* 230 */ 91, 227, 170, 165, 172, 22, 270, 279, 24, 25,
+ /* 240 */ 26, 27, 28, 29, 30, 31, 32, 178, 35, 0,
+ /* 250 */ 181, 268, 184, 185, 296, 193, 194, 291, 196, 197,
/* 260 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- /* 270 */ 208, 209, 210, 211, 212, 213, 12, 13, 358, 236,
- /* 280 */ 237, 238, 239, 240, 20, 305, 22, 317, 89, 177,
- /* 290 */ 178, 371, 120, 181, 260, 375, 197, 33, 90, 35,
+ /* 270 */ 208, 209, 210, 211, 212, 213, 12, 13, 20, 296,
+ /* 280 */ 4, 68, 20, 20, 20, 152, 22, 20, 8, 9,
+ /* 290 */ 268, 162, 12, 13, 14, 15, 16, 33, 90, 35,
/* 300 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- /* 310 */ 112, 4, 114, 115, 116, 117, 118, 119, 265, 288,
- /* 320 */ 56, 268, 288, 155, 227, 61, 19, 296, 358, 162,
- /* 330 */ 296, 296, 68, 20, 169, 301, 171, 303, 12, 13,
- /* 340 */ 33, 371, 307, 89, 268, 375, 20, 89, 22, 268,
- /* 350 */ 19, 179, 180, 89, 47, 260, 120, 121, 51, 33,
- /* 360 */ 279, 35, 328, 56, 33, 334, 332, 333, 334, 335,
- /* 370 */ 336, 337, 296, 339, 20, 111, 342, 296, 47, 288,
- /* 380 */ 346, 347, 56, 52, 53, 54, 55, 56, 297, 125,
- /* 390 */ 126, 68, 227, 22, 68, 88, 301, 56, 91, 260,
- /* 400 */ 232, 233, 89, 12, 13, 14, 35, 290, 21, 260,
- /* 410 */ 268, 20, 336, 22, 178, 89, 249, 181, 301, 88,
- /* 420 */ 272, 34, 91, 36, 33, 20, 35, 351, 352, 353,
- /* 430 */ 89, 355, 91, 285, 170, 14, 172, 111, 296, 68,
- /* 440 */ 301, 20, 294, 89, 327, 328, 329, 56, 274, 275,
- /* 450 */ 301, 125, 126, 1, 2, 124, 339, 193, 194, 68,
+ /* 310 */ 112, 4, 114, 115, 116, 117, 118, 119, 335, 20,
+ /* 320 */ 56, 22, 101, 227, 111, 61, 19, 305, 20, 227,
+ /* 330 */ 125, 126, 68, 350, 351, 352, 121, 354, 12, 13,
+ /* 340 */ 33, 120, 121, 122, 123, 124, 20, 214, 22, 50,
+ /* 350 */ 101, 89, 265, 89, 47, 268, 89, 224, 51, 33,
+ /* 360 */ 288, 35, 0, 56, 357, 89, 227, 295, 0, 120,
+ /* 370 */ 121, 122, 123, 124, 60, 111, 304, 370, 249, 3,
+ /* 380 */ 290, 374, 56, 170, 259, 172, 261, 272, 287, 125,
+ /* 390 */ 126, 301, 177, 178, 68, 88, 181, 357, 91, 68,
+ /* 400 */ 285, 300, 260, 12, 13, 14, 193, 194, 357, 294,
+ /* 410 */ 370, 20, 260, 22, 374, 89, 326, 327, 328, 100,
+ /* 420 */ 157, 370, 120, 155, 33, 374, 35, 280, 338, 357,
+ /* 430 */ 274, 275, 64, 65, 170, 288, 172, 111, 265, 71,
+ /* 440 */ 288, 268, 370, 301, 297, 20, 374, 56, 296, 81,
+ /* 450 */ 82, 125, 126, 301, 260, 303, 260, 193, 194, 68,
/* 460 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
- /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 336, 56,
- /* 480 */ 89, 227, 111, 64, 65, 227, 56, 156, 0, 33,
- /* 490 */ 71, 274, 275, 351, 352, 353, 170, 355, 172, 288,
- /* 500 */ 81, 82, 111, 47, 3, 174, 295, 176, 52, 53,
- /* 510 */ 54, 55, 56, 0, 91, 304, 125, 126, 88, 193,
- /* 520 */ 194, 91, 196, 197, 198, 199, 200, 201, 202, 203,
+ /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 68, 327,
+ /* 480 */ 89, 179, 180, 331, 332, 333, 334, 335, 336, 337,
+ /* 490 */ 338, 339, 340, 268, 227, 301, 170, 301, 172, 288,
+ /* 500 */ 232, 233, 111, 227, 0, 8, 9, 0, 14, 12,
+ /* 510 */ 13, 14, 15, 16, 20, 304, 125, 126, 289, 193,
+ /* 520 */ 194, 296, 196, 197, 198, 199, 200, 201, 202, 203,
/* 530 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
- /* 540 */ 227, 170, 90, 172, 88, 0, 20, 91, 60, 270,
- /* 550 */ 8, 9, 280, 227, 12, 13, 14, 15, 16, 0,
- /* 560 */ 288, 170, 0, 172, 193, 194, 68, 317, 227, 297,
- /* 570 */ 291, 296, 8, 9, 44, 45, 12, 13, 14, 15,
- /* 580 */ 16, 227, 307, 100, 193, 194, 35, 196, 197, 198,
+ /* 540 */ 43, 8, 9, 289, 2, 12, 13, 14, 15, 16,
+ /* 550 */ 8, 9, 101, 227, 12, 13, 14, 15, 16, 2,
+ /* 560 */ 335, 170, 14, 172, 60, 8, 9, 60, 20, 12,
+ /* 570 */ 13, 14, 15, 16, 123, 350, 351, 352, 312, 354,
+ /* 580 */ 314, 260, 157, 289, 193, 194, 37, 196, 197, 198,
/* 590 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
- /* 600 */ 209, 210, 211, 212, 213, 12, 13, 43, 358, 153,
- /* 610 */ 154, 260, 156, 20, 101, 22, 160, 289, 197, 68,
- /* 620 */ 303, 371, 60, 64, 65, 375, 33, 268, 35, 289,
- /* 630 */ 71, 314, 176, 120, 121, 122, 123, 124, 279, 288,
- /* 640 */ 81, 82, 39, 280, 268, 286, 101, 296, 260, 56,
- /* 650 */ 14, 288, 301, 268, 303, 296, 20, 289, 77, 317,
- /* 660 */ 297, 68, 317, 152, 279, 120, 121, 122, 123, 124,
- /* 670 */ 8, 9, 296, 260, 12, 13, 14, 15, 16, 328,
- /* 680 */ 260, 296, 89, 332, 333, 334, 335, 336, 337, 301,
- /* 690 */ 339, 8, 9, 317, 321, 12, 13, 14, 15, 16,
- /* 700 */ 358, 8, 9, 358, 111, 12, 13, 14, 15, 16,
- /* 710 */ 129, 130, 336, 371, 301, 317, 371, 375, 125, 126,
- /* 720 */ 375, 301, 313, 61, 315, 214, 260, 351, 352, 353,
- /* 730 */ 268, 355, 12, 13, 358, 224, 260, 18, 330, 20,
- /* 740 */ 20, 279, 22, 268, 61, 244, 27, 371, 286, 30,
- /* 750 */ 289, 375, 90, 33, 279, 35, 358, 289, 296, 165,
- /* 760 */ 98, 330, 354, 170, 0, 172, 47, 301, 49, 371,
- /* 770 */ 51, 296, 260, 375, 260, 20, 56, 301, 184, 185,
- /* 780 */ 313, 98, 315, 90, 260, 354, 193, 194, 68, 196,
+ /* 600 */ 209, 210, 211, 212, 213, 12, 13, 0, 320, 288,
+ /* 610 */ 280, 77, 0, 20, 268, 22, 289, 296, 288, 268,
+ /* 620 */ 244, 257, 301, 90, 303, 279, 33, 297, 35, 89,
+ /* 630 */ 279, 8, 9, 289, 329, 12, 13, 14, 15, 16,
+ /* 640 */ 193, 92, 296, 94, 95, 14, 97, 296, 327, 56,
+ /* 650 */ 101, 20, 331, 332, 333, 334, 335, 336, 353, 338,
+ /* 660 */ 48, 68, 341, 129, 130, 260, 345, 346, 347, 289,
+ /* 670 */ 8, 9, 123, 280, 12, 13, 14, 15, 16, 19,
+ /* 680 */ 316, 288, 89, 236, 237, 238, 239, 240, 367, 289,
+ /* 690 */ 297, 8, 9, 33, 268, 12, 13, 14, 15, 16,
+ /* 700 */ 14, 15, 16, 261, 111, 279, 301, 47, 101, 169,
+ /* 710 */ 288, 171, 52, 53, 54, 55, 56, 295, 125, 126,
+ /* 720 */ 377, 357, 296, 61, 368, 290, 304, 120, 121, 122,
+ /* 730 */ 123, 124, 12, 13, 370, 329, 301, 18, 374, 20,
+ /* 740 */ 20, 260, 22, 268, 61, 197, 27, 298, 88, 30,
+ /* 750 */ 301, 91, 90, 33, 279, 35, 39, 64, 65, 353,
+ /* 760 */ 98, 326, 327, 170, 71, 172, 47, 227, 49, 316,
+ /* 770 */ 51, 296, 316, 338, 81, 82, 56, 260, 4, 316,
+ /* 780 */ 157, 98, 301, 260, 124, 20, 193, 194, 68, 196,
/* 790 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
- /* 800 */ 207, 208, 209, 210, 211, 212, 213, 88, 260, 89,
- /* 810 */ 2, 288, 48, 301, 152, 301, 8, 9, 295, 100,
- /* 820 */ 12, 13, 14, 15, 16, 301, 2, 304, 288, 226,
- /* 830 */ 260, 111, 8, 9, 260, 152, 12, 13, 14, 15,
- /* 840 */ 16, 276, 20, 278, 304, 125, 126, 128, 260, 301,
+ /* 800 */ 207, 208, 209, 210, 211, 212, 213, 88, 270, 89,
+ /* 810 */ 357, 268, 277, 357, 152, 303, 156, 329, 301, 100,
+ /* 820 */ 357, 283, 279, 370, 301, 313, 370, 374, 197, 291,
+ /* 830 */ 374, 111, 260, 370, 174, 152, 176, 374, 312, 296,
+ /* 840 */ 314, 353, 276, 323, 278, 125, 126, 128, 260, 269,
/* 850 */ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
/* 860 */ 141, 142, 143, 144, 145, 146, 147, 148, 260, 150,
- /* 870 */ 151, 301, 101, 4, 260, 301, 214, 215, 216, 217,
- /* 880 */ 218, 219, 220, 221, 222, 223, 224, 330, 298, 301,
- /* 890 */ 170, 301, 172, 298, 123, 289, 301, 214, 215, 216,
+ /* 870 */ 151, 260, 298, 301, 260, 301, 214, 215, 216, 217,
+ /* 880 */ 218, 219, 220, 221, 222, 223, 224, 44, 45, 301,
+ /* 890 */ 170, 281, 172, 260, 284, 42, 43, 214, 215, 216,
/* 900 */ 217, 218, 219, 220, 221, 222, 223, 224, 260, 301,
- /* 910 */ 260, 354, 157, 193, 194, 301, 196, 197, 198, 199,
+ /* 910 */ 260, 260, 301, 193, 194, 301, 196, 197, 198, 199,
/* 920 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- /* 930 */ 210, 211, 212, 213, 268, 18, 268, 268, 288, 35,
- /* 940 */ 23, 268, 225, 226, 268, 279, 296, 279, 279, 301,
- /* 950 */ 289, 301, 279, 303, 37, 38, 281, 43, 41, 284,
- /* 960 */ 42, 43, 296, 0, 296, 296, 261, 317, 93, 296,
- /* 970 */ 268, 96, 296, 0, 57, 58, 59, 290, 328, 0,
- /* 980 */ 43, 279, 332, 333, 334, 335, 336, 337, 301, 339,
- /* 990 */ 61, 93, 342, 317, 96, 22, 346, 347, 296, 12,
- /* 1000 */ 13, 22, 268, 43, 90, 43, 89, 43, 358, 22,
- /* 1010 */ 47, 0, 336, 279, 327, 328, 329, 157, 158, 197,
- /* 1020 */ 33, 371, 35, 1, 2, 375, 339, 351, 352, 353,
- /* 1030 */ 296, 355, 378, 22, 358, 268, 93, 290, 93, 96,
- /* 1040 */ 43, 96, 260, 56, 127, 43, 279, 371, 301, 43,
- /* 1050 */ 90, 375, 8, 9, 90, 68, 12, 13, 14, 15,
- /* 1060 */ 16, 8, 9, 296, 43, 12, 13, 14, 15, 16,
- /* 1070 */ 288, 268, 125, 126, 327, 328, 172, 277, 296, 162,
- /* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 269, 46,
- /* 1090 */ 13, 369, 90, 35, 89, 365, 90, 228, 111, 296,
- /* 1100 */ 183, 324, 43, 186, 99, 188, 189, 190, 191, 192,
- /* 1110 */ 328, 90, 35, 43, 332, 333, 334, 335, 336, 337,
- /* 1120 */ 268, 339, 193, 268, 342, 268, 268, 268, 346, 347,
- /* 1130 */ 348, 279, 89, 35, 279, 268, 279, 279, 279, 13,
- /* 1140 */ 43, 260, 360, 90, 227, 269, 279, 267, 296, 90,
- /* 1150 */ 368, 296, 43, 296, 296, 296, 288, 170, 43, 172,
- /* 1160 */ 90, 35, 300, 296, 331, 43, 68, 356, 372, 288,
- /* 1170 */ 349, 372, 359, 372, 43, 43, 326, 296, 43, 229,
- /* 1180 */ 193, 194, 301, 260, 303, 248, 47, 90, 325, 319,
- /* 1190 */ 42, 168, 205, 206, 207, 208, 209, 210, 211, 90,
- /* 1200 */ 308, 157, 20, 268, 268, 90, 152, 308, 246, 328,
- /* 1210 */ 268, 288, 90, 332, 333, 334, 335, 336, 337, 296,
- /* 1220 */ 339, 90, 90, 342, 301, 90, 303, 346, 347, 348,
- /* 1230 */ 172, 306, 306, 268, 268, 20, 260, 262, 20, 262,
- /* 1240 */ 272, 303, 323, 272, 316, 20, 20, 316, 318, 368,
- /* 1250 */ 272, 328, 272, 260, 20, 332, 333, 334, 335, 336,
- /* 1260 */ 337, 309, 339, 272, 288, 342, 272, 268, 272, 346,
- /* 1270 */ 347, 348, 296, 288, 262, 262, 288, 301, 288, 303,
- /* 1280 */ 357, 288, 268, 288, 301, 270, 288, 175, 288, 296,
- /* 1290 */ 323, 288, 288, 268, 301, 288, 303, 288, 288, 270,
- /* 1300 */ 268, 270, 316, 322, 328, 234, 154, 20, 332, 333,
- /* 1310 */ 334, 335, 336, 337, 296, 339, 260, 270, 342, 303,
- /* 1320 */ 312, 328, 346, 347, 348, 332, 333, 334, 335, 336,
- /* 1330 */ 337, 301, 339, 357, 301, 342, 301, 301, 312, 346,
- /* 1340 */ 347, 348, 301, 309, 288, 284, 270, 310, 331, 301,
- /* 1350 */ 357, 312, 296, 235, 312, 241, 364, 301, 301, 303,
- /* 1360 */ 161, 301, 243, 301, 301, 364, 260, 242, 230, 226,
- /* 1370 */ 296, 326, 20, 317, 247, 245, 260, 89, 250, 330,
- /* 1380 */ 89, 292, 301, 363, 328, 361, 367, 270, 332, 333,
- /* 1390 */ 334, 335, 336, 337, 288, 339, 36, 268, 278, 263,
- /* 1400 */ 362, 374, 296, 262, 288, 320, 366, 301, 315, 303,
- /* 1410 */ 364, 345, 296, 271, 358, 282, 282, 301, 260, 303,
- /* 1420 */ 258, 0, 282, 317, 373, 0, 374, 371, 373, 379,
- /* 1430 */ 177, 375, 0, 0, 328, 42, 0, 373, 332, 333,
- /* 1440 */ 334, 335, 336, 337, 328, 339, 288, 374, 332, 333,
- /* 1450 */ 334, 335, 336, 337, 296, 339, 187, 35, 342, 301,
- /* 1460 */ 187, 303, 346, 347, 358, 35, 35, 0, 0, 35,
- /* 1470 */ 35, 187, 260, 35, 0, 35, 187, 371, 0, 22,
- /* 1480 */ 0, 375, 35, 172, 260, 170, 328, 0, 0, 165,
- /* 1490 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
- /* 1500 */ 288, 166, 0, 0, 46, 0, 42, 0, 296, 0,
- /* 1510 */ 0, 149, 288, 301, 0, 303, 0, 0, 0, 0,
- /* 1520 */ 296, 144, 0, 144, 35, 301, 0, 303, 0, 0,
- /* 1530 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /* 1540 */ 328, 260, 0, 42, 332, 333, 334, 335, 336, 337,
- /* 1550 */ 0, 339, 328, 42, 56, 0, 332, 333, 334, 335,
- /* 1560 */ 336, 337, 0, 339, 0, 260, 342, 22, 0, 288,
- /* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 0, 0,
- /* 1580 */ 56, 0, 301, 260, 303, 0, 39, 43, 376, 377,
- /* 1590 */ 0, 14, 46, 288, 14, 46, 40, 39, 293, 0,
- /* 1600 */ 0, 296, 0, 161, 39, 0, 301, 0, 303, 328,
- /* 1610 */ 0, 288, 0, 332, 333, 334, 335, 336, 337, 296,
- /* 1620 */ 339, 62, 0, 35, 301, 39, 303, 0, 35, 47,
- /* 1630 */ 47, 39, 0, 328, 47, 39, 35, 332, 333, 334,
- /* 1640 */ 335, 336, 337, 0, 339, 260, 35, 39, 0, 0,
- /* 1650 */ 47, 328, 0, 0, 0, 332, 333, 334, 335, 336,
- /* 1660 */ 337, 98, 339, 260, 35, 96, 22, 43, 35, 43,
- /* 1670 */ 35, 35, 22, 288, 0, 0, 0, 22, 22, 49,
- /* 1680 */ 22, 296, 35, 0, 0, 0, 301, 22, 303, 20,
- /* 1690 */ 0, 288, 35, 370, 35, 35, 0, 157, 173, 296,
- /* 1700 */ 22, 0, 0, 0, 301, 157, 303, 0, 154, 157,
- /* 1710 */ 159, 0, 89, 328, 89, 260, 0, 332, 333, 334,
- /* 1720 */ 335, 336, 337, 182, 339, 0, 155, 90, 89, 89,
- /* 1730 */ 39, 328, 46, 260, 89, 332, 333, 334, 335, 336,
- /* 1740 */ 337, 99, 339, 288, 341, 46, 231, 153, 293, 43,
- /* 1750 */ 46, 296, 90, 89, 231, 89, 301, 260, 303, 46,
- /* 1760 */ 90, 288, 377, 90, 43, 43, 293, 90, 89, 296,
- /* 1770 */ 89, 89, 43, 43, 301, 35, 303, 90, 89, 46,
- /* 1780 */ 46, 43, 90, 328, 90, 288, 225, 332, 333, 334,
- /* 1790 */ 335, 336, 337, 296, 339, 90, 35, 231, 301, 90,
- /* 1800 */ 303, 328, 35, 35, 35, 332, 333, 334, 335, 336,
- /* 1810 */ 337, 35, 339, 260, 2, 22, 43, 89, 46, 22,
- /* 1820 */ 89, 193, 35, 46, 89, 328, 90, 260, 89, 332,
- /* 1830 */ 333, 334, 335, 336, 337, 90, 339, 90, 89, 89,
- /* 1840 */ 35, 288, 100, 90, 89, 89, 195, 90, 35, 296,
- /* 1850 */ 90, 35, 89, 35, 301, 288, 303, 35, 22, 113,
- /* 1860 */ 90, 90, 35, 296, 89, 113, 101, 89, 301, 260,
- /* 1870 */ 303, 113, 113, 43, 89, 89, 22, 89, 61, 260,
- /* 1880 */ 35, 328, 62, 35, 35, 332, 333, 334, 335, 336,
- /* 1890 */ 337, 35, 339, 35, 35, 328, 35, 288, 87, 332,
- /* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 68, 43,
- /* 1910 */ 301, 35, 303, 35, 22, 296, 35, 22, 35, 35,
- /* 1920 */ 301, 260, 303, 68, 35, 22, 35, 0, 35, 35,
- /* 1930 */ 0, 35, 35, 35, 47, 35, 0, 328, 39, 35,
- /* 1940 */ 39, 332, 333, 334, 335, 336, 337, 328, 339, 288,
- /* 1950 */ 39, 332, 333, 334, 335, 336, 337, 296, 339, 47,
- /* 1960 */ 47, 0, 301, 35, 303, 47, 0, 35, 39, 35,
- /* 1970 */ 0, 22, 21, 21, 260, 22, 22, 20, 380, 380,
- /* 1980 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 328,
- /* 1990 */ 380, 380, 260, 332, 333, 334, 335, 336, 337, 380,
- /* 2000 */ 339, 380, 288, 380, 380, 380, 380, 380, 380, 380,
- /* 2010 */ 296, 380, 380, 380, 380, 301, 380, 303, 380, 380,
- /* 2020 */ 288, 380, 380, 380, 380, 380, 380, 380, 296, 380,
- /* 2030 */ 380, 380, 380, 301, 380, 303, 380, 380, 380, 380,
- /* 2040 */ 380, 380, 328, 380, 260, 380, 332, 333, 334, 335,
- /* 2050 */ 336, 337, 380, 339, 260, 380, 380, 380, 380, 380,
- /* 2060 */ 328, 380, 380, 380, 332, 333, 334, 335, 336, 337,
- /* 2070 */ 260, 339, 288, 380, 380, 380, 380, 380, 380, 380,
- /* 2080 */ 296, 380, 288, 380, 380, 301, 380, 303, 380, 380,
- /* 2090 */ 296, 380, 380, 380, 380, 301, 380, 303, 288, 380,
- /* 2100 */ 380, 380, 380, 380, 380, 380, 296, 380, 380, 380,
- /* 2110 */ 380, 301, 328, 303, 380, 380, 332, 333, 334, 335,
- /* 2120 */ 336, 337, 328, 339, 260, 380, 332, 333, 334, 335,
- /* 2130 */ 336, 337, 380, 339, 380, 380, 380, 380, 328, 380,
- /* 2140 */ 260, 380, 332, 333, 334, 335, 336, 337, 380, 339,
- /* 2150 */ 260, 380, 288, 380, 380, 380, 380, 380, 380, 380,
- /* 2160 */ 296, 380, 380, 380, 380, 301, 260, 303, 288, 380,
- /* 2170 */ 380, 380, 380, 380, 380, 380, 296, 380, 288, 380,
- /* 2180 */ 380, 301, 380, 303, 380, 380, 296, 380, 380, 380,
- /* 2190 */ 380, 301, 328, 303, 288, 380, 332, 333, 334, 335,
- /* 2200 */ 336, 337, 296, 339, 380, 380, 380, 301, 328, 303,
- /* 2210 */ 380, 380, 332, 333, 334, 335, 336, 337, 328, 339,
- /* 2220 */ 380, 380, 332, 333, 334, 335, 336, 337, 380, 339,
- /* 2230 */ 380, 380, 380, 380, 328, 260, 380, 380, 332, 333,
- /* 2240 */ 334, 335, 336, 337, 380, 339, 380, 380, 380, 380,
- /* 2250 */ 380, 380, 380, 260, 380, 380, 380, 380, 380, 380,
- /* 2260 */ 380, 380, 380, 288, 380, 380, 380, 380, 380, 380,
- /* 2270 */ 380, 296, 380, 380, 380, 380, 301, 380, 303, 380,
- /* 2280 */ 380, 288, 380, 380, 380, 380, 380, 380, 380, 296,
- /* 2290 */ 380, 380, 380, 380, 301, 380, 303, 380, 380, 380,
- /* 2300 */ 380, 380, 380, 328, 380, 260, 380, 332, 333, 334,
- /* 2310 */ 335, 336, 337, 380, 339, 260, 380, 380, 380, 380,
- /* 2320 */ 380, 328, 380, 380, 380, 332, 333, 334, 335, 336,
- /* 2330 */ 337, 380, 339, 288, 380, 380, 380, 380, 380, 380,
- /* 2340 */ 380, 296, 380, 288, 380, 380, 301, 380, 303, 380,
- /* 2350 */ 380, 296, 380, 380, 380, 380, 301, 380, 303, 380,
- /* 2360 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 380,
- /* 2370 */ 380, 380, 380, 328, 380, 380, 380, 332, 333, 334,
- /* 2380 */ 335, 336, 337, 328, 339, 380, 380, 332, 333, 334,
- /* 2390 */ 335, 336, 337, 380, 339,
+ /* 930 */ 210, 211, 212, 213, 301, 18, 296, 260, 288, 296,
+ /* 940 */ 23, 225, 226, 226, 56, 43, 296, 307, 260, 301,
+ /* 950 */ 307, 301, 301, 303, 37, 38, 260, 260, 41, 260,
+ /* 960 */ 157, 158, 197, 8, 9, 288, 316, 12, 13, 14,
+ /* 970 */ 15, 16, 0, 296, 57, 58, 59, 327, 301, 91,
+ /* 980 */ 303, 331, 332, 333, 334, 335, 336, 93, 338, 301,
+ /* 990 */ 96, 341, 90, 316, 364, 345, 346, 301, 301, 0,
+ /* 1000 */ 301, 316, 228, 43, 327, 268, 89, 357, 331, 332,
+ /* 1010 */ 333, 334, 335, 336, 93, 338, 279, 96, 341, 47,
+ /* 1020 */ 370, 22, 345, 346, 374, 93, 35, 93, 96, 268,
+ /* 1030 */ 96, 12, 13, 296, 357, 268, 0, 268, 268, 35,
+ /* 1040 */ 279, 22, 357, 43, 127, 90, 279, 370, 279, 279,
+ /* 1050 */ 260, 374, 33, 269, 35, 370, 288, 296, 22, 374,
+ /* 1060 */ 268, 268, 268, 296, 61, 296, 296, 43, 35, 43,
+ /* 1070 */ 330, 279, 279, 279, 268, 56, 0, 267, 288, 162,
+ /* 1080 */ 163, 164, 43, 268, 167, 279, 296, 68, 296, 296,
+ /* 1090 */ 296, 301, 43, 303, 279, 43, 43, 300, 22, 268,
+ /* 1100 */ 183, 68, 296, 186, 268, 188, 189, 190, 191, 192,
+ /* 1110 */ 279, 296, 260, 43, 90, 279, 90, 327, 1, 2,
+ /* 1120 */ 43, 331, 332, 333, 334, 335, 336, 296, 338, 90,
+ /* 1130 */ 111, 341, 296, 125, 126, 345, 346, 347, 46, 90,
+ /* 1140 */ 288, 355, 90, 90, 227, 229, 356, 43, 296, 89,
+ /* 1150 */ 13, 13, 348, 301, 43, 303, 43, 43, 371, 99,
+ /* 1160 */ 90, 324, 43, 172, 260, 358, 371, 90, 43, 371,
+ /* 1170 */ 43, 325, 35, 35, 168, 47, 172, 318, 42, 327,
+ /* 1180 */ 308, 89, 20, 331, 332, 333, 334, 335, 336, 170,
+ /* 1190 */ 338, 172, 288, 341, 90, 268, 193, 345, 346, 347,
+ /* 1200 */ 296, 90, 152, 90, 90, 301, 246, 303, 356, 90,
+ /* 1210 */ 268, 308, 193, 194, 306, 90, 260, 90, 306, 268,
+ /* 1220 */ 268, 268, 20, 262, 205, 206, 207, 208, 209, 210,
+ /* 1230 */ 211, 327, 262, 20, 272, 331, 332, 333, 334, 335,
+ /* 1240 */ 336, 322, 338, 260, 288, 341, 303, 272, 248, 345,
+ /* 1250 */ 346, 347, 296, 20, 315, 20, 272, 301, 317, 303,
+ /* 1260 */ 356, 315, 272, 268, 272, 272, 272, 262, 288, 288,
+ /* 1270 */ 288, 288, 316, 288, 288, 288, 288, 288, 262, 296,
+ /* 1280 */ 268, 322, 175, 327, 301, 288, 303, 331, 332, 333,
+ /* 1290 */ 334, 335, 336, 270, 338, 260, 268, 288, 288, 316,
+ /* 1300 */ 321, 303, 301, 234, 270, 268, 154, 311, 270, 284,
+ /* 1310 */ 327, 260, 301, 357, 331, 332, 333, 334, 335, 336,
+ /* 1320 */ 235, 338, 315, 288, 311, 270, 370, 309, 301, 270,
+ /* 1330 */ 374, 296, 301, 301, 20, 241, 301, 296, 303, 288,
+ /* 1340 */ 357, 301, 366, 301, 330, 161, 301, 296, 301, 243,
+ /* 1350 */ 242, 230, 301, 370, 303, 311, 226, 374, 301, 311,
+ /* 1360 */ 296, 20, 327, 301, 89, 363, 331, 332, 333, 334,
+ /* 1370 */ 335, 336, 250, 338, 245, 89, 341, 362, 327, 247,
+ /* 1380 */ 345, 346, 331, 332, 333, 334, 335, 336, 325, 338,
+ /* 1390 */ 329, 260, 341, 363, 365, 373, 345, 346, 378, 301,
+ /* 1400 */ 36, 260, 292, 268, 278, 263, 363, 361, 262, 344,
+ /* 1410 */ 270, 314, 319, 258, 360, 282, 282, 0, 271, 288,
+ /* 1420 */ 0, 282, 177, 0, 0, 42, 0, 296, 372, 288,
+ /* 1430 */ 35, 373, 301, 187, 303, 35, 35, 296, 372, 35,
+ /* 1440 */ 373, 187, 301, 372, 303, 0, 35, 35, 187, 0,
+ /* 1450 */ 260, 187, 0, 35, 0, 22, 0, 35, 327, 172,
+ /* 1460 */ 170, 0, 331, 332, 333, 334, 335, 336, 327, 338,
+ /* 1470 */ 0, 166, 331, 332, 333, 334, 335, 336, 288, 338,
+ /* 1480 */ 165, 0, 341, 293, 0, 46, 296, 346, 0, 42,
+ /* 1490 */ 0, 301, 0, 303, 0, 149, 0, 0, 0, 260,
+ /* 1500 */ 144, 35, 0, 144, 0, 0, 375, 376, 0, 0,
+ /* 1510 */ 0, 260, 0, 0, 0, 0, 0, 327, 0, 0,
+ /* 1520 */ 0, 331, 332, 333, 334, 335, 336, 288, 338, 0,
+ /* 1530 */ 0, 0, 293, 42, 0, 296, 0, 0, 0, 288,
+ /* 1540 */ 301, 0, 303, 0, 22, 0, 0, 296, 0, 0,
+ /* 1550 */ 0, 56, 301, 0, 303, 56, 0, 0, 14, 42,
+ /* 1560 */ 260, 14, 39, 0, 43, 40, 327, 39, 0, 0,
+ /* 1570 */ 331, 332, 333, 334, 335, 336, 260, 338, 327, 46,
+ /* 1580 */ 0, 46, 331, 332, 333, 334, 335, 336, 288, 338,
+ /* 1590 */ 39, 0, 161, 0, 0, 0, 296, 0, 39, 35,
+ /* 1600 */ 0, 301, 62, 303, 288, 47, 35, 47, 0, 39,
+ /* 1610 */ 35, 39, 296, 47, 0, 39, 35, 301, 0, 303,
+ /* 1620 */ 369, 47, 0, 0, 0, 98, 22, 327, 96, 260,
+ /* 1630 */ 43, 331, 332, 333, 334, 335, 336, 35, 338, 0,
+ /* 1640 */ 35, 260, 43, 327, 35, 35, 0, 331, 332, 333,
+ /* 1650 */ 334, 335, 336, 22, 338, 0, 340, 288, 22, 22,
+ /* 1660 */ 49, 0, 293, 22, 35, 296, 33, 0, 0, 288,
+ /* 1670 */ 301, 0, 303, 35, 293, 35, 376, 296, 22, 20,
+ /* 1680 */ 47, 0, 301, 157, 303, 52, 53, 54, 55, 56,
+ /* 1690 */ 260, 22, 35, 0, 0, 0, 327, 173, 159, 157,
+ /* 1700 */ 331, 332, 333, 334, 335, 336, 154, 338, 327, 0,
+ /* 1710 */ 0, 157, 331, 332, 333, 334, 335, 336, 288, 338,
+ /* 1720 */ 0, 88, 0, 89, 91, 90, 296, 0, 155, 39,
+ /* 1730 */ 46, 301, 89, 303, 89, 153, 89, 182, 231, 260,
+ /* 1740 */ 43, 89, 89, 99, 90, 43, 43, 46, 90, 35,
+ /* 1750 */ 90, 89, 46, 90, 89, 89, 43, 327, 46, 89,
+ /* 1760 */ 260, 331, 332, 333, 334, 335, 336, 288, 338, 90,
+ /* 1770 */ 90, 89, 43, 90, 46, 296, 46, 90, 43, 90,
+ /* 1780 */ 301, 35, 303, 35, 35, 35, 153, 154, 288, 156,
+ /* 1790 */ 225, 35, 2, 160, 22, 43, 296, 89, 231, 193,
+ /* 1800 */ 89, 301, 22, 303, 46, 90, 327, 90, 89, 176,
+ /* 1810 */ 331, 332, 333, 334, 335, 336, 90, 338, 100, 231,
+ /* 1820 */ 89, 260, 89, 46, 90, 89, 35, 327, 35, 90,
+ /* 1830 */ 89, 331, 332, 333, 334, 335, 336, 260, 338, 35,
+ /* 1840 */ 89, 35, 89, 195, 90, 90, 35, 90, 89, 288,
+ /* 1850 */ 35, 89, 22, 268, 89, 113, 113, 296, 113, 89,
+ /* 1860 */ 113, 101, 301, 35, 303, 288, 43, 89, 22, 62,
+ /* 1870 */ 61, 35, 35, 296, 35, 35, 35, 35, 301, 35,
+ /* 1880 */ 303, 296, 68, 87, 35, 35, 43, 22, 327, 35,
+ /* 1890 */ 260, 22, 331, 332, 333, 334, 335, 336, 35, 338,
+ /* 1900 */ 268, 316, 260, 35, 327, 35, 68, 35, 331, 332,
+ /* 1910 */ 333, 334, 335, 336, 35, 338, 35, 35, 288, 22,
+ /* 1920 */ 335, 35, 0, 35, 47, 0, 296, 35, 296, 39,
+ /* 1930 */ 288, 301, 47, 303, 39, 350, 351, 352, 296, 354,
+ /* 1940 */ 0, 35, 357, 301, 39, 303, 47, 0, 316, 35,
+ /* 1950 */ 47, 260, 39, 0, 35, 370, 35, 327, 0, 374,
+ /* 1960 */ 22, 331, 332, 333, 334, 335, 336, 335, 338, 327,
+ /* 1970 */ 21, 20, 22, 331, 332, 333, 334, 335, 336, 288,
+ /* 1980 */ 338, 22, 350, 351, 352, 21, 354, 296, 379, 357,
+ /* 1990 */ 379, 379, 301, 379, 303, 379, 379, 379, 379, 379,
+ /* 2000 */ 260, 379, 370, 379, 379, 379, 374, 379, 379, 379,
+ /* 2010 */ 379, 379, 379, 379, 379, 379, 379, 379, 327, 379,
+ /* 2020 */ 379, 260, 331, 332, 333, 334, 335, 336, 288, 338,
+ /* 2030 */ 379, 379, 379, 379, 379, 379, 296, 379, 379, 379,
+ /* 2040 */ 379, 301, 379, 303, 379, 379, 379, 379, 379, 288,
+ /* 2050 */ 379, 379, 379, 379, 379, 379, 379, 296, 379, 379,
+ /* 2060 */ 379, 379, 301, 379, 303, 379, 379, 327, 379, 379,
+ /* 2070 */ 260, 331, 332, 333, 334, 335, 336, 379, 338, 379,
+ /* 2080 */ 379, 379, 260, 379, 379, 379, 379, 379, 327, 379,
+ /* 2090 */ 379, 379, 331, 332, 333, 334, 335, 336, 288, 338,
+ /* 2100 */ 379, 379, 379, 379, 379, 379, 296, 379, 379, 379,
+ /* 2110 */ 288, 301, 379, 303, 379, 379, 379, 379, 296, 379,
+ /* 2120 */ 379, 379, 379, 301, 379, 303, 379, 379, 379, 379,
+ /* 2130 */ 379, 379, 379, 379, 260, 379, 379, 327, 379, 379,
+ /* 2140 */ 379, 331, 332, 333, 334, 335, 336, 379, 338, 327,
+ /* 2150 */ 379, 260, 379, 331, 332, 333, 334, 335, 336, 379,
+ /* 2160 */ 338, 379, 288, 379, 379, 379, 379, 379, 379, 379,
+ /* 2170 */ 296, 379, 379, 379, 379, 301, 379, 303, 379, 288,
+ /* 2180 */ 379, 379, 379, 379, 379, 379, 379, 296, 379, 379,
+ /* 2190 */ 379, 379, 301, 379, 303, 379, 379, 379, 379, 379,
+ /* 2200 */ 379, 327, 379, 379, 260, 331, 332, 333, 334, 335,
+ /* 2210 */ 336, 379, 338, 379, 379, 379, 379, 379, 327, 379,
+ /* 2220 */ 379, 379, 331, 332, 333, 334, 335, 336, 379, 338,
+ /* 2230 */ 379, 379, 288, 379, 379, 379, 379, 379, 379, 379,
+ /* 2240 */ 296, 379, 379, 379, 379, 301, 379, 303, 379, 379,
+ /* 2250 */ 379, 379, 379, 260, 379, 379, 379, 379, 379, 379,
+ /* 2260 */ 379, 379, 379, 379, 379, 379, 379, 379, 379, 379,
+ /* 2270 */ 379, 327, 379, 379, 379, 331, 332, 333, 334, 335,
+ /* 2280 */ 336, 288, 338, 379, 379, 379, 379, 379, 379, 296,
+ /* 2290 */ 379, 379, 379, 379, 301, 379, 303, 379, 379, 379,
+ /* 2300 */ 379, 379, 260, 379, 379, 379, 379, 379, 379, 379,
+ /* 2310 */ 379, 379, 379, 379, 379, 379, 379, 379, 260, 379,
+ /* 2320 */ 327, 379, 379, 379, 331, 332, 333, 334, 335, 336,
+ /* 2330 */ 288, 338, 379, 379, 379, 379, 379, 379, 296, 379,
+ /* 2340 */ 379, 379, 379, 301, 379, 303, 288, 379, 379, 379,
+ /* 2350 */ 379, 379, 379, 379, 296, 379, 379, 379, 379, 301,
+ /* 2360 */ 379, 303, 379, 379, 379, 379, 379, 260, 379, 327,
+ /* 2370 */ 379, 379, 379, 331, 332, 333, 334, 335, 336, 260,
+ /* 2380 */ 338, 379, 379, 379, 379, 327, 379, 379, 379, 331,
+ /* 2390 */ 332, 333, 334, 335, 336, 288, 338, 379, 379, 379,
+ /* 2400 */ 379, 379, 379, 296, 379, 379, 379, 288, 301, 379,
+ /* 2410 */ 303, 379, 379, 379, 379, 296, 379, 379, 379, 379,
+ /* 2420 */ 301, 379, 303, 379, 379, 379, 379, 379, 379, 379,
+ /* 2430 */ 379, 379, 379, 379, 327, 379, 379, 379, 331, 332,
+ /* 2440 */ 333, 334, 335, 336, 379, 338, 327, 379, 379, 379,
+ /* 2450 */ 331, 332, 333, 334, 335, 336, 379, 338,
};
#define YY_SHIFT_COUNT (665)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (1970)
+#define YY_SHIFT_MAX (1964)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326,
/* 10 */ 264, 264, 391, 593, 720, 593, 593, 593, 593, 593,
/* 20 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
/* 30 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
- /* 40 */ 593, 593, 313, 313, 199, 199, 199, 987, 987, 354,
- /* 50 */ 987, 987, 165, 341, 254, 258, 254, 79, 79, 36,
- /* 60 */ 36, 97, 18, 254, 254, 79, 79, 79, 79, 79,
- /* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 79,
- /* 80 */ 205, 79, 79, 205, 405, 79, 205, 205, 205, 79,
- /* 90 */ 158, 719, 662, 683, 683, 108, 371, 371, 371, 371,
- /* 100 */ 371, 371, 371, 371, 371, 371, 371, 371, 371, 371,
- /* 110 */ 371, 371, 371, 371, 371, 134, 419, 18, 636, 636,
- /* 120 */ 488, 551, 562, 90, 90, 90, 551, 526, 526, 170,
- /* 130 */ 16, 16, 205, 205, 323, 323, 483, 498, 198, 198,
- /* 140 */ 198, 198, 198, 198, 198, 331, 21, 167, 559, 43,
- /* 150 */ 50, 112, 168, 99, 421, 19, 530, 771, 755, 717,
- /* 160 */ 603, 717, 918, 501, 501, 501, 869, 822, 950, 1139,
- /* 170 */ 1023, 1148, 1182, 1182, 1148, 1054, 1054, 1182, 1182, 1182,
- /* 180 */ 1215, 1215, 1218, 82, 170, 82, 1225, 1226, 82, 1225,
- /* 190 */ 82, 1234, 82, 82, 1182, 82, 1215, 205, 205, 205,
- /* 200 */ 205, 205, 205, 205, 205, 205, 205, 205, 1182, 1215,
- /* 210 */ 323, 1218, 158, 1112, 170, 158, 1182, 1182, 1225, 158,
- /* 220 */ 1071, 323, 323, 323, 323, 1071, 323, 1152, 1234, 158,
- /* 230 */ 483, 158, 526, 1287, 323, 1118, 1071, 323, 323, 1118,
- /* 240 */ 1071, 323, 323, 205, 1114, 1199, 1118, 1119, 1125, 1138,
- /* 250 */ 950, 1143, 526, 1352, 1127, 1130, 1128, 1127, 1130, 1127,
- /* 260 */ 1130, 1288, 1291, 323, 498, 1182, 158, 1360, 1215, 2395,
- /* 270 */ 2395, 2395, 2395, 2395, 2395, 2395, 83, 456, 214, 307,
- /* 280 */ 208, 564, 693, 808, 824, 1044, 1053, 513, 542, 542,
- /* 290 */ 542, 542, 542, 542, 542, 542, 545, 129, 13, 13,
- /* 300 */ 236, 594, 430, 581, 387, 172, 452, 511, 106, 106,
- /* 310 */ 106, 106, 914, 963, 875, 898, 943, 945, 973, 979,
- /* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1059, 1070,
- /* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1097, 1043,
- /* 340 */ 1109, 1115, 1122, 1131, 1132, 1135, 1005, 1077, 1126, 1098,
- /* 350 */ 764, 1421, 1425, 1253, 1432, 1433, 1393, 1436, 1422, 1269,
- /* 360 */ 1430, 1431, 1434, 1273, 1467, 1435, 1438, 1284, 1468, 1289,
- /* 370 */ 1474, 1440, 1478, 1457, 1480, 1447, 1311, 1315, 1487, 1488,
- /* 380 */ 1335, 1324, 1502, 1503, 1458, 1505, 1464, 1507, 1509, 1510,
- /* 390 */ 1362, 1514, 1516, 1517, 1518, 1519, 1377, 1489, 1522, 1379,
- /* 400 */ 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536,
- /* 410 */ 1537, 1538, 1539, 1542, 1501, 1550, 1562, 1564, 1570, 1572,
- /* 420 */ 1573, 1545, 1568, 1575, 1576, 1578, 1579, 1498, 1555, 1524,
- /* 430 */ 1581, 1585, 1511, 1547, 1544, 1577, 1546, 1580, 1549, 1590,
- /* 440 */ 1556, 1558, 1599, 1600, 1602, 1565, 1442, 1605, 1607, 1610,
- /* 450 */ 1559, 1612, 1622, 1588, 1582, 1586, 1627, 1593, 1583, 1592,
- /* 460 */ 1632, 1601, 1587, 1596, 1643, 1611, 1603, 1608, 1648, 1649,
- /* 470 */ 1652, 1653, 1563, 1569, 1629, 1644, 1654, 1633, 1624, 1626,
- /* 480 */ 1635, 1636, 1650, 1674, 1655, 1675, 1656, 1630, 1676, 1658,
- /* 490 */ 1647, 1683, 1657, 1684, 1659, 1685, 1665, 1669, 1690, 1540,
- /* 500 */ 1660, 1696, 1525, 1678, 1548, 1554, 1701, 1702, 1552, 1551,
- /* 510 */ 1703, 1707, 1711, 1623, 1637, 1541, 1716, 1625, 1571, 1639,
- /* 520 */ 1725, 1691, 1594, 1640, 1642, 1686, 1706, 1515, 1645, 1662,
- /* 530 */ 1664, 1670, 1673, 1666, 1721, 1677, 1679, 1681, 1682, 1687,
- /* 540 */ 1722, 1699, 1704, 1689, 1729, 1523, 1692, 1694, 1713, 1561,
- /* 550 */ 1730, 1733, 1734, 1705, 1738, 1566, 1709, 1740, 1761, 1767,
- /* 560 */ 1768, 1769, 1776, 1709, 1812, 1793, 1628, 1773, 1728, 1736,
- /* 570 */ 1731, 1745, 1735, 1747, 1772, 1739, 1749, 1777, 1797, 1651,
- /* 580 */ 1750, 1742, 1753, 1787, 1805, 1755, 1757, 1813, 1756, 1760,
- /* 590 */ 1816, 1763, 1770, 1818, 1775, 1771, 1822, 1778, 1746, 1752,
- /* 600 */ 1758, 1759, 1836, 1765, 1785, 1786, 1827, 1788, 1830, 1830,
- /* 610 */ 1854, 1820, 1817, 1845, 1848, 1849, 1856, 1858, 1859, 1861,
- /* 620 */ 1840, 1811, 1866, 1876, 1878, 1892, 1881, 1895, 1883, 1884,
- /* 630 */ 1855, 1624, 1889, 1626, 1891, 1893, 1894, 1896, 1903, 1897,
- /* 640 */ 1927, 1898, 1887, 1899, 1930, 1900, 1912, 1901, 1936, 1904,
- /* 650 */ 1913, 1911, 1961, 1928, 1918, 1929, 1966, 1932, 1934, 1970,
- /* 660 */ 1949, 1951, 1953, 1954, 1952, 1957,
+ /* 40 */ 593, 593, 102, 102, 262, 262, 262, 1019, 1019, 267,
+ /* 50 */ 1019, 1019, 540, 139, 4, 96, 4, 6, 6, 19,
+ /* 60 */ 19, 276, 205, 4, 4, 6, 6, 6, 6, 6,
+ /* 70 */ 6, 6, 6, 6, 6, 9, 6, 6, 6, 24,
+ /* 80 */ 6, 6, 74, 6, 6, 74, 258, 6, 74, 74,
+ /* 90 */ 74, 6, 314, 719, 662, 683, 683, 150, 213, 213,
+ /* 100 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
+ /* 110 */ 213, 213, 213, 213, 213, 213, 213, 549, 693, 205,
+ /* 120 */ 494, 494, 504, 151, 507, 263, 263, 263, 151, 308,
+ /* 130 */ 308, 24, 362, 362, 74, 74, 331, 331, 319, 410,
+ /* 140 */ 198, 198, 198, 198, 198, 198, 198, 660, 21, 129,
+ /* 150 */ 368, 447, 5, 215, 268, 548, 631, 299, 843, 451,
+ /* 160 */ 425, 716, 717, 716, 853, 376, 376, 376, 774, 765,
+ /* 170 */ 916, 1128, 1006, 1136, 1162, 1162, 1136, 1050, 1050, 1162,
+ /* 180 */ 1162, 1162, 1202, 1202, 1213, 9, 24, 9, 1233, 1235,
+ /* 190 */ 9, 1233, 9, 9, 9, 1162, 9, 1202, 74, 74,
+ /* 200 */ 74, 74, 74, 74, 74, 74, 74, 74, 74, 1162,
+ /* 210 */ 1202, 331, 1213, 314, 1107, 24, 314, 1162, 1162, 1233,
+ /* 220 */ 314, 1069, 331, 331, 331, 331, 1069, 331, 1152, 314,
+ /* 230 */ 319, 314, 308, 1314, 331, 1085, 1069, 331, 331, 1085,
+ /* 240 */ 1069, 331, 331, 74, 1094, 1184, 1085, 1106, 1108, 1121,
+ /* 250 */ 916, 1130, 308, 1341, 1132, 1129, 1122, 1132, 1129, 1132,
+ /* 260 */ 1129, 1275, 1286, 331, 410, 1162, 314, 1364, 1202, 2458,
+ /* 270 */ 2458, 2458, 2458, 2458, 2458, 2458, 83, 1633, 214, 307,
+ /* 280 */ 208, 497, 533, 542, 557, 623, 955, 249, 280, 280,
+ /* 290 */ 280, 280, 280, 280, 280, 280, 607, 221, 119, 119,
+ /* 300 */ 69, 68, 127, 534, 85, 302, 8, 133, 686, 686,
+ /* 310 */ 686, 686, 902, 972, 894, 921, 932, 934, 999, 1036,
+ /* 320 */ 1076, 888, 803, 1024, 1026, 1039, 1049, 1052, 1053, 1070,
+ /* 330 */ 1117, 1008, 960, 1000, 1077, 991, 1004, 1003, 1104, 1092,
+ /* 340 */ 1111, 1113, 1114, 1119, 1125, 1127, 1060, 1137, 1138, 1033,
+ /* 350 */ 612, 1417, 1420, 1245, 1423, 1424, 1383, 1426, 1395, 1246,
+ /* 360 */ 1400, 1401, 1404, 1254, 1445, 1411, 1412, 1261, 1449, 1264,
+ /* 370 */ 1452, 1418, 1454, 1433, 1456, 1422, 1287, 1290, 1461, 1470,
+ /* 380 */ 1305, 1315, 1481, 1484, 1439, 1488, 1447, 1490, 1492, 1494,
+ /* 390 */ 1346, 1496, 1497, 1498, 1508, 1509, 1356, 1466, 1502, 1359,
+ /* 400 */ 1504, 1505, 1510, 1512, 1513, 1514, 1515, 1516, 1518, 1519,
+ /* 410 */ 1520, 1529, 1530, 1531, 1491, 1534, 1536, 1537, 1538, 1541,
+ /* 420 */ 1543, 1522, 1545, 1546, 1548, 1549, 1550, 1495, 1553, 1499,
+ /* 430 */ 1556, 1557, 1517, 1523, 1521, 1544, 1533, 1547, 1535, 1563,
+ /* 440 */ 1525, 1528, 1568, 1569, 1580, 1551, 1431, 1591, 1593, 1594,
+ /* 450 */ 1540, 1595, 1597, 1564, 1558, 1559, 1600, 1571, 1560, 1570,
+ /* 460 */ 1608, 1575, 1566, 1572, 1614, 1581, 1574, 1576, 1618, 1622,
+ /* 470 */ 1623, 1624, 1527, 1532, 1602, 1604, 1639, 1605, 1587, 1599,
+ /* 480 */ 1609, 1610, 1631, 1646, 1636, 1655, 1637, 1611, 1661, 1641,
+ /* 490 */ 1629, 1667, 1638, 1668, 1640, 1671, 1656, 1659, 1681, 1526,
+ /* 500 */ 1657, 1693, 1524, 1669, 1542, 1552, 1694, 1695, 1554, 1539,
+ /* 510 */ 1709, 1710, 1720, 1634, 1635, 1555, 1722, 1643, 1573, 1645,
+ /* 520 */ 1727, 1690, 1582, 1647, 1644, 1684, 1697, 1507, 1652, 1654,
+ /* 530 */ 1653, 1658, 1660, 1662, 1702, 1663, 1665, 1666, 1670, 1679,
+ /* 540 */ 1703, 1701, 1706, 1682, 1713, 1567, 1680, 1683, 1712, 1565,
+ /* 550 */ 1729, 1728, 1730, 1687, 1735, 1588, 1689, 1714, 1746, 1748,
+ /* 560 */ 1749, 1750, 1756, 1689, 1790, 1772, 1606, 1752, 1708, 1715,
+ /* 570 */ 1711, 1717, 1719, 1726, 1758, 1731, 1733, 1777, 1780, 1648,
+ /* 580 */ 1736, 1718, 1734, 1791, 1793, 1741, 1739, 1804, 1751, 1754,
+ /* 590 */ 1806, 1753, 1755, 1811, 1759, 1757, 1815, 1762, 1742, 1743,
+ /* 600 */ 1745, 1747, 1830, 1760, 1765, 1770, 1828, 1778, 1823, 1823,
+ /* 610 */ 1846, 1807, 1809, 1836, 1837, 1839, 1840, 1841, 1842, 1844,
+ /* 620 */ 1814, 1796, 1843, 1849, 1850, 1865, 1854, 1869, 1863, 1868,
+ /* 630 */ 1838, 1587, 1870, 1599, 1872, 1879, 1881, 1882, 1897, 1886,
+ /* 640 */ 1922, 1888, 1877, 1890, 1925, 1892, 1885, 1895, 1940, 1906,
+ /* 650 */ 1899, 1905, 1947, 1914, 1903, 1913, 1953, 1919, 1921, 1958,
+ /* 660 */ 1938, 1949, 1950, 1959, 1964, 1951,
};
#define YY_REDUCE_COUNT (275)
-#define YY_REDUCE_MIN (-357)
-#define YY_REDUCE_MAX (2055)
+#define YY_REDUCE_MIN (-341)
+#define YY_REDUCE_MAX (2119)
static const short yy_reduce_ofst[] = {
- /* 0 */ -80, -230, 650, 782, 881, 923, 976, 993, 1056, 1106,
- /* 10 */ 34, 1116, 1158, 1212, 1224, 1281, 1305, 1323, 1385, 1403,
- /* 20 */ 1455, 1473, 351, 1497, 1553, 1567, 1609, 1619, 1661, 1714,
- /* 30 */ 1732, 1784, 1794, 1810, 1864, 1880, 1890, 1906, 1975, 1993,
- /* 40 */ 2045, 2055, 376, 676, -259, 76, 142, 117, 687, -180,
- /* 50 */ -284, 747, -30, 250, 342, 345, 398, 359, 462, -264,
- /* 60 */ -256, -357, -240, -339, -244, 81, 385, 475, 666, 668,
- /* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, 855,
- /* 80 */ -273, 857, 858, 211, 31, 859, 272, 523, 363, 867,
- /* 90 */ -205, -20, -159, -159, -159, -171, -86, 95, 139, 149,
- /* 100 */ 388, 413, 420, 466, 476, 512, 514, 524, 548, 570,
- /* 110 */ 574, 588, 608, 614, 648, -233, -213, -298, -76, 53,
- /* 120 */ -215, 174, 279, 408, 431, 557, 217, 35, 275, 317,
- /* 130 */ 409, 467, 91, 540, 590, 595, 675, 565, 328, 340,
- /* 140 */ 368, 461, 468, 606, 661, 373, 705, 654, 800, 722,
- /* 150 */ 819, 777, 730, 868, 868, 876, 880, 862, 833, 811,
- /* 160 */ 811, 811, 821, 796, 799, 801, 813, 868, 850, 863,
- /* 170 */ 870, 892, 935, 936, 899, 925, 926, 942, 965, 966,
- /* 180 */ 975, 977, 919, 968, 938, 971, 928, 930, 978, 931,
- /* 190 */ 980, 952, 991, 994, 999, 996, 1012, 985, 988, 990,
- /* 200 */ 995, 998, 1000, 1003, 1004, 1007, 1009, 1010, 1014, 1013,
- /* 210 */ 983, 967, 1015, 981, 1016, 1029, 1025, 1032, 986, 1031,
- /* 220 */ 1008, 1030, 1033, 1035, 1036, 1026, 1041, 1037, 1034, 1047,
- /* 230 */ 1061, 1076, 1018, 1017, 1048, 992, 1039, 1057, 1060, 1001,
- /* 240 */ 1042, 1062, 1063, 868, 1019, 1040, 1046, 1020, 1038, 1024,
- /* 250 */ 1045, 811, 1074, 1049, 1027, 1051, 1050, 1052, 1055, 1073,
- /* 260 */ 1064, 1066, 1089, 1081, 1120, 1129, 1117, 1136, 1141, 1085,
- /* 270 */ 1093, 1133, 1134, 1140, 1142, 1162,
+ /* 0 */ 364, 650, 677, -231, 321, 790, 852, 904, 956, 983,
+ /* 10 */ 1035, 1051, 152, 1131, 1141, 1190, 1239, 1251, 1300, 1316,
+ /* 20 */ 1369, 1381, 1430, 1479, 1500, 1561, 1577, 1630, 1642, 1691,
+ /* 30 */ 1740, 1761, 1810, 1822, 1874, 1891, 1944, 1993, 2042, 2058,
+ /* 40 */ 2107, 2119, 1585, 1632, -264, -17, 225, -247, 90, 72,
+ /* 50 */ -260, 435, -297, 453, 456, 463, 685, -268, -262, -259,
+ /* 60 */ -228, 7, -190, 40, 51, -265, -42, 346, 351, 426,
+ /* 70 */ 475, 543, 737, 761, 767, 115, 769, 770, 792, -186,
+ /* 80 */ 793, 794, 147, 806, 815, -196, -104, 831, 330, 422,
+ /* 90 */ 393, 836, 538, 22, -341, -341, -341, 125, 142, 194,
+ /* 100 */ 196, 405, 481, 517, 523, 572, 588, 608, 611, 614,
+ /* 110 */ 633, 648, 651, 688, 696, 697, 699, 101, -215, -287,
+ /* 120 */ 87, 173, -235, -135, -34, 305, 406, 488, 156, 640,
+ /* 130 */ 643, 512, 266, 526, -168, 211, 449, 574, 610, 566,
+ /* 140 */ 229, 254, 294, 327, 344, 380, 400, 288, 442, 343,
+ /* 150 */ 535, 356, 580, 520, 630, 768, 768, 784, 810, 797,
+ /* 160 */ 740, 786, 786, 786, 804, 787, 795, 798, 807, 768,
+ /* 170 */ 846, 837, 859, 872, 927, 942, 903, 908, 912, 951,
+ /* 180 */ 952, 953, 961, 970, 919, 962, 943, 975, 939, 941,
+ /* 190 */ 984, 946, 990, 992, 993, 995, 994, 1005, 980, 981,
+ /* 200 */ 982, 985, 986, 987, 988, 989, 997, 1009, 1010, 1012,
+ /* 210 */ 1016, 1001, 959, 1023, 979, 998, 1034, 1028, 1037, 1007,
+ /* 220 */ 1038, 996, 1011, 1027, 1031, 1032, 1013, 1040, 1018, 1055,
+ /* 230 */ 1025, 1059, 1041, 1014, 1042, 1002, 1044, 1045, 1047, 1030,
+ /* 240 */ 1048, 1057, 1062, 768, 976, 1029, 1043, 1015, 1046, 1054,
+ /* 250 */ 1063, 786, 1064, 1061, 1022, 1056, 1020, 1058, 1066, 1067,
+ /* 260 */ 1071, 1065, 1110, 1098, 1126, 1135, 1140, 1142, 1146, 1093,
+ /* 270 */ 1097, 1133, 1134, 1139, 1147, 1155,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 10 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 20 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 30 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 40 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465,
- /* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 90 */ 1537, 1695, 1465, 1873, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 120 */ 1539, 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465,
- /* 130 */ 1738, 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465,
- /* 140 */ 1465, 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465,
- /* 150 */ 1465, 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877,
- /* 160 */ 1891, 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465,
- /* 170 */ 1723, 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465,
- /* 180 */ 1465, 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465,
- /* 190 */ 1539, 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465,
- /* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 210 */ 1465, 1465, 1537, 1732, 1465, 1537, 1465, 1465, 1465, 1537,
- /* 220 */ 1913, 1465, 1465, 1465, 1465, 1913, 1465, 1465, 1465, 1537,
- /* 230 */ 1465, 1537, 1465, 1465, 1465, 1915, 1913, 1465, 1465, 1915,
- /* 240 */ 1913, 1465, 1465, 1465, 1927, 1923, 1915, 1931, 1929, 1906,
- /* 250 */ 1904, 1891, 1465, 1465, 1945, 1941, 1957, 1945, 1941, 1945,
- /* 260 */ 1941, 1465, 1606, 1465, 1465, 1465, 1537, 1497, 1465, 1725,
- /* 270 */ 1738, 1640, 1640, 1640, 1540, 1470, 1465, 1465, 1465, 1465,
- /* 280 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1810, 1926,
- /* 290 */ 1925, 1849, 1848, 1847, 1845, 1809, 1465, 1602, 1808, 1807,
- /* 300 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1801, 1802,
- /* 310 */ 1800, 1799, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 320 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 330 */ 1874, 1465, 1942, 1946, 1465, 1465, 1465, 1465, 1465, 1784,
- /* 340 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 350 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 360 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 370 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 380 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 390 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 400 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 410 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 420 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 430 */ 1465, 1465, 1465, 1465, 1502, 1465, 1465, 1465, 1465, 1465,
- /* 440 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 450 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 460 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 470 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1574, 1573,
- /* 480 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 490 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 500 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 510 */ 1465, 1465, 1465, 1465, 1465, 1465, 1742, 1465, 1465, 1465,
- /* 520 */ 1465, 1465, 1465, 1465, 1465, 1465, 1907, 1465, 1465, 1465,
- /* 530 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 540 */ 1465, 1465, 1784, 1465, 1924, 1465, 1884, 1880, 1465, 1465,
- /* 550 */ 1876, 1783, 1465, 1465, 1940, 1465, 1465, 1465, 1465, 1465,
- /* 560 */ 1465, 1465, 1465, 1465, 1869, 1465, 1465, 1842, 1827, 1465,
- /* 570 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1795,
- /* 580 */ 1465, 1465, 1465, 1465, 1465, 1634, 1465, 1465, 1465, 1465,
- /* 590 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1619, 1617,
- /* 600 */ 1616, 1615, 1465, 1612, 1465, 1465, 1465, 1465, 1643, 1642,
- /* 610 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 620 */ 1465, 1465, 1558, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 630 */ 1465, 1550, 1465, 1549, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 640 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 650 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
- /* 660 */ 1465, 1465, 1465, 1465, 1465, 1465,
+ /* 0 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 10 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 20 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 30 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 40 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 50 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 60 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 70 */ 1463, 1463, 1463, 1463, 1463, 1537, 1463, 1463, 1463, 1463,
+ /* 80 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 90 */ 1463, 1463, 1535, 1693, 1463, 1870, 1463, 1463, 1463, 1463,
+ /* 100 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 110 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 120 */ 1463, 1463, 1537, 1463, 1535, 1882, 1882, 1882, 1463, 1463,
+ /* 130 */ 1463, 1463, 1736, 1736, 1463, 1463, 1463, 1463, 1635, 1463,
+ /* 140 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1728, 1463, 1951,
+ /* 150 */ 1463, 1463, 1463, 1734, 1905, 1463, 1463, 1463, 1463, 1588,
+ /* 160 */ 1897, 1874, 1888, 1875, 1872, 1936, 1936, 1936, 1891, 1463,
+ /* 170 */ 1901, 1463, 1721, 1698, 1463, 1463, 1698, 1695, 1695, 1463,
+ /* 180 */ 1463, 1463, 1463, 1463, 1463, 1537, 1463, 1537, 1463, 1463,
+ /* 190 */ 1537, 1463, 1537, 1537, 1537, 1463, 1537, 1463, 1463, 1463,
+ /* 200 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 210 */ 1463, 1463, 1463, 1535, 1730, 1463, 1535, 1463, 1463, 1463,
+ /* 220 */ 1535, 1910, 1463, 1463, 1463, 1463, 1910, 1463, 1463, 1535,
+ /* 230 */ 1463, 1535, 1463, 1463, 1463, 1912, 1910, 1463, 1463, 1912,
+ /* 240 */ 1910, 1463, 1463, 1463, 1924, 1920, 1912, 1928, 1926, 1903,
+ /* 250 */ 1901, 1888, 1463, 1463, 1942, 1938, 1954, 1942, 1938, 1942,
+ /* 260 */ 1938, 1463, 1604, 1463, 1463, 1463, 1535, 1495, 1463, 1723,
+ /* 270 */ 1736, 1638, 1638, 1638, 1538, 1468, 1463, 1463, 1463, 1463,
+ /* 280 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1807, 1923,
+ /* 290 */ 1922, 1846, 1845, 1844, 1842, 1806, 1463, 1600, 1805, 1804,
+ /* 300 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1798, 1799,
+ /* 310 */ 1797, 1796, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 320 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 330 */ 1871, 1463, 1939, 1943, 1463, 1463, 1463, 1463, 1463, 1782,
+ /* 340 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 350 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 360 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 370 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 380 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 390 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 400 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 410 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 420 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 430 */ 1463, 1463, 1463, 1463, 1500, 1463, 1463, 1463, 1463, 1463,
+ /* 440 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 450 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 460 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 470 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1572, 1571,
+ /* 480 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 490 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 500 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 510 */ 1463, 1463, 1463, 1463, 1463, 1463, 1740, 1463, 1463, 1463,
+ /* 520 */ 1463, 1463, 1463, 1463, 1463, 1463, 1904, 1463, 1463, 1463,
+ /* 530 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 540 */ 1463, 1463, 1782, 1463, 1921, 1463, 1881, 1877, 1463, 1463,
+ /* 550 */ 1873, 1781, 1463, 1463, 1937, 1463, 1463, 1463, 1463, 1463,
+ /* 560 */ 1463, 1463, 1463, 1463, 1866, 1463, 1463, 1839, 1824, 1463,
+ /* 570 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1792,
+ /* 580 */ 1463, 1463, 1463, 1463, 1463, 1632, 1463, 1463, 1463, 1463,
+ /* 590 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1617, 1615,
+ /* 600 */ 1614, 1613, 1463, 1610, 1463, 1463, 1463, 1463, 1641, 1640,
+ /* 610 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 620 */ 1463, 1463, 1556, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 630 */ 1463, 1548, 1463, 1547, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 640 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 650 */ 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463, 1463,
+ /* 660 */ 1463, 1463, 1463, 1463, 1463, 1463,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1546,77 +1558,76 @@ static const char *const yyTokenName[] = {
/* 306 */ "like_pattern_opt",
/* 307 */ "table_name_cond",
/* 308 */ "from_db_opt",
- /* 309 */ "index_name",
- /* 310 */ "index_options",
- /* 311 */ "func_list",
- /* 312 */ "sliding_opt",
- /* 313 */ "sma_stream_opt",
- /* 314 */ "func",
- /* 315 */ "stream_options",
- /* 316 */ "topic_name",
- /* 317 */ "query_expression",
- /* 318 */ "cgroup_name",
- /* 319 */ "analyze_opt",
- /* 320 */ "explain_options",
- /* 321 */ "agg_func_opt",
- /* 322 */ "bufsize_opt",
- /* 323 */ "stream_name",
- /* 324 */ "into_opt",
- /* 325 */ "dnode_list",
- /* 326 */ "where_clause_opt",
- /* 327 */ "signed",
- /* 328 */ "literal_func",
- /* 329 */ "literal_list",
- /* 330 */ "table_alias",
- /* 331 */ "column_alias",
- /* 332 */ "expression",
- /* 333 */ "pseudo_column",
- /* 334 */ "column_reference",
- /* 335 */ "function_expression",
- /* 336 */ "subquery",
- /* 337 */ "star_func",
- /* 338 */ "star_func_para_list",
- /* 339 */ "noarg_func",
- /* 340 */ "other_para_list",
- /* 341 */ "star_func_para",
- /* 342 */ "predicate",
- /* 343 */ "compare_op",
- /* 344 */ "in_op",
- /* 345 */ "in_predicate_value",
- /* 346 */ "boolean_value_expression",
- /* 347 */ "boolean_primary",
- /* 348 */ "common_expression",
- /* 349 */ "from_clause_opt",
- /* 350 */ "table_reference_list",
- /* 351 */ "table_reference",
- /* 352 */ "table_primary",
- /* 353 */ "joined_table",
- /* 354 */ "alias_opt",
- /* 355 */ "parenthesized_joined_table",
- /* 356 */ "join_type",
- /* 357 */ "search_condition",
- /* 358 */ "query_specification",
- /* 359 */ "set_quantifier_opt",
- /* 360 */ "select_list",
- /* 361 */ "partition_by_clause_opt",
- /* 362 */ "range_opt",
- /* 363 */ "every_opt",
- /* 364 */ "fill_opt",
- /* 365 */ "twindow_clause_opt",
- /* 366 */ "group_by_clause_opt",
- /* 367 */ "having_clause_opt",
- /* 368 */ "select_item",
- /* 369 */ "fill_mode",
- /* 370 */ "group_by_list",
- /* 371 */ "query_expression_body",
- /* 372 */ "order_by_clause_opt",
- /* 373 */ "slimit_clause_opt",
- /* 374 */ "limit_clause_opt",
- /* 375 */ "query_primary",
- /* 376 */ "sort_specification_list",
- /* 377 */ "sort_specification",
- /* 378 */ "ordering_specification_opt",
- /* 379 */ "null_ordering_opt",
+ /* 309 */ "index_options",
+ /* 310 */ "func_list",
+ /* 311 */ "sliding_opt",
+ /* 312 */ "sma_stream_opt",
+ /* 313 */ "func",
+ /* 314 */ "stream_options",
+ /* 315 */ "topic_name",
+ /* 316 */ "query_expression",
+ /* 317 */ "cgroup_name",
+ /* 318 */ "analyze_opt",
+ /* 319 */ "explain_options",
+ /* 320 */ "agg_func_opt",
+ /* 321 */ "bufsize_opt",
+ /* 322 */ "stream_name",
+ /* 323 */ "into_opt",
+ /* 324 */ "dnode_list",
+ /* 325 */ "where_clause_opt",
+ /* 326 */ "signed",
+ /* 327 */ "literal_func",
+ /* 328 */ "literal_list",
+ /* 329 */ "table_alias",
+ /* 330 */ "column_alias",
+ /* 331 */ "expression",
+ /* 332 */ "pseudo_column",
+ /* 333 */ "column_reference",
+ /* 334 */ "function_expression",
+ /* 335 */ "subquery",
+ /* 336 */ "star_func",
+ /* 337 */ "star_func_para_list",
+ /* 338 */ "noarg_func",
+ /* 339 */ "other_para_list",
+ /* 340 */ "star_func_para",
+ /* 341 */ "predicate",
+ /* 342 */ "compare_op",
+ /* 343 */ "in_op",
+ /* 344 */ "in_predicate_value",
+ /* 345 */ "boolean_value_expression",
+ /* 346 */ "boolean_primary",
+ /* 347 */ "common_expression",
+ /* 348 */ "from_clause_opt",
+ /* 349 */ "table_reference_list",
+ /* 350 */ "table_reference",
+ /* 351 */ "table_primary",
+ /* 352 */ "joined_table",
+ /* 353 */ "alias_opt",
+ /* 354 */ "parenthesized_joined_table",
+ /* 355 */ "join_type",
+ /* 356 */ "search_condition",
+ /* 357 */ "query_specification",
+ /* 358 */ "set_quantifier_opt",
+ /* 359 */ "select_list",
+ /* 360 */ "partition_by_clause_opt",
+ /* 361 */ "range_opt",
+ /* 362 */ "every_opt",
+ /* 363 */ "fill_opt",
+ /* 364 */ "twindow_clause_opt",
+ /* 365 */ "group_by_clause_opt",
+ /* 366 */ "having_clause_opt",
+ /* 367 */ "select_item",
+ /* 368 */ "fill_mode",
+ /* 369 */ "group_by_list",
+ /* 370 */ "query_expression_body",
+ /* 371 */ "order_by_clause_opt",
+ /* 372 */ "slimit_clause_opt",
+ /* 373 */ "limit_clause_opt",
+ /* 374 */ "query_primary",
+ /* 375 */ "sort_specification_list",
+ /* 376 */ "sort_specification",
+ /* 377 */ "ordering_specification_opt",
+ /* 378 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1858,8 +1869,8 @@ static const char *const yyRuleName[] = {
/* 231 */ "table_name_cond ::= table_name",
/* 232 */ "from_db_opt ::=",
/* 233 */ "from_db_opt ::= FROM db_name",
- /* 234 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options",
- /* 235 */ "cmd ::= DROP INDEX exists_opt index_name",
+ /* 234 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options",
+ /* 235 */ "cmd ::= DROP INDEX exists_opt full_table_name",
/* 236 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
/* 237 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
/* 238 */ "func_list ::= func",
@@ -1945,177 +1956,176 @@ static const char *const yyRuleName[] = {
/* 318 */ "table_alias ::= NK_ID",
/* 319 */ "column_alias ::= NK_ID",
/* 320 */ "user_name ::= NK_ID",
- /* 321 */ "index_name ::= NK_ID",
- /* 322 */ "topic_name ::= NK_ID",
- /* 323 */ "stream_name ::= NK_ID",
- /* 324 */ "cgroup_name ::= NK_ID",
- /* 325 */ "expression ::= literal",
- /* 326 */ "expression ::= pseudo_column",
- /* 327 */ "expression ::= column_reference",
- /* 328 */ "expression ::= function_expression",
- /* 329 */ "expression ::= subquery",
- /* 330 */ "expression ::= NK_LP expression NK_RP",
- /* 331 */ "expression ::= NK_PLUS expression",
- /* 332 */ "expression ::= NK_MINUS expression",
- /* 333 */ "expression ::= expression NK_PLUS expression",
- /* 334 */ "expression ::= expression NK_MINUS expression",
- /* 335 */ "expression ::= expression NK_STAR expression",
- /* 336 */ "expression ::= expression NK_SLASH expression",
- /* 337 */ "expression ::= expression NK_REM expression",
- /* 338 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 339 */ "expression ::= expression NK_BITAND expression",
- /* 340 */ "expression ::= expression NK_BITOR expression",
- /* 341 */ "expression_list ::= expression",
- /* 342 */ "expression_list ::= expression_list NK_COMMA expression",
- /* 343 */ "column_reference ::= column_name",
- /* 344 */ "column_reference ::= table_name NK_DOT column_name",
- /* 345 */ "pseudo_column ::= ROWTS",
- /* 346 */ "pseudo_column ::= TBNAME",
- /* 347 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 348 */ "pseudo_column ::= QSTART",
- /* 349 */ "pseudo_column ::= QEND",
- /* 350 */ "pseudo_column ::= QDURATION",
- /* 351 */ "pseudo_column ::= WSTART",
- /* 352 */ "pseudo_column ::= WEND",
- /* 353 */ "pseudo_column ::= WDURATION",
- /* 354 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 355 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 356 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
- /* 357 */ "function_expression ::= literal_func",
- /* 358 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 359 */ "literal_func ::= NOW",
- /* 360 */ "noarg_func ::= NOW",
- /* 361 */ "noarg_func ::= TODAY",
- /* 362 */ "noarg_func ::= TIMEZONE",
- /* 363 */ "noarg_func ::= DATABASE",
- /* 364 */ "noarg_func ::= CLIENT_VERSION",
- /* 365 */ "noarg_func ::= SERVER_VERSION",
- /* 366 */ "noarg_func ::= SERVER_STATUS",
- /* 367 */ "noarg_func ::= CURRENT_USER",
- /* 368 */ "noarg_func ::= USER",
- /* 369 */ "star_func ::= COUNT",
- /* 370 */ "star_func ::= FIRST",
- /* 371 */ "star_func ::= LAST",
- /* 372 */ "star_func ::= LAST_ROW",
- /* 373 */ "star_func_para_list ::= NK_STAR",
- /* 374 */ "star_func_para_list ::= other_para_list",
- /* 375 */ "other_para_list ::= star_func_para",
- /* 376 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 377 */ "star_func_para ::= expression",
- /* 378 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 379 */ "predicate ::= expression compare_op expression",
- /* 380 */ "predicate ::= expression BETWEEN expression AND expression",
- /* 381 */ "predicate ::= expression NOT BETWEEN expression AND expression",
- /* 382 */ "predicate ::= expression IS NULL",
- /* 383 */ "predicate ::= expression IS NOT NULL",
- /* 384 */ "predicate ::= expression in_op in_predicate_value",
- /* 385 */ "compare_op ::= NK_LT",
- /* 386 */ "compare_op ::= NK_GT",
- /* 387 */ "compare_op ::= NK_LE",
- /* 388 */ "compare_op ::= NK_GE",
- /* 389 */ "compare_op ::= NK_NE",
- /* 390 */ "compare_op ::= NK_EQ",
- /* 391 */ "compare_op ::= LIKE",
- /* 392 */ "compare_op ::= NOT LIKE",
- /* 393 */ "compare_op ::= MATCH",
- /* 394 */ "compare_op ::= NMATCH",
- /* 395 */ "compare_op ::= CONTAINS",
- /* 396 */ "in_op ::= IN",
- /* 397 */ "in_op ::= NOT IN",
- /* 398 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 399 */ "boolean_value_expression ::= boolean_primary",
- /* 400 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 401 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 402 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 403 */ "boolean_primary ::= predicate",
- /* 404 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 405 */ "common_expression ::= expression",
- /* 406 */ "common_expression ::= boolean_value_expression",
- /* 407 */ "from_clause_opt ::=",
- /* 408 */ "from_clause_opt ::= FROM table_reference_list",
- /* 409 */ "table_reference_list ::= table_reference",
- /* 410 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 411 */ "table_reference ::= table_primary",
- /* 412 */ "table_reference ::= joined_table",
- /* 413 */ "table_primary ::= table_name alias_opt",
- /* 414 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 415 */ "table_primary ::= subquery alias_opt",
- /* 416 */ "table_primary ::= parenthesized_joined_table",
- /* 417 */ "alias_opt ::=",
- /* 418 */ "alias_opt ::= table_alias",
- /* 419 */ "alias_opt ::= AS table_alias",
- /* 420 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 421 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 422 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 423 */ "join_type ::=",
- /* 424 */ "join_type ::= INNER",
- /* 425 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 426 */ "set_quantifier_opt ::=",
- /* 427 */ "set_quantifier_opt ::= DISTINCT",
- /* 428 */ "set_quantifier_opt ::= ALL",
- /* 429 */ "select_list ::= select_item",
- /* 430 */ "select_list ::= select_list NK_COMMA select_item",
- /* 431 */ "select_item ::= NK_STAR",
- /* 432 */ "select_item ::= common_expression",
- /* 433 */ "select_item ::= common_expression column_alias",
- /* 434 */ "select_item ::= common_expression AS column_alias",
- /* 435 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 436 */ "where_clause_opt ::=",
- /* 437 */ "where_clause_opt ::= WHERE search_condition",
- /* 438 */ "partition_by_clause_opt ::=",
- /* 439 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
- /* 440 */ "twindow_clause_opt ::=",
- /* 441 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 442 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
- /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 444 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 445 */ "sliding_opt ::=",
- /* 446 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 447 */ "fill_opt ::=",
- /* 448 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 449 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 450 */ "fill_mode ::= NONE",
- /* 451 */ "fill_mode ::= PREV",
- /* 452 */ "fill_mode ::= NULL",
- /* 453 */ "fill_mode ::= LINEAR",
- /* 454 */ "fill_mode ::= NEXT",
- /* 455 */ "group_by_clause_opt ::=",
- /* 456 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 457 */ "group_by_list ::= expression",
- /* 458 */ "group_by_list ::= group_by_list NK_COMMA expression",
- /* 459 */ "having_clause_opt ::=",
- /* 460 */ "having_clause_opt ::= HAVING search_condition",
- /* 461 */ "range_opt ::=",
- /* 462 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
- /* 463 */ "every_opt ::=",
- /* 464 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 465 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 466 */ "query_expression_body ::= query_primary",
- /* 467 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
- /* 468 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
- /* 469 */ "query_primary ::= query_specification",
- /* 470 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
- /* 471 */ "order_by_clause_opt ::=",
- /* 472 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 473 */ "slimit_clause_opt ::=",
- /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 476 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 477 */ "limit_clause_opt ::=",
- /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 480 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 481 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 482 */ "search_condition ::= common_expression",
- /* 483 */ "sort_specification_list ::= sort_specification",
- /* 484 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 485 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
- /* 486 */ "ordering_specification_opt ::=",
- /* 487 */ "ordering_specification_opt ::= ASC",
- /* 488 */ "ordering_specification_opt ::= DESC",
- /* 489 */ "null_ordering_opt ::=",
- /* 490 */ "null_ordering_opt ::= NULLS FIRST",
- /* 491 */ "null_ordering_opt ::= NULLS LAST",
+ /* 321 */ "topic_name ::= NK_ID",
+ /* 322 */ "stream_name ::= NK_ID",
+ /* 323 */ "cgroup_name ::= NK_ID",
+ /* 324 */ "expression ::= literal",
+ /* 325 */ "expression ::= pseudo_column",
+ /* 326 */ "expression ::= column_reference",
+ /* 327 */ "expression ::= function_expression",
+ /* 328 */ "expression ::= subquery",
+ /* 329 */ "expression ::= NK_LP expression NK_RP",
+ /* 330 */ "expression ::= NK_PLUS expression",
+ /* 331 */ "expression ::= NK_MINUS expression",
+ /* 332 */ "expression ::= expression NK_PLUS expression",
+ /* 333 */ "expression ::= expression NK_MINUS expression",
+ /* 334 */ "expression ::= expression NK_STAR expression",
+ /* 335 */ "expression ::= expression NK_SLASH expression",
+ /* 336 */ "expression ::= expression NK_REM expression",
+ /* 337 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 338 */ "expression ::= expression NK_BITAND expression",
+ /* 339 */ "expression ::= expression NK_BITOR expression",
+ /* 340 */ "expression_list ::= expression",
+ /* 341 */ "expression_list ::= expression_list NK_COMMA expression",
+ /* 342 */ "column_reference ::= column_name",
+ /* 343 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 344 */ "pseudo_column ::= ROWTS",
+ /* 345 */ "pseudo_column ::= TBNAME",
+ /* 346 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 347 */ "pseudo_column ::= QSTART",
+ /* 348 */ "pseudo_column ::= QEND",
+ /* 349 */ "pseudo_column ::= QDURATION",
+ /* 350 */ "pseudo_column ::= WSTART",
+ /* 351 */ "pseudo_column ::= WEND",
+ /* 352 */ "pseudo_column ::= WDURATION",
+ /* 353 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 354 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 355 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
+ /* 356 */ "function_expression ::= literal_func",
+ /* 357 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 358 */ "literal_func ::= NOW",
+ /* 359 */ "noarg_func ::= NOW",
+ /* 360 */ "noarg_func ::= TODAY",
+ /* 361 */ "noarg_func ::= TIMEZONE",
+ /* 362 */ "noarg_func ::= DATABASE",
+ /* 363 */ "noarg_func ::= CLIENT_VERSION",
+ /* 364 */ "noarg_func ::= SERVER_VERSION",
+ /* 365 */ "noarg_func ::= SERVER_STATUS",
+ /* 366 */ "noarg_func ::= CURRENT_USER",
+ /* 367 */ "noarg_func ::= USER",
+ /* 368 */ "star_func ::= COUNT",
+ /* 369 */ "star_func ::= FIRST",
+ /* 370 */ "star_func ::= LAST",
+ /* 371 */ "star_func ::= LAST_ROW",
+ /* 372 */ "star_func_para_list ::= NK_STAR",
+ /* 373 */ "star_func_para_list ::= other_para_list",
+ /* 374 */ "other_para_list ::= star_func_para",
+ /* 375 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 376 */ "star_func_para ::= expression",
+ /* 377 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 378 */ "predicate ::= expression compare_op expression",
+ /* 379 */ "predicate ::= expression BETWEEN expression AND expression",
+ /* 380 */ "predicate ::= expression NOT BETWEEN expression AND expression",
+ /* 381 */ "predicate ::= expression IS NULL",
+ /* 382 */ "predicate ::= expression IS NOT NULL",
+ /* 383 */ "predicate ::= expression in_op in_predicate_value",
+ /* 384 */ "compare_op ::= NK_LT",
+ /* 385 */ "compare_op ::= NK_GT",
+ /* 386 */ "compare_op ::= NK_LE",
+ /* 387 */ "compare_op ::= NK_GE",
+ /* 388 */ "compare_op ::= NK_NE",
+ /* 389 */ "compare_op ::= NK_EQ",
+ /* 390 */ "compare_op ::= LIKE",
+ /* 391 */ "compare_op ::= NOT LIKE",
+ /* 392 */ "compare_op ::= MATCH",
+ /* 393 */ "compare_op ::= NMATCH",
+ /* 394 */ "compare_op ::= CONTAINS",
+ /* 395 */ "in_op ::= IN",
+ /* 396 */ "in_op ::= NOT IN",
+ /* 397 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 398 */ "boolean_value_expression ::= boolean_primary",
+ /* 399 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 400 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 401 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 402 */ "boolean_primary ::= predicate",
+ /* 403 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 404 */ "common_expression ::= expression",
+ /* 405 */ "common_expression ::= boolean_value_expression",
+ /* 406 */ "from_clause_opt ::=",
+ /* 407 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 408 */ "table_reference_list ::= table_reference",
+ /* 409 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 410 */ "table_reference ::= table_primary",
+ /* 411 */ "table_reference ::= joined_table",
+ /* 412 */ "table_primary ::= table_name alias_opt",
+ /* 413 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 414 */ "table_primary ::= subquery alias_opt",
+ /* 415 */ "table_primary ::= parenthesized_joined_table",
+ /* 416 */ "alias_opt ::=",
+ /* 417 */ "alias_opt ::= table_alias",
+ /* 418 */ "alias_opt ::= AS table_alias",
+ /* 419 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 420 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 421 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 422 */ "join_type ::=",
+ /* 423 */ "join_type ::= INNER",
+ /* 424 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 425 */ "set_quantifier_opt ::=",
+ /* 426 */ "set_quantifier_opt ::= DISTINCT",
+ /* 427 */ "set_quantifier_opt ::= ALL",
+ /* 428 */ "select_list ::= select_item",
+ /* 429 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 430 */ "select_item ::= NK_STAR",
+ /* 431 */ "select_item ::= common_expression",
+ /* 432 */ "select_item ::= common_expression column_alias",
+ /* 433 */ "select_item ::= common_expression AS column_alias",
+ /* 434 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 435 */ "where_clause_opt ::=",
+ /* 436 */ "where_clause_opt ::= WHERE search_condition",
+ /* 437 */ "partition_by_clause_opt ::=",
+ /* 438 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
+ /* 439 */ "twindow_clause_opt ::=",
+ /* 440 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 441 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
+ /* 442 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 444 */ "sliding_opt ::=",
+ /* 445 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 446 */ "fill_opt ::=",
+ /* 447 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 448 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 449 */ "fill_mode ::= NONE",
+ /* 450 */ "fill_mode ::= PREV",
+ /* 451 */ "fill_mode ::= NULL",
+ /* 452 */ "fill_mode ::= LINEAR",
+ /* 453 */ "fill_mode ::= NEXT",
+ /* 454 */ "group_by_clause_opt ::=",
+ /* 455 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 456 */ "group_by_list ::= expression",
+ /* 457 */ "group_by_list ::= group_by_list NK_COMMA expression",
+ /* 458 */ "having_clause_opt ::=",
+ /* 459 */ "having_clause_opt ::= HAVING search_condition",
+ /* 460 */ "range_opt ::=",
+ /* 461 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP",
+ /* 462 */ "every_opt ::=",
+ /* 463 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 464 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 465 */ "query_expression_body ::= query_primary",
+ /* 466 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
+ /* 467 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
+ /* 468 */ "query_primary ::= query_specification",
+ /* 469 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
+ /* 470 */ "order_by_clause_opt ::=",
+ /* 471 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 472 */ "slimit_clause_opt ::=",
+ /* 473 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 476 */ "limit_clause_opt ::=",
+ /* 477 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 480 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 481 */ "search_condition ::= common_expression",
+ /* 482 */ "sort_specification_list ::= sort_specification",
+ /* 483 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 484 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
+ /* 485 */ "ordering_specification_opt ::=",
+ /* 486 */ "ordering_specification_opt ::= ASC",
+ /* 487 */ "ordering_specification_opt ::= DESC",
+ /* 488 */ "null_ordering_opt ::=",
+ /* 489 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 490 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2262,55 +2272,55 @@ static void yy_destructor(
case 306: /* like_pattern_opt */
case 307: /* table_name_cond */
case 308: /* from_db_opt */
- case 310: /* index_options */
- case 312: /* sliding_opt */
- case 313: /* sma_stream_opt */
- case 314: /* func */
- case 315: /* stream_options */
- case 317: /* query_expression */
- case 320: /* explain_options */
- case 324: /* into_opt */
- case 326: /* where_clause_opt */
- case 327: /* signed */
- case 328: /* literal_func */
- case 332: /* expression */
- case 333: /* pseudo_column */
- case 334: /* column_reference */
- case 335: /* function_expression */
- case 336: /* subquery */
- case 341: /* star_func_para */
- case 342: /* predicate */
- case 345: /* in_predicate_value */
- case 346: /* boolean_value_expression */
- case 347: /* boolean_primary */
- case 348: /* common_expression */
- case 349: /* from_clause_opt */
- case 350: /* table_reference_list */
- case 351: /* table_reference */
- case 352: /* table_primary */
- case 353: /* joined_table */
- case 355: /* parenthesized_joined_table */
- case 357: /* search_condition */
- case 358: /* query_specification */
- case 362: /* range_opt */
- case 363: /* every_opt */
- case 364: /* fill_opt */
- case 365: /* twindow_clause_opt */
- case 367: /* having_clause_opt */
- case 368: /* select_item */
- case 371: /* query_expression_body */
- case 373: /* slimit_clause_opt */
- case 374: /* limit_clause_opt */
- case 375: /* query_primary */
- case 377: /* sort_specification */
+ case 309: /* index_options */
+ case 311: /* sliding_opt */
+ case 312: /* sma_stream_opt */
+ case 313: /* func */
+ case 314: /* stream_options */
+ case 316: /* query_expression */
+ case 319: /* explain_options */
+ case 323: /* into_opt */
+ case 325: /* where_clause_opt */
+ case 326: /* signed */
+ case 327: /* literal_func */
+ case 331: /* expression */
+ case 332: /* pseudo_column */
+ case 333: /* column_reference */
+ case 334: /* function_expression */
+ case 335: /* subquery */
+ case 340: /* star_func_para */
+ case 341: /* predicate */
+ case 344: /* in_predicate_value */
+ case 345: /* boolean_value_expression */
+ case 346: /* boolean_primary */
+ case 347: /* common_expression */
+ case 348: /* from_clause_opt */
+ case 349: /* table_reference_list */
+ case 350: /* table_reference */
+ case 351: /* table_primary */
+ case 352: /* joined_table */
+ case 354: /* parenthesized_joined_table */
+ case 356: /* search_condition */
+ case 357: /* query_specification */
+ case 361: /* range_opt */
+ case 362: /* every_opt */
+ case 363: /* fill_opt */
+ case 364: /* twindow_clause_opt */
+ case 366: /* having_clause_opt */
+ case 367: /* select_item */
+ case 370: /* query_expression_body */
+ case 372: /* slimit_clause_opt */
+ case 373: /* limit_clause_opt */
+ case 374: /* query_primary */
+ case 376: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy712));
+ nodesDestroyNode((yypminor->yy616));
}
break;
case 258: /* account_options */
case 259: /* alter_account_options */
case 261: /* alter_account_option */
- case 322: /* bufsize_opt */
+ case 321: /* bufsize_opt */
{
}
@@ -2322,15 +2332,14 @@ static void yy_destructor(
case 288: /* column_name */
case 296: /* table_name */
case 303: /* function_name */
- case 309: /* index_name */
- case 316: /* topic_name */
- case 318: /* cgroup_name */
- case 323: /* stream_name */
- case 330: /* table_alias */
- case 331: /* column_alias */
- case 337: /* star_func */
- case 339: /* noarg_func */
- case 354: /* alias_opt */
+ case 315: /* topic_name */
+ case 317: /* cgroup_name */
+ case 322: /* stream_name */
+ case 329: /* table_alias */
+ case 330: /* column_alias */
+ case 336: /* star_func */
+ case 338: /* noarg_func */
+ case 353: /* alias_opt */
{
}
@@ -2349,9 +2358,9 @@ static void yy_destructor(
break;
case 270: /* not_exists_opt */
case 272: /* exists_opt */
- case 319: /* analyze_opt */
- case 321: /* agg_func_opt */
- case 359: /* set_quantifier_opt */
+ case 318: /* analyze_opt */
+ case 320: /* agg_func_opt */
+ case 358: /* set_quantifier_opt */
{
}
@@ -2369,19 +2378,19 @@ static void yy_destructor(
case 295: /* col_name_list */
case 298: /* duration_list */
case 299: /* rollup_func_list */
- case 311: /* func_list */
- case 325: /* dnode_list */
- case 329: /* literal_list */
- case 338: /* star_func_para_list */
- case 340: /* other_para_list */
- case 360: /* select_list */
- case 361: /* partition_by_clause_opt */
- case 366: /* group_by_clause_opt */
- case 370: /* group_by_list */
- case 372: /* order_by_clause_opt */
- case 376: /* sort_specification_list */
+ case 310: /* func_list */
+ case 324: /* dnode_list */
+ case 328: /* literal_list */
+ case 337: /* star_func_para_list */
+ case 339: /* other_para_list */
+ case 359: /* select_list */
+ case 360: /* partition_by_clause_opt */
+ case 365: /* group_by_clause_opt */
+ case 369: /* group_by_list */
+ case 371: /* order_by_clause_opt */
+ case 375: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy464));
+ nodesDestroyList((yypminor->yy356));
}
break;
case 277: /* alter_db_option */
@@ -2395,28 +2404,28 @@ static void yy_destructor(
}
break;
- case 343: /* compare_op */
- case 344: /* in_op */
+ case 342: /* compare_op */
+ case 343: /* in_op */
{
}
break;
- case 356: /* join_type */
+ case 355: /* join_type */
{
}
break;
- case 369: /* fill_mode */
+ case 368: /* fill_mode */
{
}
break;
- case 378: /* ordering_specification_opt */
+ case 377: /* ordering_specification_opt */
{
}
break;
- case 379: /* null_ordering_opt */
+ case 378: /* null_ordering_opt */
{
}
@@ -2949,16 +2958,16 @@ static const struct {
{ 307, -1 }, /* (231) table_name_cond ::= table_name */
{ 308, 0 }, /* (232) from_db_opt ::= */
{ 308, -2 }, /* (233) from_db_opt ::= FROM db_name */
- { 257, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options */
- { 257, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */
- { 310, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- { 310, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
- { 311, -1 }, /* (238) func_list ::= func */
- { 311, -3 }, /* (239) func_list ::= func_list NK_COMMA func */
- { 314, -4 }, /* (240) func ::= function_name NK_LP expression_list NK_RP */
- { 313, 0 }, /* (241) sma_stream_opt ::= */
- { 313, -3 }, /* (242) sma_stream_opt ::= stream_options WATERMARK duration_literal */
- { 313, -3 }, /* (243) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
+ { 257, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+ { 257, -4 }, /* (235) cmd ::= DROP INDEX exists_opt full_table_name */
+ { 309, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 309, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
+ { 310, -1 }, /* (238) func_list ::= func */
+ { 310, -3 }, /* (239) func_list ::= func_list NK_COMMA func */
+ { 313, -4 }, /* (240) func ::= function_name NK_LP expression_list NK_RP */
+ { 312, 0 }, /* (241) sma_stream_opt ::= */
+ { 312, -3 }, /* (242) sma_stream_opt ::= stream_options WATERMARK duration_literal */
+ { 312, -3 }, /* (243) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
{ 257, -6 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
{ 257, -7 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
{ 257, -9 }, /* (246) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
@@ -2970,27 +2979,27 @@ static const struct {
{ 257, -2 }, /* (252) cmd ::= DESCRIBE full_table_name */
{ 257, -3 }, /* (253) cmd ::= RESET QUERY CACHE */
{ 257, -4 }, /* (254) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
- { 319, 0 }, /* (255) analyze_opt ::= */
- { 319, -1 }, /* (256) analyze_opt ::= ANALYZE */
- { 320, 0 }, /* (257) explain_options ::= */
- { 320, -3 }, /* (258) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 320, -3 }, /* (259) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 318, 0 }, /* (255) analyze_opt ::= */
+ { 318, -1 }, /* (256) analyze_opt ::= ANALYZE */
+ { 319, 0 }, /* (257) explain_options ::= */
+ { 319, -3 }, /* (258) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 319, -3 }, /* (259) explain_options ::= explain_options RATIO NK_FLOAT */
{ 257, -10 }, /* (260) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
{ 257, -4 }, /* (261) cmd ::= DROP FUNCTION exists_opt function_name */
- { 321, 0 }, /* (262) agg_func_opt ::= */
- { 321, -1 }, /* (263) agg_func_opt ::= AGGREGATE */
- { 322, 0 }, /* (264) bufsize_opt ::= */
- { 322, -2 }, /* (265) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 320, 0 }, /* (262) agg_func_opt ::= */
+ { 320, -1 }, /* (263) agg_func_opt ::= AGGREGATE */
+ { 321, 0 }, /* (264) bufsize_opt ::= */
+ { 321, -2 }, /* (265) bufsize_opt ::= BUFSIZE NK_INTEGER */
{ 257, -8 }, /* (266) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
{ 257, -4 }, /* (267) cmd ::= DROP STREAM exists_opt stream_name */
- { 324, 0 }, /* (268) into_opt ::= */
- { 324, -2 }, /* (269) into_opt ::= INTO full_table_name */
- { 315, 0 }, /* (270) stream_options ::= */
- { 315, -3 }, /* (271) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 315, -3 }, /* (272) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 315, -4 }, /* (273) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- { 315, -3 }, /* (274) stream_options ::= stream_options WATERMARK duration_literal */
- { 315, -3 }, /* (275) stream_options ::= stream_options IGNORE EXPIRED */
+ { 323, 0 }, /* (268) into_opt ::= */
+ { 323, -2 }, /* (269) into_opt ::= INTO full_table_name */
+ { 314, 0 }, /* (270) stream_options ::= */
+ { 314, -3 }, /* (271) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 314, -3 }, /* (272) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 314, -4 }, /* (273) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ { 314, -3 }, /* (274) stream_options ::= stream_options WATERMARK duration_literal */
+ { 314, -3 }, /* (275) stream_options ::= stream_options IGNORE EXPIRED */
{ 257, -3 }, /* (276) cmd ::= KILL CONNECTION NK_INTEGER */
{ 257, -3 }, /* (277) cmd ::= KILL QUERY NK_STRING */
{ 257, -3 }, /* (278) cmd ::= KILL TRANSACTION NK_INTEGER */
@@ -2998,8 +3007,8 @@ static const struct {
{ 257, -4 }, /* (280) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ 257, -4 }, /* (281) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
{ 257, -3 }, /* (282) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 325, -2 }, /* (283) dnode_list ::= DNODE NK_INTEGER */
- { 325, -3 }, /* (284) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 324, -2 }, /* (283) dnode_list ::= DNODE NK_INTEGER */
+ { 324, -3 }, /* (284) dnode_list ::= dnode_list DNODE NK_INTEGER */
{ 257, -4 }, /* (285) cmd ::= DELETE FROM full_table_name where_clause_opt */
{ 257, -1 }, /* (286) cmd ::= query_expression */
{ 257, -7 }, /* (287) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
@@ -3013,12 +3022,12 @@ static const struct {
{ 260, -1 }, /* (295) literal ::= NULL */
{ 260, -1 }, /* (296) literal ::= NK_QUESTION */
{ 301, -1 }, /* (297) duration_literal ::= NK_VARIABLE */
- { 327, -1 }, /* (298) signed ::= NK_INTEGER */
- { 327, -2 }, /* (299) signed ::= NK_PLUS NK_INTEGER */
- { 327, -2 }, /* (300) signed ::= NK_MINUS NK_INTEGER */
- { 327, -1 }, /* (301) signed ::= NK_FLOAT */
- { 327, -2 }, /* (302) signed ::= NK_PLUS NK_FLOAT */
- { 327, -2 }, /* (303) signed ::= NK_MINUS NK_FLOAT */
+ { 326, -1 }, /* (298) signed ::= NK_INTEGER */
+ { 326, -2 }, /* (299) signed ::= NK_PLUS NK_INTEGER */
+ { 326, -2 }, /* (300) signed ::= NK_MINUS NK_INTEGER */
+ { 326, -1 }, /* (301) signed ::= NK_FLOAT */
+ { 326, -2 }, /* (302) signed ::= NK_PLUS NK_FLOAT */
+ { 326, -2 }, /* (303) signed ::= NK_MINUS NK_FLOAT */
{ 290, -1 }, /* (304) signed_literal ::= signed */
{ 290, -1 }, /* (305) signed_literal ::= NK_STRING */
{ 290, -1 }, /* (306) signed_literal ::= NK_BOOL */
@@ -3027,186 +3036,185 @@ static const struct {
{ 290, -1 }, /* (309) signed_literal ::= NULL */
{ 290, -1 }, /* (310) signed_literal ::= literal_func */
{ 290, -1 }, /* (311) signed_literal ::= NK_QUESTION */
- { 329, -1 }, /* (312) literal_list ::= signed_literal */
- { 329, -3 }, /* (313) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 328, -1 }, /* (312) literal_list ::= signed_literal */
+ { 328, -3 }, /* (313) literal_list ::= literal_list NK_COMMA signed_literal */
{ 268, -1 }, /* (314) db_name ::= NK_ID */
{ 296, -1 }, /* (315) table_name ::= NK_ID */
{ 288, -1 }, /* (316) column_name ::= NK_ID */
{ 303, -1 }, /* (317) function_name ::= NK_ID */
- { 330, -1 }, /* (318) table_alias ::= NK_ID */
- { 331, -1 }, /* (319) column_alias ::= NK_ID */
+ { 329, -1 }, /* (318) table_alias ::= NK_ID */
+ { 330, -1 }, /* (319) column_alias ::= NK_ID */
{ 262, -1 }, /* (320) user_name ::= NK_ID */
- { 309, -1 }, /* (321) index_name ::= NK_ID */
- { 316, -1 }, /* (322) topic_name ::= NK_ID */
- { 323, -1 }, /* (323) stream_name ::= NK_ID */
- { 318, -1 }, /* (324) cgroup_name ::= NK_ID */
- { 332, -1 }, /* (325) expression ::= literal */
- { 332, -1 }, /* (326) expression ::= pseudo_column */
- { 332, -1 }, /* (327) expression ::= column_reference */
- { 332, -1 }, /* (328) expression ::= function_expression */
- { 332, -1 }, /* (329) expression ::= subquery */
- { 332, -3 }, /* (330) expression ::= NK_LP expression NK_RP */
- { 332, -2 }, /* (331) expression ::= NK_PLUS expression */
- { 332, -2 }, /* (332) expression ::= NK_MINUS expression */
- { 332, -3 }, /* (333) expression ::= expression NK_PLUS expression */
- { 332, -3 }, /* (334) expression ::= expression NK_MINUS expression */
- { 332, -3 }, /* (335) expression ::= expression NK_STAR expression */
- { 332, -3 }, /* (336) expression ::= expression NK_SLASH expression */
- { 332, -3 }, /* (337) expression ::= expression NK_REM expression */
- { 332, -3 }, /* (338) expression ::= column_reference NK_ARROW NK_STRING */
- { 332, -3 }, /* (339) expression ::= expression NK_BITAND expression */
- { 332, -3 }, /* (340) expression ::= expression NK_BITOR expression */
- { 293, -1 }, /* (341) expression_list ::= expression */
- { 293, -3 }, /* (342) expression_list ::= expression_list NK_COMMA expression */
- { 334, -1 }, /* (343) column_reference ::= column_name */
- { 334, -3 }, /* (344) column_reference ::= table_name NK_DOT column_name */
- { 333, -1 }, /* (345) pseudo_column ::= ROWTS */
- { 333, -1 }, /* (346) pseudo_column ::= TBNAME */
- { 333, -3 }, /* (347) pseudo_column ::= table_name NK_DOT TBNAME */
- { 333, -1 }, /* (348) pseudo_column ::= QSTART */
- { 333, -1 }, /* (349) pseudo_column ::= QEND */
- { 333, -1 }, /* (350) pseudo_column ::= QDURATION */
- { 333, -1 }, /* (351) pseudo_column ::= WSTART */
- { 333, -1 }, /* (352) pseudo_column ::= WEND */
- { 333, -1 }, /* (353) pseudo_column ::= WDURATION */
- { 335, -4 }, /* (354) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 335, -4 }, /* (355) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 335, -6 }, /* (356) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
- { 335, -1 }, /* (357) function_expression ::= literal_func */
- { 328, -3 }, /* (358) literal_func ::= noarg_func NK_LP NK_RP */
- { 328, -1 }, /* (359) literal_func ::= NOW */
- { 339, -1 }, /* (360) noarg_func ::= NOW */
- { 339, -1 }, /* (361) noarg_func ::= TODAY */
- { 339, -1 }, /* (362) noarg_func ::= TIMEZONE */
- { 339, -1 }, /* (363) noarg_func ::= DATABASE */
- { 339, -1 }, /* (364) noarg_func ::= CLIENT_VERSION */
- { 339, -1 }, /* (365) noarg_func ::= SERVER_VERSION */
- { 339, -1 }, /* (366) noarg_func ::= SERVER_STATUS */
- { 339, -1 }, /* (367) noarg_func ::= CURRENT_USER */
- { 339, -1 }, /* (368) noarg_func ::= USER */
- { 337, -1 }, /* (369) star_func ::= COUNT */
- { 337, -1 }, /* (370) star_func ::= FIRST */
- { 337, -1 }, /* (371) star_func ::= LAST */
- { 337, -1 }, /* (372) star_func ::= LAST_ROW */
- { 338, -1 }, /* (373) star_func_para_list ::= NK_STAR */
- { 338, -1 }, /* (374) star_func_para_list ::= other_para_list */
- { 340, -1 }, /* (375) other_para_list ::= star_func_para */
- { 340, -3 }, /* (376) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 341, -1 }, /* (377) star_func_para ::= expression */
- { 341, -3 }, /* (378) star_func_para ::= table_name NK_DOT NK_STAR */
- { 342, -3 }, /* (379) predicate ::= expression compare_op expression */
- { 342, -5 }, /* (380) predicate ::= expression BETWEEN expression AND expression */
- { 342, -6 }, /* (381) predicate ::= expression NOT BETWEEN expression AND expression */
- { 342, -3 }, /* (382) predicate ::= expression IS NULL */
- { 342, -4 }, /* (383) predicate ::= expression IS NOT NULL */
- { 342, -3 }, /* (384) predicate ::= expression in_op in_predicate_value */
- { 343, -1 }, /* (385) compare_op ::= NK_LT */
- { 343, -1 }, /* (386) compare_op ::= NK_GT */
- { 343, -1 }, /* (387) compare_op ::= NK_LE */
- { 343, -1 }, /* (388) compare_op ::= NK_GE */
- { 343, -1 }, /* (389) compare_op ::= NK_NE */
- { 343, -1 }, /* (390) compare_op ::= NK_EQ */
- { 343, -1 }, /* (391) compare_op ::= LIKE */
- { 343, -2 }, /* (392) compare_op ::= NOT LIKE */
- { 343, -1 }, /* (393) compare_op ::= MATCH */
- { 343, -1 }, /* (394) compare_op ::= NMATCH */
- { 343, -1 }, /* (395) compare_op ::= CONTAINS */
- { 344, -1 }, /* (396) in_op ::= IN */
- { 344, -2 }, /* (397) in_op ::= NOT IN */
- { 345, -3 }, /* (398) in_predicate_value ::= NK_LP literal_list NK_RP */
- { 346, -1 }, /* (399) boolean_value_expression ::= boolean_primary */
- { 346, -2 }, /* (400) boolean_value_expression ::= NOT boolean_primary */
- { 346, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 346, -3 }, /* (402) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 347, -1 }, /* (403) boolean_primary ::= predicate */
- { 347, -3 }, /* (404) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 348, -1 }, /* (405) common_expression ::= expression */
- { 348, -1 }, /* (406) common_expression ::= boolean_value_expression */
- { 349, 0 }, /* (407) from_clause_opt ::= */
- { 349, -2 }, /* (408) from_clause_opt ::= FROM table_reference_list */
- { 350, -1 }, /* (409) table_reference_list ::= table_reference */
- { 350, -3 }, /* (410) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 351, -1 }, /* (411) table_reference ::= table_primary */
- { 351, -1 }, /* (412) table_reference ::= joined_table */
- { 352, -2 }, /* (413) table_primary ::= table_name alias_opt */
- { 352, -4 }, /* (414) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 352, -2 }, /* (415) table_primary ::= subquery alias_opt */
- { 352, -1 }, /* (416) table_primary ::= parenthesized_joined_table */
- { 354, 0 }, /* (417) alias_opt ::= */
- { 354, -1 }, /* (418) alias_opt ::= table_alias */
- { 354, -2 }, /* (419) alias_opt ::= AS table_alias */
- { 355, -3 }, /* (420) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 355, -3 }, /* (421) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 353, -6 }, /* (422) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 356, 0 }, /* (423) join_type ::= */
- { 356, -1 }, /* (424) join_type ::= INNER */
- { 358, -12 }, /* (425) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- { 359, 0 }, /* (426) set_quantifier_opt ::= */
- { 359, -1 }, /* (427) set_quantifier_opt ::= DISTINCT */
- { 359, -1 }, /* (428) set_quantifier_opt ::= ALL */
- { 360, -1 }, /* (429) select_list ::= select_item */
- { 360, -3 }, /* (430) select_list ::= select_list NK_COMMA select_item */
- { 368, -1 }, /* (431) select_item ::= NK_STAR */
- { 368, -1 }, /* (432) select_item ::= common_expression */
- { 368, -2 }, /* (433) select_item ::= common_expression column_alias */
- { 368, -3 }, /* (434) select_item ::= common_expression AS column_alias */
- { 368, -3 }, /* (435) select_item ::= table_name NK_DOT NK_STAR */
- { 326, 0 }, /* (436) where_clause_opt ::= */
- { 326, -2 }, /* (437) where_clause_opt ::= WHERE search_condition */
- { 361, 0 }, /* (438) partition_by_clause_opt ::= */
- { 361, -3 }, /* (439) partition_by_clause_opt ::= PARTITION BY expression_list */
- { 365, 0 }, /* (440) twindow_clause_opt ::= */
- { 365, -6 }, /* (441) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 365, -4 }, /* (442) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
- { 365, -6 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 365, -8 }, /* (444) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 312, 0 }, /* (445) sliding_opt ::= */
- { 312, -4 }, /* (446) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 364, 0 }, /* (447) fill_opt ::= */
- { 364, -4 }, /* (448) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 364, -6 }, /* (449) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 369, -1 }, /* (450) fill_mode ::= NONE */
- { 369, -1 }, /* (451) fill_mode ::= PREV */
- { 369, -1 }, /* (452) fill_mode ::= NULL */
- { 369, -1 }, /* (453) fill_mode ::= LINEAR */
- { 369, -1 }, /* (454) fill_mode ::= NEXT */
- { 366, 0 }, /* (455) group_by_clause_opt ::= */
- { 366, -3 }, /* (456) group_by_clause_opt ::= GROUP BY group_by_list */
- { 370, -1 }, /* (457) group_by_list ::= expression */
- { 370, -3 }, /* (458) group_by_list ::= group_by_list NK_COMMA expression */
- { 367, 0 }, /* (459) having_clause_opt ::= */
- { 367, -2 }, /* (460) having_clause_opt ::= HAVING search_condition */
- { 362, 0 }, /* (461) range_opt ::= */
- { 362, -6 }, /* (462) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
- { 363, 0 }, /* (463) every_opt ::= */
- { 363, -4 }, /* (464) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- { 317, -4 }, /* (465) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 371, -1 }, /* (466) query_expression_body ::= query_primary */
- { 371, -4 }, /* (467) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
- { 371, -3 }, /* (468) query_expression_body ::= query_expression_body UNION query_expression_body */
- { 375, -1 }, /* (469) query_primary ::= query_specification */
- { 375, -6 }, /* (470) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
- { 372, 0 }, /* (471) order_by_clause_opt ::= */
- { 372, -3 }, /* (472) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 373, 0 }, /* (473) slimit_clause_opt ::= */
- { 373, -2 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 373, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 373, -4 }, /* (476) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 374, 0 }, /* (477) limit_clause_opt ::= */
- { 374, -2 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 374, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 374, -4 }, /* (480) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 336, -3 }, /* (481) subquery ::= NK_LP query_expression NK_RP */
- { 357, -1 }, /* (482) search_condition ::= common_expression */
- { 376, -1 }, /* (483) sort_specification_list ::= sort_specification */
- { 376, -3 }, /* (484) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 377, -3 }, /* (485) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
- { 378, 0 }, /* (486) ordering_specification_opt ::= */
- { 378, -1 }, /* (487) ordering_specification_opt ::= ASC */
- { 378, -1 }, /* (488) ordering_specification_opt ::= DESC */
- { 379, 0 }, /* (489) null_ordering_opt ::= */
- { 379, -2 }, /* (490) null_ordering_opt ::= NULLS FIRST */
- { 379, -2 }, /* (491) null_ordering_opt ::= NULLS LAST */
+ { 315, -1 }, /* (321) topic_name ::= NK_ID */
+ { 322, -1 }, /* (322) stream_name ::= NK_ID */
+ { 317, -1 }, /* (323) cgroup_name ::= NK_ID */
+ { 331, -1 }, /* (324) expression ::= literal */
+ { 331, -1 }, /* (325) expression ::= pseudo_column */
+ { 331, -1 }, /* (326) expression ::= column_reference */
+ { 331, -1 }, /* (327) expression ::= function_expression */
+ { 331, -1 }, /* (328) expression ::= subquery */
+ { 331, -3 }, /* (329) expression ::= NK_LP expression NK_RP */
+ { 331, -2 }, /* (330) expression ::= NK_PLUS expression */
+ { 331, -2 }, /* (331) expression ::= NK_MINUS expression */
+ { 331, -3 }, /* (332) expression ::= expression NK_PLUS expression */
+ { 331, -3 }, /* (333) expression ::= expression NK_MINUS expression */
+ { 331, -3 }, /* (334) expression ::= expression NK_STAR expression */
+ { 331, -3 }, /* (335) expression ::= expression NK_SLASH expression */
+ { 331, -3 }, /* (336) expression ::= expression NK_REM expression */
+ { 331, -3 }, /* (337) expression ::= column_reference NK_ARROW NK_STRING */
+ { 331, -3 }, /* (338) expression ::= expression NK_BITAND expression */
+ { 331, -3 }, /* (339) expression ::= expression NK_BITOR expression */
+ { 293, -1 }, /* (340) expression_list ::= expression */
+ { 293, -3 }, /* (341) expression_list ::= expression_list NK_COMMA expression */
+ { 333, -1 }, /* (342) column_reference ::= column_name */
+ { 333, -3 }, /* (343) column_reference ::= table_name NK_DOT column_name */
+ { 332, -1 }, /* (344) pseudo_column ::= ROWTS */
+ { 332, -1 }, /* (345) pseudo_column ::= TBNAME */
+ { 332, -3 }, /* (346) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 332, -1 }, /* (347) pseudo_column ::= QSTART */
+ { 332, -1 }, /* (348) pseudo_column ::= QEND */
+ { 332, -1 }, /* (349) pseudo_column ::= QDURATION */
+ { 332, -1 }, /* (350) pseudo_column ::= WSTART */
+ { 332, -1 }, /* (351) pseudo_column ::= WEND */
+ { 332, -1 }, /* (352) pseudo_column ::= WDURATION */
+ { 334, -4 }, /* (353) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 334, -4 }, /* (354) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 334, -6 }, /* (355) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+ { 334, -1 }, /* (356) function_expression ::= literal_func */
+ { 327, -3 }, /* (357) literal_func ::= noarg_func NK_LP NK_RP */
+ { 327, -1 }, /* (358) literal_func ::= NOW */
+ { 338, -1 }, /* (359) noarg_func ::= NOW */
+ { 338, -1 }, /* (360) noarg_func ::= TODAY */
+ { 338, -1 }, /* (361) noarg_func ::= TIMEZONE */
+ { 338, -1 }, /* (362) noarg_func ::= DATABASE */
+ { 338, -1 }, /* (363) noarg_func ::= CLIENT_VERSION */
+ { 338, -1 }, /* (364) noarg_func ::= SERVER_VERSION */
+ { 338, -1 }, /* (365) noarg_func ::= SERVER_STATUS */
+ { 338, -1 }, /* (366) noarg_func ::= CURRENT_USER */
+ { 338, -1 }, /* (367) noarg_func ::= USER */
+ { 336, -1 }, /* (368) star_func ::= COUNT */
+ { 336, -1 }, /* (369) star_func ::= FIRST */
+ { 336, -1 }, /* (370) star_func ::= LAST */
+ { 336, -1 }, /* (371) star_func ::= LAST_ROW */
+ { 337, -1 }, /* (372) star_func_para_list ::= NK_STAR */
+ { 337, -1 }, /* (373) star_func_para_list ::= other_para_list */
+ { 339, -1 }, /* (374) other_para_list ::= star_func_para */
+ { 339, -3 }, /* (375) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 340, -1 }, /* (376) star_func_para ::= expression */
+ { 340, -3 }, /* (377) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 341, -3 }, /* (378) predicate ::= expression compare_op expression */
+ { 341, -5 }, /* (379) predicate ::= expression BETWEEN expression AND expression */
+ { 341, -6 }, /* (380) predicate ::= expression NOT BETWEEN expression AND expression */
+ { 341, -3 }, /* (381) predicate ::= expression IS NULL */
+ { 341, -4 }, /* (382) predicate ::= expression IS NOT NULL */
+ { 341, -3 }, /* (383) predicate ::= expression in_op in_predicate_value */
+ { 342, -1 }, /* (384) compare_op ::= NK_LT */
+ { 342, -1 }, /* (385) compare_op ::= NK_GT */
+ { 342, -1 }, /* (386) compare_op ::= NK_LE */
+ { 342, -1 }, /* (387) compare_op ::= NK_GE */
+ { 342, -1 }, /* (388) compare_op ::= NK_NE */
+ { 342, -1 }, /* (389) compare_op ::= NK_EQ */
+ { 342, -1 }, /* (390) compare_op ::= LIKE */
+ { 342, -2 }, /* (391) compare_op ::= NOT LIKE */
+ { 342, -1 }, /* (392) compare_op ::= MATCH */
+ { 342, -1 }, /* (393) compare_op ::= NMATCH */
+ { 342, -1 }, /* (394) compare_op ::= CONTAINS */
+ { 343, -1 }, /* (395) in_op ::= IN */
+ { 343, -2 }, /* (396) in_op ::= NOT IN */
+ { 344, -3 }, /* (397) in_predicate_value ::= NK_LP literal_list NK_RP */
+ { 345, -1 }, /* (398) boolean_value_expression ::= boolean_primary */
+ { 345, -2 }, /* (399) boolean_value_expression ::= NOT boolean_primary */
+ { 345, -3 }, /* (400) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 345, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 346, -1 }, /* (402) boolean_primary ::= predicate */
+ { 346, -3 }, /* (403) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 347, -1 }, /* (404) common_expression ::= expression */
+ { 347, -1 }, /* (405) common_expression ::= boolean_value_expression */
+ { 348, 0 }, /* (406) from_clause_opt ::= */
+ { 348, -2 }, /* (407) from_clause_opt ::= FROM table_reference_list */
+ { 349, -1 }, /* (408) table_reference_list ::= table_reference */
+ { 349, -3 }, /* (409) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 350, -1 }, /* (410) table_reference ::= table_primary */
+ { 350, -1 }, /* (411) table_reference ::= joined_table */
+ { 351, -2 }, /* (412) table_primary ::= table_name alias_opt */
+ { 351, -4 }, /* (413) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 351, -2 }, /* (414) table_primary ::= subquery alias_opt */
+ { 351, -1 }, /* (415) table_primary ::= parenthesized_joined_table */
+ { 353, 0 }, /* (416) alias_opt ::= */
+ { 353, -1 }, /* (417) alias_opt ::= table_alias */
+ { 353, -2 }, /* (418) alias_opt ::= AS table_alias */
+ { 354, -3 }, /* (419) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 354, -3 }, /* (420) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 352, -6 }, /* (421) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 355, 0 }, /* (422) join_type ::= */
+ { 355, -1 }, /* (423) join_type ::= INNER */
+ { 357, -12 }, /* (424) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ { 358, 0 }, /* (425) set_quantifier_opt ::= */
+ { 358, -1 }, /* (426) set_quantifier_opt ::= DISTINCT */
+ { 358, -1 }, /* (427) set_quantifier_opt ::= ALL */
+ { 359, -1 }, /* (428) select_list ::= select_item */
+ { 359, -3 }, /* (429) select_list ::= select_list NK_COMMA select_item */
+ { 367, -1 }, /* (430) select_item ::= NK_STAR */
+ { 367, -1 }, /* (431) select_item ::= common_expression */
+ { 367, -2 }, /* (432) select_item ::= common_expression column_alias */
+ { 367, -3 }, /* (433) select_item ::= common_expression AS column_alias */
+ { 367, -3 }, /* (434) select_item ::= table_name NK_DOT NK_STAR */
+ { 325, 0 }, /* (435) where_clause_opt ::= */
+ { 325, -2 }, /* (436) where_clause_opt ::= WHERE search_condition */
+ { 360, 0 }, /* (437) partition_by_clause_opt ::= */
+ { 360, -3 }, /* (438) partition_by_clause_opt ::= PARTITION BY expression_list */
+ { 364, 0 }, /* (439) twindow_clause_opt ::= */
+ { 364, -6 }, /* (440) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 364, -4 }, /* (441) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+ { 364, -6 }, /* (442) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 364, -8 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 311, 0 }, /* (444) sliding_opt ::= */
+ { 311, -4 }, /* (445) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 363, 0 }, /* (446) fill_opt ::= */
+ { 363, -4 }, /* (447) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 363, -6 }, /* (448) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 368, -1 }, /* (449) fill_mode ::= NONE */
+ { 368, -1 }, /* (450) fill_mode ::= PREV */
+ { 368, -1 }, /* (451) fill_mode ::= NULL */
+ { 368, -1 }, /* (452) fill_mode ::= LINEAR */
+ { 368, -1 }, /* (453) fill_mode ::= NEXT */
+ { 365, 0 }, /* (454) group_by_clause_opt ::= */
+ { 365, -3 }, /* (455) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 369, -1 }, /* (456) group_by_list ::= expression */
+ { 369, -3 }, /* (457) group_by_list ::= group_by_list NK_COMMA expression */
+ { 366, 0 }, /* (458) having_clause_opt ::= */
+ { 366, -2 }, /* (459) having_clause_opt ::= HAVING search_condition */
+ { 361, 0 }, /* (460) range_opt ::= */
+ { 361, -6 }, /* (461) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+ { 362, 0 }, /* (462) every_opt ::= */
+ { 362, -4 }, /* (463) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ { 316, -4 }, /* (464) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 370, -1 }, /* (465) query_expression_body ::= query_primary */
+ { 370, -4 }, /* (466) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+ { 370, -3 }, /* (467) query_expression_body ::= query_expression_body UNION query_expression_body */
+ { 374, -1 }, /* (468) query_primary ::= query_specification */
+ { 374, -6 }, /* (469) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ { 371, 0 }, /* (470) order_by_clause_opt ::= */
+ { 371, -3 }, /* (471) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 372, 0 }, /* (472) slimit_clause_opt ::= */
+ { 372, -2 }, /* (473) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 372, -4 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 372, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 373, 0 }, /* (476) limit_clause_opt ::= */
+ { 373, -2 }, /* (477) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 373, -4 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 373, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 335, -3 }, /* (480) subquery ::= NK_LP query_expression NK_RP */
+ { 356, -1 }, /* (481) search_condition ::= common_expression */
+ { 375, -1 }, /* (482) sort_specification_list ::= sort_specification */
+ { 375, -3 }, /* (483) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 376, -3 }, /* (484) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+ { 377, 0 }, /* (485) ordering_specification_opt ::= */
+ { 377, -1 }, /* (486) ordering_specification_opt ::= ASC */
+ { 377, -1 }, /* (487) ordering_specification_opt ::= DESC */
+ { 378, 0 }, /* (488) null_ordering_opt ::= */
+ { 378, -2 }, /* (489) null_ordering_opt ::= NULLS FIRST */
+ { 378, -2 }, /* (490) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3343,69 +3351,69 @@ static YYACTIONTYPE yy_reduce(
yy_destructor(yypParser,260,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy0, yymsp[0].minor.yy543); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy0, yymsp[0].minor.yy285); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy361, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 28: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 29: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy543 = 1; }
+{ yymsp[1].minor.yy285 = 1; }
break;
case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy543 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy285 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy549, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); }
break;
case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy549, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy457, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); }
break;
case 33: /* privileges ::= ALL */
-{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_ALL; }
break;
case 34: /* privileges ::= priv_type_list */
case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35);
-{ yylhsminor.yy549 = yymsp[0].minor.yy549; }
- yymsp[0].minor.yy549 = yylhsminor.yy549;
+{ yylhsminor.yy457 = yymsp[0].minor.yy457; }
+ yymsp[0].minor.yy457 = yylhsminor.yy457;
break;
case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy549 = yymsp[-2].minor.yy549 | yymsp[0].minor.yy549; }
- yymsp[-2].minor.yy549 = yylhsminor.yy549;
+{ yylhsminor.yy457 = yymsp[-2].minor.yy457 | yymsp[0].minor.yy457; }
+ yymsp[-2].minor.yy457 = yylhsminor.yy457;
break;
case 37: /* priv_type ::= READ */
-{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_READ; }
break;
case 38: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy457 = PRIVILEGE_TYPE_WRITE; }
break;
case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy361 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy361 = yylhsminor.yy361;
break;
case 40: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy129 = yymsp[-2].minor.yy129; }
- yymsp[-2].minor.yy129 = yylhsminor.yy129;
+{ yylhsminor.yy361 = yymsp[-2].minor.yy361; }
+ yymsp[-2].minor.yy361 = yylhsminor.yy361;
break;
case 41: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy129, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy361, NULL); }
break;
case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); }
break;
case 43: /* cmd ::= DROP DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 44: /* cmd ::= DROP DNODE dnode_endpoint */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3429,25 +3437,24 @@ static YYACTIONTYPE yy_reduce(
case 318: /* table_alias ::= NK_ID */ yytestcase(yyruleno==318);
case 319: /* column_alias ::= NK_ID */ yytestcase(yyruleno==319);
case 320: /* user_name ::= NK_ID */ yytestcase(yyruleno==320);
- case 321: /* index_name ::= NK_ID */ yytestcase(yyruleno==321);
- case 322: /* topic_name ::= NK_ID */ yytestcase(yyruleno==322);
- case 323: /* stream_name ::= NK_ID */ yytestcase(yyruleno==323);
- case 324: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==324);
- case 360: /* noarg_func ::= NOW */ yytestcase(yyruleno==360);
- case 361: /* noarg_func ::= TODAY */ yytestcase(yyruleno==361);
- case 362: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==362);
- case 363: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==363);
- case 364: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==364);
- case 365: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==365);
- case 366: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==366);
- case 367: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==367);
- case 368: /* noarg_func ::= USER */ yytestcase(yyruleno==368);
- case 369: /* star_func ::= COUNT */ yytestcase(yyruleno==369);
- case 370: /* star_func ::= FIRST */ yytestcase(yyruleno==370);
- case 371: /* star_func ::= LAST */ yytestcase(yyruleno==371);
- case 372: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==372);
-{ yylhsminor.yy129 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+ case 321: /* topic_name ::= NK_ID */ yytestcase(yyruleno==321);
+ case 322: /* stream_name ::= NK_ID */ yytestcase(yyruleno==322);
+ case 323: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==323);
+ case 359: /* noarg_func ::= NOW */ yytestcase(yyruleno==359);
+ case 360: /* noarg_func ::= TODAY */ yytestcase(yyruleno==360);
+ case 361: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==361);
+ case 362: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==362);
+ case 363: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==363);
+ case 364: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==364);
+ case 365: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==365);
+ case 366: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==366);
+ case 367: /* noarg_func ::= USER */ yytestcase(yyruleno==367);
+ case 368: /* star_func ::= COUNT */ yytestcase(yyruleno==368);
+ case 369: /* star_func ::= FIRST */ yytestcase(yyruleno==369);
+ case 370: /* star_func ::= LAST */ yytestcase(yyruleno==370);
+ case 371: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==371);
+{ yylhsminor.yy361 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy361 = yylhsminor.yy361;
break;
case 52: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3480,189 +3487,189 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy337, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy151, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); }
break;
case 63: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); }
break;
case 64: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy616); }
break;
case 66: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 67: /* cmd ::= TRIM DATABASE db_name */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 68: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy337 = true; }
+{ yymsp[-2].minor.yy151 = true; }
break;
case 69: /* not_exists_opt ::= */
case 71: /* exists_opt ::= */ yytestcase(yyruleno==71);
case 255: /* analyze_opt ::= */ yytestcase(yyruleno==255);
case 262: /* agg_func_opt ::= */ yytestcase(yyruleno==262);
- case 426: /* set_quantifier_opt ::= */ yytestcase(yyruleno==426);
-{ yymsp[1].minor.yy337 = false; }
+ case 425: /* set_quantifier_opt ::= */ yytestcase(yyruleno==425);
+{ yymsp[1].minor.yy151 = false; }
break;
case 70: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy337 = true; }
+{ yymsp[-1].minor.yy151 = true; }
break;
case 72: /* db_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy616 = createDefaultDatabaseOptions(pCxt); }
break;
case 73: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 76: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 77: /* db_options ::= db_options DURATION NK_INTEGER */
case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78);
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 80: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 81: /* db_options ::= db_options KEEP integer_list */
case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82);
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_KEEP, yymsp[0].minor.yy464); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_KEEP, yymsp[0].minor.yy356); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 83: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 85: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 86: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 87: /* db_options ::= db_options STRICT NK_STRING */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 88: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 89: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 90: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_RETENTIONS, yymsp[0].minor.yy464); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_RETENTIONS, yymsp[0].minor.yy356); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 91: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 92: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 93: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 94: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-3].minor.yy616, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 96: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-3].minor.yy616, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 98: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 99: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setDatabaseOption(pCxt, yymsp[-2].minor.yy616, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 100: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy712 = createAlterDatabaseOptions(pCxt); yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yylhsminor.yy712, &yymsp[0].minor.yy405); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterDatabaseOptions(pCxt); yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yylhsminor.yy616, &yymsp[0].minor.yy409); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 101: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy712, &yymsp[0].minor.yy405); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy616, &yymsp[0].minor.yy409); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 102: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 103: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 104: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy405.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 105: /* alter_db_option ::= KEEP integer_list */
case 106: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==106);
-{ yymsp[-1].minor.yy405.type = DB_OPTION_KEEP; yymsp[-1].minor.yy405.pList = yymsp[0].minor.yy464; }
+{ yymsp[-1].minor.yy409.type = DB_OPTION_KEEP; yymsp[-1].minor.yy409.pList = yymsp[0].minor.yy356; }
break;
case 107: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy405.type = DB_OPTION_WAL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = DB_OPTION_WAL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 108: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy464 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+{ yylhsminor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
case 109: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
case 284: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==284);
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy464 = yylhsminor.yy464;
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy356 = yylhsminor.yy356;
break;
case 110: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy464 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+{ yylhsminor.yy356 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
case 111: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy464 = yylhsminor.yy464;
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy356 = yylhsminor.yy356;
break;
case 112: /* retention_list ::= retention */
case 132: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==132);
@@ -3672,11 +3679,11 @@ static YYACTIONTYPE yy_reduce(
case 190: /* col_name_list ::= col_name */ yytestcase(yyruleno==190);
case 238: /* func_list ::= func */ yytestcase(yyruleno==238);
case 312: /* literal_list ::= signed_literal */ yytestcase(yyruleno==312);
- case 375: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==375);
- case 429: /* select_list ::= select_item */ yytestcase(yyruleno==429);
- case 483: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==483);
-{ yylhsminor.yy464 = createNodeList(pCxt, yymsp[0].minor.yy712); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+ case 374: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==374);
+ case 428: /* select_list ::= select_item */ yytestcase(yyruleno==428);
+ case 482: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==482);
+{ yylhsminor.yy356 = createNodeList(pCxt, yymsp[0].minor.yy616); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
case 113: /* retention_list ::= retention_list NK_COMMA retention */
case 143: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==143);
@@ -3684,253 +3691,253 @@ static YYACTIONTYPE yy_reduce(
case 191: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==191);
case 239: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==239);
case 313: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==313);
- case 376: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==376);
- case 430: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==430);
- case 484: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==484);
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); }
- yymsp[-2].minor.yy464 = yylhsminor.yy464;
+ case 375: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==375);
+ case 429: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==429);
+ case 483: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==483);
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); }
+ yymsp[-2].minor.yy356 = yylhsminor.yy356;
break;
case 114: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy712 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 115: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 117: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==117);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy337, yymsp[-5].minor.yy712, yymsp[-3].minor.yy464, yymsp[-1].minor.yy464, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy616, yymsp[-3].minor.yy356, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); }
break;
case 116: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy464); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy356); }
break;
case 118: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy464); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy356); }
break;
case 119: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); }
break;
case 120: /* cmd ::= ALTER TABLE alter_table_clause */
case 286: /* cmd ::= query_expression */ yytestcase(yyruleno==286);
-{ pCxt->pRootNode = yymsp[0].minor.yy712; }
+{ pCxt->pRootNode = yymsp[0].minor.yy616; }
break;
case 121: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy616); }
break;
case 122: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy712 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 123: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 124: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy361); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 125: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 126: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 127: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 128: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy616, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy361); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 129: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 130: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy616, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 131: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy712 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy712, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy616, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); }
+ yymsp[-5].minor.yy616 = yylhsminor.yy616;
break;
case 133: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 136: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==136);
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-1].minor.yy464, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy464 = yylhsminor.yy464;
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-1].minor.yy356, yymsp[0].minor.yy616); }
+ yymsp[-1].minor.yy356 = yylhsminor.yy356;
break;
case 134: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */
-{ yylhsminor.yy712 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy337, yymsp[-8].minor.yy712, yymsp[-6].minor.yy712, yymsp[-5].minor.yy464, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); }
- yymsp[-9].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy151, yymsp[-8].minor.yy616, yymsp[-6].minor.yy616, yymsp[-5].minor.yy356, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); }
+ yymsp[-9].minor.yy616 = yylhsminor.yy616;
break;
case 137: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy712 = createDropTableClause(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 138: /* specific_cols_opt ::= */
case 169: /* tags_def_opt ::= */ yytestcase(yyruleno==169);
- case 438: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==438);
- case 455: /* group_by_clause_opt ::= */ yytestcase(yyruleno==455);
- case 471: /* order_by_clause_opt ::= */ yytestcase(yyruleno==471);
-{ yymsp[1].minor.yy464 = NULL; }
+ case 437: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==437);
+ case 454: /* group_by_clause_opt ::= */ yytestcase(yyruleno==454);
+ case 470: /* order_by_clause_opt ::= */ yytestcase(yyruleno==470);
+{ yymsp[1].minor.yy356 = NULL; }
break;
case 139: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy464 = yymsp[-1].minor.yy464; }
+{ yymsp[-2].minor.yy356 = yymsp[-1].minor.yy356; }
break;
case 140: /* full_table_name ::= table_name */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy129, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy361, NULL); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 141: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, NULL); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 144: /* column_def ::= column_name type_name */
-{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184, NULL); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy361, yymsp[0].minor.yy600, NULL); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 145: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-2].minor.yy600, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 146: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 147: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 148: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 149: /* type_name ::= INT */
case 150: /* type_name ::= INTEGER */ yytestcase(yyruleno==150);
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 151: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 152: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 153: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 154: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 155: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 156: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 157: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 158: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 159: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 160: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy600 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 161: /* type_name ::= JSON */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 162: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 163: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 164: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 165: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy600 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 166: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 167: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 168: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy600 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 170: /* tags_def_opt ::= tags_def */
- case 374: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==374);
-{ yylhsminor.yy464 = yymsp[0].minor.yy464; }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+ case 373: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==373);
+{ yylhsminor.yy356 = yymsp[0].minor.yy356; }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
case 171: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy464 = yymsp[-1].minor.yy464; }
+{ yymsp[-3].minor.yy356 = yymsp[-1].minor.yy356; }
break;
case 172: /* table_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy616 = createDefaultTableOptions(pCxt); }
break;
case 173: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 174: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy464); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy356); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 175: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy464); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy356); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 176: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy464); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy356); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 177: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-2].minor.yy616, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 178: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_SMA, yymsp[-1].minor.yy464); }
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-4].minor.yy616, TABLE_OPTION_SMA, yymsp[-1].minor.yy356); }
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
case 179: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy712 = createAlterTableOptions(pCxt); yylhsminor.yy712 = setTableOption(pCxt, yylhsminor.yy712, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createAlterTableOptions(pCxt); yylhsminor.yy616 = setTableOption(pCxt, yylhsminor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 180: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setTableOption(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy409.type, &yymsp[0].minor.yy409.val); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 181: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy405.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 182: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy405.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy409.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy409.val = yymsp[0].minor.yy0; }
break;
case 183: /* duration_list ::= duration_literal */
- case 341: /* expression_list ::= expression */ yytestcase(yyruleno==341);
-{ yylhsminor.yy464 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+ case 340: /* expression_list ::= expression */ yytestcase(yyruleno==340);
+{ yylhsminor.yy356 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
case 184: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 342: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==342);
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); }
- yymsp[-2].minor.yy464 = yylhsminor.yy464;
+ case 341: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==341);
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, releaseRawExprNode(pCxt, yymsp[0].minor.yy616)); }
+ yymsp[-2].minor.yy356 = yylhsminor.yy356;
break;
case 187: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy129, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy361, NULL); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 188: /* rollup_func_name ::= FIRST */
case 189: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==189);
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 192: /* col_name ::= column_name */
-{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 193: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -3942,13 +3949,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); }
break;
case 196: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); }
break;
case 197: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, OP_TYPE_LIKE); }
break;
case 198: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy712, NULL, OP_TYPE_LIKE); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy616, NULL, OP_TYPE_LIKE); }
break;
case 199: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -3963,7 +3970,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
case 203: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); }
break;
case 204: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -3982,13 +3989,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); }
break;
case 210: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy361); }
break;
case 211: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy616); }
break;
case 212: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy616); }
break;
case 213: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -4021,7 +4028,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 223: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy616); }
break;
case 224: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -4030,155 +4037,155 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
case 226: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy616, yymsp[-1].minor.yy616, OP_TYPE_EQUAL); }
break;
case 227: /* db_name_cond_opt ::= */
case 232: /* from_db_opt ::= */ yytestcase(yyruleno==232);
-{ yymsp[1].minor.yy712 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy616 = createDefaultDatabaseCondValue(pCxt); }
break;
case 228: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy361); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 229: /* like_pattern_opt ::= */
case 268: /* into_opt ::= */ yytestcase(yyruleno==268);
- case 407: /* from_clause_opt ::= */ yytestcase(yyruleno==407);
- case 436: /* where_clause_opt ::= */ yytestcase(yyruleno==436);
- case 440: /* twindow_clause_opt ::= */ yytestcase(yyruleno==440);
- case 445: /* sliding_opt ::= */ yytestcase(yyruleno==445);
- case 447: /* fill_opt ::= */ yytestcase(yyruleno==447);
- case 459: /* having_clause_opt ::= */ yytestcase(yyruleno==459);
- case 461: /* range_opt ::= */ yytestcase(yyruleno==461);
- case 463: /* every_opt ::= */ yytestcase(yyruleno==463);
- case 473: /* slimit_clause_opt ::= */ yytestcase(yyruleno==473);
- case 477: /* limit_clause_opt ::= */ yytestcase(yyruleno==477);
-{ yymsp[1].minor.yy712 = NULL; }
+ case 406: /* from_clause_opt ::= */ yytestcase(yyruleno==406);
+ case 435: /* where_clause_opt ::= */ yytestcase(yyruleno==435);
+ case 439: /* twindow_clause_opt ::= */ yytestcase(yyruleno==439);
+ case 444: /* sliding_opt ::= */ yytestcase(yyruleno==444);
+ case 446: /* fill_opt ::= */ yytestcase(yyruleno==446);
+ case 458: /* having_clause_opt ::= */ yytestcase(yyruleno==458);
+ case 460: /* range_opt ::= */ yytestcase(yyruleno==460);
+ case 462: /* every_opt ::= */ yytestcase(yyruleno==462);
+ case 472: /* slimit_clause_opt ::= */ yytestcase(yyruleno==472);
+ case 476: /* limit_clause_opt ::= */ yytestcase(yyruleno==476);
+{ yymsp[1].minor.yy616 = NULL; }
break;
case 230: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 231: /* table_name_cond ::= table_name */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 233: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); }
+{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy361); }
break;
- case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); }
+ case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, yymsp[-3].minor.yy616, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); }
break;
- case 235: /* cmd ::= DROP INDEX exists_opt index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+ case 235: /* cmd ::= DROP INDEX exists_opt full_table_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy616); }
break;
case 236: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy712 = createIndexOption(pCxt, yymsp[-7].minor.yy464, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+{ yymsp[-9].minor.yy616 = createIndexOption(pCxt, yymsp[-7].minor.yy356, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
case 237: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-11].minor.yy712 = createIndexOption(pCxt, yymsp[-9].minor.yy464, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+{ yymsp[-11].minor.yy616 = createIndexOption(pCxt, yymsp[-9].minor.yy356, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
case 240: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy464); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 241: /* sma_stream_opt ::= */
case 270: /* stream_options ::= */ yytestcase(yyruleno==270);
-{ yymsp[1].minor.yy712 = createStreamOptions(pCxt); }
+{ yymsp[1].minor.yy616 = createStreamOptions(pCxt); }
break;
case 242: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */
case 274: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==274);
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 243: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-2].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-2].minor.yy616; }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, yymsp[0].minor.yy616); }
break;
case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy129, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy361, false); }
break;
case 246: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, &yymsp[0].minor.yy129, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[0].minor.yy361, true); }
break;
case 247: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, yymsp[0].minor.yy712, false); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy361, yymsp[0].minor.yy616, false); }
break;
case 248: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, yymsp[0].minor.yy712, true); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy361, yymsp[0].minor.yy616, true); }
break;
case 249: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); }
break;
case 250: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361); }
break;
case 251: /* cmd ::= DESC full_table_name */
case 252: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==252);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy616); }
break;
case 253: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
case 254: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy337, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
case 256: /* analyze_opt ::= ANALYZE */
case 263: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==263);
- case 427: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==427);
-{ yymsp[0].minor.yy337 = true; }
+ case 426: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==426);
+{ yymsp[0].minor.yy151 = true; }
break;
case 257: /* explain_options ::= */
-{ yymsp[1].minor.yy712 = createDefaultExplainOptions(pCxt); }
+{ yymsp[1].minor.yy616 = createDefaultExplainOptions(pCxt); }
break;
case 258: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy712 = setExplainVerbose(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setExplainVerbose(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 259: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy712 = setExplainRatio(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = setExplainRatio(pCxt, yymsp[-2].minor.yy616, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 260: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy337, yymsp[-8].minor.yy337, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy184, yymsp[0].minor.yy500); }
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-8].minor.yy151, &yymsp[-5].minor.yy361, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy600, yymsp[0].minor.yy734); }
break;
case 261: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); }
break;
case 264: /* bufsize_opt ::= */
-{ yymsp[1].minor.yy500 = 0; }
+{ yymsp[1].minor.yy734 = 0; }
break;
case 265: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
-{ yymsp[-1].minor.yy500 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy734 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 266: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy337, &yymsp[-4].minor.yy129, yymsp[-2].minor.yy712, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy151, &yymsp[-4].minor.yy361, yymsp[-2].minor.yy616, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); }
break;
case 267: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy361); }
break;
case 269: /* into_opt ::= INTO full_table_name */
- case 408: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==408);
- case 437: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==437);
- case 460: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==460);
-{ yymsp[-1].minor.yy712 = yymsp[0].minor.yy712; }
+ case 407: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==407);
+ case 436: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==436);
+ case 459: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==459);
+{ yymsp[-1].minor.yy616 = yymsp[0].minor.yy616; }
break;
case 271: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy616 = yymsp[-2].minor.yy616; }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 272: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-2].minor.yy616)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy616 = yymsp[-2].minor.yy616; }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 273: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-3].minor.yy712)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-3].minor.yy712; }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-3].minor.yy616)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy616)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); yylhsminor.yy616 = yymsp[-3].minor.yy616; }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
case 275: /* stream_options ::= stream_options IGNORE EXPIRED */
-{ ((SStreamOptions*)yymsp[-2].minor.yy712)->ignoreExpired = true; yylhsminor.yy712 = yymsp[-2].minor.yy712; }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+{ ((SStreamOptions*)yymsp[-2].minor.yy616)->ignoreExpired = true; yylhsminor.yy616 = yymsp[-2].minor.yy616; }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
case 276: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
@@ -4196,547 +4203,547 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 281: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy464); }
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy356); }
break;
case 282: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 283: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy464 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+{ yymsp[-1].minor.yy356 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 285: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
case 287: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy712, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy616, yymsp[-2].minor.yy356, yymsp[0].minor.yy616); }
break;
case 288: /* cmd ::= INSERT INTO full_table_name query_expression */
-{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); }
+{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy616, NULL, yymsp[0].minor.yy616); }
break;
case 289: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 290: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 291: /* literal ::= NK_STRING */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 292: /* literal ::= NK_BOOL */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 293: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 294: /* literal ::= duration_literal */
case 304: /* signed_literal ::= signed */ yytestcase(yyruleno==304);
- case 325: /* expression ::= literal */ yytestcase(yyruleno==325);
- case 326: /* expression ::= pseudo_column */ yytestcase(yyruleno==326);
- case 327: /* expression ::= column_reference */ yytestcase(yyruleno==327);
- case 328: /* expression ::= function_expression */ yytestcase(yyruleno==328);
- case 329: /* expression ::= subquery */ yytestcase(yyruleno==329);
- case 357: /* function_expression ::= literal_func */ yytestcase(yyruleno==357);
- case 399: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==399);
- case 403: /* boolean_primary ::= predicate */ yytestcase(yyruleno==403);
- case 405: /* common_expression ::= expression */ yytestcase(yyruleno==405);
- case 406: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==406);
- case 409: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==409);
- case 411: /* table_reference ::= table_primary */ yytestcase(yyruleno==411);
- case 412: /* table_reference ::= joined_table */ yytestcase(yyruleno==412);
- case 416: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==416);
- case 466: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==466);
- case 469: /* query_primary ::= query_specification */ yytestcase(yyruleno==469);
-{ yylhsminor.yy712 = yymsp[0].minor.yy712; }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 324: /* expression ::= literal */ yytestcase(yyruleno==324);
+ case 325: /* expression ::= pseudo_column */ yytestcase(yyruleno==325);
+ case 326: /* expression ::= column_reference */ yytestcase(yyruleno==326);
+ case 327: /* expression ::= function_expression */ yytestcase(yyruleno==327);
+ case 328: /* expression ::= subquery */ yytestcase(yyruleno==328);
+ case 356: /* function_expression ::= literal_func */ yytestcase(yyruleno==356);
+ case 398: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==398);
+ case 402: /* boolean_primary ::= predicate */ yytestcase(yyruleno==402);
+ case 404: /* common_expression ::= expression */ yytestcase(yyruleno==404);
+ case 405: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==405);
+ case 408: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==408);
+ case 410: /* table_reference ::= table_primary */ yytestcase(yyruleno==410);
+ case 411: /* table_reference ::= joined_table */ yytestcase(yyruleno==411);
+ case 415: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==415);
+ case 465: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==465);
+ case 468: /* query_primary ::= query_specification */ yytestcase(yyruleno==468);
+{ yylhsminor.yy616 = yymsp[0].minor.yy616; }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 295: /* literal ::= NULL */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 296: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 297: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 298: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 299: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
case 300: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 301: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 302: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
case 303: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
case 305: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 306: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 307: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 308: /* signed_literal ::= duration_literal */
case 310: /* signed_literal ::= literal_func */ yytestcase(yyruleno==310);
- case 377: /* star_func_para ::= expression */ yytestcase(yyruleno==377);
- case 432: /* select_item ::= common_expression */ yytestcase(yyruleno==432);
- case 482: /* search_condition ::= common_expression */ yytestcase(yyruleno==482);
-{ yylhsminor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 376: /* star_func_para ::= expression */ yytestcase(yyruleno==376);
+ case 431: /* select_item ::= common_expression */ yytestcase(yyruleno==431);
+ case 481: /* search_condition ::= common_expression */ yytestcase(yyruleno==481);
+{ yylhsminor.yy616 = releaseRawExprNode(pCxt, yymsp[0].minor.yy616); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 309: /* signed_literal ::= NULL */
-{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
case 311: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy712 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+{ yylhsminor.yy616 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
- case 330: /* expression ::= NK_LP expression NK_RP */
- case 404: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==404);
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 329: /* expression ::= NK_LP expression NK_RP */
+ case 403: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==403);
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 331: /* expression ::= NK_PLUS expression */
+ case 330: /* expression ::= NK_PLUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy712));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy616));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 332: /* expression ::= NK_MINUS expression */
+ case 331: /* expression ::= NK_MINUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 333: /* expression ::= expression NK_PLUS expression */
+ case 332: /* expression ::= expression NK_PLUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 334: /* expression ::= expression NK_MINUS expression */
+ case 333: /* expression ::= expression NK_MINUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 335: /* expression ::= expression NK_STAR expression */
+ case 334: /* expression ::= expression NK_STAR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 336: /* expression ::= expression NK_SLASH expression */
+ case 335: /* expression ::= expression NK_SLASH expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 337: /* expression ::= expression NK_REM expression */
+ case 336: /* expression ::= expression NK_REM expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 338: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 337: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 339: /* expression ::= expression NK_BITAND expression */
+ case 338: /* expression ::= expression NK_BITAND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 340: /* expression ::= expression NK_BITOR expression */
+ case 339: /* expression ::= expression NK_BITOR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 343: /* column_reference ::= column_name */
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 342: /* column_reference ::= column_name */
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy361, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy361)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
- case 344: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 343: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361, createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy361)); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 345: /* pseudo_column ::= ROWTS */
- case 346: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==346);
- case 348: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==348);
- case 349: /* pseudo_column ::= QEND */ yytestcase(yyruleno==349);
- case 350: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==350);
- case 351: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==351);
- case 352: /* pseudo_column ::= WEND */ yytestcase(yyruleno==352);
- case 353: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==353);
- case 359: /* literal_func ::= NOW */ yytestcase(yyruleno==359);
-{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 344: /* pseudo_column ::= ROWTS */
+ case 345: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==345);
+ case 347: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==347);
+ case 348: /* pseudo_column ::= QEND */ yytestcase(yyruleno==348);
+ case 349: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==349);
+ case 350: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==350);
+ case 351: /* pseudo_column ::= WEND */ yytestcase(yyruleno==351);
+ case 352: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==352);
+ case 358: /* literal_func ::= NOW */ yytestcase(yyruleno==358);
+{ yylhsminor.yy616 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
- case 347: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy129)))); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 346: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy361)))); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 354: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 355: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==355);
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy464)); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 353: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 354: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==354);
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy361, yymsp[-1].minor.yy356)); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
- case 356: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy184)); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ case 355: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy600)); }
+ yymsp[-5].minor.yy616 = yylhsminor.yy616;
break;
- case 358: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy129, NULL)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 357: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy361, NULL)); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 373: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy464 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+ case 372: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy356 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
- case 378: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 435: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==435);
-{ yylhsminor.yy712 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 377: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 434: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==434);
+{ yylhsminor.yy616 = createColumnNode(pCxt, &yymsp[-2].minor.yy361, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 379: /* predicate ::= expression compare_op expression */
- case 384: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==384);
+ case 378: /* predicate ::= expression compare_op expression */
+ case 383: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==383);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy526, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 380: /* predicate ::= expression BETWEEN expression AND expression */
+ case 379: /* predicate ::= expression BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-4].minor.yy712 = yylhsminor.yy712;
+ yymsp[-4].minor.yy616 = yylhsminor.yy616;
break;
- case 381: /* predicate ::= expression NOT BETWEEN expression AND expression */
+ case 380: /* predicate ::= expression NOT BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ yymsp[-5].minor.yy616 = yylhsminor.yy616;
break;
- case 382: /* predicate ::= expression IS NULL */
+ case 381: /* predicate ::= expression IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), NULL));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 383: /* predicate ::= expression IS NOT NULL */
+ case 382: /* predicate ::= expression IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL));
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
- case 385: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; }
+ case 384: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_THAN; }
break;
- case 386: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; }
+ case 385: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_THAN; }
break;
- case 387: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; }
+ case 386: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy526 = OP_TYPE_LOWER_EQUAL; }
break;
- case 388: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; }
+ case 387: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy526 = OP_TYPE_GREATER_EQUAL; }
break;
- case 389: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; }
+ case 388: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy526 = OP_TYPE_NOT_EQUAL; }
break;
- case 390: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy60 = OP_TYPE_EQUAL; }
+ case 389: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy526 = OP_TYPE_EQUAL; }
break;
- case 391: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy60 = OP_TYPE_LIKE; }
+ case 390: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy526 = OP_TYPE_LIKE; }
break;
- case 392: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; }
+ case 391: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_LIKE; }
break;
- case 393: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy60 = OP_TYPE_MATCH; }
+ case 392: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy526 = OP_TYPE_MATCH; }
break;
- case 394: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy60 = OP_TYPE_NMATCH; }
+ case 393: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy526 = OP_TYPE_NMATCH; }
break;
- case 395: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy60 = OP_TYPE_JSON_CONTAINS; }
+ case 394: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy526 = OP_TYPE_JSON_CONTAINS; }
break;
- case 396: /* in_op ::= IN */
-{ yymsp[0].minor.yy60 = OP_TYPE_IN; }
+ case 395: /* in_op ::= IN */
+{ yymsp[0].minor.yy526 = OP_TYPE_IN; }
break;
- case 397: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; }
+ case 396: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy526 = OP_TYPE_NOT_IN; }
break;
- case 398: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy464)); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 397: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 400: /* boolean_value_expression ::= NOT boolean_primary */
+ case 399: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy616), NULL));
}
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 401: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 400: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 402: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 401: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712);
- yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy616);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy616);
+ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), releaseRawExprNode(pCxt, yymsp[0].minor.yy616)));
}
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 410: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy712 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, NULL); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 409: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy616 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy616, yymsp[0].minor.yy616, NULL); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 413: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 412: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy616 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 414: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 413: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy616 = createRealTableNode(pCxt, &yymsp[-3].minor.yy361, &yymsp[-1].minor.yy361, &yymsp[0].minor.yy361); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
- case 415: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy712 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 414: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy616 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 417: /* alias_opt ::= */
-{ yymsp[1].minor.yy129 = nil_token; }
+ case 416: /* alias_opt ::= */
+{ yymsp[1].minor.yy361 = nil_token; }
break;
- case 418: /* alias_opt ::= table_alias */
-{ yylhsminor.yy129 = yymsp[0].minor.yy129; }
- yymsp[0].minor.yy129 = yylhsminor.yy129;
+ case 417: /* alias_opt ::= table_alias */
+{ yylhsminor.yy361 = yymsp[0].minor.yy361; }
+ yymsp[0].minor.yy361 = yylhsminor.yy361;
break;
- case 419: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; }
+ case 418: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy361 = yymsp[0].minor.yy361; }
break;
- case 420: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 421: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==421);
-{ yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; }
+ case 419: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 420: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==420);
+{ yymsp[-2].minor.yy616 = yymsp[-1].minor.yy616; }
break;
- case 422: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy712 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-5].minor.yy712 = yylhsminor.yy712;
+ case 421: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy616 = createJoinTableNode(pCxt, yymsp[-4].minor.yy504, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); }
+ yymsp[-5].minor.yy616 = yylhsminor.yy616;
break;
- case 423: /* join_type ::= */
-{ yymsp[1].minor.yy532 = JOIN_TYPE_INNER; }
+ case 422: /* join_type ::= */
+{ yymsp[1].minor.yy504 = JOIN_TYPE_INNER; }
break;
- case 424: /* join_type ::= INNER */
-{ yymsp[0].minor.yy532 = JOIN_TYPE_INNER; }
+ case 423: /* join_type ::= INNER */
+{ yymsp[0].minor.yy504 = JOIN_TYPE_INNER; }
break;
- case 425: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 424: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-11].minor.yy712 = createSelectStmt(pCxt, yymsp[-10].minor.yy337, yymsp[-9].minor.yy464, yymsp[-8].minor.yy712);
- yymsp[-11].minor.yy712 = addWhereClause(pCxt, yymsp[-11].minor.yy712, yymsp[-7].minor.yy712);
- yymsp[-11].minor.yy712 = addPartitionByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-6].minor.yy464);
- yymsp[-11].minor.yy712 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy712, yymsp[-2].minor.yy712);
- yymsp[-11].minor.yy712 = addGroupByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-1].minor.yy464);
- yymsp[-11].minor.yy712 = addHavingClause(pCxt, yymsp[-11].minor.yy712, yymsp[0].minor.yy712);
- yymsp[-11].minor.yy712 = addRangeClause(pCxt, yymsp[-11].minor.yy712, yymsp[-5].minor.yy712);
- yymsp[-11].minor.yy712 = addEveryClause(pCxt, yymsp[-11].minor.yy712, yymsp[-4].minor.yy712);
- yymsp[-11].minor.yy712 = addFillClause(pCxt, yymsp[-11].minor.yy712, yymsp[-3].minor.yy712);
+ yymsp[-11].minor.yy616 = createSelectStmt(pCxt, yymsp[-10].minor.yy151, yymsp[-9].minor.yy356, yymsp[-8].minor.yy616);
+ yymsp[-11].minor.yy616 = addWhereClause(pCxt, yymsp[-11].minor.yy616, yymsp[-7].minor.yy616);
+ yymsp[-11].minor.yy616 = addPartitionByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-6].minor.yy356);
+ yymsp[-11].minor.yy616 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy616, yymsp[-2].minor.yy616);
+ yymsp[-11].minor.yy616 = addGroupByClause(pCxt, yymsp[-11].minor.yy616, yymsp[-1].minor.yy356);
+ yymsp[-11].minor.yy616 = addHavingClause(pCxt, yymsp[-11].minor.yy616, yymsp[0].minor.yy616);
+ yymsp[-11].minor.yy616 = addRangeClause(pCxt, yymsp[-11].minor.yy616, yymsp[-5].minor.yy616);
+ yymsp[-11].minor.yy616 = addEveryClause(pCxt, yymsp[-11].minor.yy616, yymsp[-4].minor.yy616);
+ yymsp[-11].minor.yy616 = addFillClause(pCxt, yymsp[-11].minor.yy616, yymsp[-3].minor.yy616);
}
break;
- case 428: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy337 = false; }
+ case 427: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy151 = false; }
break;
- case 431: /* select_item ::= NK_STAR */
-{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy712 = yylhsminor.yy712;
+ case 430: /* select_item ::= NK_STAR */
+{ yylhsminor.yy616 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy616 = yylhsminor.yy616;
break;
- case 433: /* select_item ::= common_expression column_alias */
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-1].minor.yy712 = yylhsminor.yy712;
+ case 432: /* select_item ::= common_expression column_alias */
+{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616), &yymsp[0].minor.yy361); }
+ yymsp[-1].minor.yy616 = yylhsminor.yy616;
break;
- case 434: /* select_item ::= common_expression AS column_alias */
-{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), &yymsp[0].minor.yy129); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 433: /* select_item ::= common_expression AS column_alias */
+{ yylhsminor.yy616 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), &yymsp[0].minor.yy361); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 439: /* partition_by_clause_opt ::= PARTITION BY expression_list */
- case 456: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==456);
- case 472: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==472);
-{ yymsp[-2].minor.yy464 = yymsp[0].minor.yy464; }
+ case 438: /* partition_by_clause_opt ::= PARTITION BY expression_list */
+ case 455: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==455);
+ case 471: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==471);
+{ yymsp[-2].minor.yy356 = yymsp[0].minor.yy356; }
break;
- case 441: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy712 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 440: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy616 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); }
break;
- case 442: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
-{ yymsp[-3].minor.yy712 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 441: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+{ yymsp[-3].minor.yy616 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); }
break;
- case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 442: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), NULL, yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
- case 444: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); }
+ case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy616 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy616), releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), yymsp[-1].minor.yy616, yymsp[0].minor.yy616); }
break;
- case 446: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- case 464: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==464);
-{ yymsp[-3].minor.yy712 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy712); }
+ case 445: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ case 463: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==463);
+{ yymsp[-3].minor.yy616 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy616); }
break;
- case 448: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy712 = createFillNode(pCxt, yymsp[-1].minor.yy94, NULL); }
+ case 447: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy616 = createFillNode(pCxt, yymsp[-1].minor.yy494, NULL); }
break;
- case 449: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy464)); }
+ case 448: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy616 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy356)); }
break;
- case 450: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy94 = FILL_MODE_NONE; }
+ case 449: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy494 = FILL_MODE_NONE; }
break;
- case 451: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy94 = FILL_MODE_PREV; }
+ case 450: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy494 = FILL_MODE_PREV; }
break;
- case 452: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy94 = FILL_MODE_NULL; }
+ case 451: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy494 = FILL_MODE_NULL; }
break;
- case 453: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy94 = FILL_MODE_LINEAR; }
+ case 452: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy494 = FILL_MODE_LINEAR; }
break;
- case 454: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy94 = FILL_MODE_NEXT; }
+ case 453: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy494 = FILL_MODE_NEXT; }
break;
- case 457: /* group_by_list ::= expression */
-{ yylhsminor.yy464 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); }
- yymsp[0].minor.yy464 = yylhsminor.yy464;
+ case 456: /* group_by_list ::= expression */
+{ yylhsminor.yy356 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); }
+ yymsp[0].minor.yy356 = yylhsminor.yy356;
break;
- case 458: /* group_by_list ::= group_by_list NK_COMMA expression */
-{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); }
- yymsp[-2].minor.yy464 = yylhsminor.yy464;
+ case 457: /* group_by_list ::= group_by_list NK_COMMA expression */
+{ yylhsminor.yy356 = addNodeToList(pCxt, yymsp[-2].minor.yy356, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy616))); }
+ yymsp[-2].minor.yy356 = yylhsminor.yy356;
break;
- case 462: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
-{ yymsp[-5].minor.yy712 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); }
+ case 461: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */
+{ yymsp[-5].minor.yy616 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy616), releaseRawExprNode(pCxt, yymsp[-1].minor.yy616)); }
break;
- case 465: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 464: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy712 = addOrderByClause(pCxt, yymsp[-3].minor.yy712, yymsp[-2].minor.yy464);
- yylhsminor.yy712 = addSlimitClause(pCxt, yylhsminor.yy712, yymsp[-1].minor.yy712);
- yylhsminor.yy712 = addLimitClause(pCxt, yylhsminor.yy712, yymsp[0].minor.yy712);
+ yylhsminor.yy616 = addOrderByClause(pCxt, yymsp[-3].minor.yy616, yymsp[-2].minor.yy356);
+ yylhsminor.yy616 = addSlimitClause(pCxt, yylhsminor.yy616, yymsp[-1].minor.yy616);
+ yylhsminor.yy616 = addLimitClause(pCxt, yylhsminor.yy616, yymsp[0].minor.yy616);
}
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
- case 467: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
-{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-3].minor.yy712 = yylhsminor.yy712;
+ case 466: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy616, yymsp[0].minor.yy616); }
+ yymsp[-3].minor.yy616 = yylhsminor.yy616;
break;
- case 468: /* query_expression_body ::= query_expression_body UNION query_expression_body */
-{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 467: /* query_expression_body ::= query_expression_body UNION query_expression_body */
+{ yylhsminor.yy616 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy616, yymsp[0].minor.yy616); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 470: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ case 469: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
{
- yymsp[-5].minor.yy712 = addOrderByClause(pCxt, yymsp[-4].minor.yy712, yymsp[-3].minor.yy464);
- yymsp[-5].minor.yy712 = addSlimitClause(pCxt, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712);
- yymsp[-5].minor.yy712 = addLimitClause(pCxt, yymsp[-5].minor.yy712, yymsp[-1].minor.yy712);
+ yymsp[-5].minor.yy616 = addOrderByClause(pCxt, yymsp[-4].minor.yy616, yymsp[-3].minor.yy356);
+ yymsp[-5].minor.yy616 = addSlimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-2].minor.yy616);
+ yymsp[-5].minor.yy616 = addLimitClause(pCxt, yymsp[-5].minor.yy616, yymsp[-1].minor.yy616);
}
break;
- case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==478);
-{ yymsp[-1].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 473: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 477: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==477);
+{ yymsp[-1].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==479);
-{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==478);
+{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 476: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 480: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==480);
-{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==479);
+{ yymsp[-3].minor.yy616 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 481: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy712); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 480: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy616 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy616); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 485: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy712 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), yymsp[-1].minor.yy658, yymsp[0].minor.yy338); }
- yymsp[-2].minor.yy712 = yylhsminor.yy712;
+ case 484: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy616 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy616), yymsp[-1].minor.yy58, yymsp[0].minor.yy613); }
+ yymsp[-2].minor.yy616 = yylhsminor.yy616;
break;
- case 486: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy658 = ORDER_ASC; }
+ case 485: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy58 = ORDER_ASC; }
break;
- case 487: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy658 = ORDER_ASC; }
+ case 486: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy58 = ORDER_ASC; }
break;
- case 488: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy658 = ORDER_DESC; }
+ case 487: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy58 = ORDER_DESC; }
break;
- case 489: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy338 = NULL_ORDER_DEFAULT; }
+ case 488: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy613 = NULL_ORDER_DEFAULT; }
break;
- case 490: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy338 = NULL_ORDER_FIRST; }
+ case 489: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy613 = NULL_ORDER_FIRST; }
break;
- case 491: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy338 = NULL_ORDER_LAST; }
+ case 490: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy613 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp
index f064566d5f..6834f9ccca 100644
--- a/source/libs/parser/test/mockCatalog.cpp
+++ b/source/libs/parser/test/mockCatalog.cpp
@@ -58,46 +58,46 @@ void generateInformationSchema(MockCatalogService* mcs) {
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_DATABASES, TSDB_SYSTEM_TABLE, 1)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_DATABASES, TSDB_SYSTEM_TABLE, 1)
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_FUNCTIONS, TSDB_SYSTEM_TABLE, 1)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_FUNCTIONS, TSDB_SYSTEM_TABLE, 1)
.addColumn("name", TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_INDEXES, TSDB_SYSTEM_TABLE, 2)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_INDEXES, TSDB_SYSTEM_TABLE, 2)
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_STABLES, TSDB_SYSTEM_TABLE, 2)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES, TSDB_SYSTEM_TABLE, 2)
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
.addColumn("stable_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_TABLES, TSDB_SYSTEM_TABLE, 2)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLES, TSDB_SYSTEM_TABLE, 2)
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN)
.addColumn("table_name", TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED, TSDB_SYSTEM_TABLE, 1)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLE_DISTRIBUTED, TSDB_SYSTEM_TABLE, 1)
.addColumn("db_name", TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
builder.done();
}
{
ITableBuilder& builder =
- mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USER_USERS, TSDB_SYSTEM_TABLE, 1)
+ mcs->createTableBuilder(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_USERS, TSDB_SYSTEM_TABLE, 1)
.addColumn("user_name", TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN);
builder.done();
}
diff --git a/source/libs/parser/test/parInsertTest.cpp b/source/libs/parser/test/parInsertTest.cpp
index 22a1be2579..f3f87e945a 100644
--- a/source/libs/parser/test/parInsertTest.cpp
+++ b/source/libs/parser/test/parInsertTest.cpp
@@ -110,15 +110,15 @@ class InsertTest : public Test {
SSubmitBlk* blk = (SSubmitBlk*)(submit + 1);
for (int32_t i = 0; i < numOfBlocks; ++i) {
cout << "Block:" << i << endl;
- cout << "\tuid:" << be64toh(blk->uid) << ", tid:" << be64toh(blk->suid) << ", padding:" << ntohl(blk->padding)
- << ", sversion:" << ntohl(blk->sversion) << ", dataLen:" << ntohl(blk->dataLen)
- << ", schemaLen:" << ntohl(blk->schemaLen) << ", numOfRows:" << ntohs(blk->numOfRows) << endl;
+ cout << "\tuid:" << be64toh(blk->uid) << ", tid:" << be64toh(blk->suid) << ", sversion:" << ntohl(blk->sversion)
+ << ", dataLen:" << ntohl(blk->dataLen) << ", schemaLen:" << ntohl(blk->schemaLen)
+ << ", numOfRows:" << ntohl(blk->numOfRows) << endl;
blk = (SSubmitBlk*)(blk->data + ntohl(blk->dataLen));
}
}
}
- void checkReslut(int32_t numOfTables, int16_t numOfRows1, int16_t numOfRows2 = -1) {
+ void checkReslut(int32_t numOfTables, int32_t numOfRows1, int32_t numOfRows2 = -1) {
SVnodeModifOpStmt* pStmt = getVnodeModifStmt(res_);
ASSERT_EQ(pStmt->payloadType, PAYLOAD_TYPE_KV);
ASSERT_EQ(pStmt->insertType, TSDB_QUERY_TYPE_INSERT);
@@ -134,7 +134,7 @@ class InsertTest : public Test {
int32_t numOfBlocks = ntohl(submit->numOfBlocks);
SSubmitBlk* blk = (SSubmitBlk*)(submit + 1);
for (int32_t i = 0; i < numOfBlocks; ++i) {
- ASSERT_EQ(ntohs(blk->numOfRows), (0 == i ? numOfRows1 : (numOfRows2 > 0 ? numOfRows2 : numOfRows1)));
+ ASSERT_EQ(ntohl(blk->numOfRows), (0 == i ? numOfRows1 : (numOfRows2 > 0 ? numOfRows2 : numOfRows1)));
blk = (SSubmitBlk*)(blk->data + ntohl(blk->dataLen));
}
}
diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp
index ebf8012cf7..5b222a8dec 100644
--- a/source/libs/parser/test/parSelectTest.cpp
+++ b/source/libs/parser/test/parSelectTest.cpp
@@ -316,7 +316,8 @@ TEST_F(ParserSelectTest, subquery) {
run("SELECT SUM(a) FROM (SELECT MAX(c1) a, ts FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");
- run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstart FROM st1s1 PARTITION BY TBNAME INTERVAL(1m)) INTERVAL(1n)");
+ run("SELECT SUM(a) FROM (SELECT MAX(c1) a, _wstart FROM st1s1 PARTITION BY TBNAME INTERVAL(1m) ORDER BY _WSTART) "
+ "INTERVAL(1n)");
run("SELECT _C0 FROM (SELECT _ROWTS, ts FROM st1s1)");
@@ -426,7 +427,7 @@ TEST_F(ParserSelectTest, setOperatorSemanticCheck) {
TEST_F(ParserSelectTest, informationSchema) {
useDb("root", "test");
- run("SELECT * FROM information_schema.user_databases WHERE name = 'information_schema'");
+ run("SELECT * FROM information_schema.ins_databases WHERE name = 'information_schema'");
}
TEST_F(ParserSelectTest, withoutFrom) {
diff --git a/source/libs/parser/test/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp
index 57f07b2285..7af6d8350c 100644
--- a/source/libs/parser/test/parShowToUse.cpp
+++ b/source/libs/parser/test/parShowToUse.cpp
@@ -54,7 +54,8 @@ TEST_F(ParserShowToUseTest, showCreateSTable) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_SHOW_CREATE_STABLE_STMT);
ASSERT_EQ(pQuery->execMode, QUERY_EXEC_MODE_LOCAL);
ASSERT_TRUE(pQuery->haveResultSet);
- ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pCfg, nullptr);
+ ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pDbCfg, nullptr);
+ ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pTableCfg, nullptr);
});
run("SHOW CREATE STABLE st1");
@@ -67,7 +68,8 @@ TEST_F(ParserShowToUseTest, showCreateTable) {
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_SHOW_CREATE_TABLE_STMT);
ASSERT_EQ(pQuery->execMode, QUERY_EXEC_MODE_LOCAL);
ASSERT_TRUE(pQuery->haveResultSet);
- ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pCfg, nullptr);
+ ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pDbCfg, nullptr);
+ ASSERT_NE(((SShowCreateTableStmt*)pQuery->pRoot)->pTableCfg, nullptr);
});
run("SHOW CREATE TABLE t1");
diff --git a/source/libs/planner/inc/planInt.h b/source/libs/planner/inc/planInt.h
index 88c7c26276..82abc5d1a9 100644
--- a/source/libs/planner/inc/planInt.h
+++ b/source/libs/planner/inc/planInt.h
@@ -23,13 +23,13 @@ extern "C" {
#include "planner.h"
#include "taoserror.h"
-#define planFatal(param, ...) qFatal("PLAN: " param, __VA_ARGS__)
-#define planError(param, ...) qError("PLAN: " param, __VA_ARGS__)
-#define planWarn(param, ...) qWarn("PLAN: " param, __VA_ARGS__)
-#define planInfo(param, ...) qInfo("PLAN: " param, __VA_ARGS__)
-#define planDebug(param, ...) qDebug("PLAN: " param, __VA_ARGS__)
-#define planDebugL(param, ...) qDebugL("PLAN: " param, __VA_ARGS__)
-#define planTrace(param, ...) qTrace("PLAN: " param, __VA_ARGS__)
+#define planFatal(param, ...) qFatal("PLAN: " param, ##__VA_ARGS__)
+#define planError(param, ...) qError("PLAN: " param, ##__VA_ARGS__)
+#define planWarn(param, ...) qWarn("PLAN: " param, ##__VA_ARGS__)
+#define planInfo(param, ...) qInfo("PLAN: " param, ##__VA_ARGS__)
+#define planDebug(param, ...) qDebug("PLAN: " param, ##__VA_ARGS__)
+#define planDebugL(param, ...) qDebugL("PLAN: " param, ##__VA_ARGS__)
+#define planTrace(param, ...) qTrace("PLAN: " param, ##__VA_ARGS__)
int32_t generateUsageErrMsg(char* pBuf, int32_t len, int32_t errCode, ...);
int32_t createColumnByRewriteExprs(SNodeList* pExprs, SNodeList** pList);
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index b51624336b..0762b28188 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -480,6 +480,7 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
pAgg->hasLastRow = pSelect->hasLastRowFunc;
pAgg->hasTimeLineFunc = pSelect->hasTimeLineFunc;
+ pAgg->onlyHasKeepOrderFunc = pSelect->onlyHasKeepOrderFunc;
pAgg->node.groupAction = GROUP_ACTION_SET;
pAgg->node.requireDataOrder = pAgg->hasTimeLineFunc ? DATA_ORDER_LEVEL_IN_GROUP : DATA_ORDER_LEVEL_NONE;
pAgg->node.resultDataOrder = DATA_ORDER_LEVEL_NONE;
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index c02ef64707..719da19da6 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -436,8 +436,8 @@ static int32_t pushDownCondOptDealScan(SOptimizeContext* pCxt, SScanLogicNode* p
SNode* pPrimaryKeyCond = NULL;
SNode* pOtherCond = NULL;
- int32_t code = filterPartitionCond(&pScan->node.pConditions, &pPrimaryKeyCond, &pScan->pTagIndexCond, &pScan->pTagCond,
- &pOtherCond);
+ int32_t code = filterPartitionCond(&pScan->node.pConditions, &pPrimaryKeyCond, &pScan->pTagIndexCond,
+ &pScan->pTagCond, &pOtherCond);
if (TSDB_CODE_SUCCESS == code && NULL != pScan->pTagCond) {
code = pushDownCondOptRebuildTbanme(&pScan->pTagCond);
}
@@ -1693,22 +1693,30 @@ static EDealRes eliminateProjOptCanUseNewChildTargetsImpl(SNode* pNode, void* pC
CheckNewChildTargetsCxt* pCxt = pContext;
SNode* pTarget = NULL;
FOREACH(pTarget, pCxt->pNewChildTargets) {
- if (!nodesEqualNode(pTarget, pNode)) {
- pCxt->canUse = false;
- return DEAL_RES_END;
+ if (nodesEqualNode(pTarget, pNode)) {
+ pCxt->canUse = true;
+ return DEAL_RES_CONTINUE;
}
}
+ pCxt->canUse = false;
+ return DEAL_RES_END;
}
return DEAL_RES_CONTINUE;
}
-static bool eliminateProjOptCanUseNewChildTargets(SLogicNode* pChild, SNodeList* pNewChildTargets) {
- if (NULL == pChild->pConditions) {
- return true;
+static bool eliminateProjOptCanChildConditionUseChildTargets(SLogicNode* pChild, SNodeList* pNewChildTargets) {
+ if (NULL != pChild->pConditions) {
+ CheckNewChildTargetsCxt cxt = {.pNewChildTargets = pNewChildTargets, .canUse = false};
+ nodesWalkExpr(pChild->pConditions, eliminateProjOptCanUseNewChildTargetsImpl, &cxt);
+ if (!cxt.canUse) return false;
}
- CheckNewChildTargetsCxt cxt = {.pNewChildTargets = pNewChildTargets, .canUse = true};
- nodesWalkExpr(pChild->pConditions, eliminateProjOptCanUseNewChildTargetsImpl, &cxt);
- return cxt.canUse;
+ if (QUERY_NODE_LOGIC_PLAN_JOIN == nodeType(pChild) && NULL != ((SJoinLogicNode*)pChild)->pOnConditions) {
+ SJoinLogicNode* pJoinLogicNode = (SJoinLogicNode*)pChild;
+ CheckNewChildTargetsCxt cxt = {.pNewChildTargets = pNewChildTargets, .canUse = false};
+ nodesWalkExpr(pJoinLogicNode->pOnConditions, eliminateProjOptCanUseNewChildTargetsImpl, &cxt);
+ if (!cxt.canUse) return false;
+ }
+ return true;
}
static void alignProjectionWithTarget(SLogicNode* pNode) {
@@ -1748,7 +1756,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
}
}
}
- if (eliminateProjOptCanUseNewChildTargets(pChild, pNewChildTargets)) {
+ if (eliminateProjOptCanChildConditionUseChildTargets(pChild, pNewChildTargets)) {
nodesDestroyList(pChild->pTargets);
pChild->pTargets = pNewChildTargets;
} else {
@@ -1760,6 +1768,7 @@ static int32_t eliminateProjOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan*
if (TSDB_CODE_SUCCESS == code) {
NODES_CLEAR_LIST(pProjectNode->node.pChildren);
nodesDestroyNode((SNode*)pProjectNode);
+ // if pChild is a project logic node, remove its projection which is not reference by its target.
alignProjectionWithTarget(pChild);
}
pCxt->optimized = true;
@@ -2395,6 +2404,9 @@ static const SOptimizeRule optimizeRuleSet[] = {
static const int32_t optimizeRuleNum = (sizeof(optimizeRuleSet) / sizeof(SOptimizeRule));
static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) {
+ if (0 == (qDebugFlag & DEBUG_DEBUG)) {
+ return;
+ }
char* pStr = NULL;
nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL);
if (NULL == pRuleName) {
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index 3771586b34..6d70aa60d5 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -568,9 +568,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
pScan->showRewrite = pScanLogicNode->showRewrite;
pScan->accountId = pCxt->pPlanCxt->acctId;
- if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_USER_TABLES) ||
- 0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED) ||
- 0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_USER_TAGS)) {
+ if (0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TABLES) ||
+ 0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TABLE_DISTRIBUTED) ||
+ 0 == strcmp(pScanLogicNode->tableName.tname, TSDB_INS_TABLE_TAGS)) {
vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode);
} else {
pSubplan->execNode.nodeId = MNODE_HANDLE;
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index 74c78b970d..e10f0586ca 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -264,7 +264,7 @@ static bool stbSplNeedSplitJoin(bool streamQuery, SJoinLogicNode* pJoin) {
static bool stbSplNeedSplit(bool streamQuery, SLogicNode* pNode) {
switch (nodeType(pNode)) {
case QUERY_NODE_LOGIC_PLAN_SCAN:
- return stbSplIsMultiTbScan(streamQuery, (SScanLogicNode*)pNode);
+ return streamQuery ? false : stbSplIsMultiTbScan(streamQuery, (SScanLogicNode*)pNode);
case QUERY_NODE_LOGIC_PLAN_JOIN:
return stbSplNeedSplitJoin(streamQuery, (SJoinLogicNode*)pNode);
case QUERY_NODE_LOGIC_PLAN_PARTITION:
@@ -1423,6 +1423,9 @@ static const SSplitRule splitRuleSet[] = {
static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule));
static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) {
+ if (0 == (qDebugFlag & DEBUG_DEBUG)) {
+ return;
+ }
char* pStr = NULL;
nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL);
if (NULL == pRuleName) {
diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c
index 7aab8a7ca3..d7310892de 100644
--- a/source/libs/planner/src/planUtil.c
+++ b/source/libs/planner/src/planUtil.c
@@ -146,19 +146,13 @@ static int32_t adjustJoinDataRequirement(SJoinLogicNode* pJoin, EDataOrderLevel
return TSDB_CODE_SUCCESS;
}
-static bool isKeepOrderAggFunc(SNodeList* pFuncs) {
- SNode* pFunc = NULL;
- FOREACH(pFunc, pFuncs) {
- if (!fmIsKeepOrderFunc(((SFunctionNode*)pFunc)->funcId)) {
- return false;
- }
- }
- return true;
-}
-
static int32_t adjustAggDataRequirement(SAggLogicNode* pAgg, EDataOrderLevel requirement) {
// The sort level of agg with group by output data can only be DATA_ORDER_LEVEL_NONE
- if (requirement > DATA_ORDER_LEVEL_NONE && (NULL != pAgg->pGroupKeys || !isKeepOrderAggFunc(pAgg->pAggFuncs))) {
+ if (requirement > DATA_ORDER_LEVEL_NONE && (NULL != pAgg->pGroupKeys || !pAgg->onlyHasKeepOrderFunc)) {
+ planError(
+ "The output of aggregate cannot meet the requirements(%s) of the upper operator. "
+ "Illegal statement, should be intercepted in parser",
+ dataOrderStr(requirement));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
pAgg->node.resultDataOrder = requirement;
@@ -231,6 +225,10 @@ static int32_t adjustSortDataRequirement(SSortLogicNode* pSort, EDataOrderLevel
static int32_t adjustPartitionDataRequirement(SPartitionLogicNode* pPart, EDataOrderLevel requirement) {
if (DATA_ORDER_LEVEL_GLOBAL == requirement) {
+ planError(
+ "The output of partition cannot meet the requirements(%s) of the upper operator. "
+ "Illegal statement, should be intercepted in parser",
+ dataOrderStr(requirement));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
pPart->node.resultDataOrder = requirement;
diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c
index 0554779746..1f531b0708 100644
--- a/source/libs/planner/src/planner.c
+++ b/source/libs/planner/src/planner.c
@@ -19,6 +19,9 @@
#include "scalar.h"
static void dumpQueryPlan(SQueryPlan* pPlan) {
+ if (0 == (qDebugFlag & DEBUG_DEBUG)) {
+ return;
+ }
char* pStr = NULL;
nodesNodeToString((SNode*)pPlan, false, &pStr, NULL);
planDebugL("QID:0x%" PRIx64 " Query Plan: %s", pPlan->queryId, pStr);
@@ -42,6 +45,9 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
if (TSDB_CODE_SUCCESS == code) {
code = createPhysiPlan(pCxt, pLogicPlan, pPlan, pExecNodeList);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ dumpQueryPlan(*pPlan);
+ }
nodesDestroyNode((SNode*)pLogicSubplan);
nodesDestroyNode((SNode*)pLogicPlan);
@@ -79,6 +85,7 @@ static int32_t setSubplanExecutionNode(SPhysiNode* pNode, int32_t groupId, SDown
}
int32_t qSetSubplanExecutionNode(SSubplan* subplan, int32_t groupId, SDownstreamSourceNode* pSource) {
+ planDebug("QID:0x%" PRIx64 " set subplan execution node, groupId:%d", subplan->id.groupId, groupId);
return setSubplanExecutionNode(subplan->pNode, groupId, pSource);
}
diff --git a/source/libs/planner/test/planSysTbTest.cpp b/source/libs/planner/test/planSysTbTest.cpp
index e5c30030b3..921f86f09a 100644
--- a/source/libs/planner/test/planSysTbTest.cpp
+++ b/source/libs/planner/test/planSysTbTest.cpp
@@ -30,5 +30,5 @@ TEST_F(PlanSysTableTest, show) {
TEST_F(PlanSysTableTest, informationSchema) {
useDb("root", "information_schema");
- run("SELECT * FROM information_schema.user_databases WHERE name = 'information_schema'");
+ run("SELECT * FROM information_schema.ins_databases WHERE name = 'information_schema'");
}
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 04328fda9c..2bdc8f1384 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -3246,6 +3246,10 @@ _return:
}
bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg *pDataStatis, int32_t numOfCols, int32_t numOfRows) {
+ if (info->scalarMode) {
+ return true;
+ }
+
if (FILTER_EMPTY_RES(info)) {
return false;
}
diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c
index a70afe25d6..2d889dd925 100644
--- a/source/libs/scalar/src/sclfunc.c
+++ b/source/libs/scalar/src/sclfunc.c
@@ -1727,16 +1727,11 @@ int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO
char str[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
metaGetTableNameByUid(pInput->param, uid, str);
-
- for(int32_t i = 0; i < pInput->numOfRows; ++i) {
- colDataAppend(pOutput->columnData, pOutput->numOfRows + i, str, false);
- }
-
+ colDataAppendNItems(pOutput->columnData, pOutput->numOfRows, str, pInput->numOfRows);
pOutput->numOfRows += pInput->numOfRows;
return TSDB_CODE_SUCCESS;
}
-
/** Aggregation functions **/
int32_t countScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
SColumnInfoData *pInputData = pInput->columnData;
diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c
index 254c99f05d..aaa70ef5ae 100644
--- a/source/libs/scalar/src/sclvector.c
+++ b/source/libs/scalar/src/sclvector.c
@@ -1094,6 +1094,7 @@ static SColumnInfoData* doVectorConvert(SScalarParam* pInput, int32_t* doConvert
static void doReleaseVec(SColumnInfoData* pCol, int32_t type) {
if (type == VECTOR_DO_CONVERT) {
colDataDestroy(pCol);
+ taosMemoryFree(pCol);
}
}
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index 82146c3741..98501427ab 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -380,6 +380,7 @@ int32_t schDumpJobExecRes(SSchJob* pJob, SExecResult* pRes) {
pRes->numOfRows = pJob->resNumOfRows;
pRes->res = pJob->execRes.res;
pRes->msgType = pJob->execRes.msgType;
+ pRes->numOfBytes = pJob->execRes.numOfBytes;
pJob->execRes.res = NULL;
SCH_JOB_DLOG("execRes dumped, code: %s", tstrerror(pRes->code));
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index 544ecce175..8c9003a9b2 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -213,6 +213,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
pJob->execRes.res = rsp;
pJob->execRes.msgType = TDMT_VND_SUBMIT;
}
+ pJob->execRes.numOfBytes += pTask->msgLen;
SCH_UNLOCK(SCH_WRITE, &pJob->resLock);
}
diff --git a/source/libs/stream/CMakeLists.txt b/source/libs/stream/CMakeLists.txt
index 3bab354c22..33e864158a 100644
--- a/source/libs/stream/CMakeLists.txt
+++ b/source/libs/stream/CMakeLists.txt
@@ -8,7 +8,7 @@ target_include_directories(
target_link_libraries(
stream
- PRIVATE os util transport qcom executor
+ PRIVATE os util transport qcom executor tdb
)
if(${BUILD_TEST})
diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c
index 31da865a69..30f0919cee 100644
--- a/source/libs/stream/src/stream.c
+++ b/source/libs/stream/src/stream.c
@@ -47,7 +47,7 @@ void streamCleanUp() {
}
}
-void streamTriggerByTimer(void* param, void* tmrId) {
+void streamSchedByTimer(void* param, void* tmrId) {
SStreamTask* pTask = (void*)param;
if (atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING) {
@@ -65,31 +65,33 @@ void streamTriggerByTimer(void* param, void* tmrId) {
}
trigger->pBlock->info.type = STREAM_GET_ALL;
- atomic_store_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__IN_ACTIVE);
+ atomic_store_8(&pTask->triggerStatus, TASK_TRIGGER_STATUS__INACTIVE);
streamTaskInput(pTask, (SStreamQueueItem*)trigger);
- streamLaunchByWrite(pTask, pTask->nodeId);
+ streamSchedExec(pTask);
}
- taosTmrReset(streamTriggerByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer, &pTask->timer);
+ taosTmrReset(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer, &pTask->timer);
}
int32_t streamSetupTrigger(SStreamTask* pTask) {
if (pTask->triggerParam != 0) {
- pTask->timer = taosTmrStart(streamTriggerByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer);
- pTask->triggerStatus = TASK_TRIGGER_STATUS__IN_ACTIVE;
+ pTask->timer = taosTmrStart(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer);
+ pTask->triggerStatus = TASK_TRIGGER_STATUS__INACTIVE;
}
return 0;
}
-int32_t streamLaunchByWrite(SStreamTask* pTask, int32_t vgId) {
- int8_t execStatus = atomic_load_8(&pTask->execStatus);
- if (execStatus == TASK_EXEC_STATUS__IDLE || execStatus == TASK_EXEC_STATUS__CLOSING) {
+int32_t streamSchedExec(SStreamTask* pTask) {
+ int8_t schedStatus =
+ atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE, TASK_SCHED_STATUS__WAITING);
+ if (schedStatus == TASK_SCHED_STATUS__INACTIVE) {
SStreamTaskRunReq* pRunReq = rpcMallocCont(sizeof(SStreamTaskRunReq));
- if (pRunReq == NULL) return -1;
-
- // TODO: do we need htonl?
- pRunReq->head.vgId = vgId;
+ if (pRunReq == NULL) {
+ atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE);
+ return -1;
+ }
+ pRunReq->head.vgId = pTask->nodeId;
pRunReq->streamId = pTask->streamId;
pRunReq->taskId = pTask->taskId;
SRpcMsg msg = {
@@ -143,7 +145,7 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
// enqueue
if (pData != NULL) {
- qDebug("task %d(child %d) recv retrieve req from task %d, reqId %ld", pTask->taskId, pTask->selfChildId,
+ qDebug("task %d(child %d) recv retrieve req from task %d, reqId %" PRId64, pTask->taskId, pTask->selfChildId,
pReq->srcTaskId, pReq->reqId);
pData->type = STREAM_INPUT__DATA_RETRIEVE;
@@ -175,40 +177,20 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq,
return status == TASK_INPUT_STATUS__NORMAL ? 0 : -1;
}
-int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pRsp) {
+int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pRsp, bool exec) {
qDebug("task %d receive dispatch req from node %d task %d", pTask->taskId, pReq->upstreamNodeId,
pReq->upstreamTaskId);
- // 1. handle input
streamTaskEnqueue(pTask, pReq, pRsp);
- // 2. try exec
- // 2.1. idle: exec
- // 2.2. executing: return
- // 2.3. closing: keep trying
-#if 0
- if (pTask->execType != TASK_EXEC__NONE) {
-#endif
- streamExec(pTask);
-#if 0
- } else {
- ASSERT(pTask->sinkType != TASK_SINK__NONE);
- while (1) {
- void* data = streamQueueNextItem(pTask->inputQueue);
- if (data == NULL) return 0;
- if (streamTaskOutput(pTask, data) < 0) {
- ASSERT(0);
- }
- }
- }
-#endif
+ if (exec) {
+ streamTryExec(pTask);
- // 3. handle output
- // 3.1 check and set status
- // 3.2 dispatch / sink
- if (pTask->dispatchType != TASK_DISPATCH__NONE) {
- ASSERT(pTask->sinkType == TASK_SINK__NONE);
- streamDispatch(pTask);
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
+ streamDispatch(pTask);
+ }
+ } else {
+ streamSchedExec(pTask);
}
return 0;
@@ -219,7 +201,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp) {
qDebug("task %d receive dispatch rsp", pTask->taskId);
- if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) {
+ if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
int32_t leftRsp = atomic_sub_fetch_32(&pTask->shuffleDispatcher.waitingRspCnt, 1);
qDebug("task %d is shuffle, left waiting rsp %d", pTask->taskId, leftRsp);
if (leftRsp > 0) return 0;
@@ -238,9 +220,9 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp) {
}
int32_t streamProcessRunReq(SStreamTask* pTask) {
- streamExec(pTask);
+ streamTryExec(pTask);
- if (pTask->dispatchType != TASK_DISPATCH__NONE) {
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
streamDispatch(pTask);
}
return 0;
@@ -268,7 +250,7 @@ int32_t streamProcessRecoverRsp(SStreamTask* pTask, SStreamTaskRecoverRsp* pRsp)
streamProcessRunReq(pTask);
- if (pTask->isDataScan) {
+ if (pTask->taskLevel == TASK_LEVEL__SOURCE) {
// scan data to recover
pTask->inputStatus = TASK_INPUT_STATUS__RECOVER;
pTask->taskStatus = TASK_STATUS__RECOVERING;
@@ -290,11 +272,12 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, S
streamTaskEnqueueRetrieve(pTask, pReq, pRsp);
- ASSERT(pTask->execType != TASK_EXEC__NONE);
- streamExec(pTask);
+ ASSERT(pTask->taskLevel != TASK_LEVEL__SINK);
+ streamSchedExec(pTask);
- ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE);
- streamDispatch(pTask);
+ /*streamTryExec(pTask);*/
+
+ /*streamDispatch(pTask);*/
return 0;
}
diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c
index eb14990c0e..0bf6d4c921 100644
--- a/source/libs/stream/src/streamData.c
+++ b/source/libs/stream/src/streamData.c
@@ -167,12 +167,13 @@ void streamFreeQitem(SStreamQueueItem* data) {
SStreamMergedSubmit* pMerge = (SStreamMergedSubmit*)data;
int32_t sz = taosArrayGetSize(pMerge->reqs);
for (int32_t i = 0; i < sz; i++) {
- int32_t* ref = taosArrayGetP(pMerge->dataRefs, i);
- (*ref)--;
- if (*ref == 0) {
+ int32_t* pRef = taosArrayGetP(pMerge->dataRefs, i);
+ int32_t ref = atomic_sub_fetch_32(pRef, 1);
+ ASSERT(ref >= 0);
+ if (ref == 0) {
void* data = taosArrayGetP(pMerge->reqs, i);
taosMemoryFree(data);
- taosMemoryFree(ref);
+ taosMemoryFree(pRef);
}
}
taosArrayDestroy(pMerge->reqs);
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 95e5b61dbd..66e689dd3e 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -159,8 +159,8 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock)
return -1;
}
- qDebug("task %d(child %d) send retrieve req to task %d at node %d, reqId %ld", pTask->taskId, pTask->selfChildId,
- pEpInfo->taskId, pEpInfo->nodeId, req.reqId);
+ qDebug("task %d(child %d) send retrieve req to task %d at node %d, reqId %" PRId64, pTask->taskId,
+ pTask->selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req.reqId);
}
return 0;
FAIL:
@@ -242,7 +242,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
int32_t blockNum = taosArrayGetSize(pData->blocks);
ASSERT(blockNum != 0);
- if (pTask->dispatchType == TASK_DISPATCH__FIXED) {
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
SStreamDispatchReq req = {
.streamId = pTask->streamId,
.dataSrcVgId = pData->srcVgId,
@@ -282,7 +282,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
taosArrayDestroy(req.dataLen);
return code;
- } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) {
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
int32_t rspCnt = atomic_load_32(&pTask->shuffleDispatcher.waitingRspCnt);
ASSERT(rspCnt == 0);
@@ -393,11 +393,11 @@ int32_t streamBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* data,
int32_t vgId = 0;
int32_t downstreamTaskId = 0;
// find ep
- if (pTask->dispatchType == TASK_DISPATCH__FIXED) {
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
vgId = pTask->fixedEpDispatcher.nodeId;
*ppEpSet = &pTask->fixedEpDispatcher.epSet;
downstreamTaskId = pTask->fixedEpDispatcher.taskId;
- } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) {
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
// TODO get ctbName for each block
SSDataBlock* pBlock = taosArrayGet(data->blocks, 0);
char* ctbName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, pBlock->info.groupId);
@@ -439,14 +439,13 @@ FAIL:
}
int32_t streamDispatch(SStreamTask* pTask) {
- ASSERT(pTask->dispatchType != TASK_DISPATCH__NONE);
-#if 1
+ ASSERT(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH);
+
int8_t old =
atomic_val_compare_exchange_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL, TASK_OUTPUT_STATUS__WAIT);
if (old != TASK_OUTPUT_STATUS__NORMAL) {
return 0;
}
-#endif
SStreamDataBlock* pBlock = streamQueueNextItem(pTask->outputQueue);
if (pBlock == NULL) {
@@ -466,22 +465,8 @@ int32_t streamDispatch(SStreamTask* pTask) {
atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);
goto FREE;
}
- /*atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);*/
FREE:
taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes);
taosFreeQitem(pBlock);
-#if 0
- SRpcMsg dispatchMsg = {0};
- SEpSet* pEpSet = NULL;
- if (streamBuildDispatchMsg(pTask, pBlock, &dispatchMsg, &pEpSet) < 0) {
- ASSERT(0);
- atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);
- return -1;
- }
- taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes);
- taosFreeQitem(pBlock);
-
- tmsgSendReq(pEpSet, &dispatchMsg);
-#endif
return code;
}
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 196dbd6dc3..e662c18a15 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -24,7 +24,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes)
SStreamTrigger* pTrigger = (SStreamTrigger*)data;
qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK);
} else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) {
- ASSERT(pTask->isDataScan);
+ ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE);
SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)data;
qDebug("task %d %p set submit input %p %p %d 1", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef);
qSetMultiStreamInput(exec, pSubmit->data, 1, STREAM_INPUT__DATA_SUBMIT);
@@ -59,7 +59,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes)
block.info.childId = pTask->selfChildId;
taosArrayPush(pRes, &block);
- qDebug("task %d(child %d) processed retrieve, reqId %ld", pTask->taskId, pTask->selfChildId,
+ qDebug("task %d(child %d) processed retrieve, reqId %" PRId64, pTask->taskId, pTask->selfChildId,
pRetrieveBlock->reqId);
}
break;
@@ -72,7 +72,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes)
continue;
}
- qDebug("task %d(child %d) executed and get block");
+ qDebug("task %d(child %d) executed and get block", pTask->taskId, pTask->selfChildId);
SSDataBlock block = {0};
assignOneDataBlock(&block, output);
@@ -92,7 +92,7 @@ static FORCE_INLINE int32_t streamUpdateVer(SStreamTask* pTask, SStreamDataBlock
}
int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum) {
- ASSERT(pTask->execType != TASK_EXEC__NONE);
+ ASSERT(pTask->taskLevel != TASK_LEVEL__SINK);
void* exec = pTask->exec.executor;
@@ -139,32 +139,30 @@ int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum) {
return -1;
}
- if (pTask->dispatchType != TASK_DISPATCH__NONE) {
- ASSERT(pTask->sinkType == TASK_SINK__NONE);
+ if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
streamDispatch(pTask);
}
}
return 0;
}
-
-static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) {
+// TODO: handle version
+int32_t streamExecForAll(SStreamTask* pTask) {
while (1) {
int32_t cnt = 1;
void* data = NULL;
while (1) {
SStreamQueueItem* qItem = streamQueueNextItem(pTask->inputQueue);
if (qItem == NULL) {
- qDebug("stream exec over, queue empty");
+ qDebug("stream task exec over, queue empty, task: %d", pTask->taskId);
break;
}
if (data == NULL) {
data = qItem;
streamQueueProcessSuccess(pTask->inputQueue);
- if (pTask->execType == TASK_EXEC__NONE) break;
- /*if (qItem->type == STREAM_INPUT__DATA_BLOCK) {*/
- /*streamUpdateVer(pTask, (SStreamDataBlock*)qItem);*/
- /*}*/
+ if (pTask->taskLevel == TASK_LEVEL__SINK) {
+ break;
+ }
} else {
void* newRet;
if ((newRet = streamAppendQueueItem(data, qItem)) == NULL) {
@@ -181,18 +179,21 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) {
if (pTask->taskStatus == TASK_STATUS__DROPPING) {
if (data) streamFreeQitem(data);
- taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- return NULL;
+ return 0;
}
- if (data == NULL) break;
+ if (data == NULL) {
+ break;
+ }
- if (pTask->execType == TASK_EXEC__NONE) {
+ if (pTask->taskLevel == TASK_LEVEL__SINK) {
ASSERT(((SStreamQueueItem*)data)->type == STREAM_INPUT__DATA_BLOCK);
streamTaskOutput(pTask, data);
continue;
}
+ SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
+
qDebug("stream task %d exec begin, msg batch: %d", pTask->taskId, cnt);
streamTaskExecImpl(pTask, data, pRes);
qDebug("stream task %d exec end", pTask->taskId);
@@ -203,73 +204,44 @@ static SArray* streamExecForQall(SStreamTask* pTask, SArray* pRes) {
// TODO log failed ver
streamQueueProcessFail(pTask->inputQueue);
taosArrayDestroy(pRes);
- return NULL;
+ return -1;
}
qRes->type = STREAM_INPUT__DATA_BLOCK;
qRes->blocks = pRes;
- if (streamTaskOutput(pTask, qRes) < 0) {
- // TODO log failed ver
- /*streamQueueProcessFail(pTask->inputQueue);*/
- taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- taosFreeQitem(qRes);
- return NULL;
- }
+
if (((SStreamQueueItem*)data)->type == STREAM_INPUT__DATA_SUBMIT) {
SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)data;
qRes->childId = pTask->selfChildId;
qRes->sourceVer = pSubmit->ver;
}
+
+ if (streamTaskOutput(pTask, qRes) < 0) {
+ // TODO save failed ver
+ /*streamQueueProcessFail(pTask->inputQueue);*/
+ taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
+ taosFreeQitem(qRes);
+ return -1;
+ }
/*streamQueueProcessSuccess(pTask->inputQueue);*/
- pRes = taosArrayInit(0, sizeof(SSDataBlock));
- }
-
- streamFreeQitem(data);
- }
- return pRes;
-}
-
-// TODO: handle version
-int32_t streamExec(SStreamTask* pTask) {
- SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock));
- if (pRes == NULL) return -1;
- while (1) {
- int8_t execStatus =
- atomic_val_compare_exchange_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE, TASK_EXEC_STATUS__EXECUTING);
- if (execStatus == TASK_EXEC_STATUS__IDLE) {
- // first run
- qDebug("stream exec, enter exec status");
- pRes = streamExecForQall(pTask, pRes);
- if (pRes == NULL) goto FAIL;
-
- // set status closing
- atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__CLOSING);
-
- // second run, make sure inputQ and qall are cleared
- qDebug("stream exec, enter closing status");
- pRes = streamExecForQall(pTask, pRes);
- if (pRes == NULL) goto FAIL;
-
- taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE);
- qDebug("stream exec, return result");
- return 0;
- } else if (execStatus == TASK_EXEC_STATUS__CLOSING) {
- continue;
- } else if (execStatus == TASK_EXEC_STATUS__EXECUTING) {
- ASSERT(taosArrayGetSize(pRes) == 0);
- taosArrayDestroyEx(pRes, (FDelete)blockDataFreeRes);
- return 0;
- } else {
- ASSERT(0);
}
}
-FAIL:
- if (pRes) taosArrayDestroy(pRes);
- if (pTask->taskStatus == TASK_STATUS__DROPPING) {
- tFreeSStreamTask(pTask);
- return 0;
- } else {
- atomic_store_8(&pTask->execStatus, TASK_EXEC_STATUS__IDLE);
- return -1;
- }
+ return 0;
+}
+
+int32_t streamTryExec(SStreamTask* pTask) {
+ int8_t schedStatus =
+ atomic_val_compare_exchange_8(&pTask->schedStatus, TASK_SCHED_STATUS__WAITING, TASK_SCHED_STATUS__ACTIVE);
+ if (schedStatus == TASK_SCHED_STATUS__WAITING) {
+ int32_t code = streamExecForAll(pTask);
+ if (code < 0) {
+ atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__FAILED);
+ return -1;
+ }
+ atomic_store_8(&pTask->schedStatus, TASK_SCHED_STATUS__INACTIVE);
+
+ if (!taosQueueEmpty(pTask->inputQueue->queue)) {
+ streamSchedExec(pTask);
+ }
+ }
+ return 0;
}
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
new file mode 100644
index 0000000000..7dfeefb261
--- /dev/null
+++ b/source/libs/stream/src/streamMeta.c
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "executor.h"
+#include "tdbInt.h"
+#include "tstream.h"
+
+typedef int32_t FTaskExpand(void* ahandle, SStreamTask* pTask);
+
+typedef struct SStreamMeta {
+ char* path;
+ TDB* db;
+ TTB* pTaskDb;
+ TTB* pStateDb;
+ SHashObj* pTasks;
+ void* ahandle;
+ TXN txn;
+ FTaskExpand* expandFunc;
+} SStreamMeta;
+
+SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc) {
+ SStreamMeta* pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta));
+ if (pMeta == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ return NULL;
+ }
+ pMeta->path = strdup(path);
+ if (tdbOpen(pMeta->path, 16 * 1024, 1, &pMeta->db) < 0) {
+ goto _err;
+ }
+
+ if (tdbTbOpen("task.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pTaskDb) < 0) {
+ goto _err;
+ }
+
+ // open state storage backend
+ if (tdbTbOpen("state.db", sizeof(int32_t), -1, NULL, pMeta->db, &pMeta->pStateDb) < 0) {
+ goto _err;
+ }
+
+ pMeta->ahandle = ahandle;
+ pMeta->expandFunc = expandFunc;
+ return pMeta;
+_err:
+ return NULL;
+}
+
+void streamMetaClose(SStreamMeta* pMeta) {
+ tdbCommit(pMeta->db, &pMeta->txn);
+ tdbTbClose(pMeta->pTaskDb);
+ tdbTbClose(pMeta->pStateDb);
+ tdbClose(pMeta->db);
+}
+
+int32_t streamMetaAddTask(SStreamMeta* pMeta, SStreamTask* pTask) {
+ void* buf = NULL;
+ if (pMeta->expandFunc(pMeta->ahandle, pTask) < 0) {
+ return -1;
+ }
+ taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*));
+
+ int32_t len;
+ int32_t code;
+ tEncodeSize(tEncodeSStreamTask, pTask, len, code);
+ if (code < 0) {
+ return -1;
+ }
+ buf = taosMemoryCalloc(1, sizeof(len));
+ if (buf == NULL) {
+ return -1;
+ }
+
+ SEncoder encoder;
+ tEncoderInit(&encoder, buf, len);
+ tEncodeSStreamTask(&encoder, pTask);
+
+ if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), buf, len, &pMeta->txn) < 0) {
+ ASSERT(0);
+ return -1;
+ }
+
+ return 0;
+}
+
+int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
+ SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t));
+ if (ppTask) {
+ SStreamTask* pTask = *ppTask;
+ taosHashRemove(pMeta->pTasks, &taskId, sizeof(int32_t));
+ atomic_store_8(&pTask->taskStatus, TASK_STATUS__DROPPING);
+ }
+
+ if (tdbTbDelete(pMeta->pTaskDb, &taskId, sizeof(int32_t), &pMeta->txn) < 0) {
+ /*return -1;*/
+ }
+ return 0;
+}
+
+int32_t streamMetaBegin(SStreamMeta* pMeta) {
+ if (tdbTxnOpen(&pMeta->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+
+ if (tdbBegin(pMeta->db, &pMeta->txn) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamMetaCommit(SStreamMeta* pMeta) {
+ if (tdbCommit(pMeta->db, &pMeta->txn) < 0) {
+ return -1;
+ }
+ memset(&pMeta->txn, 0, sizeof(TXN));
+ if (tdbTxnOpen(&pMeta->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+ if (tdbBegin(pMeta->db, &pMeta->txn) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamMetaAbort(SStreamMeta* pMeta) {
+ if (tdbAbort(pMeta->db, &pMeta->txn) < 0) {
+ return -1;
+ }
+ memset(&pMeta->txn, 0, sizeof(TXN));
+ if (tdbTxnOpen(&pMeta->txn, 0, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) <
+ 0) {
+ return -1;
+ }
+ if (tdbBegin(pMeta->db, &pMeta->txn) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+int32_t streamRestoreTask(SStreamMeta* pMeta) {
+ TBC* pCur = NULL;
+ if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) {
+ ASSERT(0);
+ return -1;
+ }
+
+ void* pKey = NULL;
+ int32_t kLen = 0;
+ void* pVal = NULL;
+ int32_t vLen = 0;
+ SDecoder decoder;
+
+ tdbTbcMoveToFirst(pCur);
+
+ while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) {
+ SStreamTask* pTask = taosMemoryCalloc(1, sizeof(SStreamTask));
+ if (pTask == NULL) {
+ return -1;
+ }
+ tDecoderInit(&decoder, (uint8_t*)pVal, vLen);
+ tDecodeSStreamTask(&decoder, pTask);
+ tDecoderClear(&decoder);
+
+ if (pMeta->expandFunc(pMeta->ahandle, pTask) < 0) {
+ return -1;
+ }
+
+ if (taosHashPut(pMeta->pTasks, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
+ return -1;
+ }
+ }
+
+ if (tdbTbcClose(pCur) < 0) {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c
index f82ef1b42f..6819e5329f 100644
--- a/source/libs/stream/src/streamQueue.c
+++ b/source/libs/stream/src/streamQueue.c
@@ -35,9 +35,10 @@ FAIL:
void streamQueueClose(SStreamQueue* queue) {
while (1) {
void* qItem = streamQueueNextItem(queue);
- if (qItem)
+ if (qItem) {
taosFreeQitem(qItem);
- else
+ } else {
return;
+ }
}
}
diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c
index dec23cd151..3530c05688 100644
--- a/source/libs/stream/src/streamRecover.c
+++ b/source/libs/stream/src/streamRecover.c
@@ -88,14 +88,15 @@ int32_t tDecodeSMStreamTaskRecoverRsp(SDecoder* pDecoder, SMStreamTaskRecoverRsp
}
int32_t streamProcessFailRecoverReq(SStreamTask* pTask, SMStreamTaskRecoverReq* pReq, SRpcMsg* pRsp) {
+#if 0
if (pTask->taskStatus != TASK_STATUS__FAIL) {
return 0;
}
if (pTask->isStreamDistributed) {
- if (pTask->isDataScan) {
+ if (pTask->taskType == TASK_TYPE__SOURCE) {
pTask->taskStatus = TASK_STATUS__PREPARE_RECOVER;
- } else if (pTask->execType != TASK_EXEC__NONE) {
+ } else if (pTask->taskType != TASK_TYPE__SINK) {
pTask->taskStatus = TASK_STATUS__PREPARE_RECOVER;
bool hasCheckpoint = false;
int32_t childSz = taosArrayGetSize(pTask->childEpInfo);
@@ -113,7 +114,7 @@ int32_t streamProcessFailRecoverReq(SStreamTask* pTask, SMStreamTaskRecoverReq*
}
}
} else {
- if (pTask->isDataScan) {
+ if (pTask->taskType == TASK_TYPE__SOURCE) {
if (pTask->checkpointVer != -1) {
// load from checkpoint
} else {
@@ -133,5 +134,6 @@ int32_t streamProcessFailRecoverReq(SStreamTask* pTask, SMStreamTaskRecoverReq*
}
}
+#endif
return 0;
}
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index 216e3fa761..3a54981989 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -23,7 +23,7 @@ SStreamTask* tNewSStreamTask(int64_t streamId) {
}
pTask->taskId = tGenIdPI32();
pTask->streamId = streamId;
- pTask->execStatus = TASK_EXEC_STATUS__IDLE;
+ pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE;
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_OUTPUT_STATUS__NORMAL;
@@ -52,14 +52,12 @@ int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
/*if (tStartEncode(pEncoder) < 0) return -1;*/
if (tEncodeI64(pEncoder, pTask->streamId) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->taskId) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->isDataScan) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->execType) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->sinkType) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->dispatchType) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->taskLevel) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->outputType) < 0) return -1;
if (tEncodeI16(pEncoder, pTask->dispatchMsgType) < 0) return -1;
if (tEncodeI8(pEncoder, pTask->taskStatus) < 0) return -1;
- if (tEncodeI8(pEncoder, pTask->execStatus) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->schedStatus) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->selfChildId) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->nodeId) < 0) return -1;
@@ -73,27 +71,23 @@ int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
if (tEncodeStreamEpInfo(pEncoder, pInfo) < 0) return -1;
}
- if (pTask->execType != TASK_EXEC__NONE) {
+ if (pTask->taskLevel != TASK_LEVEL__SINK) {
if (tEncodeCStr(pEncoder, pTask->exec.qmsg) < 0) return -1;
}
- if (pTask->sinkType == TASK_SINK__TABLE) {
+ if (pTask->outputType == TASK_OUTPUT__TABLE) {
if (tEncodeI64(pEncoder, pTask->tbSink.stbUid) < 0) return -1;
if (tEncodeCStr(pEncoder, pTask->tbSink.stbFullName) < 0) return -1;
if (tEncodeSSchemaWrapper(pEncoder, pTask->tbSink.pSchemaWrapper) < 0) return -1;
- } else if (pTask->sinkType == TASK_SINK__SMA) {
+ } else if (pTask->outputType == TASK_OUTPUT__SMA) {
if (tEncodeI64(pEncoder, pTask->smaSink.smaId) < 0) return -1;
- } else if (pTask->sinkType == TASK_SINK__FETCH) {
+ } else if (pTask->outputType == TASK_OUTPUT__FETCH) {
if (tEncodeI8(pEncoder, pTask->fetchSink.reserved) < 0) return -1;
- } else {
- ASSERT(pTask->sinkType == TASK_SINK__NONE);
- }
-
- if (pTask->dispatchType == TASK_DISPATCH__FIXED) {
+ } else if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
if (tEncodeI32(pEncoder, pTask->fixedEpDispatcher.taskId) < 0) return -1;
if (tEncodeI32(pEncoder, pTask->fixedEpDispatcher.nodeId) < 0) return -1;
if (tEncodeSEpSet(pEncoder, &pTask->fixedEpDispatcher.epSet) < 0) return -1;
- } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) {
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
if (tSerializeSUseDbRspImp(pEncoder, &pTask->shuffleDispatcher.dbInfo) < 0) return -1;
if (tEncodeCStr(pEncoder, pTask->shuffleDispatcher.stbFullName) < 0) return -1;
}
@@ -107,14 +101,12 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
/*if (tStartDecode(pDecoder) < 0) return -1;*/
if (tDecodeI64(pDecoder, &pTask->streamId) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->taskId) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->isDataScan) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->execType) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->sinkType) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->dispatchType) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->taskLevel) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->outputType) < 0) return -1;
if (tDecodeI16(pDecoder, &pTask->dispatchMsgType) < 0) return -1;
if (tDecodeI8(pDecoder, &pTask->taskStatus) < 0) return -1;
- if (tDecodeI8(pDecoder, &pTask->execStatus) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->schedStatus) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->selfChildId) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->nodeId) < 0) return -1;
@@ -131,29 +123,25 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
taosArrayPush(pTask->childEpInfo, &pInfo);
}
- if (pTask->execType != TASK_EXEC__NONE) {
+ if (pTask->taskLevel != TASK_LEVEL__SINK) {
if (tDecodeCStrAlloc(pDecoder, &pTask->exec.qmsg) < 0) return -1;
}
- if (pTask->sinkType == TASK_SINK__TABLE) {
+ if (pTask->outputType == TASK_OUTPUT__TABLE) {
if (tDecodeI64(pDecoder, &pTask->tbSink.stbUid) < 0) return -1;
if (tDecodeCStrTo(pDecoder, pTask->tbSink.stbFullName) < 0) return -1;
pTask->tbSink.pSchemaWrapper = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
if (pTask->tbSink.pSchemaWrapper == NULL) return -1;
if (tDecodeSSchemaWrapper(pDecoder, pTask->tbSink.pSchemaWrapper) < 0) return -1;
- } else if (pTask->sinkType == TASK_SINK__SMA) {
+ } else if (pTask->outputType == TASK_OUTPUT__SMA) {
if (tDecodeI64(pDecoder, &pTask->smaSink.smaId) < 0) return -1;
- } else if (pTask->sinkType == TASK_SINK__FETCH) {
+ } else if (pTask->outputType == TASK_OUTPUT__FETCH) {
if (tDecodeI8(pDecoder, &pTask->fetchSink.reserved) < 0) return -1;
- } else {
- ASSERT(pTask->sinkType == TASK_SINK__NONE);
- }
-
- if (pTask->dispatchType == TASK_DISPATCH__FIXED) {
+ } else if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) {
if (tDecodeI32(pDecoder, &pTask->fixedEpDispatcher.taskId) < 0) return -1;
if (tDecodeI32(pDecoder, &pTask->fixedEpDispatcher.nodeId) < 0) return -1;
if (tDecodeSEpSet(pDecoder, &pTask->fixedEpDispatcher.epSet) < 0) return -1;
- } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) {
+ } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) {
if (tDeserializeSUseDbRspImp(pDecoder, &pTask->shuffleDispatcher.dbInfo) < 0) return -1;
if (tDecodeCStrTo(pDecoder, pTask->shuffleDispatcher.stbFullName) < 0) return -1;
}
diff --git a/source/libs/sync/inc/syncEnv.h b/source/libs/sync/inc/syncEnv.h
index dd032f1481..e6d2bd4920 100644
--- a/source/libs/sync/inc/syncEnv.h
+++ b/source/libs/sync/inc/syncEnv.h
@@ -28,13 +28,13 @@ extern "C" {
#include "trpc.h"
#include "ttimer.h"
-#define TIMER_MAX_MS 0x7FFFFFFF
-#define ENV_TICK_TIMER_MS 1000
-#define PING_TIMER_MS 5000
-#define ELECT_TIMER_MS_MIN 1300
-#define ELECT_TIMER_MS_MAX (ELECT_TIMER_MS_MIN * 2)
+#define TIMER_MAX_MS 0x7FFFFFFF
+#define ENV_TICK_TIMER_MS 1000
+#define PING_TIMER_MS 5000
+#define ELECT_TIMER_MS_MIN 5000
+#define ELECT_TIMER_MS_MAX (ELECT_TIMER_MS_MIN * 2)
#define ELECT_TIMER_MS_RANGE (ELECT_TIMER_MS_MAX - ELECT_TIMER_MS_MIN)
-#define HEARTBEAT_TIMER_MS 900
+#define HEARTBEAT_TIMER_MS 900
#define EMPTY_RAFT_ID ((SRaftId){.addr = 0, .vgId = 0})
diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h
index bc3275a971..82399f52b9 100644
--- a/source/libs/sync/inc/syncInt.h
+++ b/source/libs/sync/inc/syncInt.h
@@ -212,6 +212,7 @@ void syncNodeRelease(SSyncNode* pNode);
// raft state change --------------
void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term);
+void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term);
void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr);
void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr);
diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c
index 0f63510b12..f31f3dd1ae 100644
--- a/source/libs/sync/src/syncAppendEntries.c
+++ b/source/libs/sync/src/syncAppendEntries.c
@@ -573,7 +573,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc
// fsync once
SSyncLogStoreData* pData = ths->pLogStore->data;
SWal* pWal = pData->pWal;
- walFsync(pWal, true);
+ walFsync(pWal, false);
// update match index
matchIndex = pMsg->prevLogIndex + pMsg->dataCount;
@@ -694,7 +694,7 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc
// fsync once
SSyncLogStoreData* pData = ths->pLogStore->data;
SWal* pWal = pData->pWal;
- walFsync(pWal, true);
+ walFsync(pWal, false);
}
// prepare response msg
@@ -717,24 +717,15 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc
// maybe update commit index, leader notice me
if (pMsg->commitIndex > ths->commitIndex) {
+ SyncIndex lastIndex = ths->pLogStore->syncLogLastIndex(ths->pLogStore);
+
+ SyncIndex beginIndex = 0;
+ SyncIndex endIndex = -1;
+
// has commit entry in local
- if (pMsg->commitIndex <= ths->pLogStore->syncLogLastIndex(ths->pLogStore)) {
- // advance commit index to sanpshot first
- SSnapshot snapshot;
- ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
- if (snapshot.lastApplyIndex >= 0 && snapshot.lastApplyIndex > ths->commitIndex) {
- SyncIndex commitBegin = ths->commitIndex;
- SyncIndex commitEnd = snapshot.lastApplyIndex;
- ths->commitIndex = snapshot.lastApplyIndex;
-
- char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "commit by snapshot from index:%" PRId64 " to index:%" PRId64,
- commitBegin, commitEnd);
- syncNodeEventLog(ths, eventLog);
- }
-
- SyncIndex beginIndex = ths->commitIndex + 1;
- SyncIndex endIndex = pMsg->commitIndex;
+ if (pMsg->commitIndex <= lastIndex) {
+ beginIndex = ths->commitIndex + 1;
+ endIndex = pMsg->commitIndex;
// update commit index
ths->commitIndex = pMsg->commitIndex;
@@ -743,10 +734,22 @@ int32_t syncNodeOnAppendEntriesSnapshot2Cb(SSyncNode* ths, SyncAppendEntriesBatc
code = ths->pLogStore->updateCommitIndex(ths->pLogStore, ths->commitIndex);
ASSERT(code == 0);
- code = syncNodeCommit(ths, beginIndex, endIndex, ths->state);
+ } else if (pMsg->commitIndex > lastIndex && ths->commitIndex < lastIndex) {
+ beginIndex = ths->commitIndex + 1;
+ endIndex = lastIndex;
+
+ // update commit index, speed up
+ ths->commitIndex = lastIndex;
+
+ // call back Wal
+ code = ths->pLogStore->updateCommitIndex(ths->pLogStore, ths->commitIndex);
ASSERT(code == 0);
}
+
+ code = syncNodeCommit(ths, beginIndex, endIndex, ths->state);
+ ASSERT(code == 0);
}
+
return 0;
}
} while (0);
diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c
index 7279f0858b..4928c54bd7 100644
--- a/source/libs/sync/src/syncAppendEntriesReply.c
+++ b/source/libs/sync/src/syncAppendEntriesReply.c
@@ -93,7 +93,8 @@ int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* p
SyncIndex afterMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId));
do {
char logBuf[256];
- snprintf(logBuf, sizeof(logBuf), "before next:%ld, match:%ld, after next:%ld, match:%ld", beforeNextIndex,
+ snprintf(logBuf, sizeof(logBuf),
+ "before next:%" PRId64 ", match:%" PRId64 ", after next:%" PRId64 ", match:%" PRId64, beforeNextIndex,
beforeMatchIndex, afterNextIndex, afterMatchIndex);
syncLogRecvAppendEntriesReply(ths, pMsg, logBuf);
} while (0);
@@ -107,7 +108,7 @@ static void syncNodeStartSnapshotOnce(SSyncNode* ths, SyncIndex beginIndex, Sync
if (beginIndex > endIndex) {
do {
char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "snapshot param error, start:%ld, end:%ld", beginIndex, endIndex);
+ snprintf(logBuf, sizeof(logBuf), "snapshot param error, start:%" PRId64 ", end:%" PRId64, beginIndex, endIndex);
syncNodeErrorLog(ths, logBuf);
} while (0);
@@ -293,7 +294,8 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie
SyncIndex afterMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId));
do {
char logBuf[256];
- snprintf(logBuf, sizeof(logBuf), "before next:%ld, match:%ld, after next:%ld, match:%ld", beforeNextIndex,
+ snprintf(logBuf, sizeof(logBuf),
+ "before next:%" PRId64 ", match:%" PRId64 ", after next:%" PRId64 ", match:%" PRId64, beforeNextIndex,
beforeMatchIndex, afterNextIndex, afterMatchIndex);
syncLogRecvAppendEntriesReply(ths, pMsg, logBuf);
} while (0);
@@ -392,7 +394,8 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries
SyncIndex afterMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId));
do {
char logBuf[256];
- snprintf(logBuf, sizeof(logBuf), "before next:%ld, match:%ld, after next:%ld, match:%ld", beforeNextIndex,
+ snprintf(logBuf, sizeof(logBuf),
+ "before next:%" PRId64 ", match:%" PRId64 ", after next:%" PRId64 ", match:%" PRId64, beforeNextIndex,
beforeMatchIndex, afterNextIndex, afterMatchIndex);
syncLogRecvAppendEntriesReply(ths, pMsg, logBuf);
} while (0);
diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c
index fd6577477f..a603cfff27 100644
--- a/source/libs/sync/src/syncCommit.c
+++ b/source/libs/sync/src/syncCommit.c
@@ -73,7 +73,7 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
ASSERT(pEntry != NULL);
// cannot commit, even if quorum agree. need check term!
- if (pEntry->term == pSyncNode->pRaftStore->currentTerm) {
+ if (pEntry->term <= pSyncNode->pRaftStore->currentTerm) {
// update commit index
newCommitIndex = index;
@@ -82,8 +82,8 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
} else {
do {
char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "can not commit due to term not equal, index:%ld, term:%lu", pEntry->index,
- pEntry->term);
+ snprintf(logBuf, sizeof(logBuf), "can not commit due to term not equal, index:%" PRId64 ", term:%" PRIu64,
+ pEntry->index, pEntry->term);
syncNodeEventLog(pSyncNode, logBuf);
} while (0);
}
diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c
index 4e3c9bf73d..48ebf824e8 100644
--- a/source/libs/sync/src/syncMain.c
+++ b/source/libs/sync/src/syncMain.c
@@ -94,7 +94,7 @@ int64_t syncOpen(const SSyncInfo* pSyncInfo) {
return -1;
}
- sDebug("vgId:%d, rid:%" PRId64 " is added to rsetId:%" PRId64, pSyncInfo->vgId, pSyncNode->rid, tsNodeRefId);
+ sDebug("vgId:%d, sync rid:%" PRId64 " is added to rsetId:%" PRId64, pSyncInfo->vgId, pSyncNode->rid, tsNodeRefId);
return pSyncNode->rid;
}
@@ -142,7 +142,7 @@ void syncStop(int64_t rid) {
taosReleaseRef(tsNodeRefId, pSyncNode->rid);
taosRemoveRef(tsNodeRefId, rid);
- sDebug("vgId:%d, rid:%" PRId64 " is removed from rsetId:%" PRId64, vgId, rid, tsNodeRefId);
+ sDebug("vgId:%d, sync rid:%" PRId64 " is removed from rsetId:%" PRId64, vgId, rid, tsNodeRefId);
}
int32_t syncSetStandby(int64_t rid) {
@@ -484,7 +484,7 @@ SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapsho
lastIndex = (pSyncNode->pRaftCfg->configIndexArr)[i];
}
}
- sTrace("vgId:%d, sync get snapshot last config index, index:%" PRId64 " lcindex:%" PRId64, pSyncNode->vgId,
+ sTrace("vgId:%d, sync get last config index, index:%" PRId64 " lcindex:%" PRId64, pSyncNode->vgId,
snapshotLastApplyIndex, lastIndex);
return lastIndex;
@@ -730,8 +730,8 @@ int32_t syncNodeProposeBatch(SSyncNode* pSyncNode, SRpcMsg** pMsgPArr, bool* pIs
for (int i = 0; i < arrSize; ++i) {
do {
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "propose type:%s,%d, batch:%d", TMSG_INFO(pMsgPArr[i]->msgType),
- pMsgPArr[i]->msgType, arrSize);
+ snprintf(eventLog, sizeof(eventLog), "propose message, type:%s batch:%d", TMSG_INFO(pMsgPArr[i]->msgType),
+ arrSize);
syncNodeEventLog(pSyncNode, eventLog);
} while (0);
@@ -791,7 +791,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
do {
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "propose type:%s,%d", TMSG_INFO(pMsg->msgType), pMsg->msgType);
+ snprintf(eventLog, sizeof(eventLog), "propose message, type:%s", TMSG_INFO(pMsg->msgType));
syncNodeEventLog(pSyncNode, eventLog);
} while (0);
@@ -799,7 +799,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
if (pSyncNode->changing && pMsg->msgType != TDMT_SYNC_CONFIG_CHANGE_FINISH) {
ret = -1;
terrno = TSDB_CODE_SYN_PROPOSE_NOT_READY;
- sError("vgId:%d, sync propose not ready, type:%s,%d", pSyncNode->vgId, TMSG_INFO(pMsg->msgType), pMsg->msgType);
+ sError("vgId:%d, failed to sync propose since not ready, type:%s", pSyncNode->vgId, TMSG_INFO(pMsg->msgType));
goto _END;
}
@@ -808,8 +808,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
if (!syncNodeCanChange(pSyncNode)) {
ret = -1;
terrno = TSDB_CODE_SYN_RECONFIG_NOT_READY;
- sError("vgId:%d, sync reconfig not ready, type:%s,%d", pSyncNode->vgId, TMSG_INFO(pMsg->msgType),
- pMsg->msgType);
+ sError("vgId:%d, failed to sync reconfig since not ready, type:%s", pSyncNode->vgId, TMSG_INFO(pMsg->msgType));
goto _END;
}
@@ -836,13 +835,13 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
rpcFreeCont(rpcMsg.pCont);
syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum);
ret = 1;
- sDebug("vgId:%d, optimized index:%" PRId64 " success, msgtype:%s,%d", pSyncNode->vgId, retIndex,
- TMSG_INFO(pMsg->msgType), pMsg->msgType);
+ sDebug("vgId:%d, sync optimize index:%" PRId64 ", type:%s", pSyncNode->vgId, retIndex,
+ TMSG_INFO(pMsg->msgType));
} else {
ret = -1;
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- sError("vgId:%d, optimized index:%" PRId64 " error, msgtype:%s,%d", pSyncNode->vgId, retIndex,
- TMSG_INFO(pMsg->msgType), pMsg->msgType);
+ sError("vgId:%d, failed to sync optimize index:%" PRId64 ", type:%s", pSyncNode->vgId, retIndex,
+ TMSG_INFO(pMsg->msgType));
}
} else {
@@ -851,7 +850,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
} else {
ret = -1;
terrno = TSDB_CODE_SYN_INTERNAL_ERROR;
- sError("vgId:%d, enqueue msg error, FpEqMsg is NULL", pSyncNode->vgId);
+ sError("vgId:%d, failed to enqueue msg since its null", pSyncNode->vgId);
}
}
@@ -861,8 +860,8 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
} else {
ret = -1;
terrno = TSDB_CODE_SYN_NOT_LEADER;
- sError("vgId:%d, sync propose not leader, %s, msgtype:%s,%d", pSyncNode->vgId,
- syncUtilState2String(pSyncNode->state), TMSG_INFO(pMsg->msgType), pMsg->msgType);
+ sError("vgId:%d, sync propose not leader, %s, type:%s", pSyncNode->vgId, syncUtilState2String(pSyncNode->state),
+ TMSG_INFO(pMsg->msgType));
goto _END;
}
@@ -887,7 +886,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
}
}
- snprintf(pSyncNode->configPath, sizeof(pSyncNode->configPath), "%s/raft_config.json", pSyncInfo->path);
+ snprintf(pSyncNode->configPath, sizeof(pSyncNode->configPath), "%s%sraft_config.json", pSyncInfo->path, TD_DIRSEP);
if (!taosCheckExistFile(pSyncNode->configPath)) {
// create a new raft config file
SRaftCfgMeta meta;
@@ -910,8 +909,9 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
// init by SSyncInfo
pSyncNode->vgId = pSyncInfo->vgId;
memcpy(pSyncNode->path, pSyncInfo->path, sizeof(pSyncNode->path));
- snprintf(pSyncNode->raftStorePath, sizeof(pSyncNode->raftStorePath), "%s/raft_store.json", pSyncInfo->path);
- snprintf(pSyncNode->configPath, sizeof(pSyncNode->configPath), "%s/raft_config.json", pSyncInfo->path);
+ snprintf(pSyncNode->raftStorePath, sizeof(pSyncNode->raftStorePath), "%s%sraft_store.json", pSyncInfo->path,
+ TD_DIRSEP);
+ snprintf(pSyncNode->configPath, sizeof(pSyncNode->configPath), "%s%sraft_config.json", pSyncInfo->path, TD_DIRSEP);
pSyncNode->pWal = pSyncInfo->pWal;
pSyncNode->msgcb = pSyncInfo->msgcb;
@@ -1116,7 +1116,7 @@ void syncNodeStart(SSyncNode* pSyncNode) {
}
int32_t ret = 0;
- ret = syncNodeStartPingTimer(pSyncNode);
+ // ret = syncNodeStartPingTimer(pSyncNode);
ASSERT(ret == 0);
}
@@ -1252,6 +1252,13 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, gSyncEnv->pTimerManager,
&pSyncNode->pElectTimer);
atomic_store_64(&pSyncNode->electTimerLogicClock, pSyncNode->electTimerLogicClockUser);
+
+ do {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "elect timer reset, ms:%d", ms);
+ syncNodeEventLog(pSyncNode, logBuf);
+ } while (0);
+
} else {
sError("vgId:%d, start elect timer error, sync env is stop", pSyncNode->vgId);
}
@@ -1283,6 +1290,14 @@ int32_t syncNodeResetElectTimer(SSyncNode* pSyncNode) {
electMS = syncUtilElectRandomMS(pSyncNode->electBaseLine, 2 * pSyncNode->electBaseLine);
}
ret = syncNodeRestartElectTimer(pSyncNode, electMS);
+
+ do {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "reset elect timer, min:%d, max:%d, ms:%d", pSyncNode->electBaseLine,
+ 2 * pSyncNode->electBaseLine, electMS);
+ syncNodeEventLog(pSyncNode, logBuf);
+ } while (0);
+
return ret;
}
@@ -1295,6 +1310,13 @@ int32_t syncNodeStartHeartbeatTimer(SSyncNode* pSyncNode) {
} else {
sError("vgId:%d, start heartbeat timer error, sync env is stop", pSyncNode->vgId);
}
+
+ do {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "start heartbeat timer, ms:%d", pSyncNode->heartbeatTimerMS);
+ syncNodeEventLog(pSyncNode, logBuf);
+ } while (0);
+
return ret;
}
@@ -1306,6 +1328,13 @@ int32_t syncNodeStartNowHeartbeatTimer(SSyncNode* pSyncNode) {
} else {
sError("vgId:%d, start heartbeat timer error, sync env is stop", pSyncNode->vgId);
}
+
+ do {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "start heartbeat timer, ms:%d", 1);
+ syncNodeEventLog(pSyncNode, logBuf);
+ } while (0);
+
return ret;
}
@@ -1314,6 +1343,8 @@ int32_t syncNodeStopHeartbeatTimer(SSyncNode* pSyncNode) {
atomic_add_fetch_64(&pSyncNode->heartbeatTimerLogicClockUser, 1);
taosTmrStop(pSyncNode->pHeartbeatTimer);
pSyncNode->pHeartbeatTimer = NULL;
+ sTrace("vgId:%d, stop heartbeat timer", pSyncNode->vgId);
+
return ret;
}
@@ -1531,7 +1562,7 @@ char* syncNode2Str(const SSyncNode* pSyncNode) {
return serialized;
}
-void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
+inline void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
int32_t userStrLen = strlen(str);
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
@@ -1561,12 +1592,13 @@ void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
", sby:%d, "
"stgy:%d, bch:%d, "
"r-num:%d, "
- "lcfg:%" PRId64 ", chging:%d, rsto:%d, %s",
+ "lcfg:%" PRId64 ", chging:%d, rsto:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s",
pSyncNode->vgId, syncUtilState2String(pSyncNode->state), str, pSyncNode->pRaftStore->currentTerm,
pSyncNode->commitIndex, logBeginIndex, logLastIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm,
pSyncNode->pRaftCfg->isStandBy, pSyncNode->pRaftCfg->snapshotStrategy, pSyncNode->pRaftCfg->batchSize,
pSyncNode->replicaNum, pSyncNode->pRaftCfg->lastConfigIndex, pSyncNode->changing,
- pSyncNode->restoreFinish, printStr);
+ pSyncNode->restoreFinish, pSyncNode->electTimerLogicClockUser, pSyncNode->heartbeatTimerLogicClockUser,
+ printStr);
} else {
snprintf(logBuf, sizeof(logBuf), "%s", str);
}
@@ -1602,7 +1634,7 @@ void syncNodeEventLog(const SSyncNode* pSyncNode, char* str) {
taosMemoryFree(pCfgStr);
}
-void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
+inline void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
int32_t userStrLen = strlen(str);
SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
@@ -1669,7 +1701,7 @@ void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
taosMemoryFree(pCfgStr);
}
-char* syncNode2SimpleStr(const SSyncNode* pSyncNode) {
+inline char* syncNode2SimpleStr(const SSyncNode* pSyncNode) {
int len = 256;
char* s = (char*)taosMemoryMalloc(len);
@@ -1692,7 +1724,7 @@ char* syncNode2SimpleStr(const SSyncNode* pSyncNode) {
return s;
}
-bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) {
+inline bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) {
bool b1 = false;
bool b2 = false;
@@ -1896,7 +1928,9 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
// Raft 3.6.2 Committing entries from previous terms
syncNodeAppendNoop(pSyncNode);
+#if 0 // simon
syncNodeReplicate(pSyncNode);
+#endif
syncMaybeAdvanceCommitIndex(pSyncNode);
} else {
@@ -1953,6 +1987,12 @@ void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) {
}
}
+void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term) {
+ if (term > pSyncNode->pRaftStore->currentTerm) {
+ raftStoreSetTerm(pSyncNode->pRaftStore, term);
+ }
+}
+
void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr) {
// maybe clear leader cache
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
@@ -2072,7 +2112,9 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
// Raft 3.6.2 Committing entries from previous terms
syncNodeAppendNoop(pSyncNode);
+#if 0 // simon
syncNodeReplicate(pSyncNode);
+#endif
syncMaybeAdvanceCommitIndex(pSyncNode);
}
@@ -2240,7 +2282,8 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
do {
char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "sync node get pre term error, index:%ld, snap-index:%ld, snap-term:%lu", index,
+ snprintf(logBuf, sizeof(logBuf),
+ "sync node get pre term error, index:%" PRId64 ", snap-index:%" PRId64 ", snap-term:%" PRIu64, index,
snapshot.lastApplyIndex, snapshot.lastApplyTerm);
syncNodeErrorLog(pSyncNode, logBuf);
} while (0);
@@ -2577,7 +2620,7 @@ int32_t syncNodeOnClientRequestBatchCb(SSyncNode* ths, SyncClientRequestBatch* p
// fsync once
SSyncLogStoreData* pData = ths->pLogStore->data;
SWal* pWal = pData->pWal;
- walFsync(pWal, true);
+ walFsync(pWal, false);
if (ths->replicaNum > 1) {
// if multi replica, start replicate right now
@@ -2760,6 +2803,23 @@ bool syncNodeIsOptimizedOneReplica(SSyncNode* ths, SRpcMsg* pMsg) {
}
int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, uint64_t flag) {
+ if (beginIndex > endIndex) {
+ return 0;
+ }
+
+ // advance commit index to sanpshot first
+ SSnapshot snapshot = {0};
+ ths->pFsm->FpGetSnapshotInfo(ths->pFsm, &snapshot);
+ if (snapshot.lastApplyIndex >= 0 && snapshot.lastApplyIndex >= beginIndex) {
+ char eventLog[128];
+ snprintf(eventLog, sizeof(eventLog), "commit by snapshot from index:%" PRId64 " to index:%" PRId64, beginIndex,
+ snapshot.lastApplyIndex);
+ syncNodeEventLog(ths, eventLog);
+
+ // update begin index
+ beginIndex = snapshot.lastApplyIndex + 1;
+ }
+
int32_t code = 0;
ESyncState state = flag;
@@ -2782,13 +2842,13 @@ int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex,
// user commit
if ((ths->pFsm->FpCommitCb != NULL) && syncUtilUserCommit(pEntry->originalRpcType)) {
bool internalExecute = true;
- if ((ths->replicaNum == 1) && ths->restoreFinish && (ths->vgId != 1)) {
+ if ((ths->replicaNum == 1) && ths->restoreFinish && ths->vgId != 1) {
internalExecute = false;
}
do {
char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "index:%" PRId64 ", internalExecute:%d", i, internalExecute);
+ snprintf(logBuf, sizeof(logBuf), "commit index:%" PRId64 ", internal:%d", i, internalExecute);
syncNodeEventLog(ths, logBuf);
} while (0);
@@ -2905,7 +2965,7 @@ bool syncNodeCanChange(SSyncNode* pSyncNode) {
return true;
}
-void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
+inline void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
@@ -2916,7 +2976,7 @@ void syncLogSendRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, c
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
+inline void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, const char* s) {
char logBuf[256];
char host[64];
uint16_t port;
@@ -2927,7 +2987,7 @@ void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, c
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
+inline void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
@@ -2937,7 +2997,7 @@ void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteRepl
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
+inline void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
@@ -2947,7 +3007,7 @@ void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteRepl
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
+inline void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
@@ -2962,7 +3022,7 @@ void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMs
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
+inline void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
@@ -2977,7 +3037,7 @@ void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMs
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
+inline void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
@@ -2990,7 +3050,7 @@ void syncLogSendAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntries
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
+inline void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntriesBatch* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
@@ -3003,7 +3063,7 @@ void syncLogRecvAppendEntriesBatch(SSyncNode* pSyncNode, const SyncAppendEntries
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
+inline void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port);
@@ -3015,7 +3075,7 @@ void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntries
syncNodeEventLog(pSyncNode, logBuf);
}
-void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
+inline void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s) {
char host[64];
uint16_t port;
syncUtilU642Addr(pMsg->srcId.addr, host, sizeof(host), &port);
diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c
index 36be371213..b575e40d86 100644
--- a/source/libs/sync/src/syncRaftLog.c
+++ b/source/libs/sync/src/syncRaftLog.c
@@ -206,7 +206,7 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
SWal* pWal = pData->pWal;
SyncIndex index = 0;
- SWalSyncInfo syncMeta;
+ SWalSyncInfo syncMeta = {0};
syncMeta.isWeek = pEntry->isWeak;
syncMeta.seqNum = pEntry->seqNum;
syncMeta.term = pEntry->term;
@@ -229,59 +229,14 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
do {
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "write index:%" PRId64 ", type:%s,%d, type2:%s,%d", pEntry->index,
- TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType);
+ snprintf(eventLog, sizeof(eventLog), "write index:%" PRId64 ", type:%s, origin type:%s", pEntry->index,
+ TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType));
syncNodeEventLog(pData->pSyncNode, eventLog);
} while (0);
return 0;
}
-#if 0
-static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) {
- SSyncLogStoreData* pData = pLogStore->data;
- SWal* pWal = pData->pWal;
-
- SyncIndex writeIndex = raftLogWriteIndex(pLogStore);
- if (pEntry->index != writeIndex) {
- sError("vgId:%d, wal write index error, entry-index:%" PRId64 " update to %" PRId64, pData->pSyncNode->vgId,
- pEntry->index, writeIndex);
- pEntry->index = writeIndex;
- }
-
- int code = 0;
- SWalSyncInfo syncMeta;
- syncMeta.isWeek = pEntry->isWeak;
- syncMeta.seqNum = pEntry->seqNum;
- syncMeta.term = pEntry->term;
- code = walWriteWithSyncInfo(pWal, pEntry->index, pEntry->originalRpcType, syncMeta, pEntry->data, pEntry->dataLen);
- if (code != 0) {
- int32_t err = terrno;
- const char* errStr = tstrerror(err);
- int32_t sysErr = errno;
- const char* sysErrStr = strerror(errno);
-
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "wal write error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s",
- pEntry->index, err, err, errStr, sysErr, sysErrStr);
- syncNodeErrorLog(pData->pSyncNode, logBuf);
-
- ASSERT(0);
- }
-
- // walFsync(pWal, true);
-
- do {
- char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "write index:%" PRId64 ", type:%s,%d, type2:%s,%d", pEntry->index,
- TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType);
- syncNodeEventLog(pData->pSyncNode, eventLog);
- } while (0);
-
- return code;
-}
-#endif
-
// entry found, return 0
// entry not found, return -1, terrno = TSDB_CODE_WAL_LOG_NOT_EXIST
// other error, return -1
@@ -400,51 +355,12 @@ static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** pp
//-------------------------------
// log[0 .. n]
-#if 0
-int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) {
- SSyncLogStoreData* pData = pLogStore->data;
- SWal* pWal = pData->pWal;
-
- SyncIndex lastIndex = logStoreLastIndex(pLogStore);
- ASSERT(pEntry->index == lastIndex + 1);
-
- int code = 0;
- SWalSyncInfo syncMeta;
- syncMeta.isWeek = pEntry->isWeak;
- syncMeta.seqNum = pEntry->seqNum;
- syncMeta.term = pEntry->term;
- code = walWriteWithSyncInfo(pWal, pEntry->index, pEntry->originalRpcType, syncMeta, pEntry->data, pEntry->dataLen);
- if (code != 0) {
- int32_t err = terrno;
- const char* errStr = tstrerror(err);
- int32_t sysErr = errno;
- const char* sysErrStr = strerror(errno);
-
- char logBuf[128];
- snprintf(logBuf, sizeof(logBuf), "wal write error, index:%" PRId64 ", err:%d %X, msg:%s, syserr:%d, sysmsg:%s",
- pEntry->index, err, err, errStr, sysErr, sysErrStr);
- syncNodeErrorLog(pData->pSyncNode, logBuf);
-
- ASSERT(0);
- }
-
- // walFsync(pWal, true);
-
- char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "old write index:%" PRId64 ", type:%s,%d, type2:%s,%d", pEntry->index,
- TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType);
- syncNodeEventLog(pData->pSyncNode, eventLog);
-
- return code;
-}
-#endif
-
int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) {
SSyncLogStoreData* pData = pLogStore->data;
SWal* pWal = pData->pWal;
SyncIndex index = 0;
- SWalSyncInfo syncMeta;
+ SWalSyncInfo syncMeta = {0};
syncMeta.isWeek = pEntry->isWeak;
syncMeta.seqNum = pEntry->seqNum;
syncMeta.term = pEntry->term;
@@ -468,8 +384,8 @@ int32_t logStoreAppendEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) {
do {
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "write2 index:%" PRId64 ", type:%s,%d, type2:%s,%d", pEntry->index,
- TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType);
+ snprintf(eventLog, sizeof(eventLog), "write2 index:%" PRId64 ", type:%s, origin type:%s", pEntry->index,
+ TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType));
syncNodeEventLog(pData->pSyncNode, eventLog);
} while (0);
diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c
index f02c013d31..bc703e519c 100644
--- a/source/libs/sync/src/syncReplication.c
+++ b/source/libs/sync/src/syncReplication.c
@@ -132,15 +132,14 @@ int32_t syncNodeAppendEntriesPeersSnapshot2(SSyncNode* pSyncNode) {
SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex);
SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex);
if (preLogTerm == SYNC_TERM_INVALID) {
- // SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
- SyncIndex newNextIndex = nextIndex + 1;
+ SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
+ // SyncIndex newNextIndex = nextIndex + 1;
+
syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex);
syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID);
sError("vgId:%d, sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64
", match-index:%d, raftid:%" PRId64,
pSyncNode->vgId, nextIndex, newNextIndex, SYNC_INDEX_INVALID, pDestId->addr);
-
- syncNodeRestartNowHeartbeatTimer(pSyncNode);
return -1;
}
@@ -224,8 +223,9 @@ int32_t syncNodeAppendEntriesPeersSnapshot(SSyncNode* pSyncNode) {
SyncIndex preLogIndex = syncNodeGetPreIndex(pSyncNode, nextIndex);
SyncTerm preLogTerm = syncNodeGetPreTerm(pSyncNode, nextIndex);
if (preLogTerm == SYNC_TERM_INVALID) {
- // SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
- SyncIndex newNextIndex = nextIndex + 1;
+ SyncIndex newNextIndex = syncNodeGetLastIndex(pSyncNode) + 1;
+ // SyncIndex newNextIndex = nextIndex + 1;
+
syncIndexMgrSetIndex(pSyncNode->pNextIndex, pDestId, newNextIndex);
syncIndexMgrSetIndex(pSyncNode->pMatchIndex, pDestId, SYNC_INDEX_INVALID);
sError("vgId:%d, sync get pre term error, nextIndex:%" PRId64 ", update next-index:%" PRId64
diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c
index bad32c5f91..b47294a8e1 100644
--- a/source/libs/sync/src/syncRequestVote.c
+++ b/source/libs/sync/src/syncRequestVote.c
@@ -51,15 +51,20 @@ int32_t syncNodeOnRequestVoteCb(SSyncNode* ths, SyncRequestVote* pMsg) {
return -1;
}
- // maybe update term
- if (pMsg->term > ths->pRaftStore->currentTerm) {
- syncNodeUpdateTerm(ths, pMsg->term);
- }
- ASSERT(pMsg->term <= ths->pRaftStore->currentTerm);
-
bool logOK = (pMsg->lastLogTerm > ths->pLogStore->getLastTerm(ths->pLogStore)) ||
((pMsg->lastLogTerm == ths->pLogStore->getLastTerm(ths->pLogStore)) &&
(pMsg->lastLogIndex >= ths->pLogStore->getLastIndex(ths->pLogStore)));
+
+ // maybe update term
+ if (pMsg->term > ths->pRaftStore->currentTerm) {
+ if (logOK) {
+ syncNodeUpdateTerm(ths, pMsg->term);
+ } else {
+ syncNodeUpdateTermWithoutStepDown(ths, pMsg->term);
+ }
+ }
+ ASSERT(pMsg->term <= ths->pRaftStore->currentTerm);
+
bool grant = (pMsg->term == ths->pRaftStore->currentTerm) && logOK &&
((!raftStoreHasVoted(ths->pRaftStore)) || (syncUtilSameId(&(ths->pRaftStore->voteFor), &(pMsg->srcId))));
if (grant) {
@@ -94,48 +99,6 @@ int32_t syncNodeOnRequestVoteCb(SSyncNode* ths, SyncRequestVote* pMsg) {
return ret;
}
-#if 0
-int32_t syncNodeOnRequestVoteCb(SSyncNode* ths, SyncRequestVote* pMsg) {
- int32_t ret = 0;
-
- char logBuf[128] = {0};
- snprintf(logBuf, sizeof(logBuf), "==syncNodeOnRequestVoteCb== term:%" PRIu64, ths->pRaftStore->currentTerm);
- syncRequestVoteLog2(logBuf, pMsg);
-
- if (pMsg->term > ths->pRaftStore->currentTerm) {
- syncNodeUpdateTerm(ths, pMsg->term);
- }
- ASSERT(pMsg->term <= ths->pRaftStore->currentTerm);
-
- bool logOK = (pMsg->lastLogTerm > ths->pLogStore->getLastTerm(ths->pLogStore)) ||
- ((pMsg->lastLogTerm == ths->pLogStore->getLastTerm(ths->pLogStore)) &&
- (pMsg->lastLogIndex >= ths->pLogStore->getLastIndex(ths->pLogStore)));
- bool grant = (pMsg->term == ths->pRaftStore->currentTerm) && logOK &&
- ((!raftStoreHasVoted(ths->pRaftStore)) || (syncUtilSameId(&(ths->pRaftStore->voteFor), &(pMsg->srcId))));
- if (grant) {
- // maybe has already voted for pMsg->srcId
- // vote again, no harm
- raftStoreVote(ths->pRaftStore, &(pMsg->srcId));
-
- // forbid elect for this round
- syncNodeResetElectTimer(ths);
- }
-
- SyncRequestVoteReply* pReply = syncRequestVoteReplyBuild(ths->vgId);
- pReply->srcId = ths->myRaftId;
- pReply->destId = pMsg->srcId;
- pReply->term = ths->pRaftStore->currentTerm;
- pReply->voteGranted = grant;
-
- SRpcMsg rpcMsg;
- syncRequestVoteReply2RpcMsg(pReply, &rpcMsg);
- syncNodeSendMsgById(&pReply->destId, ths, &rpcMsg);
- syncRequestVoteReplyDestroy(pReply);
-
- return ret;
-}
-#endif
-
static bool syncNodeOnRequestVoteLogOK(SSyncNode* pSyncNode, SyncRequestVote* pMsg) {
SyncTerm myLastTerm = syncNodeGetLastTerm(pSyncNode);
SyncIndex myLastIndex = syncNodeGetLastIndex(pSyncNode);
@@ -200,13 +163,18 @@ int32_t syncNodeOnRequestVoteSnapshotCb(SSyncNode* ths, SyncRequestVote* pMsg) {
return -1;
}
+ bool logOK = syncNodeOnRequestVoteLogOK(ths, pMsg);
+
// maybe update term
if (pMsg->term > ths->pRaftStore->currentTerm) {
- syncNodeUpdateTerm(ths, pMsg->term);
+ if (logOK) {
+ syncNodeUpdateTerm(ths, pMsg->term);
+ } else {
+ syncNodeUpdateTermWithoutStepDown(ths, pMsg->term);
+ }
}
ASSERT(pMsg->term <= ths->pRaftStore->currentTerm);
- bool logOK = syncNodeOnRequestVoteLogOK(ths, pMsg);
bool grant = (pMsg->term == ths->pRaftStore->currentTerm) && logOK &&
((!raftStoreHasVoted(ths->pRaftStore)) || (syncUtilSameId(&(ths->pRaftStore->voteFor), &(pMsg->srcId))));
if (grant) {
diff --git a/source/libs/sync/src/syncRequestVoteReply.c b/source/libs/sync/src/syncRequestVoteReply.c
index 566b80881f..55553d5048 100644
--- a/source/libs/sync/src/syncRequestVoteReply.c
+++ b/source/libs/sync/src/syncRequestVoteReply.c
@@ -93,65 +93,6 @@ int32_t syncNodeOnRequestVoteReplyCb(SSyncNode* ths, SyncRequestVoteReply* pMsg)
return 0;
}
-#if 0
-int32_t syncNodeOnRequestVoteReplyCb(SSyncNode* ths, SyncRequestVoteReply* pMsg) {
- int32_t ret = 0;
-
- char logBuf[128] = {0};
- snprintf(logBuf, sizeof(logBuf), "==syncNodeOnRequestVoteReplyCb== term:%" PRIu64, ths->pRaftStore->currentTerm);
- syncRequestVoteReplyLog2(logBuf, pMsg);
-
- if (pMsg->term < ths->pRaftStore->currentTerm) {
- sTrace("DropStaleResponse, receive term:%" PRIu64 ", current term:%" PRIu64 "", pMsg->term,
- ths->pRaftStore->currentTerm);
- return ret;
- }
-
- // ASSERT(!(pMsg->term > ths->pRaftStore->currentTerm));
- // no need this code, because if I receive reply.term, then I must have sent for that term.
- // if (pMsg->term > ths->pRaftStore->currentTerm) {
- // syncNodeUpdateTerm(ths, pMsg->term);
- // }
-
- if (pMsg->term > ths->pRaftStore->currentTerm) {
- char logBuf[128] = {0};
- snprintf(logBuf, sizeof(logBuf), "syncNodeOnRequestVoteReplyCb error term, receive:%" PRIu64 " current:%" PRIu64, pMsg->term,
- ths->pRaftStore->currentTerm);
- syncNodePrint2(logBuf, ths);
- sError("%s", logBuf);
- return ret;
- }
-
- ASSERT(pMsg->term == ths->pRaftStore->currentTerm);
-
- // This tallies votes even when the current state is not Candidate,
- // but they won't be looked at, so it doesn't matter.
- if (ths->state == TAOS_SYNC_STATE_CANDIDATE) {
- votesRespondAdd(ths->pVotesRespond, pMsg);
- if (pMsg->voteGranted) {
- // add vote
- voteGrantedVote(ths->pVotesGranted, pMsg);
-
- // maybe to leader
- if (voteGrantedMajority(ths->pVotesGranted)) {
- if (!ths->pVotesGranted->toLeader) {
- syncNodeCandidate2Leader(ths);
-
- // prevent to leader again!
- ths->pVotesGranted->toLeader = true;
- }
- }
- } else {
- ;
- // do nothing
- // UNCHANGED <>
- }
- }
-
- return ret;
-}
-#endif
-
int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteReply* pMsg) {
int32_t ret = 0;
@@ -184,6 +125,14 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl
// This tallies votes even when the current state is not Candidate,
// but they won't be looked at, so it doesn't matter.
if (ths->state == TAOS_SYNC_STATE_CANDIDATE) {
+ if (ths->pVotesRespond->term != pMsg->term) {
+ char logBuf[128];
+ snprintf(logBuf, sizeof(logBuf), "vote respond error vote-respond-mgr term:%lu, msg term:lu",
+ ths->pVotesRespond->term, pMsg->term);
+ syncNodeErrorLog(ths, logBuf);
+ return -1;
+ }
+
votesRespondAdd(ths->pVotesRespond, pMsg);
if (pMsg->voteGranted) {
// add vote
diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c
index 501f1fb435..da04b19e17 100644
--- a/source/libs/sync/src/syncRespMgr.c
+++ b/source/libs/sync/src/syncRespMgr.c
@@ -50,9 +50,8 @@ int64_t syncRespMgrAdd(SSyncRespMgr *pObj, SRespStub *pStub) {
SSyncNode *pSyncNode = pObj->data;
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "resp mgr add, type:%s,%d, seq:%" PRIu64 ", handle:%p, ahandle:%p",
- TMSG_INFO(pStub->rpcMsg.msgType), pStub->rpcMsg.msgType, keyCode, pStub->rpcMsg.info.handle,
- pStub->rpcMsg.info.ahandle);
+ snprintf(eventLog, sizeof(eventLog), "save message handle, type:%s seq:%" PRIu64 " handle:%p",
+ TMSG_INFO(pStub->rpcMsg.msgType), keyCode, pStub->rpcMsg.info.handle);
syncNodeEventLog(pSyncNode, eventLog);
taosThreadMutexUnlock(&(pObj->mutex));
@@ -77,9 +76,8 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStub) {
SSyncNode *pSyncNode = pObj->data;
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "resp mgr get, type:%s,%d, seq:%" PRIu64 ", handle:%p, ahandle:%p",
- TMSG_INFO(pStub->rpcMsg.msgType), pStub->rpcMsg.msgType, index, pStub->rpcMsg.info.handle,
- pStub->rpcMsg.info.ahandle);
+ snprintf(eventLog, sizeof(eventLog), "get message handle, type:%s seq:%" PRIu64 " handle:%p",
+ TMSG_INFO(pStub->rpcMsg.msgType), index, pStub->rpcMsg.info.handle);
syncNodeEventLog(pSyncNode, eventLog);
taosThreadMutexUnlock(&(pObj->mutex));
@@ -98,9 +96,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStu
SSyncNode *pSyncNode = pObj->data;
char eventLog[128];
- snprintf(eventLog, sizeof(eventLog), "resp mgr get-and-del, type:%s,%d, seq:%" PRIu64 ", handle:%p, ahandle:%p",
- TMSG_INFO(pStub->rpcMsg.msgType), pStub->rpcMsg.msgType, index, pStub->rpcMsg.info.handle,
- pStub->rpcMsg.info.ahandle);
+ snprintf(eventLog, sizeof(eventLog), "get-and-del message handle, type:%s seq:%" PRIu64 " handle:%p",
+ TMSG_INFO(pStub->rpcMsg.msgType), index, pStub->rpcMsg.info.handle);
syncNodeEventLog(pSyncNode, eventLog);
taosHashRemove(pObj->pRespHash, &index, sizeof(index));
diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c
index ff1f2c5af9..15b1054e63 100644
--- a/source/libs/sync/src/syncTimeout.c
+++ b/source/libs/sync/src/syncTimeout.c
@@ -41,18 +41,23 @@ int32_t syncNodeOnTimeoutCb(SSyncNode* ths, SyncTimeout* pMsg) {
// syncNodePingAll(ths);
// syncNodePingPeers(ths);
+ sTrace("vgId:%d, sync timeout, type:ping count:%d", ths->vgId, ths->pingTimerCounter);
syncNodeTimerRoutine(ths);
}
} else if (pMsg->timeoutType == SYNC_TIMEOUT_ELECTION) {
if (atomic_load_64(&ths->electTimerLogicClockUser) <= pMsg->logicClock) {
++(ths->electTimerCounter);
+ sInfo("vgId:%d, sync timeout, type:election count:%d, electTimerLogicClockUser:%ld", ths->vgId,
+ ths->electTimerCounter, ths->electTimerLogicClockUser);
syncNodeElect(ths);
}
} else if (pMsg->timeoutType == SYNC_TIMEOUT_HEARTBEAT) {
if (atomic_load_64(&ths->heartbeatTimerLogicClockUser) <= pMsg->logicClock) {
++(ths->heartbeatTimerCounter);
+ sInfo("vgId:%d, sync timeout, type:replicate count:%d, heartbeatTimerLogicClockUser:%ld", ths->vgId,
+ ths->heartbeatTimerCounter, ths->heartbeatTimerLogicClockUser);
syncNodeReplicate(ths);
}
} else {
diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c
index 5b73d980c4..15e94baee4 100644
--- a/source/libs/sync/src/syncUtil.c
+++ b/source/libs/sync/src/syncUtil.c
@@ -125,7 +125,10 @@ int32_t syncUtilRand(int32_t max) { return taosRand() % max; }
int32_t syncUtilElectRandomMS(int32_t min, int32_t max) {
ASSERT(min > 0 && max > 0 && max >= min);
- return min + syncUtilRand(max - min);
+ int32_t rdm = min + syncUtilRand(max - min);
+
+ // sDebug("random min:%d, max:%d, rdm:%d", min, max, rdm);
+ return rdm;
}
int32_t syncUtilQuorum(int32_t replicaNum) { return replicaNum / 2 + 1; }
diff --git a/source/libs/sync/test/sh/a.sh b/source/libs/sync/test/sh/a.sh
index 751b42b9c2..3983d30b7c 100644
--- a/source/libs/sync/test/sh/a.sh
+++ b/source/libs/sync/test/sh/a.sh
@@ -81,4 +81,16 @@ for file in `ls ${logpath}/log.dnode*vgId*`;do
done
+echo ""
+echo "generate log.commit ..."
+tmpfile=${logpath}/log.commits.tmp
+touch ${tmpfile}
+for file in `ls ${logpath}/log.dnode*.vgId*.commit`;do
+ line=`cat ${file} | tail -n1`
+ echo $line | awk '{print $5, $0}' >> ${tmpfile}
+done
+cat ${tmpfile} | sort -k1 > ${logpath}/log.commits
+
exit 0
+
+
diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp
index fd0c41cce9..3ee28ce96b 100644
--- a/source/libs/sync/test/syncEntryCacheTest.cpp
+++ b/source/libs/sync/test/syncEntryCacheTest.cpp
@@ -82,12 +82,12 @@ void test2() {
code = raftEntryCacheGetEntryP(pCache, index, &pEntry);
ASSERT(code == 1 && index == pEntry->index);
- sTrace("get entry:%p for %ld", pEntry, index);
+ sTrace("get entry:%p for %" PRId64, pEntry, index);
syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry);
code = raftEntryCacheGetEntry(pCache, index, &pEntry);
ASSERT(code == 1 && index == pEntry->index);
- sTrace("get entry:%p for %ld", pEntry, index);
+ sTrace("get entry:%p for %" PRId64, pEntry, index);
syncEntryLog2((char*)"==test2 get entry 2==", pEntry);
syncEntryDestory(pEntry);
@@ -95,14 +95,14 @@ void test2() {
index = 8;
code = raftEntryCacheGetEntry(pCache, index, &pEntry);
ASSERT(code == 0);
- sTrace("get entry:%p for %ld", pEntry, index);
+ sTrace("get entry:%p for %" PRId64, pEntry, index);
sTrace("==test2 get entry 8 not found==");
// not found
index = 9;
code = raftEntryCacheGetEntry(pCache, index, &pEntry);
ASSERT(code == 0);
- sTrace("get entry:%p for %ld", pEntry, index);
+ sTrace("get entry:%p for %" PRId64, pEntry, index);
sTrace("==test2 get entry 9 not found==");
}
@@ -135,7 +135,7 @@ void test4() {
ASSERT(pEntry != NULL);
int64_t rid = taosAddRef(testRefId, pEntry);
- sTrace("rid: %ld", rid);
+ sTrace("rid: %" PRId64, rid);
do {
SSyncRaftEntry* pAcquireEntry = (SSyncRaftEntry*)taosAcquireRef(testRefId, rid);
@@ -164,7 +164,7 @@ void test5() {
ASSERT(pEntry != NULL);
int64_t rid = taosAddRef(testRefId, pEntry);
- sTrace("rid: %ld", rid);
+ sTrace("rid: %" PRId64, rid);
}
for (int64_t rid = 2; rid < 101; rid++) {
diff --git a/source/libs/sync/test/syncHashCacheTest.cpp b/source/libs/sync/test/syncHashCacheTest.cpp
index f155bd834f..7d822971da 100644
--- a/source/libs/sync/test/syncHashCacheTest.cpp
+++ b/source/libs/sync/test/syncHashCacheTest.cpp
@@ -194,13 +194,13 @@ SSyncRaftEntry* getLogEntry2(SSkipList* pSkipList, SyncIndex index) {
}
taosArrayDestroy(entryPArray);
- sTrace("get index2: %ld, arraySize:%d -------------", index, arraySize);
+ sTrace("get index2: %" PRId64 ", arraySize:%d -------------", index, arraySize);
syncEntryLog2((char*)"getLogEntry2", pEntry);
return pEntry;
}
SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) {
- sTrace("get index: %ld -------------", index);
+ sTrace("get index: %" PRId64 " -------------", index);
SyncIndex index2 = index;
SSyncRaftEntry* pEntry = NULL;
SSkipListIterator* pIter =
diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h
index 628bf6d7aa..ee023087df 100644
--- a/source/libs/tdb/inc/tdb.h
+++ b/source/libs/tdb/inc/tdb.h
@@ -35,6 +35,7 @@ int32_t tdbOpen(const char *dbname, int szPage, int pages, TDB **ppDb);
int32_t tdbClose(TDB *pDb);
int32_t tdbBegin(TDB *pDb, TXN *pTxn);
int32_t tdbCommit(TDB *pDb, TXN *pTxn);
+int32_t tdbAbort(TDB *pDb, TXN *pTxn);
// TTB
int32_t tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprFn, TDB *pEnv, TTB **ppTb);
@@ -87,4 +88,4 @@ enum { TDB_CODE_SUCCESS = 0, TDB_CODE_MAX };
}
#endif
-#endif /*_TD_TDB_H_*/
\ No newline at end of file
+#endif /*_TD_TDB_H_*/
diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c
index 6e8fd32641..7a44edb12c 100644
--- a/source/libs/tdb/src/db/tdbBtree.c
+++ b/source/libs/tdb/src/db/tdbBtree.c
@@ -30,6 +30,8 @@ struct SBTree {
int minLocal;
int maxLeaf;
int minLeaf;
+ SBtInfo info;
+ char *tbname;
void *pBuf;
};
@@ -123,7 +125,12 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg
}
if (strcmp(TDB_MAINDB_NAME, tbname)) {
- ret = tdbTbInsert(pPager->pEnv->pMainDb, tbname, strlen(tbname) + 1, &pgno, sizeof(SPgno), &txn);
+ pBt->info.root = pgno;
+ pBt->info.nLevel = 1;
+ pBt->info.nData = 0;
+ pBt->tbname = (char *)tbname;
+ // ret = tdbTbInsert(pPager->pEnv->pMainDb, tbname, strlen(tbname) + 1, &pgno, sizeof(SPgno), &txn);
+ ret = tdbTbInsert(pPager->pEnv->pMainDb, tbname, strlen(tbname) + 1, &pBt->info, sizeof(pBt->info), &txn);
if (ret < 0) {
return -1;
}
@@ -169,6 +176,8 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in
tdbBtcOpen(&btc, pBt, pTxn);
+ tdbTrace("tdb insert, btc: %p, pTxn: %p", &btc, pTxn);
+
// move to the position to insert
ret = tdbBtcMoveTo(&btc, pKey, kLen, &c);
if (ret < 0) {
@@ -207,6 +216,8 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) {
tdbBtcOpen(&btc, pBt, pTxn);
+ tdbTrace("tdb delete, btc: %p, pTxn: %p", &btc, pTxn);
+
// move the cursor
ret = tdbBtcMoveTo(&btc, pKey, kLen, &c);
if (ret < 0) {
@@ -237,6 +248,8 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i
tdbBtcOpen(&btc, pBt, pTxn);
+ tdbTrace("tdb upsert, btc: %p, pTxn: %p", &btc, pTxn);
+
// move the cursor
ret = tdbBtcMoveTo(&btc, pKey, nKey, &c);
if (ret < 0) {
@@ -276,10 +289,12 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
int ret;
void *pTKey = NULL;
void *pTVal = NULL;
- SCellDecoder cd;
+ SCellDecoder cd = {0};
tdbBtcOpen(&btc, pBt, NULL);
+ tdbTrace("tdb pget, btc: %p", &btc);
+
ret = tdbBtcMoveTo(&btc, pKey, kLen, &cret);
if (ret < 0) {
tdbBtcClose(&btc);
@@ -288,6 +303,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
if (btc.idx < 0 || cret) {
tdbBtcClose(&btc);
+
return -1;
}
@@ -323,9 +339,13 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
}
if (TDB_CELLDECODER_FREE_VAL(&cd)) {
+ tdbDebug("tdb btc/pget/2 decoder: %p pVal free: %p", &cd, cd.pVal);
+
tdbFree(cd.pVal);
}
+ tdbTrace("tdb pget end, btc decoder: %p/0x%x, local decoder:%p", &btc.coder, btc.coder.freeKV, &cd);
+
tdbBtcClose(&btc);
return 0;
@@ -715,7 +735,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
int szCell;
SBtreeInitPageArg iarg;
int iNew, nNewCells;
- SCellDecoder cd;
+ SCellDecoder cd = {0};
iarg.pBt = pBt;
iarg.flags = TDB_BTREE_PAGE_GET_FLAGS(pOlds[0]);
@@ -1228,6 +1248,8 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
}
TDB_CELLDECODER_SET_FREE_VAL(pDecoder);
+ tdbDebug("tdb btc decoder: %p/0x%x pVal: %p ", pDecoder, pDecoder->freeKV, pDecoder->pVal);
+
memcpy(pDecoder->pVal, pCell + nHeader + kLen, nLocal - kLen - sizeof(SPgno));
nLeft -= nLocal - kLen - sizeof(SPgno);
@@ -1369,6 +1391,9 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD
leaf = TDB_BTREE_PAGE_IS_LEAF(pPage);
// Clear the state of decoder
+ if (TDB_CELLDECODER_FREE_VAL(pDecoder)) {
+ tdbFree(pDecoder->pVal);
+ }
pDecoder->kLen = -1;
pDecoder->pKey = NULL;
pDecoder->vLen = -1;
@@ -1376,6 +1401,8 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD
pDecoder->pgno = 0;
TDB_CELLDECODER_SET_FREE_NIL(pDecoder);
+ tdbDebug("tdb btc decoder set nil: %p/0x%x ", pDecoder, pDecoder->freeKV);
+
// 1. Decode header part
if (!leaf) {
ASSERT(pPage->vLen == sizeof(SPgno));
@@ -1643,7 +1670,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) {
int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
SCell *pCell;
- SCellDecoder cd;
+ SCellDecoder cd = {0};
void *pKey, *pVal;
int ret;
@@ -1689,7 +1716,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) {
SCell *pCell;
- SCellDecoder cd;
+ SCellDecoder cd = {0};
void *pKey, *pVal;
int ret;
@@ -2030,7 +2057,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) {
const void *pTKey;
int tkLen;
- tdbTrace("ttl moveto, pager:%p, ipage:%d", pPager, pBtc->iPage);
+ tdbTrace("tdb moveto, pager:%p, ipage:%d", pPager, pBtc->iPage);
if (pBtc->iPage < 0) {
// move from a clear cursor
ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage,
@@ -2086,6 +2113,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) {
}
// search downward to the leaf
+ tdbTrace("tdb search downward, pager:%p, ipage:%d", pPager, pBtc->iPage);
for (;;) {
int lidx, ridx;
SPage *pPage;
@@ -2120,6 +2148,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) {
}
// binary search
+ tdbTrace("tdb binary search, pager:%p, ipage:%d", pPager, pBtc->iPage);
for (;;) {
if (lidx > ridx) break;
@@ -2150,6 +2179,8 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) {
}
}
+ tdbTrace("tdb moveto end, pager:%p, ipage:%d", pPager, pBtc->iPage);
+
return 0;
}
@@ -2168,6 +2199,12 @@ int tdbBtcClose(SBTC *pBtc) {
pBtc->idx = pBtc->idxStack[pBtc->iPage];
}
+ if (TDB_CELLDECODER_FREE_VAL(&pBtc->coder)) {
+ tdbDebug("tdb btc/close decoder: %p pVal free: %p", &pBtc->coder, pBtc->coder.pVal);
+
+ tdbFree(pBtc->coder.pVal);
+ }
+
return 0;
}
diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c
index 298992a560..cc8bdca75d 100644
--- a/source/libs/tdb/src/db/tdbDb.c
+++ b/source/libs/tdb/src/db/tdbDb.c
@@ -66,7 +66,7 @@ int32_t tdbOpen(const char *dbname, int32_t szPage, int32_t pages, TDB **ppDb) {
#ifdef USE_MAINDB
// open main db
- ret = tdbTbOpen(TDB_MAINDB_NAME, -1, sizeof(SPgno), NULL, pDb, &pDb->pMainDb);
+ ret = tdbTbOpen(TDB_MAINDB_NAME, -1, sizeof(SBtInfo), NULL, pDb, &pDb->pMainDb);
if (ret < 0) {
return -1;
}
@@ -97,7 +97,7 @@ int tdbClose(TDB *pDb) {
return 0;
}
-int tdbBegin(TDB *pDb, TXN *pTxn) {
+int32_t tdbBegin(TDB *pDb, TXN *pTxn) {
SPager *pPager;
int ret;
@@ -112,7 +112,7 @@ int tdbBegin(TDB *pDb, TXN *pTxn) {
return 0;
}
-int tdbCommit(TDB *pDb, TXN *pTxn) {
+int32_t tdbCommit(TDB *pDb, TXN *pTxn) {
SPager *pPager;
int ret;
@@ -127,6 +127,21 @@ int tdbCommit(TDB *pDb, TXN *pTxn) {
return 0;
}
+int32_t tdbAbort(TDB *pDb, TXN *pTxn) {
+ SPager *pPager;
+ int ret;
+
+ for (pPager = pDb->pgrList; pPager; pPager = pPager->pNext) {
+ ret = tdbPagerAbort(pPager, pTxn);
+ if (ret < 0) {
+ ASSERT(0);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
SPager *tdbEnvGetPager(TDB *pDb, const char *fname) {
u32 hash;
SPager **ppPager;
diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c
index d9a44ba570..4de99e8b1b 100644
--- a/source/libs/tdb/src/db/tdbPager.c
+++ b/source/libs/tdb/src/db/tdbPager.c
@@ -253,7 +253,70 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
// sync the db file
tdbOsFSync(pPager->fd);
- // remote the journal file
+ // remove the journal file
+ tdbOsClose(pPager->jfd);
+ tdbOsRemove(pPager->jFileName);
+ pPager->inTran = 0;
+
+ return 0;
+}
+
+// recovery dirty pages
+int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
+ SPage *pPage;
+ int pgIdx;
+ SPgno journalSize = 0;
+ int ret;
+
+ // 0, sync the journal file
+ ret = tdbOsFSync(pPager->jfd);
+ if (ret < 0) {
+ // TODO
+ ASSERT(0);
+ return 0;
+ }
+
+ tdb_fd_t jfd = tdbOsOpen(pPager->jFileName, TDB_O_RDWR, 0755);
+ if (jfd == NULL) {
+ return 0;
+ }
+
+ ret = tdbGetFileSize(jfd, pPager->pageSize, &journalSize);
+ if (ret < 0) {
+ return -1;
+ }
+
+ // 1, read pages from jounal file
+ // 2, write original pages to buffered ones
+
+ /* TODO: reset the buffered pages instead of releasing them
+ // loop to reset the dirty pages from file
+ for (pgIdx = 0, pPage = pPager->pDirty; pPage != NULL && pgIndex < journalSize; pPage = pPage->pDirtyNext, ++pgIdx) {
+ // read pgno & the page from journal
+ SPgno pgno;
+
+ int ret = tdbOsRead(jfd, &pgno, sizeof(pgno));
+ if (ret < 0) {
+ return -1;
+ }
+
+ ret = tdbOsRead(jfd, pageBuf, pPager->pageSize);
+ if (ret < 0) {
+ return -1;
+ }
+ }
+ */
+ // 3, release the dirty pages
+ for (pPage = pPager->pDirty; pPage; pPage = pPager->pDirty) {
+ pPager->pDirty = pPage->pDirtyNext;
+ pPage->pDirtyNext = NULL;
+
+ pPage->isDirty = 0;
+
+ tdbPCacheRelease(pPager->pCache, pPage, pTxn);
+ }
+
+ // 4, remove the journal file
tdbOsClose(pPager->jfd);
tdbOsRemove(pPager->jFileName);
pPager->inTran = 0;
@@ -475,8 +538,7 @@ int tdbPagerRestore(SPager *pPager, SBTree *pBt) {
for (int pgIndex = 0; pgIndex < journalSize; ++pgIndex) {
// read pgno & the page from journal
- SPgno pgno;
- SPage *pPage;
+ SPgno pgno;
int ret = tdbOsRead(jfd, &pgno, sizeof(pgno));
if (ret < 0) {
diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h
index 1f38cea038..49126b80b6 100644
--- a/source/libs/tdb/src/inc/tdbInt.h
+++ b/source/libs/tdb/src/inc/tdbInt.h
@@ -189,6 +189,7 @@ int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate, SBTree *pBt);
int tdbPagerWrite(SPager *pPager, SPage *pPage);
int tdbPagerBegin(SPager *pPager, TXN *pTxn);
int tdbPagerCommit(SPager *pPager, TXN *pTxn);
+int tdbPagerAbort(SPager *pPager, TXN *pTxn);
int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *, int), void *arg,
TXN *pTxn);
void tdbPagerReturnPage(SPager *pPager, SPage *pPage, TXN *pTxn);
diff --git a/source/libs/wal/inc/walInt.h b/source/libs/wal/inc/walInt.h
index 3aebb1c6ba..e4b27292bb 100644
--- a/source/libs/wal/inc/walInt.h
+++ b/source/libs/wal/inc/walInt.h
@@ -151,8 +151,8 @@ int walMetaDeserialize(SWal* pWal, const char* bytes);
// meta section end
// seek section
-int walChangeWrite(SWal* pWal, int64_t ver);
-int walInitWriteFile(SWal* pWal);
+int64_t walChangeWrite(SWal* pWal, int64_t ver);
+int walInitWriteFile(SWal* pWal);
// seek section end
int64_t walGetSeq();
diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c
index f57bcd41d6..a5b5a2b7b4 100644
--- a/source/libs/wal/src/walRead.c
+++ b/source/libs/wal/src/walRead.c
@@ -78,7 +78,8 @@ int32_t walNextValidMsg(SWalReader *pReader) {
int64_t endVer = pReader->cond.scanUncommited ? lastVer : committedVer;
endVer = TMIN(appliedVer, endVer);
- wDebug("vgId:%d, wal start to fetch, ver %ld, last ver %ld commit ver %ld, applied ver %ld, end ver %ld",
+ wDebug("vgId:%d, wal start to fetch, index:%" PRId64 ", last index:%" PRId64 " commit index:%" PRId64
+ ", applied index:%" PRId64 ", end index:%" PRId64,
pReader->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer, endVer);
pReader->curStopped = 0;
while (fetchVer <= endVer) {
@@ -190,7 +191,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
return -1;
}
- wDebug("vgId:%d, wal version reset from %" PRId64 "(invalid: %d) to %" PRId64, pReader->pWal->cfg.vgId,
+ wDebug("vgId:%d, wal version reset from index:%" PRId64 "(invalid:%d) to index:%" PRId64, pReader->pWal->cfg.vgId,
pReader->curVersion, pReader->curInvalid, ver);
pReader->curVersion = ver;
@@ -200,7 +201,7 @@ int32_t walReadSeekVerImpl(SWalReader *pReader, int64_t ver) {
int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) {
SWal *pWal = pReader->pWal;
if (!pReader->curInvalid && ver == pReader->curVersion) {
- wDebug("vgId:%d, wal version %" PRId64 " match, no need to reset", pReader->pWal->cfg.vgId, ver);
+ wDebug("vgId:%d, wal index:%" PRId64 " match, no need to reset", pReader->pWal->cfg.vgId, ver);
return 0;
}
@@ -229,7 +230,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) {
int64_t contLen;
bool seeked = false;
- wDebug("vgId:%d, wal starts to fetch head %d", pRead->pWal->cfg.vgId, fetchVer);
+ wDebug("vgId:%d, wal starts to fetch head, index:%" PRId64, pRead->pWal->cfg.vgId, fetchVer);
if (pRead->curInvalid || pRead->curVersion != fetchVer) {
if (walReadSeekVer(pRead, fetchVer) < 0) {
@@ -267,7 +268,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
SWalCont *pReadHead = &pRead->pHead->head;
int64_t ver = pReadHead->version;
- wDebug("vgId:%d, wal starts to fetch body %ld", pRead->pWal->cfg.vgId, ver);
+ wDebug("vgId:%d, wal starts to fetch body, index:%" PRId64, pRead->pWal->cfg.vgId, ver);
if (pRead->capacity < pReadHead->bodyLen) {
void *ptr = taosMemoryRealloc(pRead->pHead, sizeof(SWalCkHead) + pReadHead->bodyLen);
@@ -312,7 +313,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
return -1;
}
- wDebug("vgId:%d, version %" PRId64 " is fetched, cursor advance", pRead->pWal->cfg.vgId, ver);
+ wDebug("vgId:%d, index:%" PRId64 " is fetched, cursor advance", pRead->pWal->cfg.vgId, ver);
pRead->curVersion = ver + 1;
return 0;
}
@@ -406,7 +407,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
if (pReadHead->version != ver) {
- wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId,
+ wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId,
pRead->pHead->head.version, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
@@ -414,7 +415,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
if (walValidBodyCksum(*ppHead) != 0) {
- wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver);
+ wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver);
pRead->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
return -1;
@@ -425,7 +426,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) {
}
int32_t walReadVer(SWalReader *pReader, int64_t ver) {
- wDebug("vgId:%d, wal start to read ver %ld", pReader->pWal->cfg.vgId, ver);
+ wDebug("vgId:%d, wal start to read index:%" PRId64, pReader->pWal->cfg.vgId, ver);
int64_t contLen;
int32_t code;
bool seeked = false;
@@ -521,7 +522,7 @@ int32_t walReadVer(SWalReader *pReader, int64_t ver) {
ver);
uint32_t readCkSum = walCalcBodyCksum(pReader->pHead->head.body, pReader->pHead->head.bodyLen);
uint32_t logCkSum = pReader->pHead->cksumBody;
- wError("checksum written into log: %u, checksum calculated: %u", logCkSum, readCkSum);
+ wError("checksum written into log:%u, checksum calculated:%u", logCkSum, readCkSum);
pReader->curInvalid = 1;
terrno = TSDB_CODE_WAL_FILE_CORRUPTED;
ASSERT(0);
diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c
index 87ab155065..1196914dae 100644
--- a/source/libs/wal/src/walSeek.c
+++ b/source/libs/wal/src/walSeek.c
@@ -74,7 +74,7 @@ int walInitWriteFile(SWal* pWal) {
return 0;
}
-int walChangeWrite(SWal* pWal, int64_t ver) {
+int64_t walChangeWrite(SWal* pWal, int64_t ver) {
int code;
TdFilePtr pIdxTFile, pLogTFile;
char fnameStr[WAL_FILE_LEN];
diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c
index eaf43ba7d7..ad571a9e82 100644
--- a/source/libs/wal/src/walWrite.c
+++ b/source/libs/wal/src/walWrite.c
@@ -208,6 +208,9 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
taosCloseFile(&pIdxFile);
taosCloseFile(&pLogFile);
+ taosFsyncFile(pWal->pLogFile);
+ taosFsyncFile(pWal->pIdxFile);
+
walSaveMeta(pWal);
// unlock
diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c
index 6ae3d8a0c0..8f6800c7be 100644
--- a/source/os/src/osEnv.c
+++ b/source/os/src/osEnv.c
@@ -105,6 +105,10 @@ void osCleanup() {}
bool osLogSpaceAvailable() { return tsLogSpace.reserved <= tsLogSpace.size.avail; }
+bool osDataSpaceAvailable() { return tsDataSpace.reserved <= tsDataSpace.size.avail; }
+
+bool osTempSpaceAvailable() { return tsTempSpace.reserved <= tsTempSpace.size.avail; }
+
void osSetTimezone(const char *timezone) { taosSetSystemTimezone(timezone, tsTimezoneStr, &tsDaylight, &tsTimezone); }
void osSetSystemLocale(const char *inLocale, const char *inCharSet) {
diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c
index 556fd78360..b76769bdb8 100644
--- a/source/os/src/osFile.c
+++ b/source/os/src/osFile.c
@@ -162,6 +162,26 @@ _err:
#endif
}
+TdFilePtr taosCreateFile(const char *path, int32_t tdFileOptions) {
+ TdFilePtr fp = taosOpenFile(path, tdFileOptions);
+ if (!fp) {
+ if (errno == ENOENT) {
+ // Try to create directory recursively
+ char *s = strdup(path);
+ if (taosMulMkDir(taosDirName(s)) != 0) {
+ taosMemoryFree(s);
+ return NULL;
+ }
+ taosMemoryFree(s);
+ fp = taosOpenFile(path, tdFileOptions);
+ if (!fp) {
+ return NULL;
+ }
+ }
+ }
+ return fp;
+}
+
int32_t taosRemoveFile(const char *path) { return remove(path); }
int32_t taosRenameFile(const char *oldName, const char *newName) {
diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c
index 98cd63a831..cd2acac261 100644
--- a/source/os/src/osMath.c
+++ b/source/os/src/osMath.c
@@ -31,6 +31,7 @@ void swapStr(char* j, char* J, int width) {
}
#endif
+// todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually.
void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar) {
#ifdef WINDOWS
int64_t i, j;
diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c
index 3275774cce..63c414386b 100644
--- a/source/os/src/osSemaphore.c
+++ b/source/os/src/osSemaphore.c
@@ -93,7 +93,7 @@ int32_t tsem_timewait(tsem_t* sem, int64_t nanosecs) {
// // We specified a non-zero wait. Time must advance.
// if (ft_before.dwLowDateTime == ft_after.dwLowDateTime && ft_before.dwHighDateTime == ft_after.dwHighDateTime)
// {
- // printf("nanoseconds: %d, rc: %d, errno: %d. before filetime: %d, %d; after filetime: %d, %d\n",
+ // printf("nanoseconds: %d, rc: %d, code:0x%x. before filetime: %d, %d; after filetime: %d, %d\n",
// nanosecs, rc, errno,
// (int)ft_before.dwLowDateTime, (int)ft_before.dwHighDateTime,
// (int)ft_after.dwLowDateTime, (int)ft_after.dwHighDateTime);
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 51dfa1ce13..e4b6983dcb 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -410,6 +410,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed limited b
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity limited by license")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by license")
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "STable creation limited by license")
+TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Table creation limited by license")
// sync
TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout")
@@ -610,6 +612,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env")
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state")
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_QTASKINFO_CREATE, "Rsma qtaskinfo creation error")
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_FILE_CORRUPTED, "Rsma file corrupted")
+TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_REMOVE_EXISTS, "Rsma remove exists")
//index
TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_REBUILDING, "Index is rebuilding")
diff --git a/source/util/src/thash.c b/source/util/src/thash.c
index 8275072748..aee84a0d55 100644
--- a/source/util/src/thash.c
+++ b/source/util/src/thash.c
@@ -832,8 +832,9 @@ void *taosHashIterate(SHashObj *pHashObj, void *p) {
if (pNode) {
SHashEntry *pe = pHashObj->hashList[slot];
- uint16_t prevRef = atomic_load_16(&pNode->refCount);
+ /*uint16_t prevRef = atomic_load_16(&pNode->refCount);*/
uint16_t afterRef = atomic_add_fetch_16(&pNode->refCount, 1);
+#if 0
ASSERT(prevRef < afterRef);
// the reference count value is overflow, which will cause the delete node operation immediately.
@@ -845,6 +846,8 @@ void *taosHashIterate(SHashObj *pHashObj, void *p) {
} else {
data = GET_HASH_NODE_DATA(pNode);
}
+#endif
+ data = GET_HASH_NODE_DATA(pNode);
if (afterRef >= MAX_WARNING_REF_COUNT) {
uWarn("hash entry ref count is abnormally high: %d", afterRef);
diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c
index 73d89523ce..2e8239c68f 100644
--- a/source/util/src/tlog.c
+++ b/source/util/src/tlog.c
@@ -691,9 +691,14 @@ static void taosWriteLog(SLogBuff *pLogBuf) {
static void *taosAsyncOutputLog(void *param) {
SLogBuff *pLogBuf = (SLogBuff *)param;
setThreadName("log");
-
+ int32_t count = 0;
while (1) {
+ count += tsWriteInterval;
taosMsleep(tsWriteInterval);
+ if (count > 1000) {
+ osUpdate();
+ count = 0;
+ }
// Polling the buffer
taosWriteLog(pLogBuf);
diff --git a/tests/pytest/crash_gen/crash_gen_main.py b/tests/pytest/crash_gen/crash_gen_main.py
index 7ab09383bf..2fa99230bc 100755
--- a/tests/pytest/crash_gen/crash_gen_main.py
+++ b/tests/pytest/crash_gen/crash_gen_main.py
@@ -1339,8 +1339,9 @@ class Task():
0x03A1, # STable [does] not exist
0x03AA, # Tag already exists
0x0603, # Table already exists
- 0x2603, # Table does not exist
+ 0x2603, # Table does not exist, replaced by 2662 below
0x260d, # Tags number not matched
+ 0x2662, # Table does not exist #TODO: what about 2603 above?
diff --git a/tests/pytest/tools/taosdumpTest.py b/tests/pytest/tools/taosdumpTest.py
index bc31b9fbcc..d23e2f79af 100644
--- a/tests/pytest/tools/taosdumpTest.py
+++ b/tests/pytest/tools/taosdumpTest.py
@@ -35,7 +35,7 @@ class TDTestCase:
else:
return True
- def getBuildPath(self):
+ def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
@@ -43,25 +43,33 @@ class TDTestCase:
else:
projPath = selfPath[:selfPath.find("tests")]
+ paths = []
for root, dirs, files in os.walk(projPath):
- if ("taosdump" in files):
+ if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
- buildPath = root[:len(root) - len("/build/bin")]
+ paths.append(os.path.join(root, tool))
break
- return buildPath
+ if (len(paths) == 0):
+ return ""
+ return paths[0]
def run(self):
if not os.path.exists("./taosdumptest/tmp1"):
os.makedirs("./taosdumptest/tmp1")
else:
- print("目录存在")
+ os.system("rm -rf ./taosdumptest/tmp1")
+ os.makedirs("./taosdumptest/tmp1")
if not os.path.exists("./taosdumptest/tmp2"):
os.makedirs("./taosdumptest/tmp2")
+ else:
+ os.system("rm -rf ./taosdumptest/tmp2")
+ os.makedirs("./taosdumptest/tmp2")
+
tdSql.execute("drop database if exists db")
- tdSql.execute("create database db duration 11 keep 3649 blocks 8 ")
- tdSql.execute("create database db1 duration 12 keep 3640 blocks 7 ")
+ tdSql.execute("create database db duration 11 keep 3649")
+ tdSql.execute("create database db1 duration 12 keep 3640")
tdSql.execute("use db")
tdSql.execute(
"create table st(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))")
@@ -78,31 +86,30 @@ class TDTestCase:
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
tdSql.execute(sql)
- buildPath = self.getBuildPath()
- if (buildPath == ""):
+ binPath = self.getPath()
+ if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
- tdLog.info("taosdump found in %s" % buildPath)
- binPath = buildPath + "/build/bin/"
+ tdLog.info("taosdump found: %s" % binPath)
- os.system("%staosdump --databases db -o ./taosdumptest/tmp1" % binPath)
+ os.system("%s -y --databases db -o ./taosdumptest/tmp1" % binPath)
os.system(
- "%staosdump --databases db1 -o ./taosdumptest/tmp2" %
+ "%s -y --databases db1 -o ./taosdumptest/tmp2" %
binPath)
tdSql.execute("drop database db")
tdSql.execute("drop database db1")
tdSql.query("show databases")
- tdSql.checkRows(0)
+ tdSql.checkRows(2)
- os.system("%staosdump -i ./taosdumptest/tmp1" % binPath)
- os.system("%staosdump -i ./taosdumptest/tmp2" % binPath)
+ os.system("%s -i ./taosdumptest/tmp1" % binPath)
+ os.system("%s -i ./taosdumptest/tmp2" % binPath)
tdSql.execute("use db")
tdSql.query("show databases")
- tdSql.checkRows(2)
+ tdSql.checkRows(4)
dbresult = tdSql.queryResult
- # 6--duration,7--keep0,keep1,keep, 12--block,
+ # 6--duration,7--keep0,keep1,keep
isCommunity = self.checkCommunity()
print("iscommunity: %d" % isCommunity)
@@ -111,20 +118,15 @@ class TDTestCase:
print(dbresult[i])
print(type(dbresult[i][6]))
print(type(dbresult[i][7]))
- print(type(dbresult[i][9]))
- assert dbresult[i][6] == 11
- if isCommunity:
- assert dbresult[i][7] == "3649"
- else:
- assert dbresult[i][7] == "3649,3649,3649"
- assert dbresult[i][9] == 8
+ print((dbresult[i][6]))
+ assert dbresult[i][6] == "15840m"
+ print((dbresult[i][7]))
+ assert dbresult[i][7] == "5254560m,5254560m,5254560m"
if dbresult[i][0] == 'db1':
- assert dbresult[i][6] == 12
- if isCommunity:
- assert dbresult[i][7] == "3640"
- else:
- assert dbresult[i][7] == "3640,3640,3640"
- assert dbresult[i][9] == 7
+ print((dbresult[i][6]))
+ assert dbresult[i][6] == "17280m"
+ print((dbresult[i][7]))
+ assert dbresult[i][7] == "5241600m,5241600m,5241600m"
tdSql.query("show stables")
tdSql.checkRows(1)
@@ -132,8 +134,10 @@ class TDTestCase:
tdSql.query("show tables")
tdSql.checkRows(2)
- tdSql.checkData(0, 0, 't2')
- tdSql.checkData(1, 0, 't1')
+ dbresult = tdSql.queryResult
+ print(dbresult)
+ for i in range(len(dbresult)):
+ assert ((dbresult[i][0] == "t1") or (dbresult[i][0] == "t2"))
tdSql.query("select * from t1")
tdSql.checkRows(100)
@@ -155,7 +159,7 @@ class TDTestCase:
os.system("rm -rf ./taosdumptest/tmp2")
os.makedirs("./taosdumptest/tmp1")
tdSql.execute("create database db12312313231231321312312312_323")
- tdSql.error("create database db12312313231231321312312312_3231")
+ tdSql.error("create database db012345678911234567892234567893323456789423456789523456789bcdefe")
tdSql.execute("use db12312313231231321312312312_323")
tdSql.execute("create stable st12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))")
tdSql.error("create stable st_12345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678_9(ts timestamp, c1 int, c2 nchar(10)) tags(t1 int, t2 binary(10))")
@@ -168,9 +172,10 @@ class TDTestCase:
tdSql.query("show stables")
tdSql.checkRows(2)
os.system(
- "%staosdump --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" % binPath)
+ "%s -y --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" %
+ binPath)
tdSql.execute("drop database db12312313231231321312312312_323")
- os.system("%staosdump -i ./taosdumptest/tmp1" % binPath)
+ os.system("%s -i ./taosdumptest/tmp1" % binPath)
tdSql.execute("use db12312313231231321312312312_323")
tdSql.query("show stables")
tdSql.checkRows(2)
diff --git a/tests/pytest/tools/taosdumpTest2.py b/tests/pytest/tools/taosdumpTest2.py
index 839988375b..f611623241 100644
--- a/tests/pytest/tools/taosdumpTest2.py
+++ b/tests/pytest/tools/taosdumpTest2.py
@@ -26,9 +26,9 @@ class TDTestCase:
self.ts = 1601481600000
self.numberOfTables = 1
- self.numberOfRecords = 15000
+ self.numberOfRecords = 150
- def getBuildPath(self):
+ def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
@@ -36,15 +36,24 @@ class TDTestCase:
else:
projPath = selfPath[:selfPath.find("tests")]
+ paths = []
for root, dirs, files in os.walk(projPath):
- if ("taosd" in files):
+ if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
- buildPath = root[:len(root) - len("/build/bin")]
+ paths.append(os.path.join(root, tool))
break
- return buildPath
+ if (len(paths) == 0):
+ return ""
+ return paths[0]
def run(self):
+ if not os.path.exists("./taosdumptest/tmp"):
+ os.makedirs("./taosdumptest/tmp")
+ else:
+ os.system("rm -rf ./taosdumptest/tmp")
+ os.makedirs("./taosdumptest/tmp")
+
tdSql.prepare()
tdSql.execute("create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)")
@@ -60,27 +69,26 @@ class TDTestCase:
break
tdSql.execute(sql)
- buildPath = self.getBuildPath()
- if (buildPath == ""):
+ binPath = self.getPath()
+ if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
- tdLog.info("taosdump found in %s" % buildPath)
- binPath = buildPath + "/build/bin/"
+ tdLog.info("taosdump found in %s" % binPath)
- os.system("rm /tmp/*.sql")
+ os.system("rm ./taosdumptest/tmp/*.sql")
os.system(
- "%staosdump --databases db -o /tmp -B 32766 -L 1048576" %
+ "%s --databases db -o ./taosdumptest/tmp -B 32766 -L 1048576" %
binPath)
tdSql.execute("drop database db")
tdSql.query("show databases")
- tdSql.checkRows(0)
+ tdSql.checkRows(2)
- os.system("%staosdump -i /tmp" % binPath)
+ os.system("%s -i ./taosdumptest/tmp" % binPath)
tdSql.query("show databases")
- tdSql.checkRows(1)
- tdSql.checkData(0, 0, 'db')
+ tdSql.checkRows(3)
+ tdSql.checkData(2, 0, 'db')
tdSql.execute("use db")
tdSql.query("show stables")
@@ -90,6 +98,38 @@ class TDTestCase:
tdSql.query("select count(*) from t1")
tdSql.checkData(0, 0, self.numberOfRecords)
+ # test case for TS-1225
+ tdSql.execute("create database test")
+ tdSql.execute("use test")
+ tdSql.execute(
+ "create table stb(ts timestamp, c1 binary(16374), c2 binary(16374), c3 binary(16374)) tags(t1 nchar(256))")
+ tdSql.execute(
+ "insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')" %
+ ("16374",
+ "16374",
+ "16374"))
+
+# sys.exit(0)
+ os.system("rm ./taosdumptest/tmp/*.sql")
+ os.system("rm ./taosdumptest/tmp/*.avro*")
+ os.system("%s -D test -o ./taosdumptest/tmp -y" % binPath)
+
+ tdSql.execute("drop database test")
+ tdSql.query("show databases")
+ tdSql.checkRows(3)
+
+ os.system("%s -i ./taosdumptest/tmp -y" % binPath)
+
+ tdSql.execute("use test")
+ tdSql.error("show vnodes '' ")
+ tdSql.query("show stables")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 'stb')
+
+ tdSql.query("select * from stb")
+ tdSql.checkRows(1)
+ os.system("rm -rf dump_result.txt")
+
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
diff --git a/tests/pytest/tools/taosdumpTestNanoSupport.py b/tests/pytest/tools/taosdumpTestNanoSupport.py
index e96de674d7..c40462b8db 100644
--- a/tests/pytest/tools/taosdumpTestNanoSupport.py
+++ b/tests/pytest/tools/taosdumpTestNanoSupport.py
@@ -35,7 +35,7 @@ class TDTestCase:
else:
return True
- def getBuildPath(self):
+ def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
@@ -43,15 +43,16 @@ class TDTestCase:
else:
projPath = selfPath[:selfPath.find("tests")]
+ paths = []
for root, dirs, files in os.walk(projPath):
- if ("taosd" in files):
+ if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
- buildPath = root[:len(root) - len("/build/bin")]
+ paths.append(os.path.join(root, tool))
break
- return buildPath
-
-
+ if (len(paths) == 0):
+ return ""
+ return paths[0]
def createdb(self, precision="ns"):
tb_nums = self.numberOfTables
@@ -60,13 +61,16 @@ class TDTestCase:
def build_db(precision, start_time):
tdSql.execute("drop database if exists timedb1")
tdSql.execute(
- "create database timedb1 duration 10 keep 36500 blocks 8 precision "+"\""+precision+"\"")
+ "create database timedb1 duration 10 keep 36500 precision " +
+ "\"" +
+ precision +
+ "\"")
tdSql.execute("use timedb1")
tdSql.execute(
"create stable st(ts timestamp, c1 int, c2 nchar(10),c3 timestamp) tags(t1 int, t2 binary(10))")
for tb in range(tb_nums):
- tbname = "t"+str(tb)
+ tbname = "t" + str(tb)
tdSql.execute("create table " + tbname +
" using st tags(1, 'beijing')")
sql = "insert into " + tbname + " values"
@@ -79,8 +83,8 @@ class TDTestCase:
ts_seed = 1000
for i in range(per_tb_rows):
- sql += "(%d, %d, 'nchar%d',%d)" % (currts + i*ts_seed, i %
- 100, i % 100, currts + i*100) # currts +1000ms (1000000000ns)
+ sql += "(%d, %d, 'nchar%d',%d)" % (currts + i * ts_seed, i %
+ 100, i % 100, currts + i * 100) # currts +1000ms (1000000000ns)
tdSql.execute(sql)
if precision == "ns":
@@ -97,7 +101,6 @@ class TDTestCase:
else:
print("other time precision not valid , please check! ")
-
def run(self):
@@ -118,12 +121,11 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
- buildPath = self.getBuildPath()
- if (buildPath == ""):
+ binPath = self.getPath("taosdump")
+ if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
- tdLog.info("taosdump found in %s" % buildPath)
- binPath = buildPath + "/build/bin/"
+ tdLog.info("taosdump found: %s" % binPath)
# create nano second database
@@ -132,67 +134,51 @@ class TDTestCase:
# dump all data
os.system(
- "%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath)
+ "%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
+ binPath)
# dump part data with -S -E
os.system(
- '%staosdump --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' %
+ '%s -y -g --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' %
binPath)
os.system(
- '%staosdump --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' %
+ '%s -y -g --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' %
binPath)
- # replace strings to dump in databases
- os.system(
- "sed -i \"s/timedb1/dumptmp1/g\" `grep timedb1 -rl ./taosdumptest/dumptmp1`")
- os.system(
- "sed -i \"s/timedb1/dumptmp2/g\" `grep timedb1 -rl ./taosdumptest/dumptmp2`")
- os.system(
- "sed -i \"s/timedb1/dumptmp3/g\" `grep timedb1 -rl ./taosdumptest/dumptmp3`")
-
- os.system( "%staosdump -i ./taosdumptest/dumptmp1" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp2" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp3" %binPath)
-
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump
- tdSql.query("select count(*) from dumptmp1.st")
- tdSql.checkData(0,0,1000)
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 510)
- tdSql.query("select count(*) from dumptmp2.st")
- tdSql.checkData(0,0,510)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 900)
- tdSql.query("select count(*) from dumptmp3.st")
- tdSql.checkData(0,0,900)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 1000)
# check data
origin_res = tdSql.getResult("select * from timedb1.st")
- dump_res = tdSql.getResult("select * from dumptmp1.st")
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
- tdLog.info("test nano second : dump check data pass for all data!" )
+ tdLog.info("test nano second : dump check data pass for all data!")
else:
- tdLog.info("test nano second : dump check data failed for all data!" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000000000 and ts <= 1625068860000000000")
- dump_res = tdSql.getResult("select * from dumptmp2.st")
- if origin_res == dump_res:
- tdLog.info(" test nano second : dump check data pass for data! " )
- else:
- tdLog.info(" test nano second : dump check data failed for data !" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000000000 ")
- dump_res = tdSql.getResult("select * from dumptmp3.st")
- if origin_res == dump_res:
- tdLog.info(" test nano second : dump check data pass for data! " )
- else:
- tdLog.info(" test nano second : dump check data failed for data !" )
-
+ tdLog.info(
+ "test nano second : dump check data failed for all data!")
# us second support test case
os.system("rm -rf ./taosdumptest/")
- tdSql.execute("drop database if exists dumptmp1")
- tdSql.execute("drop database if exists dumptmp2")
- tdSql.execute("drop database if exists dumptmp3")
+ tdSql.execute("drop database if exists timedb1")
if not os.path.exists("./taosdumptest/tmp1"):
os.makedirs("./taosdumptest/dumptmp1")
@@ -205,75 +191,63 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
- buildPath = self.getBuildPath()
- if (buildPath == ""):
+ binPath = self.getPath()
+ if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
- tdLog.info("taosdump found in %s" % buildPath)
- binPath = buildPath + "/build/bin/"
+ tdLog.info("taosdump found: %s" % binPath)
self.createdb(precision="us")
os.system(
- "%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath)
-
- os.system(
- '%staosdump --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' %
- binPath)
- os.system(
- '%staosdump --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' %
+ "%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath)
os.system(
- "sed -i \"s/timedb1/dumptmp1/g\" `grep timedb1 -rl ./taosdumptest/dumptmp1`")
+ '%s -y -g --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' %
+ binPath)
os.system(
- "sed -i \"s/timedb1/dumptmp2/g\" `grep timedb1 -rl ./taosdumptest/dumptmp2`")
- os.system(
- "sed -i \"s/timedb1/dumptmp3/g\" `grep timedb1 -rl ./taosdumptest/dumptmp3`")
+ '%s -y -g --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' %
+ binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp1" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp2" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp3" %binPath)
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
+ os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
-
- tdSql.query("select count(*) from dumptmp1.st")
- tdSql.checkData(0,0,1000)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 510)
- tdSql.query("select count(*) from dumptmp2.st")
- tdSql.checkData(0,0,510)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 900)
- tdSql.query("select count(*) from dumptmp3.st")
- tdSql.checkData(0,0,900)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 1000)
-
+ # check data
origin_res = tdSql.getResult("select * from timedb1.st")
- dump_res = tdSql.getResult("select * from dumptmp1.st")
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
- tdLog.info("test us second : dump check data pass for all data!" )
+ tdLog.info("test micro second : dump check data pass for all data!")
else:
- tdLog.info("test us second : dump check data failed for all data!" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000000 and ts <= 1625068860000000")
- dump_res = tdSql.getResult("select * from dumptmp2.st")
- if origin_res == dump_res:
- tdLog.info(" test us second : dump check data pass for data! " )
- else:
- tdLog.info(" test us second : dump check data failed for data!" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000000 ")
- dump_res = tdSql.getResult("select * from dumptmp3.st")
- if origin_res == dump_res:
- tdLog.info(" test us second : dump check data pass for data! " )
- else:
- tdLog.info(" test us second : dump check data failed for data! " )
+ tdLog.info(
+ "test micro second : dump check data failed for all data!")
-
# ms second support test case
os.system("rm -rf ./taosdumptest/")
- tdSql.execute("drop database if exists dumptmp1")
- tdSql.execute("drop database if exists dumptmp2")
- tdSql.execute("drop database if exists dumptmp3")
+ tdSql.execute("drop database if exists timedb1")
if not os.path.exists("./taosdumptest/tmp1"):
os.makedirs("./taosdumptest/dumptmp1")
@@ -286,69 +260,60 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3")
- buildPath = self.getBuildPath()
- if (buildPath == ""):
+ binPath = self.getPath()
+ if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
- tdLog.info("taosdump found in %s" % buildPath)
- binPath = buildPath + "/build/bin/"
+ tdLog.info("taosdump found: %s" % binPath)
self.createdb(precision="ms")
os.system(
- "%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % binPath)
-
- os.system(
- '%staosdump --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' %
- binPath)
- os.system(
- '%staosdump --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' %
+ "%s -y -g --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath)
os.system(
- "sed -i \"s/timedb1/dumptmp1/g\" `grep timedb1 -rl ./taosdumptest/dumptmp1`")
+ '%s -y -g --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' %
+ binPath)
os.system(
- "sed -i \"s/timedb1/dumptmp2/g\" `grep timedb1 -rl ./taosdumptest/dumptmp2`")
- os.system(
- "sed -i \"s/timedb1/dumptmp3/g\" `grep timedb1 -rl ./taosdumptest/dumptmp3`")
+ '%s -y -g --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' %
+ binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp1" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp2" %binPath)
- os.system( "%staosdump -i ./taosdumptest/dumptmp3" %binPath)
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
+ os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
-
- tdSql.query("select count(*) from dumptmp1.st")
- tdSql.checkData(0,0,1000)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 510)
- tdSql.query("select count(*) from dumptmp2.st")
- tdSql.checkData(0,0,510)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 900)
- tdSql.query("select count(*) from dumptmp3.st")
- tdSql.checkData(0,0,900)
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ tdSql.query("select count(*) from timedb1.st")
+ tdSql.checkData(0, 0, 1000)
-
+ # check data
origin_res = tdSql.getResult("select * from timedb1.st")
- dump_res = tdSql.getResult("select * from dumptmp1.st")
+ tdSql.execute("drop database timedb1")
+ os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
+ # dump data and check for taosdump
+ dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res:
- tdLog.info("test ms second : dump check data pass for all data!" )
+ tdLog.info(
+ "test million second : dump check data pass for all data!")
else:
- tdLog.info("test ms second : dump check data failed for all data!" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000 and ts <= 1625068860000")
- dump_res = tdSql.getResult("select * from dumptmp2.st")
- if origin_res == dump_res:
- tdLog.info(" test ms second : dump check data pass for data! " )
- else:
- tdLog.info(" test ms second : dump check data failed for data!" )
-
- origin_res = tdSql.getResult("select * from timedb1.st where ts >=1625068810000 ")
- dump_res = tdSql.getResult("select * from dumptmp3.st")
- if origin_res == dump_res:
- tdLog.info(" test ms second : dump check data pass for data! " )
- else:
- tdLog.info(" test ms second : dump check data failed for data! " )
+ tdLog.info(
+ "test million second : dump check data failed for all data!")
-
os.system("rm -rf ./taosdumptest/")
os.system("rm -rf ./dump_result.txt")
os.system("rm -rf *.py.sql")
diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt
index 910b99ace3..356eaed57e 100644
--- a/tests/script/jenkins/basic.txt
+++ b/tests/script/jenkins/basic.txt
@@ -131,7 +131,7 @@
./test.sh -f tsim/parser/insert_tb.sim
# TD-17038 ./test.sh -f tsim/parser/interp.sim
./test.sh -f tsim/parser/join_manyblocks.sim
-# TD-18018 ./test.sh -f tsim/parser/join_multitables.sim
+./test.sh -f tsim/parser/join_multitables.sim
./test.sh -f tsim/parser/join_multivnode.sim
./test.sh -f tsim/parser/join.sim
./test.sh -f tsim/parser/last_cache.sim
@@ -183,7 +183,7 @@
# ---- qnode
./test.sh -f tsim/qnode/basic1.sim
-# ---- snode
+# ---- snode ----
# unsupport ./test.sh -f tsim/snode/basic1.sim
# ---- bnode
@@ -199,7 +199,7 @@
# ---- show ----
./test.sh -f tsim/show/basic.sim
-# ---- table
+# ---- table ----
./test.sh -f tsim/table/autocreate.sim
./test.sh -f tsim/table/basic1.sim
./test.sh -f tsim/table/basic2.sim
@@ -248,7 +248,7 @@
./test.sh -f tsim/stream/ignoreExpiredData.sim
./test.sh -f tsim/stream/sliding.sim
-# ---- transaction
+# ---- transaction ----
./test.sh -f tsim/trans/lossdata1.sim
./test.sh -f tsim/trans/create_db.sim
@@ -307,7 +307,7 @@
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
-# --- valgrind
+# --- valgrind ----
./test.sh -f tsim/valgrind/checkError1.sim
./test.sh -f tsim/valgrind/checkError2.sim
./test.sh -f tsim/valgrind/checkError3.sim
@@ -331,7 +331,7 @@
./test.sh -f tsim/vnode/stable_replica3_vnode3.sim
# --- sync
-./test.sh -f tsim/sync/3Replica1VgElect.sim
+#./test.sh -f tsim/sync/3Replica1VgElect.sim
#./test.sh -f tsim/sync/3Replica5VgElect.sim
./test.sh -f tsim/sync/oneReplica1VgElect.sim
./test.sh -f tsim/sync/oneReplica5VgElect.sim
diff --git a/tests/script/sh/bit_and.c b/tests/script/sh/bit_and.c
new file mode 100644
index 0000000000..2f2e48fdb0
--- /dev/null
+++ b/tests/script/sh/bit_and.c
@@ -0,0 +1,61 @@
+#include
+#include
+#include
+#include "taosudf.h"
+
+
+DLL_EXPORT int32_t bit_and_init() {
+ return 0;
+}
+
+DLL_EXPORT int32_t bit_and_destroy() {
+ return 0;
+}
+
+DLL_EXPORT int32_t bit_and(SUdfDataBlock* block, SUdfColumn *resultCol) {
+
+ if (block->numOfCols < 2) {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+
+ for (int32_t i = 0; i < block->numOfCols; ++i) {
+ SUdfColumn* col = block->udfCols[i];
+ if (!(col->colMeta.type == TSDB_DATA_TYPE_INT)) {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+ }
+
+ SUdfColumnMeta *meta = &resultCol->colMeta;
+ meta->bytes = 4;
+ meta->type = TSDB_DATA_TYPE_INT;
+ meta->scale = 0;
+ meta->precision = 0;
+
+
+ SUdfColumnData *resultData = &resultCol->colData;
+
+ resultData->numOfRows = block->numOfRows;
+
+ for (int32_t i = 0; i < resultData->numOfRows; ++i) {
+ if (udfColDataIsNull(block->udfCols[0], i)) {
+ udfColDataSetNull(resultCol, i);
+ continue;
+ }
+ int32_t result = *(int32_t*)udfColDataGetData(block->udfCols[0], i);
+ int j = 1;
+ for (; j < block->numOfCols; ++j) {
+ if (udfColDataIsNull(block->udfCols[j], i)) {
+ udfColDataSetNull(resultCol, i);
+ break;
+ }
+
+ char* colData = udfColDataGetData(block->udfCols[j], i);
+ result &= *(int32_t*)colData;
+ }
+ if (j == block->numOfCols) {
+ udfColDataSet(resultCol, i, (char*)&result, false);
+ }
+
+ }
+ return TSDB_CODE_SUCCESS;
+}
diff --git a/tests/script/sh/compile_udf.sh b/tests/script/sh/compile_udf.sh
new file mode 100755
index 0000000000..12e922b2df
--- /dev/null
+++ b/tests/script/sh/compile_udf.sh
@@ -0,0 +1,10 @@
+set +e
+
+rm -rf /tmp/udf/libbitand.so /tmp/udf/libsqrsum.so
+mkdir -p /tmp/udf
+echo "compile udf bit_and and sqr_sum"
+gcc -fPIC -shared sh/bit_and.c -o /tmp/udf/libbitand.so
+gcc -fPIC -shared sh/sqr_sum.c -o /tmp/udf/libsqrsum.so
+echo "debug show /tmp/udf/*.so"
+ls /tmp/udf/*.so
+
diff --git a/tests/script/sh/sqr_sum.c b/tests/script/sh/sqr_sum.c
new file mode 100644
index 0000000000..af57f377ab
--- /dev/null
+++ b/tests/script/sh/sqr_sum.c
@@ -0,0 +1,80 @@
+#include
+#include
+#include
+#include
+
+#include "taosudf.h"
+
+DLL_EXPORT int32_t sqr_sum_init() {
+ return 0;
+}
+
+DLL_EXPORT int32_t sqr_sum_destroy() {
+ return 0;
+}
+
+DLL_EXPORT int32_t sqr_sum_start(SUdfInterBuf *buf) {
+ *(int64_t*)(buf->buf) = 0;
+ buf->bufLen = sizeof(double);
+ buf->numOfResult = 0;
+ return 0;
+}
+
+DLL_EXPORT int32_t sqr_sum(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf) {
+ double sumSquares = *(double*)interBuf->buf;
+ int8_t numNotNull = 0;
+ for (int32_t i = 0; i < block->numOfCols; ++i) {
+ SUdfColumn* col = block->udfCols[i];
+ if (!(col->colMeta.type == TSDB_DATA_TYPE_INT ||
+ col->colMeta.type == TSDB_DATA_TYPE_DOUBLE)) {
+ return TSDB_CODE_UDF_INVALID_INPUT;
+ }
+ }
+ for (int32_t i = 0; i < block->numOfCols; ++i) {
+ for (int32_t j = 0; j < block->numOfRows; ++j) {
+ SUdfColumn* col = block->udfCols[i];
+ if (udfColDataIsNull(col, j)) {
+ continue;
+ }
+ switch (col->colMeta.type) {
+ case TSDB_DATA_TYPE_INT: {
+ char* cell = udfColDataGetData(col, j);
+ int32_t num = *(int32_t*)cell;
+ sumSquares += (double)num * num;
+ break;
+ }
+ case TSDB_DATA_TYPE_DOUBLE: {
+ char* cell = udfColDataGetData(col, j);
+ double num = *(double*)cell;
+ sumSquares += num * num;
+ break;
+ }
+ default:
+ break;
+ }
+ ++numNotNull;
+ }
+ }
+
+ *(double*)(newInterBuf->buf) = sumSquares;
+ newInterBuf->bufLen = sizeof(double);
+
+ if (interBuf->numOfResult == 0 && numNotNull == 0) {
+ newInterBuf->numOfResult = 0;
+ } else {
+ newInterBuf->numOfResult = 1;
+ }
+ return 0;
+}
+
+DLL_EXPORT int32_t sqr_sum_finish(SUdfInterBuf* buf, SUdfInterBuf *resultData) {
+ if (buf->numOfResult == 0) {
+ resultData->numOfResult = 0;
+ return 0;
+ }
+ double sumSquares = *(double*)(buf->buf);
+ *(double*)(resultData->buf) = sqrt(sumSquares);
+ resultData->bufLen = sizeof(double);
+ resultData->numOfResult = 1;
+ return 0;
+}
diff --git a/tests/script/tmp/r1.sim b/tests/script/tmp/r1.sim
new file mode 100644
index 0000000000..3fc875ad23
--- /dev/null
+++ b/tests/script/tmp/r1.sim
@@ -0,0 +1,47 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/deploy.sh -n dnode2 -i 2
+system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
+system sh/exec.sh -n dnode1 -s start
+system sh/exec.sh -n dnode2 -s start
+sql connect
+
+print =============== step1: create dnodes
+sql create dnode $hostname port 7200
+
+$x = 0
+step1:
+ $x = $x + 1
+ sleep 1000
+ if $x == 10 then
+ print ====> dnode not ready!
+ return -1
+ endi
+sql show dnodes
+print ===> rows: $rows
+print ===> $data00 $data01 $data02 $data03 $data04 $data05
+print ===> $data10 $data11 $data12 $data13 $data14 $data15
+if $rows != 2 then
+ return -1
+endi
+if $data(1)[4] != ready then
+ goto step1
+endi
+if $data(2)[4] != ready then
+ goto step1
+endi
+
+print =============== step2: create database
+sql create database db vgroups 1 replica 1
+sql show databases
+if $rows != 3 then
+ return -1
+endi
+
+sql use db;
+sql create table stb (ts timestamp, c int) tags (t int);
+sql create table t0 using stb tags (0);
+sql insert into t0 values(now, 1);
+sql insert into t0 values(now+1s, 1);
+
+return
diff --git a/tests/script/tsim/parser/join_multitables.sim b/tests/script/tsim/parser/join_multitables.sim
index 6c5138f8cb..4278be52f3 100644
--- a/tests/script/tsim/parser/join_multitables.sim
+++ b/tests/script/tsim/parser/join_multitables.sim
@@ -682,7 +682,7 @@ if $data08 != 3 then
return -1
endi
-sql select st0.f1,st1.f1 from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1;
+sql select st0.f1,st1.f1 from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 order by st0.f1;
if $rows != 25 then
return -1
endi
@@ -721,22 +721,10 @@ endi
if $data01 != @21-03-01 01:00:00.000@ then
return -1
endi
-if $data10 != @21-03-02 01:00:00.000@ then
+if $data50 != @21-03-02 01:00:00.000@ then
return -1
endi
-if $data11 != @21-03-02 01:00:00.000@ then
- return -1
-endi
-if $data20 != @21-03-03 01:00:00.000@ then
- return -1
-endi
-if $data21 != @21-03-03 01:00:00.000@ then
- return -1
-endi
-if $data30 != @21-03-04 01:00:00.000@ then
- return -1
-endi
-if $data31 != @21-03-04 01:00:00.000@ then
+if $data51 != @21-03-02 01:00:00.000@ then
return -1
endi
@@ -782,23 +770,23 @@ endi
if $data04 != 01 then
return -1
endi
-if $data10 != @21-03-02 01:00:00.000@ then
+if $data50 != @21-03-02 01:00:00.000@ then
return -1
endi
-if $data11 != 9901.000000000 then
+if $data51 != 9901.000000000 then
return -1
endi
-if $data12 != 11 then
+if $data52 != 11 then
return -1
endi
-if $data13 != 9911.000000000 then
+if $data53 != 9911.000000000 then
return -1
endi
-if $data14 != 01 then
+if $data54 != 01 then
return -1
endi
-sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(10a);
+sql select _wstart, last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(10a);
if $rows != 25 then
return -1
endi
@@ -830,7 +818,7 @@ if $data08 != 11 then
return -1
endi
-sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(1d) sliding(1d);
+sql select _wstart, last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(1d) sliding(1d);
if $rows != 5 then
return -1
endi
@@ -937,7 +925,7 @@ sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and
if $rows != 5 then
return -1
endi
-if $data00 != @21-03-01 01:00:00.000@ then
+if $data00 != @21-03-02 01:00:00.000@ then
print $data00
return -1
endi
@@ -965,7 +953,7 @@ endi
if $data08 != 3 then
return -1
endi
-if $data09 != @21-03-01 01:00:00.000@ then
+if $data09 != @21-03-02 01:00:00.000@ then
return -1
endi
@@ -973,38 +961,23 @@ sql select top(st1.f1, 5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts
if $rows != 5 then
return -1
endi
-if $data00 != @21-03-01 05:00:00.000@ then
- return -1
-endi
-if $data01 != 9915 then
+if $data00 != 9915 then
return -1
endi
-if $data10 != @21-03-02 05:00:00.000@ then
- return -1
-endi
-if $data11 != 9915 then
+if $data10 != 9915 then
return -1
endi
-if $data20 != @21-03-03 05:00:00.000@ then
- return -1
-endi
-if $data21 != 9915 then
+if $data20 != 9915 then
return -1
endi
-if $data30 != @21-03-04 05:00:00.000@ then
- return -1
-endi
-if $data31 != 9915 then
+if $data30 != 9915 then
return -1
endi
-if $data40 != @21-03-05 05:00:00.000@ then
- return -1
-endi
-if $data41 != 9915 then
+if $data40 != 9915 then
return -1
endi
-sql select top(st0.f1,5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1;
+sql select st0.ts, top(st0.f1,5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1 order by st0.ts;
if $rows != 5 then
return -1
endi
@@ -1329,25 +1302,25 @@ if $data09 != 9925 then
endi
sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.f1=tb1_1.f1;
-sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id2;
-sql_error select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.*,tba_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5, tba_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts and tb0_5.ts=tba_5.ts;
+sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id2;
+sql select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.*,tba_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5, tba_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts and tb0_5.ts=tba_5.ts;
-sql_error select * from st0, st1 where st0.ts=st1.ts;
+sql select * from st0, st1 where st0.ts=st1.ts;
sql_error select * from st0, st1 where st0.id1=st1.id1;
sql_error select * from st0, st1 where st0.f1=st1.f1 and st0.id1=st1.id1;
-sql_error select * from st0, st1, st2, st3 where st0.id1=st1.id1 and st2.id1=st3.id1 and st0.ts=st1.ts and st1.ts=st2.ts and st2.ts=st3.ts;
+sql select * from st0, st1, st2, st3 where st0.id1=st1.id1 and st2.id1=st3.id1 and st0.ts=st1.ts and st1.ts=st2.ts and st2.ts=st3.ts;
sql_error select * from st0, st1, st2 where st0.id1=st1.id1;
sql_error select * from st0, st1 where st0.id1=st1.id1 and st0.id2=st1.id3;
sql_error select * from st0, st1 where st0.id1=st1.id1 or st0.ts=st1.ts;
sql_error select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 or st0.id2=st1.id2;
sql_error select * from st0, st1, st2 where st0.ts=st1.ts and st0.id1=st1.id1;
sql_error select * from st0, st1 where st0.id1=st1.ts and st0.ts=st1.id1;
-sql_error select * from st0, st1 where st0.id1=st1.id2 and st0.ts=st1.ts;
-sql_error select * from st0, st1 where st1.id4=st0.id4 and st1.ts=st0.ts;
-sql_error select * from st0, st1 where st0.id1=st1.id2 and st1.ts=st0.ts;
+sql select * from st0, st1 where st0.id1=st1.id2 and st0.ts=st1.ts;
+sql select * from st0, st1 where st1.id4=st0.id4 and st1.ts=st0.ts;
+sql select * from st0, st1 where st0.id1=st1.id2 and st1.ts=st0.ts;
sql_error select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval 10a;
sql_error select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 group by f1;
sql_error select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9 where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1;
-sql_error select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9,sta where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1 and st0.id1=sta.id1 and st0.ts=sta.ts;
+sql select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9,sta where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1 and st0.id1=sta.id1 and st0.ts=sta.ts;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/parser/nestquery.sim b/tests/script/tsim/parser/nestquery.sim
index 101205db74..8cb7a3790b 100644
--- a/tests/script/tsim/parser/nestquery.sim
+++ b/tests/script/tsim/parser/nestquery.sim
@@ -160,12 +160,12 @@ endi
sql select stddev(c1) from (select c1 from nest_tb0);
sql_error select percentile(c1, 20) from (select * from nest_tb0);
-sql select interp(c1) from (select * from nest_tb0);
+#sql select interp(c1) from (select * from nest_tb0);
sql_error select derivative(val, 1s, 0) from (select c1 val from nest_tb0);
sql_error select twa(c1) from (select c1 from nest_tb0);
sql_error select irate(c1) from (select c1 from nest_tb0);
sql_error select diff(c1), twa(c1) from (select * from nest_tb0);
-sql_error select irate(c1), interp(c1), twa(c1) from (select * from nest_tb0);
+#sql_error select irate(c1), interp(c1), twa(c1) from (select * from nest_tb0);
sql select _wstart, apercentile(c1, 50) from (select * from nest_tb0) interval(1d)
if $rows != 7 then
diff --git a/tests/script/tsim/query/explain.sim b/tests/script/tsim/query/explain.sim
index fcf91c45da..7cc1458657 100644
--- a/tests/script/tsim/query/explain.sim
+++ b/tests/script/tsim/query/explain.sim
@@ -35,7 +35,7 @@ sql explain select * from st1 where -2;
sql explain select ts from tb1;
sql explain select * from st1;
sql explain select * from st1 order by ts;
-sql explain select * from information_schema.user_stables;
+sql explain select * from information_schema.ins_stables;
sql explain select count(*),sum(f1) from tb1;
sql explain select count(*),sum(f1) from st1;
sql explain select count(*),sum(f1) from st1 group by f1;
@@ -46,7 +46,7 @@ sql explain verbose true select * from st1 where -2;
sql explain verbose true select ts from tb1 where f1 > 0;
sql explain verbose true select * from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain verbose true select count(*) from st1 partition by tbname slimit 1 soffset 2 limit 2 offset 1;
-sql explain verbose true select * from information_schema.user_stables where db_name='db2';
+sql explain verbose true select * from information_schema.ins_stables where db_name='db2';
print ======== step4
sql explain analyze select ts from st1 where -2;
@@ -54,7 +54,7 @@ sql explain analyze select ts from tb1;
sql explain analyze select ts from st1;
sql explain analyze select ts from st1;
sql explain analyze select ts from st1 order by ts;
-sql explain analyze select * from information_schema.user_stables;
+sql explain analyze select * from information_schema.ins_stables;
sql explain analyze select count(*),sum(f1) from tb1;
sql explain analyze select count(*),sum(f1) from st1;
sql explain analyze select count(*),sum(f1) from st1 group by f1;
@@ -65,14 +65,14 @@ sql explain analyze verbose true select ts from tb1;
sql explain analyze verbose true select ts from st1;
sql explain analyze verbose true select ts from st1;
sql explain analyze verbose true select ts from st1 order by ts;
-sql explain analyze verbose true select * from information_schema.user_stables;
+sql explain analyze verbose true select * from information_schema.ins_stables;
sql explain analyze verbose true select count(*),sum(f1) from tb1;
sql explain analyze verbose true select count(*),sum(f1) from st1;
sql explain analyze verbose true select count(*),sum(f1) from st1 group by f1;
#sql explain analyze verbose true select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
sql explain analyze verbose true select ts from tb1 where f1 > 0;
sql explain analyze verbose true select f1 from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
-sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
+sql explain analyze verbose true select * from information_schema.ins_stables where db_name='db2';
sql explain analyze verbose true select * from (select min(f1),count(*) a from st1 where f1 > 0) where a < 0;
#not pass case
diff --git a/tests/script/tsim/query/udf.sim b/tests/script/tsim/query/udf.sim
new file mode 100644
index 0000000000..7259b1e779
--- /dev/null
+++ b/tests/script/tsim/query/udf.sim
@@ -0,0 +1,161 @@
+system_content printf %OS%
+if $system_content == Windows_NT then
+ return 0;
+endi
+
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/cfg.sh -n dnode1 -c udf -v 1
+system sh/exec.sh -n dnode1 -s start
+sql connect
+
+print ======== step1 udf
+system sh/compile_udf.sh
+sql create database udf vgroups 3;
+sql use udf;
+sql show databases;
+
+sql create table t (ts timestamp, f int);
+sql insert into t values(now, 1)(now+1s, 2);
+
+system_content printf %OS%
+if $system_content == Windows_NT then
+ return 0;
+endi
+if $system_content == Windows_NT then
+ sql create function bit_and as 'C:\\Windows\\Temp\\bitand.dll' outputtype int bufSize 8;
+ sql create aggregate function sqr_sum as 'C:\\Windows\\Temp\\sqrsum.dll' outputtype double bufSize 8;
+else
+ sql create function bit_and as '/tmp/udf/libbitand.so' outputtype int bufSize 8;
+ sql create aggregate function sqr_sum as '/tmp/udf/libsqrsum.so' outputtype double bufSize 8;
+endi
+sql show functions;
+if $rows != 2 then
+ return -1
+endi
+sql select bit_and(f, f) from t;
+if $rows != 2 then
+ return -1
+endi
+if $data00 != 1 then
+ return -1
+endi
+if $data10 != 2 then
+ return -1
+endi
+
+sql select sqr_sum(f) from t;
+if $rows != 1 then
+ print expect 1, actual $rows
+ return -1
+endi
+if $data00 != 2.236067977 then
+ return -1
+endi
+
+sql create table t2 (ts timestamp, f1 int, f2 int);
+sql insert into t2 values(now, 0, 0)(now+1s, 1, 1);
+sql select bit_and(f1, f2) from t2;
+if $rows != 2 then
+ return -1
+endi
+if $data00 != 0 then
+ return -1
+endi
+if $data10 != 1 then
+ return -1
+endi
+
+sql select sqr_sum(f1, f2) from t2;
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 1.414213562 then
+ return -1
+endi
+
+sql insert into t2 values(now+2s, 1, null)(now+3s, null, 2);
+sql select bit_and(f1, f2) from t2;
+print $rows , $data00 , $data10 , $data20 , $data30
+if $rows != 4 then
+ return -1
+endi
+if $data00 != 0 then
+ return -1
+endi
+if $data10 != 1 then
+ return -1
+endi
+
+if $data20 != NULL then
+ return -1
+endi
+
+if $data30 != NULL then
+ return -1
+endi
+
+sql select sqr_sum(f1, f2) from t2;
+print $rows, $data00
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 2.645751311 then
+ return -1
+endi
+
+sql insert into t2 values(now+4s, 4, 8)(now+5s, 5, 9);
+sql select sqr_sum(f1-f2), sqr_sum(f1+f2) from t2;
+print $rows , $data00 , $data01
+if $rows != 1 then
+ return -1;
+endi
+if $data00 != 5.656854249 then
+ return -1
+endi
+if $data01 != 18.547236991 then
+ return -1
+endi
+
+sql select sqr_sum(bit_and(f2, f1)), sqr_sum(bit_and(f1, f2)) from t2;
+print $rows , $data00 , $data01
+if $rows != 1 then
+ return -1
+endi
+if $data00 != 1.414213562 then
+ return -1
+endi
+if $data01 != 1.414213562 then
+ return -1
+endi
+
+sql select sqr_sum(f2) from udf.t2 group by 1-bit_and(f1, f2) order by 1-bit_and(f1,f2);
+print $rows , $data00 , $data10 , $data20
+if $rows != 3 then
+ return -1
+endi
+if $data00 != 2.000000000 then
+ return -1
+endi
+if $data10 != 9.055385138 then
+ return -1
+endi
+if $data20 != 8.000000000 then
+ return -1
+endi
+
+sql drop function bit_and;
+sql show functions;
+if $rows != 1 then
+ return -1
+endi
+if $data00 != @sqr_sum@ then
+ return -1
+ endi
+sql drop function sqr_sum;
+sql show functions;
+if $rows != 0 then
+ return -1
+endi
+
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/show/basic.sim b/tests/script/tsim/show/basic.sim
index c4af7f3f3c..cc2b847d1a 100644
--- a/tests/script/tsim/show/basic.sim
+++ b/tests/script/tsim/show/basic.sim
@@ -77,37 +77,37 @@ if $rows != 3 then
endi
print =============== run select * from information_schema.xxxx
-sql select * from information_schema.`dnodes`
+sql select * from information_schema.ins_dnodes
if $rows != 2 then
return -1
endi
-sql select * from information_schema.`mnodes`
+sql select * from information_schema.ins_mnodes
if $rows != 1 then
return -1
endi
-#sql select * from information_schema.`modules`
-#sql select * from information_schema.`qnodes`
-sql select * from information_schema.user_databases
+#sql select * from information_schema.ins_modules
+#sql select * from information_schema.ins_qnodes
+sql select * from information_schema.ins_databases
if $rows != 3 then
return -1
endi
-#sql select * from information_schema.user_functions
-#sql select * from information_schema.user_indexes
-sql select * from information_schema.user_stables
+#sql select * from information_schema.ins_functions
+#sql select * from information_schema.ins_indexes
+sql select * from information_schema.ins_stables
if $rows != 1 then
return -1
endi
-#sql select * from information_schema.`streams`
-sql select * from information_schema.user_tables
+#sql select * from information_schema.ins_streams
+sql select * from information_schema.ins_tables
if $rows <= 0 then
return -1
endi
-#sql select * from information_schema.user_table_distributed
-sql select * from information_schema.user_users
+#sql select * from information_schema.ins_table_distributed
+sql select * from information_schema.ins_users
if $rows != 1 then
return -1
endi
-sql select * from information_schema.`vgroups`
+sql select * from information_schema.ins_vgroups
if $rows != 3 then
return -1
endi
@@ -175,37 +175,37 @@ if $rows != 3 then
endi
print =============== run select * from information_schema.xxxx
-sql select * from information_schema.`dnodes`
+sql select * from information_schema.ins_dnodes
if $rows != 2 then
return -1
endi
-sql select * from information_schema.`mnodes`
+sql select * from information_schema.ins_mnodes
if $rows != 1 then
return -1
endi
-#sql select * from information_schema.`modules`
-#sql select * from information_schema.`qnodes`
-sql select * from information_schema.user_databases
+#sql select * from information_schema.ins_modules
+#sql select * from information_schema.ins_qnodes
+sql select * from information_schema.ins_databases
if $rows != 3 then
return -1
endi
-#sql select * from information_schema.user_functions
-#sql select * from information_schema.user_indexes
-sql select * from information_schema.user_stables
+#sql select * from information_schema.ins_functions
+#sql select * from information_schema.ins_indexes
+sql select * from information_schema.ins_stables
if $rows != 1 then
return -1
endi
-#sql select * from performance_schema.`streams`
-sql select * from information_schema.user_tables
+#sql select * from performance_schema.perf_streams
+sql select * from information_schema.ins_tables
if $rows <= 0 then
return -1
endi
-#sql select * from information_schema.user_table_distributed
-sql select * from information_schema.user_users
+#sql select * from information_schema.ins_table_distributed
+sql select * from information_schema.ins_users
if $rows != 1 then
return -1
endi
-sql select * from information_schema.`vgroups`
+sql select * from information_schema.ins_vgroups
if $rows != 3 then
return -1
endi
diff --git a/tests/script/tsim/sync/3Replica1VgElect.sim b/tests/script/tsim/sync/3Replica1VgElect.sim
index 1cadf7c81d..4e127654ee 100644
--- a/tests/script/tsim/sync/3Replica1VgElect.sim
+++ b/tests/script/tsim/sync/3Replica1VgElect.sim
@@ -140,6 +140,8 @@ if $rows != $totalTblNum then
return -1
endi
+print ====> start_switch_leader:
+
start_switch_leader:
$switch_loop_cnt = 0
@@ -299,7 +301,7 @@ print ===> $rows $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $da
print ===> $rows $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]
print ===> $rows $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] $data[2][5] $data[2][6]
print ===> $rows $data[3][0] $data[3][1] $data[3][2] $data[3][3] $data[3][4] $data[3][5] $data[3][6]
-print ===> $rows $data[4][0] $data[3][1] $data[3][2] $data[3][3] $data[3][4] $data[3][5] $data[3][6]
+print ===> $rows $data[4][0] $data[4][1] $data[4][2] $data[4][3] $data[4][4] $data[4][5] $data[4][6]
if $rows != 5 then
return -1
@@ -341,6 +343,8 @@ print ===> $rows $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $da
print ===> $rows $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]
print ===> $rows $data[2][0] $data[2][1] $data[2][2] $data[2][3] $data[2][4] $data[2][5] $data[2][6]
print ===> $rows $data[3][0] $data[3][1] $data[3][2] $data[3][3] $data[3][4] $data[3][5] $data[3][6]
+print ===> $rows $data[4][0] $data[4][1] $data[4][2] $data[4][3] $data[4][4] $data[4][5] $data[4][6]
+
if $data[0][0] != 1 then
return -1
endi
@@ -358,6 +362,8 @@ if $data[3][4] != ready then
goto check_dnode_ready_2
endi
+print ====> final test: create child table ctb2* and table ntb2*
+
sql use db;
$ctbPrefix = ctb2
$ntbPrefix = ntb2
diff --git a/tests/script/tsim/sync/3Replica5VgElect.sim b/tests/script/tsim/sync/3Replica5VgElect.sim
index 2a9f8c30a2..c4ab9bd4bc 100644
--- a/tests/script/tsim/sync/3Replica5VgElect.sim
+++ b/tests/script/tsim/sync/3Replica5VgElect.sim
@@ -542,6 +542,8 @@ if $data[3][4] != ready then
goto check_dnode_ready_2
endi
+print ====> final test: create child table ctb2* and table ntb2*
+
sql use db;
$ctbPrefix = ctb2
$ntbPrefix = ntb2
diff --git a/tests/script/tsim/sync/start3replica.sim b/tests/script/tsim/sync/start3replica.sim
new file mode 100644
index 0000000000..f66021f88a
--- /dev/null
+++ b/tests/script/tsim/sync/start3replica.sim
@@ -0,0 +1,19 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/deploy.sh -n dnode2 -i 2
+system sh/deploy.sh -n dnode3 -i 3
+system sh/deploy.sh -n dnode4 -i 4
+
+system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
+
+system sh/exec.sh -n dnode1 -s start
+system sh/exec.sh -n dnode2 -s start
+system sh/exec.sh -n dnode3 -s start
+system sh/exec.sh -n dnode4 -s start
+
+sql connect
+sql create dnode $hostname port 7200
+sql create dnode $hostname port 7300
+sql create dnode $hostname port 7400
+
+
diff --git a/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim b/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
index 241781eed1..c4e0503aa9 100644
--- a/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
+++ b/tests/script/tsim/sync/vnodesnapshot-rsma-test.sim
@@ -167,12 +167,26 @@ system sh/exec.sh -n dnode4 -s start
sleep 3000
-print =============== query data
+
+
+
+print =============== query data of level 1
sql connect
sql use db
+
sql select * from ct1 where ts > now - 1d
-print rows: $rows
+print rows of level 1: $rows
print $data00 $data01 $data02
if $rows != 100 then
return -1
-endi
\ No newline at end of file
+endi
+
+print =============== query data of level 2
+sql select * from ct1 where ts > now - 10d
+print rows of level 2: $rows
+print $data00 $data01 $data02
+
+print =============== query data of level 3
+sql select * from ct1
+print rows of level 3: $rows
+print $data00 $data01 $data02
diff --git a/tests/script/tsim/table/delete_writing.sim b/tests/script/tsim/table/delete_writing.sim
index df7c7f47e8..2f11424e8a 100644
--- a/tests/script/tsim/table/delete_writing.sim
+++ b/tests/script/tsim/table/delete_writing.sim
@@ -3,10 +3,6 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
-print ========= start dnodes
-system sh/exec.sh -n dnode1 -s start
-sql connect
-
sql create database db
sql create table db.tb (ts timestamp, i int)
sql insert into db.tb values(now, 1)
diff --git a/tests/script/tsim/table/smallint.sim b/tests/script/tsim/table/smallint.sim
index 87140c561a..a7547c7282 100644
--- a/tests/script/tsim/table/smallint.sim
+++ b/tests/script/tsim/table/smallint.sim
@@ -90,7 +90,6 @@ endi
if $data01 != 2 then
return -1
endi
-return
sql drop database $db
sql show databases
if $rows != 2 then
diff --git a/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim b/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
index d9c6b195d2..dda5e0059e 100644
--- a/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
+++ b/tests/script/tsim/tmq/basic2Of2ConsOverlap.sim
@@ -342,12 +342,12 @@ endi
return -1
check_ok_3:
-sql select * from performance_schema.`consumers`
+sql select * from performance_schema.perf_consumers
if $rows != 0 then
return -1
endi
-#sql select * from performance_schema.`subscriptions`
+#sql select * from performance_schema.perf_subscriptions
#if $rows != 0 then
# return -1
#endi
diff --git a/tests/script/tsim/tmq/snapshot1.sim b/tests/script/tsim/tmq/snapshot1.sim
index 58541b725d..e586719db2 100644
--- a/tests/script/tsim/tmq/snapshot1.sim
+++ b/tests/script/tsim/tmq/snapshot1.sim
@@ -294,12 +294,12 @@ endi
return -1
check_ok_3:
-sql select * from performance_schema.`consumers`
+sql select * from performance_schema.perf_consumers
if $rows != 0 then
return -1
endi
-#sql select * from performance_schema.`subscriptions`
+#sql select * from performance_schema.perf_subscriptions
#if $rows != 0 then
# return -1
#endi
diff --git a/tests/script/tsim/valgrind/basic3.sim b/tests/script/tsim/valgrind/basic3.sim
index b9ed1641c8..0913691a11 100644
--- a/tests/script/tsim/valgrind/basic3.sim
+++ b/tests/script/tsim/valgrind/basic3.sim
@@ -29,7 +29,7 @@ $rowNum = 10
print =============== step2: prepare data
sql create database db vgroups 2
sql use db
-sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned)
+sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double, tbcol4 binary(30), tbcol5 binary(30)) tags (tgcol int unsigned)
$i = 0
while $i < $tbNum
@@ -39,19 +39,22 @@ while $i < $tbNum
while $x < $rowNum
$cc = $x * 60000
$ms = 1601481600000 + $cc
- sql insert into $tb values ($ms , $x , $x , $x )
+ sql insert into $tb values ($ms , $x , $x , $x , "abcd1234=-+*" , "123456 0" )
$x = $x + 1
endw
+
+ $cc = $x * 60000
+ $ms = 1601481600000 + $cc
+ sql insert into $tb values ($ms , NULL , NULL , NULL , NULL , NULL )
$i = $i + 1
endw
print =============== step3: tb
-sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
+sql select tbcol5 - tbcol3 from tb1
print =============== step4: stb
-sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
+sql select tbcol5 - tbcol3 from stb
-_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== check
$null=
diff --git a/tests/script/tsim/valgrind/checkError1.sim b/tests/script/tsim/valgrind/checkError1.sim
index 059808e4be..f06a26aec6 100644
--- a/tests/script/tsim/valgrind/checkError1.sim
+++ b/tests/script/tsim/valgrind/checkError1.sim
@@ -84,37 +84,37 @@ if $rows != 1 then
endi
print =============== run select * from information_schema.xxxx
-sql select * from information_schema.`dnodes`
+sql select * from information_schema.ins_dnodes
if $rows != 2 then
return -1
endi
-sql select * from information_schema.`mnodes`
+sql select * from information_schema.ins_mnodes
if $rows != 1 then
return -1
endi
-sql select * from information_schema.user_databases
+sql select * from information_schema.ins_databases
if $rows != 3 then
return -1
endi
-sql select * from information_schema.user_stables
+sql select * from information_schema.ins_stables
if $rows != 1 then
return -1
endi
-sql select * from information_schema.user_tables
+sql select * from information_schema.ins_tables
if $rows <= 0 then
return -1
endi
-sql select * from information_schema.user_users
+sql select * from information_schema.ins_users
if $rows != 1 then
return -1
endi
-sql select * from information_schema.`vgroups`
+sql select * from information_schema.ins_vgroups
if $rows != 3 then
return -1
endi
diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim
index 7a16f5668a..6e456148bf 100644
--- a/tests/script/tsim/valgrind/checkError6.sim
+++ b/tests/script/tsim/valgrind/checkError6.sim
@@ -77,6 +77,8 @@ sql select length("abcd1234"), char_length("abcd1234=-+*") from tb1
sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from tb1
sql select * from tb1 where tbcol not in (1,2,3,null);
sql select * from tb1 where tbcol + 3 <> null;
+sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
+sql select tbcol5 - tbcol3 from tb1
print =============== step4: stb
sql select avg(tbcol) as c from stb
@@ -105,17 +107,20 @@ sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4),
sql select * from stb where tbcol not in (1,2,3,null);
sql select * from stb where tbcol + 3 <> null;
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from stb where tbcol = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol interval(1d)
+sql select _wstart, count(*) from tb1 session(ts, 1m)
+sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
+sql select tbcol5 - tbcol3 from stb
print =============== step5: explain
sql explain analyze select ts from stb where -2;
sql explain analyze select ts from tb1;
sql explain analyze select ts from stb order by ts;
-sql explain analyze select * from information_schema.user_stables;
+sql explain analyze select * from information_schema.ins_stables;
sql explain analyze select count(*),sum(tbcol) from tb1;
sql explain analyze select count(*),sum(tbcol) from stb;
sql explain analyze select count(*),sum(tbcol) from stb group by tbcol;
-sql explain analyze select * from information_schema.user_stables;
-sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
+sql explain analyze select * from information_schema.ins_stables;
+sql explain analyze verbose true select * from information_schema.ins_stables where db_name='db2';
sql explain analyze verbose true select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql explain select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
diff --git a/tests/system-test/0-others/user_control.py b/tests/system-test/0-others/user_control.py
index ce8ac6941b..3be59f0adf 100644
--- a/tests/system-test/0-others/user_control.py
+++ b/tests/system-test/0-others/user_control.py
@@ -1,15 +1,16 @@
-from tabnanny import check
import taos
import time
import inspect
import traceback
import socket
from dataclasses import dataclass
+from datetime import datetime
from util.log import *
from util.sql import *
from util.cases import *
from util.dnodes import *
+from util.common import *
PRIVILEGES_ALL = "ALL"
PRIVILEGES_READ = "READ"
@@ -21,17 +22,40 @@ WEIGHT_WRITE = 3
PRIMARY_COL = "ts"
-INT_COL = "c1"
-BINT_COL = "c2"
-SINT_COL = "c3"
-TINT_COL = "c4"
-FLOAT_COL = "c5"
-DOUBLE_COL = "c6"
-BOOL_COL = "c7"
+INT_COL = "c_int"
+BINT_COL = "c_bint"
+SINT_COL = "c_sint"
+TINT_COL = "c_tint"
+FLOAT_COL = "c_float"
+DOUBLE_COL = "c_double"
+BOOL_COL = "c_bool"
+TINT_UN_COL = "c_utint"
+SINT_UN_COL = "c_usint"
+BINT_UN_COL = "c_ubint"
+INT_UN_COL = "c_uint"
+BINARY_COL = "c_binary"
+NCHAR_COL = "c_nchar"
+TS_COL = "c_ts"
-BINARY_COL = "c8"
-NCHAR_COL = "c9"
-TS_COL = "c10"
+NUM_COL = [INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, ]
+CHAR_COL = [BINARY_COL, NCHAR_COL, ]
+BOOLEAN_COL = [BOOL_COL, ]
+TS_TYPE_COL = [TS_COL, ]
+
+INT_TAG = "t_int"
+
+ALL_COL = [PRIMARY_COL, INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BINARY_COL, NCHAR_COL, BOOL_COL, TS_COL]
+TAG_COL = [INT_TAG]
+
+# insert data args:
+TIME_STEP = 10000
+NOW = int(datetime.timestamp(datetime.now()) * 1000)
+
+# init db/table
+DBNAME = "db"
+STBNAME = "stb1"
+CTBNAME = "ct1"
+NTBNAME = "nt1"
class TDconnect:
def __init__(self,
@@ -247,25 +271,26 @@ class TDTestCase:
with taos_connect(user=user.name, passwd=user.passwd) as use:
time.sleep(2)
if check_priv == PRIVILEGES_ALL:
- use.query("use db")
- use.query("show tables")
- use.query("select * from ct1")
- use.query("insert into t1 (ts) values (now())")
+ use.query(f"use {DBNAME}")
+ use.query(f"show {DBNAME}.tables")
+ use.query(f"select * from {DBNAME}.{CTBNAME}")
+ use.query(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
elif check_priv == PRIVILEGES_READ:
- use.query("use db")
- use.query("show tables")
- use.query("select * from ct1")
- use.error("insert into t1 (ts) values (now())")
+ use.query(f"use {DBNAME}")
+ use.query(f"show {DBNAME}.tables")
+ use.query(f"select * from {DBNAME}.{CTBNAME}")
+ use.error(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
elif check_priv == PRIVILEGES_WRITE:
- use.query("use db")
- use.query("show tables")
- use.error("select * from ct1")
- use.query("insert into t1 (ts) values (now())")
+ use.query(f"use {DBNAME}")
+ use.query(f"show {DBNAME}.tables")
+ use.error(f"select * from {DBNAME}.{CTBNAME}")
+ use.query(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
elif check_priv is None:
- use.error("use db")
- use.error("show tables")
- use.error("select * from db.ct1")
- use.error("insert into db.t1 (ts) values (now())")
+ use.error(f"use {DBNAME}")
+ # use.error(f"show {DBNAME}.tables")
+ use.error(f"show tables")
+ use.error(f"select * from {DBNAME}.{CTBNAME}")
+ use.error(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
def __change_user_priv(self, user: User, pre_priv, invoke=False):
if user.priv == pre_priv and invoke :
@@ -418,7 +443,7 @@ class TDTestCase:
self.__grant_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) ,
self.__grant_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) ,
f"GRANT {self.__privilege[0]} ON * TO {self.__user_list[0]}" ,
- f"GRANT {self.__privilege[0]} ON db.t1 TO {self.__user_list[0]}" ,
+ f"GRANT {self.__privilege[0]} ON {DBNAME}.{NTBNAME} TO {self.__user_list[0]}" ,
]
def __revoke_err(self):
@@ -430,7 +455,7 @@ class TDTestCase:
self.__revoke_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) ,
self.__revoke_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) ,
f"REVOKE {self.__privilege[0]} ON * FROM {self.__user_list[0]}" ,
- f"REVOKE {self.__privilege[0]} ON db.t1 FROM {self.__user_list[0]}" ,
+ f"REVOKE {self.__privilege[0]} ON {DBNAME}.{NTBNAME} FROM {self.__user_list[0]}" ,
]
def test_grant_err(self):
@@ -505,101 +530,48 @@ class TDTestCase:
self.drop_user_error()
self.drop_user_current()
- def __create_tb(self):
-
- tdLog.printNoPrefix("==========step1:create table")
- create_stb_sql = f'''create table stb1(
- ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
- {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
- {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
- ) tags (t1 int)
- '''
- create_ntb_sql = f'''create table t1(
- ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
- {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
- {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp
- )
+ def __create_tb(self, stb=STBNAME, ctb_num=20, ntbnum=1, dbname=DBNAME):
+ tdLog.printNoPrefix("==========step: create table")
+ create_stb_sql = f'''create table {dbname}.{stb}(
+ {PRIMARY_COL} timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
+ {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
+ {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
+ {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
+ {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
+ ) tags ({INT_TAG} int)
'''
tdSql.execute(create_stb_sql)
- tdSql.execute(create_ntb_sql)
- for i in range(4):
- tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )')
- { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}
-
- def __insert_data(self, rows):
- now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
- for i in range(rows):
- tdSql.execute(
- f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
- )
- tdSql.execute(
- f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
- )
- tdSql.execute(
- f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )"
- )
- tdSql.execute(
- f'''insert into ct1 values
- ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } )
- ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } )
- '''
- )
-
- tdSql.execute(
- f'''insert into ct4 values
- ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- (
- { now_time + 5184000000}, {pow(2,31)-pow(2,15)}, {pow(2,63)-pow(2,30)}, 32767, 127,
- { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000}
+ for i in range(ntbnum):
+ create_ntb_sql = f'''create table {dbname}.nt{i+1}(
+ {PRIMARY_COL} timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
+ {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
+ {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
+ {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
+ {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
)
- (
- { now_time + 2592000000 }, {pow(2,31)-pow(2,16)}, {pow(2,63)-pow(2,31)}, 32766, 126,
- { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000}
- )
- '''
- )
-
- tdSql.execute(
- f'''insert into ct2 values
- ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- (
- { now_time + 5184000000 }, { -1 * pow(2,31) + pow(2,15) }, { -1 * pow(2,63) + pow(2,30) }, -32766, -126,
- { -1 * 3.2 * pow(10,38) }, { -1.2 * pow(10,308) }, { rows % 2 }, "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
- )
- (
- { now_time + 2592000000 }, { -1 * pow(2,31) + pow(2,16) }, { -1 * pow(2,63) + pow(2,31) }, -32767, -127,
- { - 3.3 * pow(10,38) }, { -1.3 * pow(10,308) }, { (rows-1) % 2 }, "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
- )
- '''
- )
-
- for i in range(rows):
- insert_data = f'''insert into t1 values
- ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2},
- "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } )
'''
- tdSql.execute(insert_data)
- tdSql.execute(
- f'''insert into t1 values
- ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- ( { now_time + 7200000 }, { pow(2,31) - pow(2,15) }, { pow(2,63) - pow(2,30) }, 32767, 127,
- { 3.3 * pow(10,38) }, { 1.3 * pow(10,308) }, { rows % 2 },
- "binary_limit-1", "nchar_测试_limit-1", { now_time - 86400000 }
- )
- (
- { now_time + 3600000 } , { pow(2,31) - pow(2,16) }, { pow(2,63) - pow(2,31) }, 32766, 126,
- { 3.2 * pow(10,38) }, { 1.2 * pow(10,308) }, { (rows-1) % 2 },
- "binary_limit-2", "nchar_测试_limit-2", { now_time - 172800000 }
- )
+ tdSql.execute(create_ntb_sql)
+
+ for i in range(ctb_num):
+ tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.{stb} tags ( {i+1} )')
+
+ def __insert_data(self, rows, ctb_num=20, dbname=DBNAME, star_time=NOW):
+ tdLog.printNoPrefix("==========step: start inser data into tables now.....")
+ # from ...pytest.util.common import DataSet
+ data = DataSet()
+ data.get_order_set(rows)
+
+ for i in range(rows):
+ row_data = f'''
+ {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
+ {data.bool_data[i]}, '{data.vchar_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.utint_data[i]},
+ {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}
'''
- )
+ tdSql.execute( f"insert into {dbname}.{NTBNAME} values ( {star_time - i * int(TIME_STEP * 1.2)}, {row_data} )" )
+
+ for j in range(ctb_num):
+ tdSql.execute( f"insert into {dbname}.ct{j+1} values ( {star_time - j * i * TIME_STEP}, {row_data} )" )
def run(self):
tdSql.prepare()
@@ -656,27 +628,81 @@ class TDTestCase:
with taos_connect(user=self.__user_list[0], passwd=f"new{self.__passwd_list[0]}") as user:
# user = conn
# 不能创建用户
- tdLog.printNoPrefix("==========step5: normal user can not create user")
+ tdLog.printNoPrefix("==========step4.1: normal user can not create user")
user.error("create use utest1 pass 'utest1pass'")
# 可以查看用户
- tdLog.printNoPrefix("==========step6: normal user can show user")
+ tdLog.printNoPrefix("==========step4.2: normal user can show user")
user.query("show users")
assert user.queryRows == self.users_count + 1
# 不可以修改其他用户的密码
- tdLog.printNoPrefix("==========step7: normal user can not alter other user pass")
+ tdLog.printNoPrefix("==========step4.3: normal user can not alter other user pass")
user.error(self.__alter_pass_sql(self.__user_list[1], self.__passwd_list[1] ))
user.error(self.__alter_pass_sql("root", "taosdata_root" ))
# 可以修改自己的密码
- tdLog.printNoPrefix("==========step8: normal user can alter owner pass")
+ tdLog.printNoPrefix("==========step4.4: normal user can alter owner pass")
user.query(self.__alter_pass_sql(self.__user_list[0], self.__passwd_list[0]))
# 不可以删除用户,包括自己
- tdLog.printNoPrefix("==========step9: normal user can not drop any user ")
+ tdLog.printNoPrefix("==========step4.5: normal user can not drop any user ")
user.error(f"drop user {self.__user_list[0]}")
user.error(f"drop user {self.__user_list[1]}")
user.error("drop user root")
+ tdLog.printNoPrefix("==========step5: enable info")
+ taos1_conn = taos.connect(user=self.__user_list[1], password=f"new{self.__passwd_list[1]}")
+ taos1_conn.query(f"show databases")
+ tdSql.execute(f"alter user {self.__user_list[1]} enable 0")
+ tdSql.execute(f"alter user {self.__user_list[2]} enable 0")
+ taos1_except = True
+ try:
+ taos1_conn.query("show databases")
+ except BaseException:
+ taos1_except = False
+ if taos1_except:
+ tdLog.exit("taos 1 connect except error not occured, when enable == 0, should not r/w ")
+ else:
+ tdLog.info("taos 1 connect except error occured, enable == 0")
+
+ taos2_except = True
+ try:
+ taos.connect(user=self.__user_list[2], password=f"new{self.__passwd_list[2]}")
+ except BaseException:
+ taos2_except = False
+ if taos2_except:
+ tdLog.exit("taos 2 connect except error not occured, when enable == 0, should not connect")
+ else:
+ tdLog.info("taos 2 connect except error occured, enable == 0, can not login")
+
+ tdLog.printNoPrefix("==========step6: sysinfo info")
+ taos3_conn = taos.connect(user=self.__user_list[3], password=f"new{self.__passwd_list[3]}")
+ taos3_conn.query(f"show dnodes")
+ taos3_conn.query(f"show {DBNAME}.vgroups")
+ tdSql.execute(f"alter user {self.__user_list[3]} sysinfo 0")
+ tdSql.execute(f"alter user {self.__user_list[4]} sysinfo 0")
+ taos3_except = True
+ try:
+ taos3_conn.query(f"show dnodes")
+ taos3_conn.query(f"show {DBNAME}.vgroups")
+ except BaseException:
+ taos3_except = False
+ if taos3_except:
+ tdLog.exit("taos 3 query except error not occured, when sysinfo == 0, should not show info:dnode/monde/qnode ")
+ else:
+ tdLog.info("taos 3 query except error occured, sysinfo == 0, can not show dnode/vgroups")
+
+ taos4_conn = taos.connect(user=self.__user_list[4], password=f"new{self.__passwd_list[4]}")
+ taos4_except = True
+ try:
+ taos4_conn.query(f"show mnodes")
+ taos4_conn.query(f"show {DBNAME}.vgroups")
+ except BaseException:
+ taos4_except = False
+ if taos4_except:
+ tdLog.exit("taos 4 query except error not occured, when sysinfo == 0, when enable == 0, should not show info:dnode/monde/qnode")
+ else:
+ tdLog.info("taos 4 query except error occured, sysinfo == 0, can not show dnode/vgroups")
+
# root删除用户测试
- tdLog.printNoPrefix("==========step10: super user drop normal user")
+ tdLog.printNoPrefix("==========step7: super user drop normal user")
self.test_drop_user()
tdSql.query("show users")
diff --git a/tests/system-test/1-insert/db_tb_name_check.py b/tests/system-test/1-insert/db_tb_name_check.py
new file mode 100644
index 0000000000..e4b164e01f
--- /dev/null
+++ b/tests/system-test/1-insert/db_tb_name_check.py
@@ -0,0 +1,88 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.common import *
+
+class TDTestCase:
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.special_name = ['!','@','#','$','%','^','&','*','(',')','[',']','{','}',\
+ ':',';','\'','\"',',','<','>','/','?','-','_','+','=','~']
+ def db_name_check(self):
+ dbname = tdCom.getLongName(10)
+ for j in self.special_name:
+ for i in range(len(list(dbname))+1):
+ new_dbname = list(dbname)
+ new_dbname.insert(i,j)
+ dbname_1 = ''.join(new_dbname)
+ tdSql.execute(f'create database if not exists `{dbname_1}`')
+ tdSql.query('show databases')
+ tdSql.checkEqual(tdSql.queryResult[2][0],str(dbname_1))
+ tdSql.execute(f'drop database `{dbname_1}`')
+ for i in range(len(list(dbname))+1):
+ new_dbname = list(dbname)
+ new_dbname.insert(i,'.')
+ dbname_1 = ''.join(new_dbname)
+ tdSql.error(f'create database if not exists `{dbname_1}`')
+
+ def tb_name_check(self):
+ dbname = tdCom.getLongName(10)
+ tdSql.execute(f'create database if not exists `{dbname}`')
+ tdSql.execute(f'use `{dbname}`')
+ tbname = tdCom.getLongName(5)
+ for i in self.special_name:
+ for j in range(len(list(tbname))+1):
+ tbname1 = list(tbname)
+ tbname1.insert(j,i)
+ new_tbname = ''.join(tbname1)
+ for sql in [f'`{dbname}`.`{new_tbname}`',f'`{new_tbname}`']:
+ tdSql.execute(f'create table {sql} (ts timestamp,c0 int)')
+ tdSql.execute(f'insert into {sql} values(now,1)')
+ tdSql.query(f'select * from {sql}')
+ tdSql.checkRows(1)
+ tdSql.execute(f'drop table {sql}')
+ for i in range(len(list(tbname))+1):
+ tbname1 = list(tbname)
+ tbname1.insert(i,'.')
+ new_tbname = ''.join(tbname1)
+ for sql in [f'`{dbname}`.`{new_tbname}`',f'`{new_tbname}`']:
+ tdSql.error(f'create table {sql} (ts timestamp,c0 int)')
+ tdSql.execute(f'drop database `{dbname}`')
+ def run(self):
+ self.db_name_check()
+ self.tb_name_check()
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/1-insert/time_range_wise.py b/tests/system-test/1-insert/time_range_wise.py
index e65dded601..e66f5560df 100644
--- a/tests/system-test/1-insert/time_range_wise.py
+++ b/tests/system-test/1-insert/time_range_wise.py
@@ -1,4 +1,4 @@
-import datetime
+from datetime import datetime
import time
from dataclasses import dataclass
@@ -8,6 +8,7 @@ from util.sql import *
from util.cases import *
from util.dnodes import *
from util.constant import *
+from util.common import *
PRIMARY_COL = "ts"
@@ -38,7 +39,7 @@ TAG_COL = [INT_TAG]
# insert data args:
TIME_STEP = 10000
-NOW = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
+NOW = int(datetime.timestamp(datetime.now()) * 1000)
# init db/table
DBNAME = "db"
@@ -47,40 +48,6 @@ CTBNAME = "ct1"
NTBNAME = "nt1"
-@dataclass
-class DataSet:
- ts_data : List[int] = None
- int_data : List[int] = None
- bint_data : List[int] = None
- sint_data : List[int] = None
- tint_data : List[int] = None
- int_un_data : List[int] = None
- bint_un_data: List[int] = None
- sint_un_data: List[int] = None
- tint_un_data: List[int] = None
- float_data : List[float] = None
- double_data : List[float] = None
- bool_data : List[int] = None
- binary_data : List[str] = None
- nchar_data : List[str] = None
-
- def __post_init__(self):
- self.ts_data = []
- self.int_data = []
- self.bint_data = []
- self.sint_data = []
- self.tint_data = []
- self.int_un_data = []
- self.bint_un_data = []
- self.sint_un_data = []
- self.tint_un_data = []
- self.float_data = []
- self.double_data = []
- self.bool_data = []
- self.binary_data = []
- self.nchar_data = []
-
-
@dataclass
class SMAschema:
creation : str = "CREATE"
@@ -164,10 +131,6 @@ class SMAschema:
del self.other[k]
-
-# from ...pytest.util.sql import *
-# from ...pytest.util.constant import *
-
class TDTestCase:
updatecfgDict = {"querySmaOptimize": 1}
@@ -469,14 +432,12 @@ class TDTestCase:
err_sqls.append( SMAschema(index_flag="SMA INDEX ,", tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
err_sqls.append( SMAschema(index_name="tbname", tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
-
# current_set
cur_sqls.append( SMAschema(max_delay="",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
cur_sqls.append( SMAschema(watermark="",index_name="sma_index_2",tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
cur_sqls.append( SMAschema(sliding="",index_name='sma_index_3',tbname=STBNAME, func=(f"min({INT_COL})",f"max({INT_COL})") ) )
-
return err_sqls, cur_sqls
def test_create_sma(self):
@@ -512,102 +473,48 @@ class TDTestCase:
self.test_create_sma()
self.test_drop_sma()
- pass
-
- def __create_tb(self):
+ def __create_tb(self, stb=STBNAME, ctb_num=20, ntbnum=1, dbname=DBNAME):
tdLog.printNoPrefix("==========step: create table")
- create_stb_sql = f'''create table {STBNAME}(
- ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
+ create_stb_sql = f'''create table {dbname}.{stb}(
+ {PRIMARY_COL} timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
{TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) tags ({INT_TAG} int)
'''
- create_ntb_sql = f'''create table {NTBNAME}(
- ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
- {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
- {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
- {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
- {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
- )
- '''
tdSql.execute(create_stb_sql)
- tdSql.execute(create_ntb_sql)
- for i in range(4):
- tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )')
+ for i in range(ntbnum):
+ create_ntb_sql = f'''create table {dbname}.nt{i+1}(
+ {PRIMARY_COL} timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
+ {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
+ {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
+ {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
+ {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
+ )
+ '''
+ tdSql.execute(create_ntb_sql)
- def __data_set(self, rows):
- data_set = DataSet()
+ for i in range(ctb_num):
+ tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.{stb} tags ( {i+1} )')
+
+ def __insert_data(self, rows, ctb_num=20, dbname=DBNAME, star_time=NOW):
+ tdLog.printNoPrefix("==========step: start inser data into tables now.....")
+ # from ...pytest.util.common import DataSet
+ data = DataSet()
+ data.get_order_set(rows, bint_step=2)
for i in range(rows):
- data_set.ts_data.append(NOW + 1 * (rows - i))
- data_set.int_data.append(rows - i)
- data_set.bint_data.append(11111 * (rows - i))
- data_set.sint_data.append(111 * (rows - i) % 32767)
- data_set.tint_data.append(11 * (rows - i) % 127)
- data_set.int_un_data.append(rows - i)
- data_set.bint_un_data.append(11111 * (rows - i))
- data_set.sint_un_data.append(111 * (rows - i) % 32767)
- data_set.tint_un_data.append(11 * (rows - i) % 127)
- data_set.float_data.append(1.11 * (rows - i))
- data_set.double_data.append(1100.0011 * (rows - i))
- data_set.bool_data.append((rows - i) % 2)
- data_set.binary_data.append(f'binary{(rows - i)}')
- data_set.nchar_data.append(f'nchar_测试_{(rows - i)}')
-
- return data_set
-
- def __insert_data(self):
- tdLog.printNoPrefix("==========step: start inser data into tables now.....")
- data = self.__data_set(rows=self.rows)
-
- # now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
- null_data = '''null, null, null, null, null, null, null, null, null, null, null, null, null, null'''
- zero_data = "0, 0, 0, 0, 0, 0, 0, 'binary_0', 'nchar_0', 0, 0, 0, 0, 0"
-
- for i in range(self.rows):
row_data = f'''
{data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
- {data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.tint_un_data[i]},
- {data.sint_un_data[i]}, {data.int_un_data[i]}, {data.bint_un_data[i]}
- '''
- neg_row_data = f'''
- {-1 * data.int_data[i]}, {-1 * data.bint_data[i]}, {-1 * data.sint_data[i]}, {-1 * data.tint_data[i]}, {-1 * data.float_data[i]}, {-1 * data.double_data[i]},
- {data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {1 * data.tint_un_data[i]},
- {1 * data.sint_un_data[i]}, {1 * data.int_un_data[i]}, {1 * data.bint_un_data[i]}
+ {data.bool_data[i]}, '{data.vchar_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.utint_data[i]},
+ {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}
'''
+ tdSql.execute( f"insert into {dbname}.{NTBNAME} values ( {star_time - i * int(TIME_STEP * 1.2)}, {row_data} )" )
- tdSql.execute(
- f"insert into ct1 values ( {NOW - i * TIME_STEP}, {row_data} )")
- tdSql.execute(
- f"insert into ct2 values ( {NOW - i * int(TIME_STEP * 0.6)}, {neg_row_data} )")
- tdSql.execute(
- f"insert into ct4 values ( {NOW - i * int(TIME_STEP * 0.8) }, {row_data} )")
- tdSql.execute(
- f"insert into {NTBNAME} values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )")
-
- tdSql.execute(
- f"insert into ct2 values ( {NOW + int(TIME_STEP * 0.6)}, {null_data} )")
- tdSql.execute(
- f"insert into ct2 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.6)}, {null_data} )")
- tdSql.execute(
- f"insert into ct2 values ( {NOW - self.rows * int(TIME_STEP * 0.29) }, {null_data} )")
-
- tdSql.execute(
- f"insert into ct4 values ( {NOW + int(TIME_STEP * 0.8)}, {null_data} )")
- tdSql.execute(
- f"insert into ct4 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.8)}, {null_data} )")
- tdSql.execute(
- f"insert into ct4 values ( {NOW - self.rows * int(TIME_STEP * 0.39)}, {null_data} )")
-
- tdSql.execute(
- f"insert into {NTBNAME} values ( {NOW + int(TIME_STEP * 1.2)}, {null_data} )")
- tdSql.execute(
- f"insert into {NTBNAME} values ( {NOW - (self.rows + 1) * int(TIME_STEP * 1.2)}, {null_data} )")
- tdSql.execute(
- f"insert into {NTBNAME} values ( {NOW - self.rows * int(TIME_STEP * 0.59)}, {null_data} )")
+ for j in range(ctb_num):
+ tdSql.execute( f"insert into {dbname}.ct{j+1} values ( {star_time - j * i * TIME_STEP}, {row_data} )" )
def run(self):
self.rows = 10
@@ -616,14 +523,60 @@ class TDTestCase:
tdLog.printNoPrefix("==========step1:create table in normal database")
tdSql.prepare()
- self.__create_tb()
- self.__insert_data()
+ self.__create_tb(dbname=DBNAME)
+ self.__insert_data(rows=self.rows)
self.all_test()
+ # # from ...pytest.util.sql import *
+
# drop databases, create same name db、stb and sma index
tdSql.prepare()
- self.__create_tb()
- self.__insert_data()
+ self.__create_tb(dbname=DBNAME)
+ self.__insert_data(rows=self.rows,star_time=NOW + self.rows * 2 * TIME_STEP)
+ tdLog.printNoPrefix("==========step1.1 : create a tsma index and checkdata")
+ tdSql.execute(f"create sma index {DBNAME}.sma_index_name1 on {DBNAME}.{STBNAME} function(max({INT_COL}),max({BINT_COL}),min({INT_COL})) interval(6m,10s) sliding(6m)")
+ self.__insert_data(rows=self.rows)
+ tdSql.query(f"select max({INT_COL}), max({BINT_COL}), min({INT_COL}) from {DBNAME}.{STBNAME} interval(6m,10s) sliding(6m)")
+ tdSql.checkData(0, 0, self.rows - 1)
+ tdSql.checkData(0, 1, (self.rows - 1) * 2 )
+ tdSql.checkData(tdSql.queryRows - 1, 2, 0)
+ # tdSql.checkData(0, 2, 0)
+
+ tdLog.printNoPrefix("==========step1.2 : alter table schema, drop col without index")
+ tdSql.execute(f"alter stable {DBNAME}.{STBNAME} drop column {BINARY_COL}")
+ tdSql.query(f"select max({INT_COL}), max({BINT_COL}), min({INT_COL}) from {DBNAME}.{STBNAME} interval(6m,10s) sliding(6m)")
+ tdSql.checkData(0, 0, self.rows - 1)
+ tdSql.checkData(0, 1, (self.rows - 1) * 2 )
+ tdSql.checkData(tdSql.queryRows - 1, 2, 0)
+
+ tdLog.printNoPrefix("==========step1.3 : alter table schema, drop col with index")
+ # TODO: TD-18047, can not drop col, when col in tsma-index and tsma-index is not dropped.
+ tdSql.error(f"alter stable {DBNAME}.stb1 drop column {BINT_COL}")
+
+ tdLog.printNoPrefix("==========step1.4 : alter table schema, add col")
+ tdSql.execute(f"alter stable {DBNAME}.{STBNAME} add column {BINT_COL}_1 bigint")
+ tdSql.execute(f"insert into {DBNAME}.{CTBNAME} ({PRIMARY_COL}, {BINT_COL}_1) values(now(), 111)")
+ tdSql.query(f"select max({INT_COL}), max({BINT_COL}), min({INT_COL}) from {DBNAME}.{STBNAME} interval(6m,10s) sliding(6m)")
+ tdSql.checkData(0, 0, self.rows - 1)
+ tdSql.checkData(0, 1, (self.rows - 1) * 2 )
+ tdSql.checkData(tdSql.queryRows - 1, 2, 0)
+ # tdSql.checkData(0, 2, 0)
+ tdSql.query(f"select max({BINT_COL}_1) from {DBNAME}.{STBNAME} ")
+ tdSql.checkData(0, 0 , 111)
+
+ tdSql.execute(f"flush database {DBNAME}")
+
+ tdLog.printNoPrefix("==========step1.5 : drop child table")
+ tdSql.execute(f"drop table {CTBNAME}")
+ tdSql.query(f"select max({INT_COL}), max({BINT_COL}), min({INT_COL}) from {DBNAME}.{STBNAME} interval(6m,10s) sliding(6m)")
+ tdSql.checkData(0, 0, self.rows - 1)
+ tdSql.checkData(0, 1, (self.rows - 1) * 2 )
+ tdSql.checkData(tdSql.queryRows - 1, 2, 0)
+
+ tdLog.printNoPrefix("==========step1.6 : drop stable")
+ tdSql.execute(f"drop table {STBNAME}")
+ tdSql.error(f"select * from {DBNAME}.{STBNAME}")
+
self.all_test()
tdLog.printNoPrefix("==========step2:create table in rollup database")
@@ -640,7 +593,6 @@ class TDTestCase:
tdSql.execute("flush database db ")
-
tdLog.printNoPrefix("==========step4:after wal, all check again ")
self.all_test()
diff --git a/tests/system-test/2-query/check_tsdb.py b/tests/system-test/2-query/check_tsdb.py
index 746906776d..8d5bcc370d 100644
--- a/tests/system-test/2-query/check_tsdb.py
+++ b/tests/system-test/2-query/check_tsdb.py
@@ -49,29 +49,11 @@ class TDTestCase:
tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
- # tdSql.execute(
- # f'''insert into t1 values
- # ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- # ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a )
- # ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
- # ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a )
- # ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a )
- # ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- # ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a )
- # ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a )
- # ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
- # ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
- # ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
- # ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
- # '''
- # )
-
-
def restart_taosd_query_sum(self, dbname="db"):
for i in range(5):
- tdLog.info(" this is %d_th restart taosd " %i)
- os.system(f"taos -s ' use db ;select c6 from {dbname}.stb1 ; '")
+ tdLog.notice(" this is %d_th restart taosd " %i)
+ # os.system(f"taos -s ' use db ;select c6 from {dbname}.stb1 ; '")
tdSql.execute(f"use {dbname} ")
tdSql.query(f"select count(*) from {dbname}.stb1")
tdSql.checkRows(1)
@@ -85,6 +67,25 @@ class TDTestCase:
tdDnodes.stop(1)
tdDnodes.start(1)
time.sleep(2)
+ tdSql.query("show databases")
+
+ status = False
+ while status==False:
+ tdSql.query("show databases")
+ for db_info in tdSql.queryResult:
+ if db_info[0]==dbname :
+ if db_info[15]=="ready":
+ status = True
+ tdLog.notice(" ==== database {} status is ready ==== ".format(dbname))
+ break
+ else:
+ status = False
+ else:
+ continue
+
+
+
+
@@ -96,7 +97,7 @@ class TDTestCase:
self.prepare_datas()
- os.system(f"taos -s ' select c6 from {dbname}.stb1 ; '")
+ # os.system(f"taos -s ' select c6 from {dbname}.stb1 ; '")
self.restart_taosd_query_sum()
def stop(self):
diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py
index f38a99d809..953dd1e491 100644
--- a/tests/system-test/2-query/csum.py
+++ b/tests/system-test/2-query/csum.py
@@ -162,9 +162,9 @@ class TDTestCase:
self.checkcsum(**case6)
# case7~8: nested query
- case7 = {"table_expr": "(select c1 from db.stb1 order by tbname ,ts )"}
+ case7 = {"table_expr": "(select c1 from db.stb1 order by ts, tbname )"}
self.checkcsum(**case7)
- case8 = {"table_expr": "(select csum(c1) c1 from db.t1 partition by tbname)"}
+ case8 = {"table_expr": "(select csum(c1) c1 from db.t1)"}
self.checkcsum(**case8)
# case9~10: mix with tbname/ts/tag/col not support , must partition by alias ,such as select tbname ,csum(c1) partition by tbname
diff --git a/tests/system-test/2-query/irate.py b/tests/system-test/2-query/irate.py
index 856006aaf1..f70f30f55a 100644
--- a/tests/system-test/2-query/irate.py
+++ b/tests/system-test/2-query/irate.py
@@ -6,7 +6,7 @@ import inspect
from util.log import *
from util.sql import *
from util.cases import *
-import random
+import random ,math
class TDTestCase:
@@ -41,8 +41,8 @@ class TDTestCase:
c2 = random.randint(0,100000)
c3 = random.randint(0,125)
c4 = random.randint(0,125)
- c5 = random.random()/1.0
- c6 = random.random()/1.0
+ c5 = random.randint(0,10000)/1000
+ c6 = random.randint(0,10000)/1000
c7 = "'true'"
c8 = "'binary_val'"
c9 = "'nchar_val'"
@@ -72,7 +72,7 @@ class TDTestCase:
comput_irate_value = origin_result[1][0]*1000/( origin_result[1][-1] - origin_result[0][-1])
else:
comput_irate_value = (origin_result[1][0] - origin_result[0][0])*1000/( origin_result[1][-1] - origin_result[0][-1])
- if comput_irate_value ==irate_value:
+ if abs(comput_irate_value - irate_value) <= 0.0000001:
tdLog.info(" irate work as expected , sql is %s "% irate_sql)
else:
tdLog.exit(" irate work not as expected , sql is %s "% irate_sql)
diff --git a/tests/system-test/2-query/json_tag.py b/tests/system-test/2-query/json_tag.py
index b817b1afb4..d9d7ef2300 100644
--- a/tests/system-test/2-query/json_tag.py
+++ b/tests/system-test/2-query/json_tag.py
@@ -506,7 +506,7 @@ class TDTestCase:
#show create table
tdSql.query("show create table jsons1")
- tdSql.checkData(0, 1, 'CREATE STABLE `jsons1` (`ts` TIMESTAMP, `dataint` INT, `databool` BOOL, `datastr` NCHAR(50), `datastrbin` VARCHAR(150)) TAGS (`jtag` JSON) WATERMARK 5000a, 5000a')
+ tdSql.checkData(0, 1, 'CREATE STABLE `jsons1` (`ts` TIMESTAMP, `dataint` INT, `databool` BOOL, `datastr` NCHAR(50), `datastrbin` VARCHAR(150)) TAGS (`jtag` JSON)')
#test aggregate function:count/avg/twa/irate/sum/stddev/leastsquares
tdSql.query("select count(*) from jsons1 where jtag is not null")
diff --git a/tests/system-test/2-query/qnodeCluster.py b/tests/system-test/2-query/qnodeCluster.py
new file mode 100644
index 0000000000..23adfb768d
--- /dev/null
+++ b/tests/system-test/2-query/qnodeCluster.py
@@ -0,0 +1,290 @@
+# from asyncio.windows_events import NULL
+import taos
+import sys
+import datetime
+import inspect
+import random
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+from util.cluster import *
+from util.common import *
+
+sys.path.append("./6-cluster/")
+from clusterCommonCreate import *
+from clusterCommonCheck import clusterComCheck
+
+import threading
+
+class TDTestCase:
+
+ clientCfgDict = {'queryproxy': '1','debugFlag': 135}
+ clientCfgDict["debugFlag"] = 131
+ updatecfgDict = {'clientCfg': {}}
+ updatecfgDict = {'debugFlag': 131}
+ updatecfgDict = {'keepColumnName': 1}
+ updatecfgDict["clientCfg"] = clientCfgDict
+
+ def init(self, conn, logSql):
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1):
+ tsql.execute("use %s" %dbName)
+ pre_create = "create table"
+ sql = pre_create
+ #tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname))
+ for i in range(ctbNum):
+ tagValue = 'beijing'
+ if (i % 10 == 0):
+ sql += " %s%d using %s (name,fleet,driver,device_version) tags('truck_%d', 'South%d','Trish%d','v2.%d')"%(ctbPrefix,i,stbName,i,i,i,i)
+ else:
+ model = 'H-%d'%i
+ sql += " %s%d using %s tags('truck_%d', 'South%d','Trish%d','%s','v2.%d')"%(ctbPrefix,i,stbName,i,i,i,model,i)
+ if (i > 0) and (i%1000 == 0):
+ tsql.execute(sql)
+ sql = pre_create
+ if sql != pre_create:
+ tsql.execute(sql)
+
+ tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName))
+ return
+
+ def prepareData(self):
+ dbname="db_tsbs"
+ stabname1="readings"
+ stabname2="diagnostics"
+ ctbnamePre1="rct"
+ ctbnamePre2="dct"
+ ctbNums=40
+ self.ctbNums=ctbNums
+ rowNUms=100
+ ts=1451606400000
+ tdSql.execute(f"create database {dbname};")
+ tdSql.execute(f"use {dbname} ")
+ tdSql.execute(f'''
+ create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30));
+ ''')
+ tdSql.execute(f'''
+ create table {stabname2} (ts timestamp,fuel_state double,current_load double,status bigint,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30)) ;
+ ''')
+ self.create_ctable(tsql=tdSql,dbName=dbname,stbName=stabname1,ctbPrefix=ctbnamePre1,ctbNum=ctbNums)
+ self.create_ctable(tsql=tdSql,dbName=dbname,stbName=stabname2,ctbPrefix=ctbnamePre2,ctbNum=ctbNums)
+
+
+ for j in range(ctbNums):
+ for i in range(rowNUms):
+ tdSql.execute(
+ f"insert into rct{j} values ( {ts+i*60000}, {80+i}, {90+i}, {85+i}, {30+i*10}, {1.2*i}, {221+i*2}, {20+i*0.2}, {1500+i*20}, {150+i*2},{5+i} )"
+ )
+ status= random.randint(0,1)
+ tdSql.execute(
+ f"insert into dct{j} values ( {ts+i*60000}, {1+i*0.1},{1400+i*15}, {status},{1500+i*20}, {150+i*2},{5+i} )"
+ )
+ tdSql.execute("insert into dct9 (ts,fuel_state) values('2021-07-13 14:06:33.123Z',1.2) ;")
+ # def check_avg(self ,origin_query , check_query):
+ # avg_result = tdSql.getResult(origin_query)
+ # origin_result = tdSql.getResult(check_query)
+
+ # check_status = True
+ # for row_index , row in enumerate(avg_result):
+ # for col_index , elem in enumerate(row):
+ # if avg_result[row_index][col_index] != origin_result[row_index][col_index]:
+ # check_status = False
+ # if not check_status:
+ # tdLog.notice("avg function value has not as expected , sql is \"%s\" "%origin_query )
+ # sys.exit(1)
+ # else:
+ # tdLog.info("avg value check pass , it work as expected ,sql is \"%s\" "%check_query )
+
+
+ def createCluster(self):
+ tdSql.execute("create mnode on dnode 2")
+ tdSql.execute("create mnode on dnode 3")
+ tdSql.execute("create qnode on dnode 1")
+ tdSql.execute("create qnode on dnode 2")
+ tdSql.execute("create qnode on dnode 3")
+ time.sleep(10)
+
+ def tsbsIotQuery(self,tdSql):
+ tdSql.execute("use db_tsbs")
+
+ # test interval and partition
+ tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ")
+ # print(tdSql.queryResult)
+ parRows=tdSql.queryRows
+ tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ")
+ tdSql.checkRows(parRows)
+
+
+ # # test insert into
+ # tdSql.execute("create table testsnode (ts timestamp, c1 float,c2 binary(30),c3 binary(30),c4 binary(30)) ;")
+ # tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);")
+
+ # tdSql.query("insert into testsnode(ts,c1,c2,c3,c4) SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);")
+
+
+ # test paitition interval fill
+ tdSql.query("SELECT name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0) ;")
+
+
+ # test partition interval limit (PRcore-TD-17410)
+ tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings partition BY name,driver,fleet interval (10m) limit 1);")
+ tdSql.checkRows(self.ctbNums)
+
+ # test partition interval Pseudo time-column
+ tdSql.query("SELECT count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
+
+ # 1 high-load:
+ tdSql.query("SELECT ts,name,driver,current_load,load_capacity FROM (SELECT last(ts) as ts,name,driver, current_load,load_capacity FROM diagnostics WHERE fleet = 'South' partition by name,driver) WHERE current_load>= (0.9 * load_capacity) partition by name ORDER BY name desc, ts DESC;")
+
+ tdSql.query("SELECT ts,name,driver,current_load,load_capacity FROM (SELECT last(ts) as ts,name,driver, current_load,load_capacity FROM diagnostics WHERE fleet = 'South' partition by name,driver) WHERE current_load>= (0.9 * load_capacity) partition by name ORDER BY name ;")
+
+ # 2 stationary-trucks
+ tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings WHERE ts > '2016-01-01T15:07:21Z' AND ts <= '2016-01-01T16:17:21Z' partition BY name,driver,fleet interval(10m) LIMIT 1)")
+ tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings WHERE ts > '2016-01-01T15:07:21Z' AND ts <= '2016-01-01T16:17:21Z' partition BY name,driver,fleet interval(10m) LIMIT 1) WHERE fleet = 'West' AND mean_velocity < 1000 partition BY name")
+
+ # 3 long-driving-sessions
+ tdSql.query("SELECT name,driver FROM(SELECT name,driver,count(*) AS ten_min FROM(SELECT _wstart as ts,name,driver,avg(velocity) as mean_velocity FROM readings where ts > '2016-01-01T00:00:34Z' AND ts <= '2016-01-01T04:00:34Z' partition BY name,driver interval(10m)) WHERE mean_velocity > 1 GROUP BY name,driver) WHERE ten_min > 22 ;")
+
+
+ #4 long-daily-sessions
+ tdSql.query("SELECT name,driver FROM(SELECT name,driver,count(*) AS ten_min FROM(SELECT name,driver,avg(velocity) as mean_velocity FROM readings WHERE fleet ='West' AND ts > '2016-01-01T12:31:37Z' AND ts <= '2016-01-05T12:31:37Z' partition BY name,driver interval(10m) ) WHERE mean_velocity > 1 GROUP BY name,driver) WHERE ten_min > 60")
+
+ # 5. avg-daily-driving-duration
+ tdSql.query("select _wstart as ts,fleet,name,driver,count(mv)/6 as hours_driven from ( select _wstart as ts,fleet,name,driver,avg(velocity) as mv from readings where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(10m)) where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(1d) ;")
+
+
+ # # 6. avg-daily-driving-session
+ # #taosc core dumped
+ # tdSql.execute("create table random_measure2_1 (ts timestamp,ela float, name binary(40))")
+ # tdSql.query("SELECT ts,diff(mv) AS difka FROM (SELECT ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name,ts interval(10m) fill(value,0)) GROUP BY name,ts;")
+ # tdSql.query("select name,diff(mv) AS difka FROM (SELECT ts,name,mv FROM (SELECT _wstart as ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0))) group BY name ;")
+ # tdSql.query("SELECT _wstart,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name interval(10m) fill(value,0)")
+
+ # 7. avg-load
+ tdSql.query("SELECT fleet, model,avg(ml) AS mean_load_percentage FROM (SELECT fleet, model,current_load/load_capacity AS ml FROM diagnostics partition BY name, fleet, model) partition BY fleet, model order by fleet ;")
+
+ # 8. daily-activity
+ tdSql.query(" SELECT model,ms1 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
+
+ tdSql.query(" SELECT model,ms1 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) ) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
+
+ tdSql.query("SELECT _wstart,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;")
+
+ tdSql.query("SELECT _wstart as ts,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) ) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;")
+
+
+ # 9. breakdown-frequency
+ # NULL ---count(NULL)=0 expect count(NULL)= 100
+ tdSql.query("SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where model is null partition BY model,state_changed ")
+ parRows=tdSql.queryRows
+ assert parRows != 0 , "query result is wrong"
+
+
+ tdSql.query(" SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where state_changed =1 partition BY model,state_changed ;")
+
+ #it's already supported:
+ # last-loc
+ tdSql.query("SELECT last_row(ts),latitude,longitude,name,driver FROM readings WHERE fleet='South' and name IS NOT NULL partition BY name,driver order by name ;")
+
+
+ #2. low-fuel
+ tdSql.query("SELECT last_row(ts),name,driver,fuel_state,driver FROM diagnostics WHERE fuel_state <= 0.1 AND fleet = 'South' and name IS NOT NULL GROUP BY name,driver order by name;")
+
+ # 3. avg-vs-projected-fuel-consumption
+ tdSql.query("select avg(fuel_consumption) as avg_fuel_consumption,avg(nominal_fuel_consumption) as nominal_fuel_consumption from readings where velocity > 1 group by fleet")
+
+ def restartFunc(self,func_name,threadNumbers,dnodeNumbers,mnodeNums,restartNumbers,stopRole):
+ tdLog.printNoPrefix("======== test case 1: ")
+ paraDict = {'dbName': 'db',
+ 'dbNumbers': 8,
+ 'dropFlag': 1,
+ 'event': '',
+ 'vgroups': 2,
+ 'replica': 1,
+ 'stbName': 'stb',
+ 'stbNumbers': 100,
+ 'colPrefix': 'c',
+ 'tagPrefix': 't',
+ 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}],
+ 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}],
+ 'ctbPrefix': 'ctb',
+ 'ctbNum': 1,
+ }
+
+ dnodeNumbers=int(dnodeNumbers)
+ mnodeNums=int(mnodeNums)
+ vnodeNumbers = int(dnodeNumbers-mnodeNums)
+
+ tdSql.query("show dnodes;")
+ tdLog.debug(tdSql.queryResult)
+ clusterComCheck.checkDnodes(dnodeNumbers)
+
+ tdLog.info("create database and stable")
+ tdDnodes=cluster.dnodes
+ stopcount =0
+ threads=[]
+ for i in range(threadNumbers):
+ newTdSql=tdCom.newTdSql()
+ print("123")
+ threads.append(threading.Thread(target=func_name,args=(newTdSql,)))
+ print("456")
+ for tr in threads:
+ tr.start()
+
+ tdLog.info("Take turns stopping %s "%stopRole)
+ while stopcount < restartNumbers:
+ tdLog.info(" restart loop: %d"%stopcount )
+ if stopRole == "mnode":
+ for i in range(mnodeNums):
+ tdDnodes[i].stoptaosd()
+ # sleep(10)
+ tdDnodes[i].starttaosd()
+ # sleep(10)
+ elif stopRole == "vnode":
+ for i in range(vnodeNumbers):
+ tdDnodes[i+mnodeNums].stoptaosd()
+ # sleep(10)
+ tdDnodes[i+mnodeNums].starttaosd()
+ # sleep(10)
+ elif stopRole == "dnode":
+ for i in range(dnodeNumbers):
+ tdDnodes[i].stoptaosd()
+ # sleep(10)
+ tdDnodes[i].starttaosd()
+ # sleep(10)
+
+ # dnodeNumbers don't include database of schema
+ if clusterComCheck.checkDnodes(dnodeNumbers):
+ tdLog.info("check dnodes status is ready")
+ else:
+ tdLog.info("check dnodes status is not ready")
+ self.stopThread(threads)
+ tdLog.exit("one or more of dnodes failed to start ")
+ # self.check3mnode()
+ stopcount+=1
+
+ for tr in threads:
+ tr.join()
+
+
+ def run(self):
+ tdLog.printNoPrefix("==========step1:create database and table,insert data ==============")
+ self.createCluster()
+ self.prepareData()
+ queryPolicy=2
+ simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath()
+ cmd='sed -i "s/^queryPolicy.*/queryPolicy 2/g" %s'%simClientCfg
+ os.system(cmd)
+ # self.tsbsIotQuery()
+ self.restartFunc(func_name=self.tsbsIotQuery,threadNumbers=3,dnodeNumbers=5,mnodeNums=3,restartNumbers=3,stopRole='mnode')
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/queryQnode.py b/tests/system-test/2-query/queryQnode.py
index b5e2bd3328..176c7ccf3e 100644
--- a/tests/system-test/2-query/queryQnode.py
+++ b/tests/system-test/2-query/queryQnode.py
@@ -318,7 +318,6 @@ class TDTestCase:
os.system(cmd)
# tdDnodes.stop(1)
# tdDnodes.start(1)
- tdSql.execute("reset query cache")
tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy)
tdSql.query("show local variables;")
for i in range(tdSql.queryRows):
diff --git a/tests/system-test/2-query/tsbsQuery.py b/tests/system-test/2-query/tsbsQuery.py
index ca270932b1..75b33f1a5e 100644
--- a/tests/system-test/2-query/tsbsQuery.py
+++ b/tests/system-test/2-query/tsbsQuery.py
@@ -1,3 +1,4 @@
+# from asyncio.windows_events import NULL
import taos
import sys
import datetime
@@ -21,38 +22,99 @@ class TDTestCase:
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), True)
- def prepareData(self):
- database="db_tsbs"
- ts=1451606400000
- tdSql.execute(f"create database {database};")
- tdSql.execute(f"use {database} ")
- tdSql.execute('''
- create table readings (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30));
- ''')
- tdSql.execute('''
- create table diagnostics (ts timestamp,fuel_state double,current_load double,status bigint,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30)) ;
- ''')
+ def create_ctable(self,tsql=None, dbName='db',stbName='stb',ctbPrefix='ctb',ctbNum=1):
+ tsql.execute("use %s" %dbName)
+ pre_create = "create table"
+ sql = pre_create
+ #tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname))
+ for i in range(ctbNum):
+ tagValue = 'beijing'
+ if (i % 10 == 0):
+ sql += " %s%d using %s (name,fleet,driver,device_version) tags('truck_%d', 'South%d','Trish%d','v2.%d')"%(ctbPrefix,i,stbName,i,i,i,i)
+ else:
+ model = 'H-%d'%i
+ sql += " %s%d using %s tags('truck_%d', 'South%d','Trish%d','%s','v2.%d')"%(ctbPrefix,i,stbName,i,i,i,model,i)
+ if (i > 0) and (i%1000 == 0):
+ tsql.execute(sql)
+ sql = pre_create
+ if sql != pre_create:
+ tsql.execute(sql)
+
+ tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName))
+ return
- for i in range(10):
- if i == 1 or i == 2 :
- tdLog.debug(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')")
- tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')")
- else :
- tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')")
- if i == 1 or i == 2 :
- tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}',NULL ,'v2.3')")
- else:
- tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')")
- for j in range(10):
- for i in range(100):
- tdSql.execute(
- f"insert into rct{j} values ( {ts+i*60000}, {80+i}, {90+i}, {85+i}, {30+i*10}, {1.2*i}, {221+i*2}, {20+i*0.2}, {1500+i*20}, {150+i*2},{5+i} )"
- )
- status= random.randint(0,1)
- tdSql.execute(
- f"insert into dct{j} values ( {ts+i*60000}, {1+i*0.1},{1400+i*15}, {status},{1500+i*20}, {150+i*2},{5+i} )"
- )
- tdSql.execute("insert into dct9 (ts,fuel_state) values('2021-07-13 14:06:33.123Z',1.2) ;")
+ def insertData(self,startTs,tsql=None, dbName='db',stbName='stb',ctbPrefix='ctb',ctbNum=1,rowsPerTbl=100,batchNum=1000):
+ tsql.execute("use %s" %dbName)
+ pre_insert = "insert into "
+ sql = pre_insert
+ if startTs is None:
+ t = time.time()
+ startTs = int(round(t * 1000))
+
+ for i in range(ctbNum):
+ sql += " %s%d values "%(ctbPrefix,i)
+ for j in range(rowsPerTbl):
+ if(ctbPrefix=="rct"):
+ sql += f"({startTs+j*60000}, {80+j}, {90+j}, {85+j}, {30+j*10}, {1.2*j}, {221+j*2}, {20+j*0.2}, {1500+j*20}, {150+j*2},{5+j}) "
+ elif ( ctbPrefix=="dct"):
+ status= random.randint(0,1)
+ sql += f"( {startTs+j*60000}, {1+j*0.1},{1400+j*15}, {status},{1500+j*20}, {150+j*2},{5+j} ) "
+ # tdLog.debug("1insert sql:%s"%sql)
+ if (j > 0) and ((j%batchNum == 0) or (j == rowsPerTbl - 1)):
+ # tdLog.debug("2insert sql:%s"%sql)
+ tsql.execute(sql)
+ if j < rowsPerTbl - 1:
+ sql = "insert into %s%d values " %(ctbPrefix,i)
+ else:
+ sql = "insert into "
+ if sql != pre_insert:
+ # tdLog.debug("3insert sql:%s"%sql)
+ tsql.execute(sql)
+ tdLog.debug("insert data ............ [OK]")
+ return
+
+ def prepareData(self):
+ dbname="db_tsbs"
+ stabname1="readings"
+ stabname2="diagnostics"
+ ctbnamePre1="rct"
+ ctbnamePre2="dct"
+ ctbNums=40
+ self.ctbNums=ctbNums
+ rowNUms=200
+ ts=1451606400000
+ tdSql.execute(f"create database {dbname};")
+ tdSql.execute(f"use {dbname} ")
+ tdSql.execute(f'''
+ create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30));
+ ''')
+ tdSql.execute(f'''
+ create table {stabname2} (ts timestamp,fuel_state double,current_load double,status bigint,load_capacity double,fuel_capacity double,nominal_fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30)) ;
+ ''')
+ self.create_ctable(tsql=tdSql,dbName=dbname,stbName=stabname1,ctbPrefix=ctbnamePre1,ctbNum=ctbNums)
+ self.create_ctable(tsql=tdSql,dbName=dbname,stbName=stabname2,ctbPrefix=ctbnamePre2,ctbNum=ctbNums)
+ self.insertData(tsql=tdSql,dbName=dbname,stbName=stabname1,ctbPrefix=ctbnamePre1,ctbNum=ctbNums,rowsPerTbl=rowNUms,startTs=ts,batchNum=1000)
+ self.insertData(tsql=tdSql,dbName=dbname,stbName=stabname2,ctbPrefix=ctbnamePre2,ctbNum=ctbNums,rowsPerTbl=rowNUms,startTs=ts,batchNum=1000)
+ # for i in range(ctbNum):
+ # if i %10 == 0 :
+ # # tdLog.debug(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')")
+ # tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}', NULL,'v2.3')")
+ # else :
+ # tdSql.execute(f"create table rct{i} using readings (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')")
+ # if i %10 == 0 :
+ # tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}',NULL ,'v2.3')")
+ # else:
+ # tdSql.execute(f"create table dct{i} using diagnostics (name,fleet,driver,model,device_version) tags ('truck_{i}','South{i}','Trish{i}','H-{i}','v2.3')")
+ # for j in range(ctbNums):
+ # for i in range(rowNUms):
+ # tdSql.execute(
+ # f"insert into rct{j} values ( {ts+i*60000}, {80+i}, {90+i}, {85+i}, {30+i*10}, {1.2*i}, {221+i*2}, {20+i*0.2}, {1500+i*20}, {150+i*2},{5+i} )"
+ # )
+ # status= random.randint(0,1)
+ # tdSql.execute(
+ # f"insert into dct{j} values ( {ts+i*60000}, {1+i*0.1},{1400+i*15}, {status},{1500+i*20}, {150+i*2},{5+i} )"
+ # )
+ # tdSql.execute("insert into dct9 (ts,fuel_state) values('2021-07-13 14:06:33.123Z',1.2) ;")
# def check_avg(self ,origin_query , check_query):
# avg_result = tdSql.getResult(origin_query)
# origin_result = tdSql.getResult(check_query)
@@ -75,7 +137,6 @@ class TDTestCase:
# test interval and partition
tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ")
- print(tdSql.queryResult)
parRows=tdSql.queryRows
tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ")
tdSql.checkRows(parRows)
@@ -94,7 +155,7 @@ class TDTestCase:
# test partition interval limit (PRcore-TD-17410)
tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings partition BY name,driver,fleet interval (10m) limit 1);")
- tdSql.checkRows(10)
+ tdSql.checkRows(self.ctbNums)
# test partition interval Pseudo time-column
tdSql.query("SELECT count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
@@ -136,17 +197,27 @@ class TDTestCase:
tdSql.query("SELECT _wstart,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;")
- tdSql.query("SELECT _wstart,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) ) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;")
+ tdSql.query("SELECT _wstart as ts,model,fleet,count(ms1)/144 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) ) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1 partition by model, fleet interval(1d) ;")
# 9. breakdown-frequency
# NULL ---count(NULL)=0 expect count(NULL)= 100
tdSql.query("SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where model is null partition BY model,state_changed ")
parRows=tdSql.queryRows
- assert parRows != 0 , "query result is wrong"
+ assert parRows != 0 , "query result is wrong, query rows %d but expect > 0 " %parRows
tdSql.query(" SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where state_changed =1 partition BY model,state_changed ;")
+ sql="select model,ctc from (SELECT model,count(state_changed) as ctc FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= 1451606400000 AND ts < 1451952001000 ) WHERE ts >= 1451606400000 AND ts < 1451952001000 partition BY model interval(10m)) partition BY model) WHERE state_changed = 1 partition BY model )where model is null;"
+
+ # for i in range(2):
+ # tdSql.query("%s"%sql)
+ # quertR1=tdSql.queryResult
+ # for j in range(50):
+ # tdSql.query("%s"%sql)
+ # quertR2=tdSql.queryResult
+ # assert quertR1 == quertR2 , "%s != %s ,The results of multiple queries are different" %(quertR1,quertR2)
+
#it's already supported:
# last-loc
diff --git a/tests/system-test/5-taos-tools/TD-12478.py b/tests/system-test/5-taos-tools/TD-12478.py
new file mode 100644
index 0000000000..69849d3c7a
--- /dev/null
+++ b/tests/system-test/5-taos-tools/TD-12478.py
@@ -0,0 +1,151 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import random
+import string
+import os
+import sys
+import time
+import taos
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+from util.dnodes import tdDnodes
+from util.dnodes import *
+import itertools
+from itertools import product
+from itertools import combinations
+from faker import Faker
+import subprocess
+
+class TDTestCase:
+ def caseDescription(self):
+ '''
+ case1[TD-12434]:taosdump null nchar/binary length can cause core:taos-tools/src/taosdump.c
+ case2[TD-12478]:taos_stmt_execute() failed! reason: WAL size exceeds limit
+ '''
+ return
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ os.system("rm -rf 5-taos-tools/TD-12478.py.sql")
+ os.system("rm db*")
+ os.system("rm dump_result.txt*")
+
+ def restartDnodes(self):
+ tdDnodes.stop(1)
+ tdDnodes.start(1)
+
+ def dropandcreateDB_random(self,n):
+ self.ts = 1630000000000
+
+ fake = Faker('zh_CN')
+ self.num_random = fake.random_int(min=1000, max=5000, step=1)
+ print(self.num_random)
+ for i in range(n):
+ tdSql.execute('''drop database if exists db ;''')
+ tdSql.execute('''create database db keep 36500;''')
+ tdSql.execute('''use db;''')
+
+ tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+ tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+
+ tdSql.execute('''create table table_1 using stable_1 tags('table_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
+ tdSql.execute('''create table table_2 using stable_1 tags('table_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\')''')
+ tdSql.execute('''create table table_3 using stable_1 tags('table_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\')''')
+ tdSql.execute('''create table table_21 using stable_2 tags('table_21' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
+
+ #regular table
+ tdSql.execute('''create table regular_table_1 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+ tdSql.execute('''create table regular_table_2 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+ tdSql.execute('''create table regular_table_3 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+
+
+ for i in range(self.num_random):
+ tdSql.execute('''insert into table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1),
+ fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+ tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=-2147483647, max=2147483647, step=1) ,
+ fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1) ,
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+
+ tdSql.execute('''insert into table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+ tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+
+ tdSql.execute('''insert into table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
+ fake.random_int(min=-9223372036854775807, max=0, step=1),
+ fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+ tdSql.execute('''insert into regular_table_3 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts) values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d)'''
+ % (self.ts + i*1000, fake.random_int(min=-2147483647, max=0, step=1),
+ fake.random_int(min=-9223372036854775807, max=0, step=1),
+ fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , self.ts + i))
+
+ tdSql.query("select count(*) from stable_1;")
+ tdSql.checkData(0,0,3*self.num_random)
+ tdSql.query("select count(*) from regular_table_1;")
+ tdSql.checkData(0,0,self.num_random)
+
+ def run(self):
+ tdSql.prepare()
+
+ dcDB = self.dropandcreateDB_random(1)
+
+ assert os.system("taosdump -D db") == 0
+
+ assert os.system("taosdump -i . -g") == 0
+
+ tdSql.query("select count(*) from stable_1;")
+ tdSql.checkData(0,0,3*self.num_random)
+ tdSql.query("select count(*) from regular_table_1;")
+ tdSql.checkData(0,0,self.num_random)
+ tdSql.query("select count(*) from regular_table_2;")
+ tdSql.checkData(0,0,self.num_random)
+ tdSql.query("select count(*) from regular_table_3;")
+ tdSql.checkData(0,0,self.num_random)
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py b/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py
new file mode 100644
index 0000000000..eb4de435ec
--- /dev/null
+++ b/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py
@@ -0,0 +1,1291 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import taos
+import time
+import os
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+
+
+class TDTestCase:
+ def caseDescription(self):
+ '''
+ case1:[TD-10540]The escape char "`" can be used for both tag name and column name
+ case2:[TD-12435]create table as cause column error;
+ '''
+ return
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.tmpdir = "tmp"
+ now = time.time()
+ self.ts = int(round(now * 1000))
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ buildPath = ""
+ for root, dirs, files in os.walk(projPath):
+ if ("taosdump" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root) - len("/build/bin")]
+ break
+ return buildPath
+
+ def table1_checkall(self, sql):
+ tdLog.info(sql)
+ tdSql.query(sql)
+ tdSql.checkData(0, 1, 1)
+ tdSql.checkData(0, 2, 2)
+ tdSql.checkData(0, 3, 3)
+ tdSql.checkData(0, 4, 4)
+ tdSql.checkData(0, 5, 'True')
+ tdSql.checkData(0, 6, 6)
+ tdSql.checkData(0, 7, 7)
+ tdSql.checkData(0, 8, 8)
+ tdSql.checkData(0, 9, 9)
+ tdSql.checkData(0, 10, '1970-01-01 08:00:00.010')
+
+ def table1_checkall_1(self, sql):
+ tdSql.query(sql)
+ tdSql.checkData(0, 1, 1)
+
+ def table1_checkall_2(self, sql):
+ self.table1_checkall_1(sql)
+ tdSql.checkData(0, 2, 2)
+
+ def table1_checkall_3(self, sql):
+ self.table1_checkall_2(sql)
+ tdSql.checkData(0, 3, 3)
+
+ def table1_checkall_4(self, sql):
+ self.table1_checkall_3(sql)
+ tdSql.checkData(0, 4, 4)
+
+ def table1_checkall_5(self, sql):
+ self.table1_checkall_4(sql)
+ tdSql.checkData(0, 5, 'True')
+
+ def table1_checkall_6(self, sql):
+ self.table1_checkall_5(sql)
+ tdSql.checkData(0, 6, 6)
+
+ def table1_checkall_7(self, sql):
+ self.table1_checkall_6(sql)
+ tdSql.checkData(0, 7, 7)
+
+ def table1_checkall_8(self, sql):
+ self.table1_checkall_7(sql)
+ tdSql.checkData(0, 8, 8)
+
+ def table1_checkall_9(self, sql):
+ self.table1_checkall_8(sql)
+ tdSql.checkData(0, 9, 9)
+
+ def table1_checkall_10(self, sql):
+ self.table1_checkall_9(sql)
+ tdSql.checkData(0, 10, '1970-01-01 08:00:00.010')
+
+ def run(self):
+
+ testcaseFilename = os.path.split(__file__)[-1]
+ os.system("rm -rf 5-taos-tools/%s.sql" % testcaseFilename)
+ os.system("rm %s/db*" % self.tmpdir)
+ os.system("rm dump_result.txt*")
+ tdSql.prepare()
+
+ print("==============step1")
+ print("prepare data")
+
+ tdSql.execute("create database db2")
+ tdSql.execute("use db2")
+
+ print(
+ "==============new version [escape character] for stable==============")
+ print("==============step1,#create db.stable,db.table; insert db.table; show db.table; select db.table; drop db.table;")
+ print("prepare data")
+
+ self.stb1 = "stable_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
+ self.tb1 = "table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
+
+ self.col_base = "123~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
+
+ self.col_int = "stable_col_int%s" % self.col_base
+ print(self.col_int)
+ self.col_bigint = "stable_col_bigint%s" % self.col_base
+ self.col_smallint = "stable_col_smallint%s" % self.col_base
+ self.col_tinyint = "stable_col_tinyint%s" % self.col_base
+ self.col_bool = "stable_col_bool%s" % self.col_base
+ self.col_binary = "stable_col_binary%s" % self.col_base
+ self.col_nchar = "stable_col_nchar%s" % self.col_base
+ self.col_float = "stable_col_float%s" % self.col_base
+ self.col_double = "stable_col_double%s" % self.col_base
+ self.col_ts = "stable_col_ts%s" % self.col_base
+
+ self.tag_base = "abc~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
+ self.tag_int = "stable_tag_int%s" % self.tag_base
+ self.tag_bigint = "stable_tag_bigint%s" % self.tag_base
+ self.tag_smallint = "stable_tag_smallint%s" % self.tag_base
+ self.tag_tinyint = "stable_tag_tinyint%s" % self.tag_base
+ self.tag_bool = "stable_tag_bool%s" % self.tag_base
+ self.tag_binary = "stable_tag_binary%s" % self.tag_base
+ self.tag_nchar = "stable_tag_nchar%s" % self.tag_base
+ self.tag_float = "stable_tag_float%s" % self.tag_base
+ self.tag_double = "stable_tag_double%s" % self.tag_base
+ self.tag_ts = "stable_tag_ts%s" % self.tag_base
+
+ tdSql.execute('''create stable db.`%s` (ts timestamp, `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
+ `%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp)
+ tags(loc nchar(20), `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
+ `%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp);'''
+ % (self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
+ self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
+ self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
+ tdSql.query("describe db.`%s` ; " % self.stb1)
+ tdSql.checkRows(22)
+
+ tdSql.query("select count(*) from db.`%s` ; " % self.stb1)
+ tdSql.checkRows(0)
+
+ tdSql.query("show create stable db.`%s` ; " % self.stb1)
+ tdSql.checkData(0, 0, self.stb1)
+ tdSql.checkData(0, 1, "CREATE TABLE `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)\
+ TAGS (`loc` NCHAR(20),`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
+ % (self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
+ self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
+ self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
+
+ tdSql.execute(
+ "create table db.`table!1` using db.`%s` tags('table_1' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')" %
+ self.stb1)
+ tdSql.query("describe db.`table!1` ; ")
+ tdSql.checkRows(22)
+
+ time.sleep(10)
+ tdSql.query("show create table db.`table!1` ; ")
+ tdSql.checkData(0, 0, "table!1")
+ tdSql.checkData(
+ 0,
+ 1,
+ "CREATE TABLE `table!1` USING `%s` TAGS (\"table_1\",0,0,0,0,false,\"0\",\"0\",0.000000,0.000000,\"0\")" %
+ self.stb1)
+
+ tdSql.execute(
+ "insert into db.`table!1` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)")
+ sql = " select * from db.`table!1`; "
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+ sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`table!1`; '''\
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+
+ time.sleep(1)
+ tdSql.execute('''insert into db.`table!1`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+ sql = " select * from db.`table!1`; "
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ tdSql.query("select count(*) from db.`table!1`; ")
+ tdSql.checkData(0, 0, 2)
+ tdSql.query("select count(*) from db.`%s` ; " % self.stb1)
+ tdSql.checkRows(1)
+
+ tdSql.execute(
+ "create table db.`%s` using db.`%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %
+ (self.tb1, self.stb1))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.query("show create table db.`%s` ; " % self.tb1)
+ tdSql.checkData(0, 0, self.tb1)
+ tdSql.checkData(
+ 0,
+ 1,
+ "CREATE TABLE `%s` USING `%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %
+ (self.tb1,
+ self.stb1))
+
+ tdSql.execute(
+ "insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.tb1)
+ sql = "select * from db.`%s` ; " % self.tb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+ sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s` ; '''\
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool, self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts, self.tb1)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+
+ time.sleep(1)
+ tdSql.execute('''insert into db.`%s`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''
+ % (self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+ sql = " select * from db.`%s` ; " % self.tb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ sql = " select * from db.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
+ % (self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ tdSql.query("select count(*) from db.`%s`; " % self.tb1)
+ tdSql.checkData(0, 0, 2)
+ sql = "select * from db.`%s` ; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(4)
+ tdSql.query("select count(*) from db.`%s`; " % self.stb1)
+ tdSql.checkData(0, 0, 4)
+
+ sql = "select * from (select * from db.`%s`) ; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(4)
+ tdSql.query(
+ "select count(*) from (select * from db.`%s`) ; " %
+ self.stb1)
+ tdSql.checkData(0, 0, 4)
+
+ sql = "select * from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(4)
+
+ sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(4)
+
+ sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`\
+ where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(4)
+
+ tdSql.query("show db.stables like 'stable_1%' ")
+ tdSql.checkRows(1)
+ tdSql.query("show db.tables like 'table%' ")
+ tdSql.checkRows(2)
+
+ self.cr_tb1 = "create_table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
+ tdSql.execute(
+ "create table db.`%s` as select avg(`%s`) from db.`%s` where ts > now interval(1m) sliding(30s);" %
+ (self.cr_tb1, self.col_bigint, self.stb1))
+ tdSql.query("show db.tables like 'create_table_%' ")
+ tdSql.checkRows(1)
+
+ print(r"==============drop\ add\ change\ modify column or tag")
+ print("==============drop==============")
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_ts))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(21)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_double))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(20)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_float))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(19)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_nchar))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(18)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_binary))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(17)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_bool))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(16)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_tinyint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(15)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_smallint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(14)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_bigint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(13)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP TAG `%s`; " %
+ (self.stb1, self.tag_int))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(12)
+
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_ts))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_9(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(11)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_double))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_8(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_float))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_7(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_nchar))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_6(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(8)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_binary))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_5(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(7)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_bool))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_4(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_tinyint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_3(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_smallint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_2(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(4)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_bigint))
+ sql = " select * from db.`%s`; " % self.stb1
+ datacheck = self.table1_checkall_1(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(3)
+ tdSql.error(
+ "ALTER TABLE db.`%s` DROP COLUMN `%s`; " %
+ (self.stb1, self.col_int))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(3)
+
+ print("==============add==============")
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` bigint; " %
+ (self.stb1, self.col_bigint))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(4)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` smallint; " %
+ (self.stb1, self.col_smallint))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` tinyint; " %
+ (self.stb1, self.col_tinyint))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` bool; " %
+ (self.stb1, self.col_bool))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(7)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` binary(20); " %
+ (self.stb1, self.col_binary))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(8)
+
+ tdSql.execute(
+ "insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %
+ self.tb1)
+ sql = "select * from db.`%s` order by ts desc; " % self.tb1
+ datacheck = self.table1_checkall_5(sql)
+
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` nchar(20); " %
+ (self.stb1, self.col_nchar))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` float; " %
+ (self.stb1, self.col_float))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` double; " %
+ (self.stb1, self.col_double))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(11)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD COLUMN `%s` timestamp; " %
+ (self.stb1, self.col_ts))
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(12)
+
+ tdSql.execute(
+ "insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.tb1)
+ sql = "select * from db.`%s` order by ts desc; " % self.tb1
+ datacheck = self.table1_checkall(sql)
+
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` int; " %
+ (self.stb1, self.tag_int))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(13)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` bigint; " %
+ (self.stb1, self.tag_bigint))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(14)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` smallint; " %
+ (self.stb1, self.tag_smallint))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(15)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` tinyint; " %
+ (self.stb1, self.tag_tinyint))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(16)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` bool; " %
+ (self.stb1, self.tag_bool))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(17)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` binary(20); " %
+ (self.stb1, self.tag_binary))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(18)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` nchar(20); " %
+ (self.stb1, self.tag_nchar))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(19)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` float; " %
+ (self.stb1, self.tag_float))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(20)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` double; " %
+ (self.stb1, self.tag_double))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(21)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` ADD TAG `%s` timestamp; " %
+ (self.stb1, self.tag_ts))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+
+ print("==============change==============")
+ self.tag_base_change = "abcdas"
+ self.tag_int_change = "stable_tag_int%s" % self.tag_base_change
+ self.tag_bigint_change = "stable_tag_bigint%s" % self.tag_base_change
+ self.tag_smallint_change = "stable_tag_smallint%s" % self.tag_base_change
+ self.tag_tinyint_change = "stable_tag_tinyint%s" % self.tag_base_change
+ self.tag_bool_change = "stable_tag_bool%s" % self.tag_base_change
+ self.tag_binary_change = "stable_tag_binary%s" % self.tag_base_change
+ self.tag_nchar_change = "stable_tag_nchar%s" % self.tag_base_change
+ self.tag_float_change = "stable_tag_float%s" % self.tag_base_change
+ self.tag_double_change = "stable_tag_double%s" % self.tag_base_change
+ self.tag_ts_change = "stable_tag_ts%s" % self.tag_base_change
+
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_int, self.tag_int_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_bigint, self.tag_bigint_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_smallint, self.tag_smallint_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_tinyint, self.tag_tinyint_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_bool, self.tag_bool_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_binary, self.tag_binary_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_nchar, self.tag_nchar_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_float, self.tag_float_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_double, self.tag_double_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %
+ (self.stb1, self.tag_ts, self.tag_ts_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+
+ print("==============modify==============")
+ # TD-10810
+ tdSql.execute(
+ "ALTER STABLE db.`%s` MODIFY TAG `%s` binary(30); ; " %
+ (self.stb1, self.tag_binary_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER STABLE db.`%s` MODIFY TAG `%s` nchar(30); ; " %
+ (self.stb1, self.tag_nchar_change))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+
+ tdSql.execute(
+ "ALTER STABLE db.`%s` MODIFY COLUMN `%s` binary(30); ; " %
+ (self.stb1, self.col_binary))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+ tdSql.execute(
+ "ALTER STABLE db.`%s` MODIFY COLUMN `%s` nchar(30); ; " %
+ (self.stb1, self.col_nchar))
+ sql = " select * from db.`%s` order by ts desc; " % self.stb1
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
+
+ print(r"==============drop table\stable")
+ try:
+ tdSql.execute("drop table db.`%s` " % self.tb1)
+ except Exception as e:
+ tdLog.exit(e)
+
+ tdSql.error("select * from db.`%s`" % self.tb1)
+ tdSql.query("show db.stables like 'stable_1%' ")
+ tdSql.checkRows(1)
+
+ try:
+ tdSql.execute("drop table db.`%s` " % self.stb1)
+ except Exception as e:
+ tdLog.exit(e)
+
+ tdSql.error("select * from db.`%s`" % self.tb1)
+ tdSql.error("select * from db.`%s`" % self.stb1)
+
+ print("==============step2,#create stable,table; insert table; show table; select table; drop table")
+
+ self.stb2 = "stable_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+ self.tb2 = "table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+
+ tdSql.execute(
+ "create stable `%s` (ts timestamp, i int) tags(j int);" %
+ self.stb2)
+ tdSql.query("describe `%s` ; " % self.stb2)
+ tdSql.checkRows(3)
+
+ tdSql.query("select count(*) from `%s` ; " % self.stb2)
+ tdSql.checkRows(0)
+
+ tdSql.query("show create stable `%s` ; " % self.stb2)
+ tdSql.checkData(0, 0, self.stb2)
+ tdSql.checkData(
+ 0,
+ 1,
+ "CREATE TABLE `%s` (`ts` TIMESTAMP,`i` INT) TAGS (`j` INT)" %
+ self.stb2)
+
+ tdSql.execute("create table `table!2` using `%s` tags(1)" % self.stb2)
+ tdSql.query("describe `table!2` ; ")
+ tdSql.checkRows(3)
+
+ time.sleep(10)
+
+ tdSql.query("show create table `table!2` ; ")
+ tdSql.checkData(0, 0, "table!2")
+ tdSql.checkData(
+ 0,
+ 1,
+ "CREATE TABLE `table!2` USING `%s` TAGS (1)" %
+ self.stb2)
+ tdSql.execute("insert into `table!2` values(now, 1)")
+ tdSql.query("select * from `table!2`; ")
+ tdSql.checkRows(1)
+ tdSql.query("select count(*) from `table!2`; ")
+ tdSql.checkData(0, 0, 1)
+ tdSql.query("select count(*) from `%s` ; " % self.stb2)
+ tdSql.checkRows(1)
+
+ tdSql.execute(
+ "create table `%s` using `%s` tags(1)" %
+ (self.tb2, self.stb2))
+ tdSql.query("describe `%s` ; " % self.tb2)
+ tdSql.checkRows(3)
+ tdSql.query("show create table `%s` ; " % self.tb2)
+ tdSql.checkData(0, 0, self.tb2)
+ tdSql.checkData(
+ 0, 1, "CREATE TABLE `%s` USING `%s` TAGS (1)" %
+ (self.tb2, self.stb2))
+ tdSql.execute("insert into `%s` values(now, 1)" % self.tb2)
+ tdSql.query("select * from `%s` ; " % self.tb2)
+ tdSql.checkRows(1)
+ tdSql.query("select count(*) from `%s`; " % self.tb2)
+ tdSql.checkData(0, 0, 1)
+ tdSql.query("select * from `%s` ; " % self.stb2)
+ tdSql.checkRows(2)
+ tdSql.query("select count(*) from `%s`; " % self.stb2)
+ tdSql.checkData(0, 0, 2)
+
+ tdSql.query("select * from (select * from `%s`) ; " % self.stb2)
+ tdSql.checkRows(2)
+ tdSql.query("select count(*) from (select * from `%s` ); " % self.stb2)
+ tdSql.checkData(0, 0, 2)
+
+ tdSql.query("show stables like 'stable_2%' ")
+ tdSql.checkRows(1)
+ tdSql.query("show tables like 'table%' ")
+ tdSql.checkRows(2)
+
+ # TD-10536
+ self.cr_tb2 = "create_table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+ tdSql.execute(
+ "create table `%s` as select * from `%s` ;" %
+ (self.cr_tb2, self.stb2))
+ tdSql.query("show db.tables like 'create_table_%' ")
+ tdSql.checkRows(1)
+
+ print("==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")
+ self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+
+ self.regular_col_base = "123@#$%^&*()-_+=[]{};:,<.>/?~!$%^"
+
+ self.col_int = "regular_table_col_int%s" % self.regular_col_base
+ print(self.col_int)
+ self.col_bigint = "regular_table_col_bigint%s" % self.regular_col_base
+ self.col_smallint = "regular_table_col_smallint%s" % self.regular_col_base
+ self.col_tinyint = "regular_table_col_tinyint%s" % self.regular_col_base
+ self.col_bool = "regular_table_col_bool%s" % self.regular_col_base
+ self.col_binary = "regular_table_col_binary%s" % self.regular_col_base
+ self.col_nchar = "regular_table_col_nchar%s" % self.regular_col_base
+ self.col_float = "regular_table_col_float%s" % self.regular_col_base
+ self.col_double = "regular_table_col_double%s" % self.regular_col_base
+ self.col_ts = "regular_table_col_ts%s" % self.regular_col_base
+
+ tdSql.execute("create table `%s` (ts timestamp,`%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool , \
+ `%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp) ;"
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
+ self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ tdSql.query("select count(*) from `%s` ; " % self.regular_table)
+ tdSql.checkRows(1)
+
+ tdSql.query("show create table `%s` ; " % self.regular_table)
+ tdSql.checkData(0, 0, self.regular_table)
+ tdSql.checkData(0, 1, "CREATE TABLE `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
+ self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+
+ tdSql.execute(
+ "insert into `%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.regular_table)
+ sql = "select * from `%s` ; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+ sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`; '''\
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(1)
+
+ time.sleep(1)
+ tdSql.execute('''insert into db2.`%s` (ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ sql = " select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ tdSql.query("select count(*) from `%s`; " % self.regular_table)
+ tdSql.checkData(0, 0, 2)
+ tdSql.query("select count(*) from `%s` ; " % self.regular_table)
+ tdSql.checkRows(1)
+
+ sql = "select * from (select * from `%s`) ; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`\
+ where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(2)
+
+ tdSql.query(
+ "select count(*) from (select * from `%s` ); " %
+ self.regular_table)
+ tdSql.checkData(0, 0, 2)
+
+ tdSql.query("show tables like 'regular_table%' ")
+ tdSql.checkRows(1)
+
+ self.crr_tb = "create_r_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+ tdSql.execute(
+ "create table `%s` as select * from `%s` ;" %
+ (self.crr_tb, self.regular_table))
+ tdSql.query("show db2.tables like 'create_r_table%' ")
+ tdSql.checkRows(1)
+
+ print(r"==============drop\ add\ change\ modify column ")
+ print("==============drop==============")
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_ts))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall_9(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_double))
+ sql = " select * from `%s`; " % self.regular_table
+ datacheck = self.table1_checkall_8(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_float))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall_7(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(8)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_nchar))
+ sql = " select * from `%s`; " % self.regular_table
+ datacheck = self.table1_checkall_6(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(7)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_binary))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall_5(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_bool))
+ sql = " select * from `%s`; " % self.regular_table
+ datacheck = self.table1_checkall_4(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_tinyint))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall_3(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(4)
+ tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_smallint))
+ sql = " select * from `%s`; " % self.regular_table
+ datacheck = self.table1_checkall_2(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(3)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_bigint))
+ sql = " select * from db2.`%s`; " % self.regular_table
+ datacheck = self.table1_checkall_1(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(2)
+ tdSql.error(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_int))
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(2)
+
+ print("==============add==============")
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` bigint; " %
+ (self.regular_table, self.col_bigint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(3)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` smallint; " %
+ (self.regular_table, self.col_smallint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(4)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` tinyint; " %
+ (self.regular_table, self.col_tinyint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` bool; " %
+ (self.regular_table, self.col_bool))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` binary(20); " %
+ (self.regular_table, self.col_binary))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(7)
+
+ tdSql.execute(
+ "insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %
+ self.regular_table)
+ sql = "select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_5(sql)
+
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` nchar(20); " %
+ (self.regular_table, self.col_nchar))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(8)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` float; " %
+ (self.regular_table, self.col_float))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` double; " %
+ (self.regular_table, self.col_double))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` timestamp; " %
+ (self.regular_table, self.col_ts))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ tdSql.execute(
+ "insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.regular_table)
+ sql = "select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+
+ print("==============change, regular not support==============")
+
+ print("==============modify==============")
+ # TD-10810
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` MODIFY COLUMN `%s` binary(30); ; " %
+ (self.regular_table, self.col_binary))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+ tdSql.execute(
+ "ALTER TABLE `%s` MODIFY COLUMN `%s` nchar(30); ; " %
+ (self.regular_table, self.col_nchar))
+ sql = " select * from `%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ buildPath = self.getBuildPath()
+ if (buildPath == ""):
+ tdLog.exit("taosdump not found!")
+ else:
+ tdLog.info("taosdump found in %s" % buildPath)
+ binPath = buildPath + "/build/bin/"
+
+ if not os.path.exists(self.tmpdir):
+ os.makedirs(self.tmpdir)
+ else:
+ print("directory exists")
+ os.system("rm -rf %s" % self.tmpdir)
+ os.makedirs(self.tmpdir)
+
+ print("==============step4,#taosdump out ; drop db ; taosdumo in")
+ assert os.system(
+ "%staosdump -D db2 -o %s" %
+ (binPath, self.tmpdir)) == 0
+
+ tdSql.execute('''drop database if exists db2 ;''')
+
+ assert os.system("%staosdump -i %s -g" % (binPath, self.tmpdir)) == 0
+
+ print("==============step5,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")
+ self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
+
+ self.regular_col_base = "123@#$%^&*()-_+=[]{};:,<.>/?~!$%^"
+
+ self.col_int = "regular_table_col_int%s" % self.regular_col_base
+ print(self.col_int)
+ self.col_bigint = "regular_table_col_bigint%s" % self.regular_col_base
+ self.col_smallint = "regular_table_col_smallint%s" % self.regular_col_base
+ self.col_tinyint = "regular_table_col_tinyint%s" % self.regular_col_base
+ self.col_bool = "regular_table_col_bool%s" % self.regular_col_base
+ self.col_binary = "regular_table_col_binary%s" % self.regular_col_base
+ self.col_nchar = "regular_table_col_nchar%s" % self.regular_col_base
+ self.col_float = "regular_table_col_float%s" % self.regular_col_base
+ self.col_double = "regular_table_col_double%s" % self.regular_col_base
+ self.col_ts = "regular_table_col_ts%s" % self.regular_col_base
+
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ tdSql.query("select count(*) from `%s` ; " % self.regular_table)
+ tdSql.checkRows(1)
+
+ tdSql.query("show create table `%s` ; " % self.regular_table)
+ tdSql.checkData(0, 0, self.regular_table)
+ tdSql.checkData(0, 1, "CREATE TABLE `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(30),`%s` NCHAR(30),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
+ self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+
+ tdSql.execute(
+ "insert into `%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.regular_table)
+ sql = "select * from `%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(5)
+ sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s` order by ts desc; '''\
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table)
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(5)
+
+ time.sleep(1)
+ tdSql.execute('''insert into db2.`%s` (ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(6)
+
+ sql = " select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
+ % (self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+# CBD tdSql.checkRows(3)
+
+ tdSql.query(
+ "select count(*) from `%s` order by ts desc; " %
+ self.regular_table)
+ tdSql.checkData(0, 0, 6)
+ tdSql.query("select count(*) from `%s` ; " % self.regular_table)
+ tdSql.checkRows(1)
+
+ sql = "select * from (select * from `%s` order by ts desc) ; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.checkRows(6)
+
+ sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`\
+ where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
+ % (self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table,
+ self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
+ datacheck = self.table1_checkall(sql)
+# CBD tdSql.checkRows(3)
+
+ tdSql.query(
+ "select count(*) from (select * from `%s` ); " %
+ self.regular_table)
+ tdSql.checkData(0, 0, 6)
+
+ tdSql.query("show tables like 'regular_table%' ")
+ tdSql.checkRows(1)
+
+ tdSql.query("show db2.tables like 'create_r_table%' ")
+ tdSql.checkRows(1)
+
+ print(r"==============drop\ add\ change\ modify column ")
+ print("==============drop==============")
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_ts))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_9(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_double))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_8(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_float))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_7(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(8)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_nchar))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_6(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(7)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_binary))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_5(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_bool))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_4(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_tinyint))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_3(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(4)
+ tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_smallint))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_2(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(3)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_bigint))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_1(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(2)
+ tdSql.error(
+ "ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %
+ (self.regular_table, self.col_int))
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(2)
+
+ print("==============add==============")
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` bigint; " %
+ (self.regular_table, self.col_bigint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(3)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` smallint; " %
+ (self.regular_table, self.col_smallint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(4)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` tinyint; " %
+ (self.regular_table, self.col_tinyint))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(5)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` bool; " %
+ (self.regular_table, self.col_bool))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(6)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` binary(20); " %
+ (self.regular_table, self.col_binary))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(7)
+
+ tdSql.execute(
+ "insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %
+ self.regular_table)
+ sql = "select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall_5(sql)
+
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` nchar(20); " %
+ (self.regular_table, self.col_nchar))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(8)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` float; " %
+ (self.regular_table, self.col_float))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(9)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` double; " %
+ (self.regular_table, self.col_double))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(10)
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` ADD COLUMN `%s` timestamp; " %
+ (self.regular_table, self.col_ts))
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ tdSql.execute(
+ "insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %
+ self.regular_table)
+ sql = "select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+
+ print("==============change, regular not support==============")
+
+ print("==============modify==============")
+ # TD-10810
+ tdSql.execute(
+ "ALTER TABLE db2.`%s` MODIFY COLUMN `%s` binary(40); ; " %
+ (self.regular_table, self.col_binary))
+ sql = " select * from db2.`%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe db2.`%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+ tdSql.execute(
+ "ALTER TABLE `%s` MODIFY COLUMN `%s` nchar(40); ; " %
+ (self.regular_table, self.col_nchar))
+ sql = " select * from `%s` order by ts desc; " % self.regular_table
+ datacheck = self.table1_checkall(sql)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
+
+ os.system("rm %s/db*" % self.tmpdir)
+ os.system("rm dump_result.txt*")
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py
index e9b032c003..3736166a83 100644
--- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py
+++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py
@@ -68,7 +68,7 @@ class TDTestCase:
def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole):
tdLog.printNoPrefix("======== test case 1: ")
paraDict = {'dbName': 'db',
- 'dbNumbers': 8,
+ 'dbNumbers': 6,
'dropFlag': 1,
'event': '',
'vgroups': 2,
@@ -98,10 +98,10 @@ class TDTestCase:
# fisr add three mnodes;
tdLog.info("fisr add three mnodes and check mnode status")
- tdSql.info("create mnode on dnode 2")
+ tdLog.info("create mnode on dnode 2")
tdSql.execute("create mnode on dnode 2")
clusterComCheck.checkMnodeStatus(2)
- tdSql.info("create mnode on dnode 3")
+ tdLog.info("create mnode on dnode 3")
tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3)
@@ -161,7 +161,7 @@ class TDTestCase:
tdLog.info("check dnode number:")
clusterComCheck.checkDnodes(dnodeNumbers)
tdSql.query("show databases")
- tdLog.debug("we find %d databases but exepect to create %d databases "%(tdSql.queryRows-2,allDbNumbers-2))
+ tdLog.debug("we find %d databases but exepect to create %d databases "%(tdSql.queryRows-2,allDbNumbers))
# tdLog.info("check DB Rows:")
# clusterComCheck.checkDbRows(allDbNumbers)
@@ -172,7 +172,7 @@ class TDTestCase:
def run(self):
# print(self.master_dnode.cfgDict)
- self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=10,stopRole='mnode')
+ self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=5,stopRole='mnode')
def stop(self):
tdSql.close()
diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
index 99efabd8ea..ea8e9612a2 100644
--- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
+++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
@@ -159,7 +159,7 @@ class TDTestCase:
tdLog.info("check dnode number:")
clusterComCheck.checkDnodes(dnodeNumbers)
tdSql.query("show databases")
- tdLog.debug("we find %d databases but exepect to create %d databases "%(tdSql.queryRows-2,allDbNumbers-2))
+ tdLog.debug("we find %d databases but exepect to create %d databases "%(tdSql.queryRows-2,allDbNumbers))
# tdLog.info("check DB Rows:")
# clusterComCheck.checkDbRows(allDbNumbers)
@@ -170,7 +170,7 @@ class TDTestCase:
def run(self):
# print(self.master_dnode.cfgDict)
- self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode')
+ self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=3,stopRole='mnode')
def stop(self):
tdSql.close()
diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh
index 3fc38ac898..f44e81433d 100755
--- a/tests/system-test/fulltest.sh
+++ b/tests/system-test/fulltest.sh
@@ -27,14 +27,14 @@ python3 ./test.py -f 1-insert/alter_stable.py
python3 ./test.py -f 1-insert/alter_table.py
python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
python3 ./test.py -f 1-insert/table_comment.py
-python3 ./test.py -f 1-insert/time_range_wise.py
+#python3 ./test.py -f 1-insert/time_range_wise.py #TD-18130
python3 ./test.py -f 1-insert/block_wise.py
python3 ./test.py -f 1-insert/create_retentions.py
python3 ./test.py -f 1-insert/table_param_ttl.py
python3 ./test.py -f 1-insert/mutil_stage.py
python3 ./test.py -f 1-insert/update_data_muti_rows.py
-
+python3 ./test.py -f 1-insert/db_tb_name_check.py
python3 ./test.py -f 2-query/abs.py
python3 ./test.py -f 2-query/abs.py -R
@@ -60,8 +60,8 @@ python3 ./test.py -f 2-query/ceil.py
python3 ./test.py -f 2-query/ceil.py -R
python3 ./test.py -f 2-query/char_length.py
python3 ./test.py -f 2-query/char_length.py -R
-# python3 ./test.py -f 2-query/check_tsdb.py
-# python3 ./test.py -f 2-query/check_tsdb.py -R
+python3 ./test.py -f 2-query/check_tsdb.py
+python3 ./test.py -f 2-query/check_tsdb.py -R
python3 ./test.py -f 2-query/concat.py
python3 ./test.py -f 2-query/concat.py -R
python3 ./test.py -f 2-query/concat_ws.py
@@ -173,8 +173,9 @@ python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3
-# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3
+python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3
@@ -195,15 +196,15 @@ python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
# vnode case
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_force_stop_all_dnodes.py -N 4 -M 1
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_all_vnode.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_follower.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys_loop_restart_leader.py -N 4 -M 1
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_all_dnodes.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_sync.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py -N 4 -M 1
@@ -215,7 +216,7 @@ python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader_force_stop.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_leader.py -N 4 -M 1
-# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1
+python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups_stopOne.py -N 4 -M 1
diff --git a/tools/shell/src/shellCommand.c b/tools/shell/src/shellCommand.c
index 1af6ee4c06..d87e10fd08 100644
--- a/tools/shell/src/shellCommand.c
+++ b/tools/shell/src/shellCommand.c
@@ -525,7 +525,11 @@ int32_t shellReadCommand(char *command) {
switch (c) {
case 'A': // Up arrow
hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE - 1) % SHELL_MAX_HISTORY_SIZE;
- shellResetCommand(&cmd, (pHistory->hist[hist_counter] == NULL) ? "" : pHistory->hist[hist_counter]);
+ if (pHistory->hist[hist_counter] == NULL) {
+ hist_counter = (hist_counter + SHELL_MAX_HISTORY_SIZE + 1) % SHELL_MAX_HISTORY_SIZE;
+ } else {
+ shellResetCommand(&cmd, pHistory->hist[hist_counter]);
+ }
break;
case 'B': // Down arrow
if (hist_counter != pHistory->hend) {
diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c
index fee2325c34..2dcab04b3f 100644
--- a/tools/shell/src/shellWebsocket.c
+++ b/tools/shell/src/shellWebsocket.c
@@ -33,10 +33,11 @@ int shell_conn_ws_server(bool first) {
return 0;
}
-static int horizontalPrintWebsocket(WS_RES* wres) {
+static int horizontalPrintWebsocket(WS_RES* wres, double* execute_time) {
const void* data = NULL;
int rows;
ws_fetch_block(wres, &data, &rows);
+ *execute_time += (double)(ws_take_timing(wres)/1E6);
if (!rows) {
return 0;
}
@@ -72,10 +73,11 @@ static int horizontalPrintWebsocket(WS_RES* wres) {
return numOfRows;
}
-static int verticalPrintWebsocket(WS_RES* wres) {
+static int verticalPrintWebsocket(WS_RES* wres, double* pexecute_time) {
int rows = 0;
const void* data = NULL;
ws_fetch_block(wres, &data, &rows);
+ *pexecute_time += (double)(ws_take_timing(wres)/1E6);
if (!rows) {
return 0;
}
@@ -112,7 +114,7 @@ static int verticalPrintWebsocket(WS_RES* wres) {
return numOfRows;
}
-static int dumpWebsocketToFile(const char* fname, WS_RES* wres) {
+static int dumpWebsocketToFile(const char* fname, WS_RES* wres, double* pexecute_time) {
char fullname[PATH_MAX] = {0};
if (taosExpandDir(fname, fullname, PATH_MAX) != 0) {
tstrncpy(fullname, fname, PATH_MAX);
@@ -127,6 +129,7 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres) {
int rows = 0;
const void* data = NULL;
ws_fetch_block(wres, &data, &rows);
+ *pexecute_time += (double)(ws_take_timing(wres)/1E6);
if (!rows) {
taosCloseFile(&pFile);
return 0;
@@ -162,14 +165,14 @@ static int dumpWebsocketToFile(const char* fname, WS_RES* wres) {
return numOfRows;
}
-static int shellDumpWebsocket(WS_RES *wres, char *fname, int *error_no, bool vertical) {
+static int shellDumpWebsocket(WS_RES *wres, char *fname, int *error_no, bool vertical, double* pexecute_time) {
int numOfRows = 0;
if (fname != NULL) {
- numOfRows = dumpWebsocketToFile(fname, wres);
+ numOfRows = dumpWebsocketToFile(fname, wres, pexecute_time);
} else if (vertical) {
- numOfRows = verticalPrintWebsocket(wres);
+ numOfRows = verticalPrintWebsocket(wres, pexecute_time);
} else {
- numOfRows = horizontalPrintWebsocket(wres);
+ numOfRows = horizontalPrintWebsocket(wres, pexecute_time);
}
*error_no = ws_errno(wres);
return numOfRows;
@@ -225,6 +228,8 @@ void shellRunSingleCommandWebsocketImp(char *command) {
return;
}
+ double execute_time = ws_take_timing(res)/1E6;
+
if (shellRegexMatch(command, "^\\s*use\\s+[a-zA-Z0-9_]+\\s*;\\s*$", REG_EXTENDED | REG_ICASE)) {
fprintf(stdout, "Database changed.\r\n\r\n");
fflush(stdout);
@@ -236,22 +241,27 @@ void shellRunSingleCommandWebsocketImp(char *command) {
if (ws_is_update_query(res)) {
numOfRows = ws_affected_rows(res);
et = taosGetTimestampUs();
- printf("Query Ok, %d of %d row(s) in database (%.6fs)\n", numOfRows, numOfRows,
- (et - st)/1E6);
+ double total_time = (et - st)/1E3;
+ double net_time = total_time - (double)execute_time;
+ printf("Query Ok, %d of %d row(s) in database\n", numOfRows, numOfRows);
+ printf("Execute: %.2f ms Network: %.2f ms Total: %.2f ms\n", execute_time, net_time, total_time);
} else {
int error_no = 0;
- numOfRows = shellDumpWebsocket(res, fname, &error_no, printMode);
+ numOfRows = shellDumpWebsocket(res, fname, &error_no, printMode, &execute_time);
if (numOfRows < 0) {
ws_free_result(res);
return;
}
et = taosGetTimestampUs();
+ double total_time = (et - st) / 1E3;
+ double net_time = total_time - execute_time;
if (error_no == 0 && !shell.stop_query) {
- printf("Query OK, %d row(s) in set (%.6fs)\n", numOfRows,
- (et - st)/1E6);
+ printf("Query OK, %d row(s) in set\n", numOfRows);
+ printf("Execute: %.2f ms Network: %.2f ms Total: %.2f ms\n", execute_time, net_time, total_time);
} else {
printf("Query interrupted, %d row(s) in set (%.6fs)\n", numOfRows,
(et - st)/1E6);
+ printf("Execute: %.2f ms Network: %.2f ms Total: %.2f ms\n", execute_time, net_time, total_time);
}
}
printf("\n");