diff --git a/Jenkinsfile b/Jenkinsfile
index 3bbb744b0a87e6bfa632ff7ff970a25c4706e5df..bb757d6624bdc7e8d1ecd4735645f7716e0b943d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -8,6 +8,7 @@ def skipbuild = 0
def win_stop = 0
def scope = []
def mod = [0,1,2,3,4]
+def sim_mod = [0,1,2,3]
def abortPreviousBuilds() {
def currentJobName = env.JOB_NAME
@@ -382,7 +383,9 @@ pipeline {
temp = (gitlog =~ /\((.*?)\)/)
temp = temp[0].remove(1)
scope = temp.split(",")
+ scope = ['connector','query','insert','other','tools','taosAdapter']
Collections.shuffle mod
+ Collections.shuffle sim_mod
}
}
@@ -400,7 +403,7 @@ pipeline {
}
parallel {
stage('python_1') {
- agent{label " slave1 || slave6 || slave11 || slave16 "}
+ agent{label " slave1 || slave11 "}
steps {
pre_test()
timeout(time: 100, unit: 'MINUTES'){
@@ -417,7 +420,7 @@ pipeline {
}
}
stage('python_2') {
- agent{label " slave2 || slave7 || slave12 || slave17 "}
+ agent{label " slave2 || slave12 "}
steps {
pre_test()
timeout(time: 100, unit: 'MINUTES'){
@@ -434,7 +437,7 @@ pipeline {
}
}
stage('python_3') {
- agent{label " slave3 || slave8 || slave13 ||slave18 "}
+ agent{label " slave3 || slave13 "}
steps {
timeout(time: 105, unit: 'MINUTES'){
pre_test()
@@ -451,7 +454,7 @@ pipeline {
}
}
stage('python_4') {
- agent{label " slave4 || slave9 || slave14 || slave19 "}
+ agent{label " slave4 || slave14 "}
steps {
timeout(time: 100, unit: 'MINUTES'){
pre_test()
@@ -469,7 +472,7 @@ pipeline {
}
}
stage('python_5') {
- agent{label " slave5 || slave10 || slave15 || slave20 "}
+ agent{label " slave5 || slave15 "}
steps {
timeout(time: 100, unit: 'MINUTES'){
pre_test()
@@ -486,35 +489,98 @@ pipeline {
}
}
}
- stage('arm64centos7') {
- agent{label " arm64centos7 "}
+ stage('sim_1') {
+ agent{label " slave6 || slave16 "}
steps {
- pre_test_noinstall()
- }
+ pre_test()
+ timeout(time: 100, unit: 'MINUTES'){
+ sh """
+ date
+ cd ${WKC}/tests
+ ./test-CI.sh sim 4 ${sim_mod[0]}
+ date"""
+ }
+ }
}
- stage('arm64centos8') {
- agent{label " arm64centos8 "}
+ stage('sim_2') {
+ agent{label " slave7 || slave17 "}
steps {
- pre_test_noinstall()
+ pre_test()
+ timeout(time: 100, unit: 'MINUTES'){
+ sh """
+ date
+ cd ${WKC}/tests
+ ./test-CI.sh sim 4 ${sim_mod[1]}
+ date"""
}
+ }
}
- stage('arm32bionic') {
- agent{label " arm32bionic "}
+ stage('sim_3') {
+ agent{label " slave8 || slave18 "}
steps {
- pre_test_noinstall()
+ timeout(time: 105, unit: 'MINUTES'){
+ pre_test()
+ sh """
+ date
+ cd ${WKC}/tests
+ ./test-CI.sh sim 4 ${sim_mod[2]}
+ date"""
}
+ }
}
- stage('arm64bionic') {
- agent{label " arm64bionic "}
+ stage('sim_4') {
+ agent{label " slave9 || slave19 "}
steps {
- pre_test_noinstall()
+ timeout(time: 100, unit: 'MINUTES'){
+ pre_test()
+ sh """
+ date
+ cd ${WKC}/tests
+ ./test-CI.sh sim 4 ${sim_mod[3]}
+ date"""
+ }
}
+
}
- stage('arm64focal') {
- agent{label " arm64focal "}
+ stage('other') {
+ agent{label " slave10 || slave20 "}
steps {
- pre_test_noinstall()
+ timeout(time: 100, unit: 'MINUTES'){
+ pre_test()
+ timeout(time: 60, unit: 'MINUTES'){
+ sh '''
+ cd ${WKC}/tests/pytest
+ ./crash_gen.sh -a -p -t 4 -s 2000
+ '''
+ }
+ timeout(time: 60, unit: 'MINUTES'){
+ sh '''
+ cd ${WKC}/tests/pytest
+ rm -rf /var/lib/taos/*
+ rm -rf /var/log/taos/*
+ ./handle_crash_gen_val_log.sh
+ '''
+ sh '''
+ cd ${WKC}/tests/pytest
+ rm -rf /var/lib/taos/*
+ rm -rf /var/log/taos/*
+ ./handle_taosd_val_log.sh
+ '''
+ }
+ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
+ sh '''
+ cd ${WKC}/tests/pytest
+ ./valgrind-test.sh 2>&1 > mem-error-out.log
+ ./handle_val_log.sh
+ '''
+ }
+ sh '''
+ cd ${WKC}/tests
+ ./test-all.sh full unit
+ date
+ '''
}
+ }
}
stage('centos7') {
agent{label " centos7 "}
@@ -546,12 +612,41 @@ pipeline {
pre_test_mac()
}
}
-
+ stage('arm64centos7') {
+ agent{label " arm64centos7 "}
+ steps {
+ pre_test_noinstall()
+ }
+ }
+ stage('arm64centos8') {
+ agent{label " arm64centos8 "}
+ steps {
+ pre_test_noinstall()
+ }
+ }
+ stage('arm32bionic') {
+ agent{label " arm32bionic "}
+ steps {
+ pre_test_noinstall()
+ }
+ }
+ stage('arm64bionic') {
+ agent{label " arm64bionic "}
+ steps {
+ pre_test_noinstall()
+ }
+ }
+ stage('arm64focal') {
+ agent{label " arm64focal "}
+ steps {
+ pre_test_noinstall()
+ }
+ }
stage('build'){
agent{label " wintest "}
steps {
pre_test()
- script{
+ script{
while(win_stop == 0){
sleep(1)
}
@@ -561,6 +656,7 @@ pipeline {
stage('test'){
agent{label "win"}
steps{
+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
pre_test_win()
timeout(time: 20, unit: 'MINUTES'){
@@ -569,7 +665,7 @@ pipeline {
.\\test-all.bat wintest
'''
}
- }
+ }
script{
win_stop=1
}
diff --git a/documentation20/cn/02.getting-started/01.docker/docs.md b/documentation20/cn/02.getting-started/01.docker/docs.md
index 4ac6d96ec1de161d3259c5246e78565ec2cfc726..cab6d878991a315f79b7fc0813e3727b6e8720dd 100644
--- a/documentation20/cn/02.getting-started/01.docker/docs.md
+++ b/documentation20/cn/02.getting-started/01.docker/docs.md
@@ -15,22 +15,34 @@ $ docker -v
Docker version 20.10.3, build 48d30b5
```
-## 在 Docker 容器中运行 TDengine
+## 使用 Docker 在容器中运行 TDengine
-1,使用命令拉取 TDengine 镜像,并使它在后台运行。
+### 在 Docker 容器中运行 TDengine server
```bash
-$ docker run -d --name tdengine tdengine/tdengine
-7760c955f225d72e9c1ec5a4cef66149a7b94dae7598b11eb392138877e7d292
+$ docker run -d -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine
+526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
```
+这条命令,启动一个运行了 TDengine server 的 docker 容器,并且将容器的 6030 到 6041 端口映射到宿主机的 6030 到 6041 端口上。如果宿主机已经运行了 TDengine server 并占用了相同端口,需要映射容器的端口到不同的未使用端口段。(详情参见 [TDengine 2.0 端口说明](https://www.taosdata.com/cn/documentation/faq#port))。为了支持 TDengine 客户端操作 TDengine server 服务, TCP 和 UDP 端口都需要打开。
+
- **docker run**:通过 Docker 运行一个容器
-- **--name tdengine**:设置容器名称,我们可以通过容器名称来查看对应的容器
- **-d**:让容器在后台运行
+- **-p**:指定映射端口。注意:如果不是用端口映射,依然可以进入 Docker 容器内部使用 TDengine 服务或进行应用开发,只是不能对容器外部提供服务
- **tdengine/tdengine**:拉取的 TDengine 官方发布的应用镜像
-- **7760c955f225d72e9c1ec5a4cef66149a7b94dae7598b11eb392138877e7d292**:这个返回的长字符是容器 ID,我们也可以通过容器 ID 来查看对应的容器
+- **526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd**:这个返回的长字符是容器 ID,我们也可以通过容器 ID 来查看对应的容器
+
+进一步,还可以使用 docker run 命令启动运行 TDengine server 的 docker 容器,并使用 --name 命令行参数将容器命名为 tdengine,使用 --hostname 指定 hostname 为 tdengine-server,通过 -v 挂载本地目录(-v),实现宿主机与容器内部的数据同步,防止容器删除后,数据丢失。
-2,确认容器是否已经正确运行。
+```
+$ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine
+```
+
+- **--name tdengine**:设置容器名称,我们可以通过容器名称来访问对应的容器
+- **--hostnamename=tdengine-server**:设置容器内 Linux 系统的 hostname,我们可以通过映射 hostname 和 IP 来解决容器 IP 可能变化的问题。
+- **-v**:设置宿主机文件目录映射到容器内目录,避免容器删除后数据丢失。
+
+### 使用 docker ps 命令确认容器是否已经正确运行
```bash
$ docker ps
@@ -45,23 +57,23 @@ c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes ·
- **CREATED**:容器创建时间。
- **STATUS**:容器状态。UP 表示运行中。
-3,进入 Docker 容器内,使用 TDengine。
+### 通过 docker exec 命令,进入到 docker 容器中去做开发
```bash
$ docker exec -it tdengine /bin/bash
-root@c452519b0f9b:~/TDengine-server-2.0.20.13#
+root@tdengine-server:~/TDengine-server-2.0.20.13#
```
- **docker exec**:通过 docker exec 命令进入容器,如果退出,容器不会停止。
- **-i**:进入交互模式。
- **-t**:指定一个终端。
-- **c452519b0f9b**:容器 ID,需要根据 docker ps 指令返回的值进行修改。
+- **tdengine**:容器名称,需要根据 docker ps 指令返回的值进行修改。
- **/bin/bash**:载入容器后运行 bash 来进行交互。
-4,进入容器后,执行 taos shell 客户端程序。
+进入容器后,执行 taos shell 客户端程序。
```bash
-$ root@c452519b0f9b:~/TDengine-server-2.0.20.13# taos
+root@tdengine-server:~/TDengine-server-2.0.20.13# taos
Welcome to the TDengine shell from Linux, Client Version:2.0.20.13
Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
@@ -73,19 +85,92 @@ TDengine 终端成功连接服务端,打印出了欢迎消息和版本信息
在 TDengine 终端中,可以通过 SQL 命令来创建/删除数据库、表、超级表等,并可以进行插入和查询操作。具体可以参考 [TAOS SQL 说明文档](https://www.taosdata.com/cn/documentation/taos-sql)。
-## 通过 taosdemo 进一步了解 TDengine
-1,接上面的步骤,先退出 TDengine 终端程序。
+### 在宿主机访问 Docker 容器中的 TDengine server
-```bash
-$ taos> q
-root@c452519b0f9b:~/TDengine-server-2.0.20.13#
+在使用了 -p 命令行参数映射了正确的端口启动了 TDengine Docker 容器后,就在宿主机使用 taos shell 命令即可访问运行在 Docker 容器中的 TDengine。
+
+```
+$ taos
+
+Welcome to the TDengine shell from Linux, Client Version:2.0.22.3
+Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
+
+taos>
```
-2,在命令行界面执行 taosdemo。
+也可以在宿主机使用 curl 通过 RESTful 端口访问 Docker 容器内的 TDengine server。
+
+```
+$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql
+{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2}
+```
+
+这条命令,通过 RESTful 接口访问 TDengine server,这时连接的是本机的 6041 端口,可见连接成功。
+
+TDengine RESTful 接口详情请参考[官方文档](https://www.taosdata.com/cn/documentation/connector#restful)。
+
+
+### 使用 Docker 容器运行 TDengine server 和 taosAdapter
+
+在 TDegnine 2.4.0.0 之后版本的 Docker 容器,开始一个组件 taosAdapter,taosAdapter 支持通过 RESTful 接口对 TDengine server 的数据写入和查询能力,并提供和 InfluxDB/OpenTSDB 兼容的数据摄取接口,允许 InfluxDB/OpenTSDB 应用程序无缝移植到 TDengine。
+
+注意:如果容器中运行 taosAdapter,需要根据需要增加映射其他端口,具体端口默认配置和修改方法请参考[taosAdapter文档](https://github.com/taosdata/taosadapter/blob/develop/README-CN.md)。
+
+使用 docker 运行 TDengine 2.4.0.0 版本镜像:
+
+```
+$ docker run -d --name tdengine-taosa -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.0
+```
+
+使用 curl 命令验证 RESTful 接口可以正常工作:
+```
+$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql
+
+{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1}
+```
+
+taosAdapter 支持多个数据收集代理软件(如 Telegraf、StatsD、collectd 等),这里仅模拟 StasD 写入数据,在宿主机执行命令如下:
+```
+$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044
+```
+
+然后可以使用 taos shell 查询 taosAdapter 自动创建的数据库 statsd 和 超级表 foo 中的内容:
+```
+taos> show databases;
+ name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status |
+====================================================================================================================================================================================================================================================================================
+ log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready |
+ statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready |
+Query OK, 2 row(s) in set (0.002112s)
+
+taos> use statsd;
+Database changed.
+
+taos> show stables;
+ name | created_time | columns | tags | tables |
+============================================================================================
+ foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 |
+Query OK, 1 row(s) in set (0.001160s)
+
+taos> select * from foo;
+ ts | value | metric_type |
+=======================================================================================
+ 2021-12-28 09:21:48.840820836 | 1 | counter |
+Query OK, 1 row(s) in set (0.001639s)
+
+taos>
+```
+
+可以看到模拟数据已经被写入到 TDengine 中。
+
+
+### 应用示例:在宿主机使用 taosdemo 写入数据到 Docker 容器中的 TDengine server
+
+1,在宿主机命令行界面执行 taosdemo 写入数据到 Docker 容器中的 TDengine server
```bash
-root@c452519b0f9b:~/TDengine-server-2.0.20.13# taosdemo
+$ taosdemo
taosdemo is simulating data generated by power equipments monitoring...
@@ -134,9 +219,9 @@ column[0]:FLOAT column[1]:INT column[2]:FLOAT
回车后,该命令将在数据库 test 下面自动创建一张超级表 meters,该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupId,groupId 被设置为 1 到 10, location 被设置为 "beijing" 或者 "shanghai"。
-执行这条命令大概需要几分钟,最后共插入 1 亿条记录。
+最后共插入 1 亿条记录。
-3,进入 TDengine 终端,查看 taosdemo 生成的数据。
+2,进入 TDengine 终端,查看 taosdemo 生成的数据。
- **进入命令行。**
@@ -217,27 +302,3 @@ tdengine
- **docker stop**:通过 docker stop 停止指定的正在运行中的 docker 镜像。
- **tdengine**:容器名称。
-## 编程开发时连接在 Docker 中的 TDengine
-
-从 Docker 之外连接使用在 Docker 容器内运行的 TDengine 服务,有以下两个思路:
-
-1,通过端口映射(-p),将容器内部开放的网络端口映射到宿主机的指定端口上。通过挂载本地目录(-v),可以实现宿主机与容器内部的数据同步,防止容器删除后,数据丢失。
-
-```bash
-$ docker run -d -v /etc/taos:/etc/taos -p 6041:6041 tdengine/tdengine
-526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
-
-$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql
-{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2}
-```
-
-- 第一条命令,启动一个运行了 TDengine 的 docker 容器,并且将容器的 6041 端口映射到宿主机的 6041 端口上。
-- 第二条命令,通过 RESTful 接口访问 TDengine,这时连接的是本机的 6041 端口,可见连接成功。
-
-注意:在这个示例中,出于方便性考虑,只映射了 RESTful 需要的 6041 端口。如果希望以非 RESTful 方式连接 TDengine 服务,则需要映射从 6030 开始的共 11 个端口(完整的端口情况请参见 [TDengine 2.0 端口说明](https://www.taosdata.com/cn/documentation/faq#port))。在例子中,挂载本地目录也只是处理了配置文件所在的 /etc/taos 目录,而没有挂载数据存储目录。
-
-2,直接通过 exec 命令,进入到 docker 容器中去做开发。也即,把程序代码放在 TDengine 服务端所在的同一个 Docker 容器中,连接容器本地的 TDengine 服务。
-
-```bash
-$ docker exec -it tdengine /bin/bash
-```
diff --git a/documentation20/en/02.getting-started/01.docker/docs.md b/documentation20/en/02.getting-started/01.docker/docs.md
index daa89ef1016179e7860e4178c52481aef2760243..aeaaa7778d98e72995869328b8c96c5a0e9dfe03 100644
--- a/documentation20/en/02.getting-started/01.docker/docs.md
+++ b/documentation20/en/02.getting-started/01.docker/docs.md
@@ -15,22 +15,34 @@ $ docker -v
Docker version 20.10.3, build 48d30b5
```
-## Running TDengine in a Docker container
+## Using Docker to run TDengine
-1, Use the command to pull the TDengine image and make it run in the background.
+### running TDengine server inside Docker
```bash
-$ docker run -d --name tdengine tdengine/tdengine
-7760c955f225d72e9c1ec5a4cef66149a7b94dae7598b11eb392138877e7d292
+$ docker run -d -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine
+526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
+```
+
+This command starts a docker container with TDengine server running and maps the container's ports from 6030 to 6041 to the host's ports from 6030 to 6041. If the host is already running TDengine server and occupying the same port(s), you need to map the container's port to a different unused port segment. (Please see [TDengine 2.0 Port Description](https://www.taosdata.com/en/documentation/faq#port) for details). In order to support TDengine clients accessing TDengine server services, both TCP and UDP ports need to be open.
+
+- **docker run**: Run a container via Docker
+- **-d**: put the container run in the background
+- **-p**: specify the port(s) to map. Note: If you do not use port mapping, you can still go inside the Docker container to access TDengine services or develop your application, but you cannot provide services outside the container
+- **tdengine/tdengine**: the official TDengine published application image that is pulled
+- **526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd**: The long character returned is the container ID, and we can also view the corresponding container by its container ID
+
+Further, you can also use the `docker run` command to start the docker container running TDengine server, and use the `--name` command line parameter to name the container tdengine, use `--hostname` to specify the hostname as tdengine-server, and use `-v` to mount the local directory (-v) to synchronize the data inside the host and the container to prevent data loss after the container is deleted.
+
+```
+$ docker run -d --name tdengine --hostname="tdengine-server" -v ~/work/taos/log:/var/log/taos -v ~/work/taos/data:/var/lib/taos -p 6030-6041:6030-6041 -p 6030-6041:6030-6041/udp tdengine/tdengine
```
-- **docker run**: Running a container via Docker
-- **--name tdengine**: Set the container name, we can see the corresponding container by the container name
-- **-d**: Keeping containers running in the background
-- **tdengine/tdengine**: Pulled from the official TDengine published application image
-- **7760c955f225d72e9c1ec5a4cef66149a7b94dae7598b11eb392138877e7d292**: The long character returned is the container ID, and we can also view the corresponding container by its container ID
+- **--name tdengine**: set the container name, we can access the corresponding container by container name
+- **--hostnamename=tdengine-server**: set the hostname of the Linux system inside the container, we can map the hostname and IP to solve the problem that the container IP may change.
+- **-v**: Set the host file directory to be mapped to the inner container directory to avoid data loss after the container is deleted.
-2, Verify that the container is running correctly.
+### Use the `docker ps` command to verify that the container is running correctly
```bash
$ docker ps
@@ -38,30 +50,30 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS ·
c452519b0f9b tdengine/tdengine "taosd" 14 minutes ago Up 14 minutes ···
```
-- **docker ps**: Lists information about all containers that are in running state.
-- **CONTAINER ID**: Container ID.
-- **IMAGE**: The mirror used.
-- **COMMAND**: The command to run when starting the container.
-- **CREATED**: The time when the container was created.
-- **STATUS**: The container status. Up means running.
+- **docker ps**: list all containers in running state.
+- **CONTAINER ID**: container ID.
+- **IMAGE**: the image used.
+- **COMMAND**: the command to run when starting the container.
+- **CREATED**: container creation time.
+- **STATUS**: container status. UP means running.
-3, Go inside the Docker container and use TDengine.
+### Enter the docker container to do development via the `docker exec` COMMAND
```bash
$ docker exec -it tdengine /bin/bash
-root@c452519b0f9b:~/TDengine-server-2.0.20.13#
+root@tdengine-server:~/TDengine-server-2.0.20.13#
```
-- **docker exec**: Enter the container via the docker exec command; if you exit, the container will not stop.
-- **-i**: Enter the interactive mode.
-- **-t**: Specify a terminal.
-- **c452519b0f9b**: The container ID, which needs to be modified according to the value returned by the docker ps command.
-- **/bin/bash**: Load the container and run bash to interact with it.
+- **docker exec**: Enter the container by `docker exec` command, if exited, the container will not stop.
+- **-i**: use interactive mode.
+- **-t**: specify a terminal.
+- **tdengine**: container name, needs to be changed according to the value returned by the docker ps command.
+- **/bin/bash**: load the container and run bash to interact with it.
-4, After entering the container, execute the taos shell client program.
+After entering the container, execute the taos shell client program.
```bash
-$ root@c452519b0f9b:~/TDengine-server-2.0.20.13# taos
+root@tdengine-server:~/TDengine-server-2.0.20.13# taos
Welcome to the TDengine shell from Linux, Client Version:2.0.20.13
Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
@@ -69,23 +81,94 @@ Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
taos>
```
-The TDengine terminal successfully connects to the server and prints out a welcome message and version information. If it fails, an error message is printed.
+The TDengine shell successfully connects to the server and prints out a welcome message and version information. If it fails, an error message is printed.
-In the TDengine terminal, you can create/delete databases, tables, super tables, etc., and perform insert and query operations via SQL commands. For details, you can refer to [TAOS SQL guide](https://www.taosdata.com/en/documentation/taos-sql).
+In the TDengine shell, you can create/delete databases, tables, super tables, etc., and perform insert and query operations via SQL commands. For details, please refer to the [TAOS SQL documentation](https://www.taosdata.com/en/documentation/taos-sql).
-## Learn more about TDengine with taosdemo
+### Accessing TDengine server inside Docker container from the host side
-1, Following the above steps, exit the TDengine terminal program first.
+After starting the TDengine Docker container with the correct port mapped with the -p command line parameter, you can access the TDengine running inside the Docker container from the host side using the taos shell command.
+
+```
+$ taos
+
+Welcome to the TDengine shell from Linux, Client Version:2.0.22.3
+Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
+
+taos>
+```
+
+You can also access the TDengine server inside the Docker container using `curl` command from the host side through the RESTful port.
-```bash
-$ taos> q
-root@c452519b0f9b:~/TDengine-server-2.0.20.13#
```
+$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql
+{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2}
+```
+
+This command accesses the TDengine server through the RESTful interface, which connects to port 6041 on the local machine, so the connection is successful.
+
+TDengine RESTful interface details can be found in the [official documentation](https://www.taosdata.com/en/documentation/connector#restful).
+
+
+### Running TDengine server and taosAdapter with a Docker container
+
+Docker containers of TDegnine version 2.4.0.0 and later include a component named `taosAdapter`, which supports data writing and querying capabilities to the TDengine server through the RESTful interface and provides the data ingestion interfaces compatible with InfluxDB/OpenTSDB. Allows seamless migration of InfluxDB/OpenTSDB applications to access TDengine.
-2, Execute taosdemo from the command line interface.
+Note: If taosAdapter is running inside the container, you need to add mapping to other additional ports as needed, please refer to [taosAdapter documentation](https://github.com/taosdata/taosadapter/blob/develop/README.md) for the default port number and modification methods for the specific purpose.
+
+Running TDengine version 2.4.0.0 image with docker.
+
+```
+$ docker run -d --name tdengine-taosa -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine:2.4.0.0
+```
+
+Verify that the RESTful interface taosAdapter provides working using the `curl` command.
+```
+$ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'show databases;' 127.0.0.1:6041/rest/sql
+
+{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["log","2021-12-28 09:18:55.765",10,1,1,1,10,"30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":1}
+```
+taosAdapter supports multiple data collection agents (e.g. Telegraf, StatsD, collectd, etc.), here only demonstrate how StasD is simulated to write data, and the command is executed from the host side as follows.
+```
+$ echo "foo:1|c" | nc -u -w0 127.0.0.1 6044
+```
+
+Then you can use the taos shell to query the taosAdapter automatically created database statsd and the contents of the super table foo.
+```
+taos> show databases;
+ name | created_time | ntables | vgroups | replica | quorum | days | keep | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | cachelast | precision | update | status |
+====================================================================================================================================================================================================================================================================================
+ log | 2021-12-28 09:18:55.765 | 12 | 1 | 1 | 1 | 10 | 30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | 0 | us | 0 | ready |
+ statsd | 2021-12-28 09:21:48.841 | 1 | 1 | 1 | 1 | 10 | 3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | 0 | ns | 2 | ready |
+Query OK, 2 row(s) in set (0.002112s)
+
+taos> use statsd;
+Database changed.
+
+taos> show stables;
+ name | created_time | columns | tags | tables |
+============================================================================================
+ foo | 2021-12-28 09:21:48.894 | 2 | 1 | 1 |
+Query OK, 1 row(s) in set (0.001160s)
+
+taos> select * from foo;
+ ts | value | metric_type |
+=======================================================================================
+ 2021-12-28 09:21:48.840820836 | 1 | counter |
+Query OK, 1 row(s) in set (0.001639s)
+
+taos>
+```
+
+You can see that the simulation data has been written to TDengine.
+
+
+### Application example: write data to TDengine server in Docker container using taosdemo on the host
+
+1, execute taosdemo in the host command line interface to write data to the TDengine server in the Docker container
```bash
-root@c452519b0f9b:~/TDengine-server-2.0.20.13# taosdemo
+$ taosdemo
taosdemo is simulating data generated by power equipments monitoring...
@@ -217,27 +300,3 @@ tdengine
- **docker stop**: Stop the specified running docker image with docker stop.
- **tdengine**: The name of the container.
-## TDengine connected in Docker during programming development
-
-There are two ideas for connecting from outside of Docker to use TDengine services running inside a Docker container:
-
-1, By port mapping (-p), the open network port inside the container is mapped to the specified port of the host. By mounting the local directory (-v), you can synchronize the data inside the host and the container to prevent data loss after the container is deleted.
-
-```bash
-$ docker run -d -v /etc/taos:/etc/taos -P 6041:6041 tdengine/tdengine
-526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
-
-$ curl -u root:taosdata -d 'show databases' 127.0.0.1:6041/rest/sql
-{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep0,keep1,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","cachelast","precision","update","status"],"column_meta":[["name",8,32],["created_time",9,8],["ntables",4,4],["vgroups",4,4],["replica",3,2],["quorum",3,2],["days",3,2],["keep0,keep1,keep(D)",8,24],["cache(MB)",4,4],["blocks",4,4],["minrows",4,4],["maxrows",4,4],["wallevel",2,1],["fsync",4,4],["comp",2,1],["cachelast",2,1],["precision",8,3],["update",2,1],["status",8,10]],"data":[["test","2021-08-18 06:01:11.021",10000,4,1,1,10,"3650,3650,3650",16,6,100,4096,1,3000,2,0,"ms",0,"ready"],["log","2021-08-18 05:51:51.065",4,1,1,1,10,"30,30,30",1,3,100,4096,1,3000,2,0,"us",0,"ready"]],"rows":2}
-```
-
-- The first command starts a docker container with TDengine running and maps the 6041 port of the container to port 6041 of the host.
-- The second command, accessing TDengine through the RESTful interface, connects to port 6041 on the local machine, so the connection is successful.
-
-Note: In this example, for convenience reasons, only port 6041 is mapped, which is required for RESTful. If you wish to connect to the TDengine service in a non-RESTful manner, you will need to map a total of 11 ports starting at 6030. In the example, mounting the local directory also only deals with the /etc/taos directory where the configuration files are located, but not the data storage directory.
-
-2, Go directly to the docker container to do development via the exec command. That is, put the program code in the same Docker container where the TDengine server is located and connect to the TDengine service local to the container.
-
-```bash
-$ docker exec -it tdengine /bin/bash
-```
diff --git a/packaging/release.sh b/packaging/release.sh
index 38e5dd929e78ce1a167464892089c42a044d94f6..e24493bd0a834e79faadffd468e574f2554fbac1 100755
--- a/packaging/release.sh
+++ b/packaging/release.sh
@@ -3,7 +3,7 @@
# Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os
set -e
-set -x
+#set -x
# release.sh -v [cluster | edge]
# -c [aarch32 | aarch64 | x64 | x86 | mips64 ...]
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index 89bbbf9370e545d10aa8c8f9a4b16e0319693e30..3a2b11f3a47d4a6f490c5290711f6890ec1e4e88 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -36,11 +36,11 @@ if [ -d ${top_dir}/src/kit/taos-tools/packaging/deb ]; then
[ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
taostools_ver=$(git describe --tags|sed -e 's/ver-//g'|awk -F '-' '{print $1}')
- taostools_install_dir="${release_dir}/taos-tools-${taostools_ver}"
+ taostools_install_dir="${release_dir}/taosTools-${taostools_ver}"
cd ${curr_dir}
else
- taostools_install_dir="${release_dir}/taos-tools-${version}"
+ taostools_install_dir="${release_dir}/taosTools-${version}"
fi
# Directories and files
diff --git a/src/client/src/tscGlobalmerge.c b/src/client/src/tscGlobalmerge.c
index 5d936fe7067a9ce13a590537c2ba6162cf2a6c83..68e3bf4b8a20106d37c0dcd9c0a5e449c634ed58 100644
--- a/src/client/src/tscGlobalmerge.c
+++ b/src/client/src/tscGlobalmerge.c
@@ -902,7 +902,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
// not belongs to the same group, return the result of current group;
setInputDataBlock(pOperator, pAggInfo->binfo.pCtx, pAggInfo->pExistBlock, TSDB_ORDER_ASC);
- updateOutputBuf(&pAggInfo->binfo, &pAggInfo->bufCapacity, pAggInfo->pExistBlock->info.rows);
+ updateOutputBuf(&pAggInfo->binfo, &pAggInfo->bufCapacity, pAggInfo->pExistBlock->info.rows, pOperator->pRuntimeEnv);
{ // reset output buffer
for(int32_t j = 0; j < pOperator->numOfOutput; ++j) {
@@ -954,7 +954,7 @@ SSDataBlock* doGlobalAggregate(void* param, bool* newgroup) {
// not belongs to the same group, return the result of current group
setInputDataBlock(pOperator, pAggInfo->binfo.pCtx, pBlock, TSDB_ORDER_ASC);
- updateOutputBuf(&pAggInfo->binfo, &pAggInfo->bufCapacity, pBlock->info.rows * pAggInfo->resultRowFactor);
+ updateOutputBuf(&pAggInfo->binfo, &pAggInfo->bufCapacity, pBlock->info.rows * pAggInfo->resultRowFactor, pOperator->pRuntimeEnv);
doExecuteFinalMerge(pOperator, pOperator->numOfOutput, pBlock);
savePrevOrderColumns(pAggInfo->currentGroupColData, pAggInfo->groupColumnList, pBlock, 0, &pAggInfo->hasGroupColData);
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index fc5548f2ed18495debc897957886cf6f38cd4e9d..4d90949e5485fbec9f87828f9351e7f9f6fca85d 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -433,7 +433,7 @@ int32_t readFromFile(char *name, uint32_t *len, void **buf) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
- int fd = open(name, O_RDONLY);
+ int fd = open(name, O_RDONLY | O_BINARY);
if (fd < 0) {
tscError("open file %s failed, error:%s", name, strerror(errno));
tfree(*buf);
diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c
index 57362499a4fcaaa1500b199de8f63c07a03af898..7f8e9066af2ea05dd2cc50d8a9e156a5b44cb6cc 100644
--- a/src/client/src/tscServer.c
+++ b/src/client/src/tscServer.c
@@ -1866,6 +1866,7 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) {
bool convertJson = true;
if (pQueryInfo->isStddev == true) convertJson = false;
convertQueryResult(pRes, pQueryInfo, pSql->self, true, convertJson);
+ pRes->code = pQueryInfo->pQInfo->code;
code = pRes->code;
if (pRes->code == TSDB_CODE_SUCCESS) {
diff --git a/src/connector/C#/.gitignore b/src/connector/C#/.gitignore
index 525c7a04c07762c6f77bdaaaf7d602a5b4fc9591..a15c72f06cb1ed1f03b1ef19f18d3043f72061e3 100644
--- a/src/connector/C#/.gitignore
+++ b/src/connector/C#/.gitignore
@@ -4,3 +4,5 @@ src/test/Cases/bin/
src/test/Cases/obj/
src/test/XUnitTest/bin/
src/test/XUnitTest/obj/
+src/test/doc/
+NugetPackTest/
\ No newline at end of file
diff --git a/src/connector/C#/src/TDengineDriver/TDengineDriver.csproj b/src/connector/C#/src/TDengineDriver/TDengineDriver.csproj
index f208d303c9811fa05807ef8f72685b8ebb536a37..14b1776fb3aa8a92227c8154a0fed58d1f94f46c 100644
--- a/src/connector/C#/src/TDengineDriver/TDengineDriver.csproj
+++ b/src/connector/C#/src/TDengineDriver/TDengineDriver.csproj
@@ -1,7 +1,25 @@
-
- net5.0
+
+ net5;netstandard2.0;net45
+ TDengine.Connector
+ logo.jpg
+ 1.0.3
+ taosdata
+ www.taosdata.com
+ MIT
+ Taos;Data;Microsoft.NET.Sdk;IOT;bigdata;TDengine;taosdata
+
+ This is the C# connector's classlib that lets you connect to TDengine.
+ This C # connector supports: Linux 64/Windows x64/Windows x86.
+ more information please visit: https://www.taosdata.com
+
+ https://github.com/taosdata/TDengine/tree/develop/src/connector/C%23
+ CS1591
+
+
+
+
diff --git a/src/connector/C#/src/TDengineDriver/resource/logo.jpg b/src/connector/C#/src/TDengineDriver/resource/logo.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..b64b508f91beabdc6759dad955db5464a0efdac2
Binary files /dev/null and b/src/connector/C#/src/TDengineDriver/resource/logo.jpg differ
diff --git a/src/connector/C#/src/test/Cases/Cases.csproj b/src/connector/C#/src/test/Cases/Cases.csproj
index 57c0dd8f7d363e9da4ae580751cacf706f714883..ebc9c3100a778d35e6aee0feeb8d059ad5e4bfbd 100644
--- a/src/connector/C#/src/test/Cases/Cases.csproj
+++ b/src/connector/C#/src/test/Cases/Cases.csproj
@@ -7,10 +7,8 @@
Exe
net5.0
-
-
-
- true
- ..\doc\FunctionTest.XML
+ CS1591
+ true
+ ..\doc\FunctionTest.XML
diff --git a/src/connector/C#/src/test/XUnitTest/XUnitTest.csproj b/src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
index 997a9d6fe072c01ffeb45a32773f8c76a530825c..6da7156111003eb671c3a0fa392f1d6adc7ac0d1 100644
--- a/src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
+++ b/src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
@@ -3,13 +3,12 @@
net5.0
false
-
-
-
+ CS1591
true
..\doc\UnitTest.XML
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c
index 420f462051687c72019d7c0697a23c940e4b8ae0..0580761de1c8768ed6fdb1c8f3ea6c7b4fa0836b 100644
--- a/src/dnode/src/dnodeMain.c
+++ b/src/dnode/src/dnodeMain.c
@@ -240,7 +240,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
char filepath[256] = {0};
sprintf(filepath, "%s/.running", dir);
- int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
+ int fd = open(filepath, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
dError("failed to open lock file:%s, reason: %s, quit", filepath, strerror(errno));
exit(0);
diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c
index 22a6dc5b1993b6d15510b078ac4245909221ae78..ec09ab5d752cfbd4219787c0438c9b8bf4d1a9c4 100644
--- a/src/dnode/src/dnodeTelemetry.c
+++ b/src/dnode/src/dnodeTelemetry.c
@@ -266,7 +266,7 @@ static void* telemetryThread(void* param) {
}
static void dnodeGetEmail(char* filepath) {
- int32_t fd = open(filepath, O_RDONLY);
+ int32_t fd = open(filepath, O_RDONLY | O_BINARY);
if (fd < 0) {
return;
}
diff --git a/src/inc/tfs.h b/src/inc/tfs.h
index 11e33a3af791c3aef51c9d6ca876df2feb784473..1f16587536ddcc08770410cc34dc3b29b001eccb 100644
--- a/src/inc/tfs.h
+++ b/src/inc/tfs.h
@@ -70,7 +70,7 @@ typedef struct {
#define TFILE_NAME(pf) ((pf)->aname)
#define TFILE_REL_NAME(pf) ((pf)->rname)
-#define tfsopen(pf, flags) open(TFILE_NAME(pf), flags)
+#define tfsopen(pf, flags) open(TFILE_NAME(pf), flags | O_BINARY)
#define tfsclose(fd) close(fd)
#define tfsremove(pf) remove(TFILE_NAME(pf))
#define tfscopy(sf, df) taosCopy(TFILE_NAME(sf), TFILE_NAME(df))
diff --git a/src/kit/taos-tools b/src/kit/taos-tools
index ed92906f2d09d0bfa75598f4a019de06710cffb0..59f00a69f36b08cea86a70a22c29b2c27ef506ae 160000
--- a/src/kit/taos-tools
+++ b/src/kit/taos-tools
@@ -1 +1 @@
-Subproject commit ed92906f2d09d0bfa75598f4a019de06710cffb0
+Subproject commit 59f00a69f36b08cea86a70a22c29b2c27ef506ae
diff --git a/src/os/src/detail/osRand.c b/src/os/src/detail/osRand.c
index 0dda908bb35c68513dba150e8380846c36aa2893..e1d81ea5d3ed1fccd0b8b96cb8c3991475f9c714 100644
--- a/src/os/src/detail/osRand.c
+++ b/src/os/src/detail/osRand.c
@@ -22,7 +22,7 @@ uint32_t taosSafeRand(void) {
int fd;
int seed;
- fd = open("/dev/urandom", 0);
+ fd = open("/dev/urandom", 0 | O_BINARY);
if (fd < 0) {
seed = (int)time(0);
} else {
diff --git a/src/os/src/detail/osSysinfo.c b/src/os/src/detail/osSysinfo.c
index 0542407c3ba8e8d17c79f16ef0f3560e3bc10693..06c58d43067ce5941975f97c169a2718640bac2a 100644
--- a/src/os/src/detail/osSysinfo.c
+++ b/src/os/src/detail/osSysinfo.c
@@ -713,7 +713,7 @@ bool taosGetSystemUid(char *uid) {
int fd;
int len = 0;
- fd = open("/proc/sys/kernel/random/uuid", 0);
+ fd = open("/proc/sys/kernel/random/uuid", 0 | O_BINARY);
if (fd < 0) {
return false;
} else {
diff --git a/src/os/src/detail/osTimer.c b/src/os/src/detail/osTimer.c
index 618df8a8bad451984fafd022a33a799986a48422..bc5119107a312b5f281263823d766e9ce506a85a 100644
--- a/src/os/src/detail/osTimer.c
+++ b/src/os/src/detail/osTimer.c
@@ -20,6 +20,7 @@
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) || defined(_TD_DARWIN_64))
+#ifndef _ALPINE
static void taosDeleteTimer(void *tharg) {
timer_t *pTimer = tharg;
timer_delete(*pTimer);
@@ -105,4 +106,41 @@ void taosUninitTimer() {
pthread_join(timerThread, NULL);
}
+#else
+
+static timer_t timerId;
+
+void sig_alrm_handler(union sigval sv) {
+ void (*callback)(int) = sv.sival_ptr;
+ callback(0);
+}
+int taosInitTimer(void (*callback)(int), int ms) {
+ struct sigevent evp;
+ memset((void *)&evp, 0, sizeof(evp));
+ evp.sigev_notify = SIGEV_THREAD;
+ evp.sigev_notify_function = &sig_alrm_handler;
+ evp.sigev_signo = SIGALRM;
+ evp.sigev_value.sival_ptr = (void *)callback;
+
+ struct itimerspec ts;
+ ts.it_value.tv_sec = 0;
+ ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
+ ts.it_interval.tv_sec = 0;
+ ts.it_interval.tv_nsec = 1000000 * MSECONDS_PER_TICK;
+ if (timer_create(CLOCK_REALTIME, &evp, &timerId)) {
+ uError("Failed to create timer");
+ return -1;
+ }
+
+ if (timer_settime(timerId, 0, &ts, NULL)) {
+ uError("Failed to init timer");
+ return -1;
+ }
+ return 0;
+}
+
+void taosUninitTimer() {
+ timer_delete(timerId);
+}
+#endif
#endif
diff --git a/src/os/src/linux/linuxEnv.c b/src/os/src/linux/linuxEnv.c
index 84c873202b685e690252890e347632e096a4b39e..49db2329e68d09b16e92c696289e56d1d540b398 100644
--- a/src/os/src/linux/linuxEnv.c
+++ b/src/os/src/linux/linuxEnv.c
@@ -72,7 +72,7 @@ char* taosGetCmdlineByPID(int pid) {
static char cmdline[1024];
sprintf(cmdline, "/proc/%d/cmdline", pid);
- int fd = open(cmdline, O_RDONLY);
+ int fd = open(cmdline, O_RDONLY | O_BINARY);
if (fd >= 0) {
int n = read(fd, cmdline, sizeof(cmdline) - 1);
if (n < 0) n = 0;
diff --git a/src/plugins/http/src/httpResp.c b/src/plugins/http/src/httpResp.c
index a2452a16b94fea060a370c86518bb36c1da45070..2c18904d2a9cc2d2dca57c406134518028daba9b 100644
--- a/src/plugins/http/src/httpResp.c
+++ b/src/plugins/http/src/httpResp.c
@@ -156,7 +156,10 @@ void httpSendErrorResp(HttpContext *pContext, int32_t errNo) {
HttpServer *pServer = &tsHttpServer;
SMonHttpStatus *httpStatus = monGetHttpStatusHashTableEntry(httpCode);
- pServer->statusCodeErrs[httpStatus->index] += 1;
+ // FIXME(@huolinhe): I don't known why the errors index is overflowed, but fix it by index check
+ if (httpStatus->index < HTTP_STATUS_CODE_NUM) {
+ pServer->statusCodeErrs[httpStatus->index] += 1;
+ }
pContext->error = true;
diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c
index a03bc09036d14045043704e82e22fdd177c243b2..145e8e5ea83f79017bf438cd13eecdb728b0104e 100644
--- a/src/plugins/monitor/src/monMain.c
+++ b/src/plugins/monitor/src/monMain.c
@@ -171,7 +171,6 @@ static void monSaveSystemInfo();
static void monSaveClusterInfo();
static void monSaveDnodesInfo();
static void monSaveVgroupsInfo();
-static void monSaveSlowQueryInfo();
static void monSaveDisksInfo();
static void monSaveGrantsInfo();
static void monSaveHttpReqInfo();
@@ -321,7 +320,6 @@ static void *monThreadFunc(void *param) {
monSaveClusterInfo();
}
monSaveVgroupsInfo();
- monSaveSlowQueryInfo();
monSaveDisksInfo();
monSaveGrantsInfo();
monSaveHttpReqInfo();
@@ -383,9 +381,9 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
tsMonitorDbName, TSDB_DEFAULT_USER);
} else if (cmd == MON_CMD_CREATE_TB_SLOWQUERY) {
snprintf(sql, SQL_LENGTH,
- "create table if not exists %s.slowquery(ts timestamp, query_id "
- "binary(%d), username binary(%d), qid binary(%d), created_time timestamp, time bigint, end_point binary(%d), sql binary(%d))",
- tsMonitorDbName, QUERY_ID_LEN, TSDB_TABLE_FNAME_LEN - 1, QUERY_ID_LEN, TSDB_EP_LEN, TSDB_SLOW_QUERY_SQL_LEN);
+ "create table if not exists %s.slowquery(ts timestamp, username "
+ "binary(%d), created_time timestamp, time bigint, sql binary(%d))",
+ tsMonitorDbName, TSDB_TABLE_FNAME_LEN - 1, TSDB_SLOW_QUERY_SQL_LEN);
} else if (cmd == MON_CMD_CREATE_TB_LOG) {
snprintf(sql, SQL_LENGTH,
"create table if not exists %s.log(ts timestamp, level tinyint, "
@@ -1213,91 +1211,6 @@ static void monSaveVgroupsInfo() {
taos_free_result(result);
}
-static void monSaveSlowQueryInfo() {
- int64_t ts = taosGetTimestampUs();
- char * sql = tsMonitor.sql;
- int32_t pos = snprintf(sql, SQL_LENGTH, "insert into %s.slowquery values(%" PRId64, tsMonitorDbName, ts);
- bool has_slowquery = false;
-
- TAOS_RES *result = taos_query(tsMonitor.conn, "show queries");
- int32_t code = taos_errno(result);
- if (code != TSDB_CODE_SUCCESS) {
- monError("failed to execute cmd: show queries, reason:%s", tstrerror(code));
- }
-
- TAOS_ROW row;
- int32_t num_fields = taos_num_fields(result);
- TAOS_FIELD *fields = taos_fetch_fields(result);
-
- int32_t charLen;
- while ((row = taos_fetch_row(result))) {
- for (int i = 0; i < num_fields; ++i) {
- if (strcmp(fields[i].name, "query_id") == 0) {
- has_slowquery = true;
- charLen = monGetRowElemCharLen(fields[i], (char *)row[i]);
- if (charLen < 0) {
- monError("failed to save slow_query info, reason: invalid row %s len, sql:%s", (char *)row[i], tsMonitor.sql);
- goto DONE;
- }
- pos += snprintf(sql + pos, strlen(SQL_STR_FMT) + charLen + 1, ", "SQL_STR_FMT, (char *)row[i]);
- } else if (strcmp(fields[i].name, "user") == 0) {
- charLen = monGetRowElemCharLen(fields[i], (char *)row[i]);
- if (charLen < 0) {
- monError("failed to save slow_query info, reason: invalid row %s len, sql:%s", (char *)row[i], tsMonitor.sql);
- goto DONE;
- }
- pos += snprintf(sql + pos, strlen(SQL_STR_FMT) + charLen + 1, ", "SQL_STR_FMT, (char *)row[i]);
- } else if (strcmp(fields[i].name, "qid") == 0) {
- charLen = monGetRowElemCharLen(fields[i], (char *)row[i]);
- if (charLen < 0) {
- monError("failed to save slow_query info, reason: invalid row %s len, sql:%s", (char *)row[i], tsMonitor.sql);
- goto DONE;
- }
- pos += snprintf(sql + pos, strlen(SQL_STR_FMT) + charLen + 1, ", "SQL_STR_FMT, (char *)row[i]);
- } else if (strcmp(fields[i].name, "created_time") == 0) {
- int64_t create_time = *(int64_t *)row[i];
- create_time = convertTimePrecision(create_time, TSDB_TIME_PRECISION_MILLI, TSDB_TIME_PRECISION_MICRO);
- pos += snprintf(sql + pos, SQL_LENGTH, ", %" PRId64 "", create_time);
- } else if (strcmp(fields[i].name, "time") == 0) {
- pos += snprintf(sql + pos, SQL_LENGTH, ", %" PRId64 "", *(int64_t *)row[i]);
- } else if (strcmp(fields[i].name, "ep") == 0) {
- charLen = monGetRowElemCharLen(fields[i], (char *)row[i]);
- if (charLen < 0) {
- monError("failed to save slow_query info, reason: invalid row %s len, sql:%s", (char *)row[i], tsMonitor.sql);
- goto DONE;
- }
- pos += snprintf(sql + pos, strlen(SQL_STR_FMT) + charLen + 1, ", "SQL_STR_FMT, (char *)row[i]);
- } else if (strcmp(fields[i].name, "sql") == 0) {
- charLen = monGetRowElemCharLen(fields[i], (char *)row[i]);
- if (charLen < 0) {
- monError("failed to save slow_query info, reason: invalid row %s len, sql:%s", (char *)row[i], tsMonitor.sql);
- goto DONE;
- }
- pos += snprintf(sql + pos, strlen(SQL_STR_FMT) + charLen + 2, ", "SQL_STR_FMT")", (char *)row[i]);
- }
- }
- }
-
- monDebug("save slow query, sql:%s", sql);
- if (!has_slowquery) {
- goto DONE;
- }
- void *res = taos_query(tsMonitor.conn, tsMonitor.sql);
- code = taos_errno(res);
- taos_free_result(res);
-
- if (code != 0) {
- monError("failed to save slowquery info, reason:%s, sql:%s", tstrerror(code), tsMonitor.sql);
- } else {
- monIncSubmitReqCnt();
- monDebug("successfully to save slowquery info, sql:%s", tsMonitor.sql);
- }
-
-DONE:
- taos_free_result(result);
- return;
-}
-
static void monSaveDisksInfo() {
int64_t ts = taosGetTimestampUs();
char * sql = tsMonitor.sql;
diff --git a/src/plugins/taosadapter b/src/plugins/taosadapter
index 273b5219f8bcc604e43beebc6f1f95abed85170a..fd84b35d3a30c9bcf3939d565f717b7f98ff9eb7 160000
--- a/src/plugins/taosadapter
+++ b/src/plugins/taosadapter
@@ -1 +1 @@
-Subproject commit 273b5219f8bcc604e43beebc6f1f95abed85170a
+Subproject commit fd84b35d3a30c9bcf3939d565f717b7f98ff9eb7
diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h
index ba277b23018a58e3ed29122761aa65506c94078a..68ca7a1e3913ac3de6be448fee3f6229953dc15b 100644
--- a/src/query/inc/qExecutor.h
+++ b/src/query/inc/qExecutor.h
@@ -659,7 +659,7 @@ void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFil
void setInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t order);
int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput);
void finalizeQueryResult(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset);
-void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOfInputRows);
+void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOfInputRows, SQueryRuntimeEnv* runtimeEnv);
void clearOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity);
void copyTsColoum(SSDataBlock* pRes, SQLFunctionCtx* pCtx, int32_t numOfOutput);
diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c
index 6346e743081a6594fcc9e8d8001ae18e3f90ac92..9ea0c07f68eb91fa3dfad7404ea9b2c13329c2d4 100644
--- a/src/query/src/qExecutor.c
+++ b/src/query/src/qExecutor.c
@@ -1432,7 +1432,7 @@ static void doWindowBorderInterpolation(SOperatorInfo* pOperatorInfo, SSDataBloc
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order);
if (pBlock->pDataBlock == NULL){
- tscError("pBlock->pDataBlock == NULL");
+ qError("window border interpolation: pBlock->pDataBlock == NULL");
return;
}
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, 0);
@@ -3586,7 +3586,7 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i
initCtxOutputBuffer(pCtx, pDataBlock->info.numOfCols);
}
-void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOfInputRows) {
+void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOfInputRows, SQueryRuntimeEnv* runtimeEnv) {
SSDataBlock* pDataBlock = pBInfo->pRes;
int32_t newSize = pDataBlock->info.rows + numOfInputRows + 5; // extra output buffer
@@ -3594,7 +3594,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
for(int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) {
SColumnInfoData *pColInfo = taosArrayGet(pDataBlock->pDataBlock, i);
- char* p = realloc(pColInfo->pData, newSize * pColInfo->info.bytes);
+ char* p = realloc(pColInfo->pData, ((size_t)newSize) * pColInfo->info.bytes);
if (p != NULL) {
pColInfo->pData = p;
@@ -3602,7 +3602,10 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
pBInfo->pCtx[i].pOutput = pColInfo->pData;
(*bufCapacity) = newSize;
} else {
- // longjmp
+ size_t allocateSize = ((size_t)(newSize)) * pColInfo->info.bytes;
+ qError("can not allocate %zu bytes for output. Rows: %d, colBytes %d",
+ allocateSize, newSize, pColInfo->info.bytes);
+ longjmp(runtimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
}
}
@@ -3610,7 +3613,7 @@ void updateOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity, int32_t numOf
for (int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) {
SColumnInfoData *pColInfo = taosArrayGet(pDataBlock->pDataBlock, i);
- pBInfo->pCtx[i].pOutput = pColInfo->pData + pColInfo->info.bytes * pDataBlock->info.rows;
+ pBInfo->pCtx[i].pOutput = pColInfo->pData + (size_t)pColInfo->info.bytes * pDataBlock->info.rows;
// set the correct pointer after the memory buffer reallocated.
int32_t functionId = pBInfo->pCtx[i].functionId;
@@ -5752,7 +5755,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order);
- updateOutputBuf(&pProjectInfo->binfo, &pProjectInfo->bufCapacity, pBlock->info.rows);
+ updateOutputBuf(&pProjectInfo->binfo, &pProjectInfo->bufCapacity, pBlock->info.rows, pOperator->pRuntimeEnv);
projectApplyFunctions(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput);
if (pTableQueryInfo != NULL) {
@@ -5818,7 +5821,7 @@ static SSDataBlock* doProjectOperation(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order);
- updateOutputBuf(&pProjectInfo->binfo, &pProjectInfo->bufCapacity, pBlock->info.rows);
+ updateOutputBuf(&pProjectInfo->binfo, &pProjectInfo->bufCapacity, pBlock->info.rows, pOperator->pRuntimeEnv);
projectApplyFunctions(pRuntimeEnv, pInfo->pCtx, pOperator->numOfOutput);
if (pTableQueryInfo != NULL) {
@@ -6315,7 +6318,7 @@ static void doTimeEveryImpl(SOperatorInfo* pOperator, SQLFunctionCtx *pCtx, SSDa
break;
}
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0, pOperator->pRuntimeEnv);
}
}
}
@@ -6335,7 +6338,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
pRes->info.rows = 0;
if (!pEveryInfo->groupDone) {
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0, pOperator->pRuntimeEnv);
doTimeEveryImpl(pOperator, pInfo->pCtx, pEveryInfo->lastBlock, false);
if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) {
copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput);
@@ -6371,7 +6374,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order);
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows, pOperator->pRuntimeEnv);
doTimeEveryImpl(pOperator, pInfo->pCtx, pBlock, *newgroup);
if (pEveryInfo->groupDone && pOperator->upstream[0]->notify) {
@@ -6397,7 +6400,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
if (!pEveryInfo->groupDone) {
pEveryInfo->allDone = true;
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0, pOperator->pRuntimeEnv);
doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false);
if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) {
break;
@@ -6418,7 +6421,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// Return result of the previous group in the firstly.
if (*newgroup) {
if (!pEveryInfo->groupDone) {
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, 0, pOperator->pRuntimeEnv);
doTimeEveryImpl(pOperator, pInfo->pCtx, NULL, false);
if (pRes->info.rows >= pRuntimeEnv->resultInfo.threshold) {
pEveryInfo->existDataBlock = pBlock;
@@ -6454,7 +6457,7 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
// the pDataBlock are always the same one, no need to call this again
setInputDataBlock(pOperator, pInfo->pCtx, pBlock, order);
- updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows);
+ updateOutputBuf(&pEveryInfo->binfo, &pEveryInfo->bufCapacity, pBlock->info.rows, pOperator->pRuntimeEnv);
pEveryInfo->groupDone = false;
diff --git a/src/rpc/test/rserver.c b/src/rpc/test/rserver.c
index 64960db0446413ebce1978b7fe310b6a34c34f1c..767b756badcbd3e2ffdf7908a19aa61e86ac8f1b 100644
--- a/src/rpc/test/rserver.c
+++ b/src/rpc/test/rserver.c
@@ -172,7 +172,7 @@ int main(int argc, char *argv[]) {
tInfo("RPC server is running, ctrl-c to exit");
if (commit) {
- dataFd = open(dataName, O_APPEND | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
+ dataFd = open(dataName, O_APPEND | O_CREAT | O_WRONLY | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (dataFd<0)
tInfo("failed to open data file, reason:%s", strerror(errno));
}
diff --git a/src/sync/test/syncServer.c b/src/sync/test/syncServer.c
index 4598e16a9d05be29d11612755a079ce0a228a2ff..13010783962273f8ae5c5f68bb16e8480a8dacf9 100644
--- a/src/sync/test/syncServer.c
+++ b/src/sync/test/syncServer.c
@@ -43,7 +43,7 @@ int writeIntoWal(SWalHead *pHead) {
char walName[280];
snprintf(walName, sizeof(walName), "%s/wal/wal.%d", path, walNum);
(void)remove(walName);
- dataFd = open(walName, O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
+ dataFd = open(walName, O_CREAT | O_WRONLY | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (dataFd < 0) {
uInfo("failed to open wal file:%s(%s)", walName, strerror(errno));
return -1;
diff --git a/src/tfs/src/tfs.c b/src/tfs/src/tfs.c
index b3aabe177bd4c34151cbe2778825bed6262679ab..63266f8d92c0051306542c683851cdfb6ed50275 100644
--- a/src/tfs/src/tfs.c
+++ b/src/tfs/src/tfs.c
@@ -498,7 +498,11 @@ static int tfsFormatDir(char *idir, char *odir) {
}
char tmp[PATH_MAX] = {0};
+#ifdef WINDOWS
+ if (_fullpath(tmp,wep.we_wordv[0], PATH_MAX) == NULL) {
+#else
if (realpath(wep.we_wordv[0], tmp) == NULL) {
+#endif
terrno = TAOS_SYSTEM_ERROR(errno);
wordfree(&wep);
return -1;
diff --git a/src/tsdb/inc/tsdbFile.h b/src/tsdb/inc/tsdbFile.h
index dfef13b51ecc4692f80cc6dbd937e70911228cf8..6d1e0cf2461a28dbcf481c7dc93d651551c0453d 100644
--- a/src/tsdb/inc/tsdbFile.h
+++ b/src/tsdb/inc/tsdbFile.h
@@ -89,7 +89,7 @@ static FORCE_INLINE void tsdbSetMFileInfo(SMFile* pMFile, SMFInfo* pInfo) { pMFi
static FORCE_INLINE int tsdbOpenMFile(SMFile* pMFile, int flags) {
ASSERT(TSDB_FILE_CLOSED(pMFile));
- pMFile->fd = open(TSDB_FILE_FULL_NAME(pMFile), flags);
+ pMFile->fd = open(TSDB_FILE_FULL_NAME(pMFile), flags | O_BINARY);
if (pMFile->fd < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
@@ -204,7 +204,7 @@ static FORCE_INLINE void tsdbSetDFileInfo(SDFile* pDFile, SDFInfo* pInfo) { pDFi
static FORCE_INLINE int tsdbOpenDFile(SDFile* pDFile, int flags) {
ASSERT(!TSDB_FILE_OPENED(pDFile));
- pDFile->fd = open(TSDB_FILE_FULL_NAME(pDFile), flags);
+ pDFile->fd = open(TSDB_FILE_FULL_NAME(pDFile), flags | O_BINARY);
if (pDFile->fd < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
diff --git a/src/util/src/tlog.c b/src/util/src/tlog.c
index 7b5dafcc8e771ba7d6e7b5691226bbc84a556ef8..657d152c18a576f3c25e41e0ca461b57002f85aa 100644
--- a/src/util/src/tlog.c
+++ b/src/util/src/tlog.c
@@ -191,7 +191,7 @@ static void *taosThreadToOpenNewFile(void *param) {
umask(0);
- int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
+ int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
tsLogObj.openInProgress = 0;
tsLogObj.lines = tsLogObj.maxLines - 1000;
@@ -252,7 +252,7 @@ void taosResetLog() {
}
static bool taosCheckFileIsOpen(char *logFileName) {
- int32_t fd = open(logFileName, O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
+ int32_t fd = open(logFileName, O_WRONLY | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
if (errno == ENOENT) {
return false;
@@ -340,7 +340,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
pthread_mutex_init(&tsLogObj.logMutex, NULL);
umask(0);
- tsLogObj.logHandle->fd = open(fileName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ tsLogObj.logHandle->fd = open(fileName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (tsLogObj.logHandle->fd < 0) {
printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno));
@@ -375,6 +375,9 @@ void taosPrintLog(const char *flags, int32_t dflag, const char *format, ...) {
fflush(stdout);
return;
}
+ if (flags == NULL || format == NULL) {
+ return;
+ }
va_list argpointer;
char buffer[MAX_LOGLINE_BUFFER_SIZE] = { 0 };
diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c
index b691abc5b9f6f828edcc46ec3a5989baa083f443..193ad3263cfa502d2eae6507cf4e12d6033c8a8c 100644
--- a/src/util/src/tnote.c
+++ b/src/util/src/tnote.c
@@ -92,7 +92,7 @@ static void *taosThreadToOpenNewNote(void *param) {
umask(0);
- int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
+ int32_t fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
return NULL;
}
@@ -132,7 +132,7 @@ static int32_t taosOpenNewNote(SNoteObj *pNote) {
}
static bool taosCheckNoteIsOpen(char *noteName, SNoteObj *pNote) {
- int32_t fd = open(noteName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ int32_t fd = open(noteName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
fprintf(stderr, "failed to open note:%s reason:%s\n", noteName, strerror(errno));
return true;
@@ -207,7 +207,7 @@ static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxN
pthread_mutex_init(&pNote->mutex, NULL);
umask(0);
- pNote->fd = open(noteName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ pNote->fd = open(noteName, O_WRONLY | O_CREAT | O_BINARY, S_IRWXU | S_IRWXG | S_IRWXO);
if (pNote->fd < 0) {
fprintf(stderr, "failed to open note file:%s reason:%s\n", noteName, strerror(errno));
diff --git a/tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py b/tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
index f8adf2a99c87d9658776e1f294cbd73f98ada1a3..6cc2f21b54efa4b7f590f267c3e2fdf7d58be078 100644
--- a/tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
+++ b/tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
@@ -61,6 +61,16 @@ class TDTestCase:
"create table t1 using st tags('{\"location\": \"beijing\"}')")
tdSql.execute("insert into t1 values(1500000000000, 1)")
+ tdSql.execute(
+ "create table t2 using st tags(NULL)")
+ tdSql.execute("insert into t2 values(1500000000000, NULL)")
+
+ tdSql.execute(
+ "create table t3 using st tags('')")
+ tdSql.execute("insert into t3 values(1500000000000, 0)")
+
+# sys.exit(1)
+
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
@@ -90,11 +100,11 @@ class TDTestCase:
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
- tdSql.checkRows(1)
- tdSql.checkData(0, 0, 't1')
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, 't3')
tdSql.query("select jtag->'location' from st")
- tdSql.checkRows(1)
+ tdSql.checkRows(3)
tdSql.checkData(0, 0, "\"beijing\"")
tdSql.query("select * from st where jtag contains 'location'")
@@ -102,6 +112,12 @@ class TDTestCase:
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, '{\"location\":\"beijing\"}')
+ tdSql.query("select jtag from st")
+ tdSql.checkRows(3)
+ tdSql.checkData(0, 0, "{\"location\":\"beijing\"}")
+ tdSql.checkData(1, 0, None)
+ tdSql.checkData(2, 0, None)
+
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
diff --git a/tests/examples/C#/stmt/StmtDemo.cs b/tests/examples/C#/stmt/StmtDemo.cs
index c2b299140976ed36f245f5693a2a047607c5b5be..fdd647fdb5f9c4bb528a2e99acc6975adf4c30a3 100644
--- a/tests/examples/C#/stmt/StmtDemo.cs
+++ b/tests/examples/C#/stmt/StmtDemo.cs
@@ -86,8 +86,8 @@ namespace TDengineDriver
stmtDemo.ExecuteQuery(createTable);
stmtDemo.StmtInit();
- string[] tableList = { "stmtdemo" };
- stmtDemo.loadTableInfo(tableList);
+ // string[] tableList = { "stmtdemo" };
+ // stmtDemo.loadTableInfo(tableList);
stmtDemo.StmtPrepare(stmtSql);
TAOS_BIND[] binds = stmtDemo.InitBindArr();
diff --git a/tests/examples/C#/stmt/stmt.csproj b/tests/examples/C#/stmt/stmt.csproj
index bc14850edbf9023e885436016141f24d6d042127..f0370cbf5684418edb026b56e306d7d7295a6638 100644
--- a/tests/examples/C#/stmt/stmt.csproj
+++ b/tests/examples/C#/stmt/stmt.csproj
@@ -1,7 +1,7 @@
-
+
diff --git a/tests/perftest-scripts/specifyColsComparison.py b/tests/perftest-scripts/specifyColsComparison.py
index 7e44ffbd0502a2449237fcfb86fb7f966c27ae00..92ca941d2250c0579f50f80bbb7dfb1d0a97978f 100644
--- a/tests/perftest-scripts/specifyColsComparison.py
+++ b/tests/perftest-scripts/specifyColsComparison.py
@@ -11,13 +11,13 @@ from fabric import Connection
class specifyColsCompared:
def __init__(self):
# remote server
- self.remote_hostname = "node2"
+ self.remote_hostname = "vm85"
self.remote_sshport = "22"
self.remote_username = "root"
- self.remote_password = "1"
+ self.remote_password = "tbase125!"
# TDengine pkg path
- self.autoDeploy = True
+ self.autoDeploy = False
self.install_package = '/root/share/TDengine-server-2.4.0.0-Linux-amd64.tar.gz'
# test element
@@ -25,13 +25,13 @@ class specifyColsCompared:
self.column_count_list = [100, 500, 2000]
# perfMonitor config
- self.thread_count = 32
+ self.thread_count = 10
self.taosc_port = 6030
self.http_port = 6041
self.database = "test"
self.table_count = 10
self.tag_count = 5
- self.col_count = 1000000
+ self.col_count = 50000
self.batch_size = 1
self.sleep_time = 20
@@ -81,6 +81,13 @@ class specifyColsCompared:
package_dir = '-'.join(package_name.split("-", 3)[0:3])
self.exec_local_cmd(f'tar -xvf {self.install_package} && cd {package_dir} && echo -e "\n" | ./install.sh')
+ def dropAndCreateDb(self):
+ try:
+ self.conn.run(f'taos -s "drop database if exists {self.database}"')
+ self.conn.run(f'taos -s "create database if not exists {self.database}"')
+ except Exception as e:
+ logger.error(f"drop db failed----{e}, please check by manual")
+
def uploadPkg(self):
# upload TDengine pkg
try:
@@ -109,9 +116,14 @@ class specifyColsCompared:
except Exception as e:
logger.error(f"deploy TDengine failed----{e}, please check by manual")
- def genInsertJsonFile(self, thread_count, table_count, row_count, batch_size, column_count, partical_col_num, update):
+ def genInsertJsonFile(self, thread_count, table_count, row_count, batch_size, column_count, partical_col_num, update, drop="yes", result_file=None):
# gen json file
json_file = os.path.join(self.current_dir, f'./insert.json')
+ if result_file == None:
+ result_file = self.log_file
+ else:
+ result_file = self.log_file.replace('performance.log', 'unused_performance.log')
+
jdict = {
"filetype": "insert",
"cfgdir": "/etc/taos",
@@ -123,11 +135,11 @@ class specifyColsCompared:
"password": "taosdata",
"thread_count": thread_count,
"thread_count_create_tbl": 1,
- "result_file": self.log_file,
+ "result_file": result_file,
"databases": [{
"dbinfo": {
"name": self.database,
- "drop": "yes",
+ "drop": drop,
"update": update
},
"super_tables": [{
@@ -155,17 +167,35 @@ class specifyColsCompared:
def runTest(self):
self.initLog()
- self.deployPerfMonitor()
if self.autoDeploy:
self.deployTDengine()
+ self.deployPerfMonitor()
+
+ # blank insert
+ update = 0
+ for col_count in self.column_count_list:
+ for partical_col_num in [int(col_count * 0), int(col_count * 0.1), int(col_count * 0.3)]:
+ logger.info(f'update: {update} || col_count: {col_count} || partical_col_num: {partical_col_num} test')
+ self.genInsertJsonFile(self.thread_count, self.table_count, self.col_count, self.batch_size, col_count, partical_col_num, update)
+ self.exec_local_cmd(f'{self.current_dir}/perfMonitor -f insert.json')
+ time.sleep(self.sleep_time)
+
+ # update = 1/2
for update in self.update_list:
for col_count in self.column_count_list:
- for partical_col_num in [int(col_count * 0), int(col_count * 0.1), int(col_count * 0.3)]:
+ for partical_col_num in [int(col_count * 0.1), int(col_count * 0.3)]:
logger.info(f'update: {update} || col_count: {col_count} || partical_col_num: {partical_col_num} test')
- self.genInsertJsonFile(self.thread_count, self.table_count, self.col_count, self.batch_size, col_count, partical_col_num, update)
+ self.genInsertJsonFile(self.thread_count, self.table_count, self.col_count, 100, col_count, int(col_count * 0), update, drop="yes", result_file="unused")
+ self.exec_local_cmd(f'{self.current_dir}/perfMonitor -f insert.json')
+ time.sleep(self.sleep_time)
+ self.genInsertJsonFile(self.thread_count, self.table_count, self.col_count, self.batch_size, col_count, partical_col_num, update, drop="no")
self.exec_local_cmd(f'{self.current_dir}/perfMonitor -f insert.json')
time.sleep(self.sleep_time)
if __name__ == '__main__':
runPerf = specifyColsCompared()
runPerf.runTest()
+
+
+
+
diff --git a/tests/pytest/fulltest-others.sh b/tests/pytest/fulltest-others.sh
index a081833ddb323ad1becfc24f48fdaaebac26b328..afbc2e07c0f3c5f86b471f004d93e718dfa2719a 100755
--- a/tests/pytest/fulltest-others.sh
+++ b/tests/pytest/fulltest-others.sh
@@ -1,45 +1,34 @@
#!/bin/bash
ulimit -c unlimited
#======================p1-start===============
-
#python3 ./test.py -f dbmgmt/database-name-boundary.py
python3 test.py -f dbmgmt/nanoSecondCheck.py
-
#
python3 ./test.py -f tsdb/tsdbComp.py
-
# user
python3 ./test.py -f user/user_create.py
python3 ./test.py -f user/pass_len.py
-
#======================p1-end===============
#======================p2-start===============
-
# perfbenchmark
python3 ./test.py -f perfbenchmark/bug3433.py
#python3 ./test.py -f perfbenchmark/bug3589.py
#python3 ./test.py -f perfbenchmark/taosdemoInsert.py
-
#alter table
python3 ./test.py -f alter/alter_table_crash.py
python3 ./test.py -f alter/alterTabAddTagWithNULL.py
python3 ./test.py -f alter/alterTimestampColDataProcess.py
-
#======================p2-end===============
#======================p3-start===============
-
python3 ./test.py -f alter/alter_table.py
python3 ./test.py -f alter/alter_debugFlag.py
python3 ./test.py -f alter/alter_keep.py
python3 ./test.py -f alter/alter_cacheLastRow.py
python3 ./test.py -f alter/alter_create_exception.py
python3 ./test.py -f alter/alterColMultiTimes.py
-
#======================p3-end===============
#======================p4-start===============
-
python3 ./test.py -f account/account_create.py
-
# client
python3 ./test.py -f client/client.py
python3 ./test.py -f client/version.py
@@ -50,12 +39,10 @@ python3 ./test.py -f client/taoshellCheckCase.py
# python3 ./test.py -f client/change_time_1_2.py
python3 client/twoClients.py
python3 testMinTablesPerVnode.py
-
# topic
python3 ./test.py -f topic/topicQuery.py
#======================p4-end===============
#======================p5-start===============
python3 ./test.py -f ../system-test/0-management/1-stable/create_col_tag.py
python3 ./test.py -f ../develop-test/0-management/3-tag/json_tag.py
-
#======================p5-end===============
diff --git a/tests/pytest/fulltest-query.sh b/tests/pytest/fulltest-query.sh
index b36694017c405991271340c91d21da7ca2e1b21b..f19e11024b1447d5546b3a14a487d98b0edb1deb 100755
--- a/tests/pytest/fulltest-query.sh
+++ b/tests/pytest/fulltest-query.sh
@@ -1,14 +1,11 @@
#!/bin/bash
ulimit -c unlimited
#======================p1-start===============
-
# timezone
python3 ./test.py -f TimeZone/TestCaseTimeZone.py
-
#stable
python3 ./test.py -f stable/insert.py
python3 ./test.py -f stable/query_after_reset.py
-
#table
python3 ./test.py -f table/alter_wal0.py
python3 ./test.py -f table/column_name.py
@@ -22,7 +19,6 @@ python3 ./test.py -f table/boundary.py
#python3 ./test.py -f table/create.py
python3 ./test.py -f table/del_stable.py
python3 ./test.py -f table/create_db_from_normal_db.py
-
# tag
python3 ./test.py -f tag_lite/filter.py
python3 ./test.py -f tag_lite/create-tags-boundary.py
@@ -38,10 +34,8 @@ python3 ./test.py -f tag_lite/bool_binary.py
python3 ./test.py -f tag_lite/bool_int.py
python3 ./test.py -f tag_lite/bool.py
python3 ./test.py -f tag_lite/change.py
-
#======================p1-end===============
#======================p2-start===============
-
python3 ./test.py -f tag_lite/column.py
python3 ./test.py -f tag_lite/commit.py
python3 ./test.py -f tag_lite/create.py
@@ -65,10 +59,8 @@ python3 ./test.py -f tag_lite/unsignedTinyint.py
python3 ./test.py -f tag_lite/alter_tag.py
python3 ./test.py -f tag_lite/drop_auto_create.py
python3 ./test.py -f tag_lite/json_tag_extra.py
-
#======================p2-end===============
#======================p3-start===============
-
#query
python3 ./test.py -f query/distinctOneColTb.py
python3 ./test.py -f query/filter.py
@@ -118,10 +110,8 @@ python3 ./test.py -f query/subqueryFilter.py
python3 ./test.py -f query/nestedQuery/queryInterval.py
python3 ./test.py -f query/queryStateWindow.py
# python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
-
#======================p3-end===============
#======================p4-start===============
-
python3 ./test.py -f query/nestquery_last_row.py
python3 ./test.py -f query/nestedQuery/nestedQuery.py
python3 ./test.py -f query/nestedQuery/nestedQuery_datacheck.py
@@ -145,7 +135,6 @@ python3 ./test.py -f query/query.py
python3 ./test.py -f query/queryDiffColsTagsAndOr.py
python3 ./test.py -f query/queryGroupTbname.py
python3 ./test.py -f query/queryRegex.py
-
#stream
python3 ./test.py -f stream/metric_1.py
python3 ./test.py -f stream/metric_n.py
@@ -159,18 +148,14 @@ python3 ./test.py -f stream/table_1.py
python3 ./test.py -f stream/table_n.py
python3 ./test.py -f stream/showStreamExecTimeisNull.py
python3 ./test.py -f stream/cqSupportBefore1970.py
-
python3 ./test.py -f query/queryGroupbyWithInterval.py
python3 queryCount.py
-
# subscribe
python3 test.py -f subscribe/singlemeter.py
#python3 test.py -f subscribe/stability.py
python3 test.py -f subscribe/supertable.py
-
#======================p4-end===============
#======================p5-start===============
-
# functions
python3 ./test.py -f functions/all_null_value.py
python3 ./test.py -f functions/function_avg.py -r 1
@@ -208,12 +193,6 @@ python3 ./test.py -f functions/function_mavg.py
python3 ./test.py -f functions/function_csum.py
python3 ./test.py -f functions/function_percentile2.py
python3 ./test.py -f functions/variable_httpDbNameMandatory.py
-
-
-
######## system-test
#python3 ./test.py -f ../system-test/2-query/9-others/TD-11389.py # this case will run when this bug fix TD-11389
-
-
#======================p5-end===============
-
diff --git a/tests/pytest/fulltest-tools.sh b/tests/pytest/fulltest-tools.sh
index 4b7559bbdcb9d022a254218c4dd5a905e1eaa3d9..7614effbe9c5fd6ad82955193f11dbda19984bff 100755
--- a/tests/pytest/fulltest-tools.sh
+++ b/tests/pytest/fulltest-tools.sh
@@ -1,29 +1,24 @@
#!/bin/bash
ulimit -c unlimited
#======================p1-start===============
-
# tools
python3 test.py -f tools/taosdumpTest.py
python3 test.py -f tools/taosdumpTest2.py
-
python3 test.py -f tools/taosdemoTest.py
python3 test.py -f tools/taosdemoTestWithoutMetric.py
python3 test.py -f tools/taosdemoTestWithJson.py
-
#======================p1-end===============
#======================p2-start===============
-
python3 test.py -f tools/taosdemoTestLimitOffset.py
python3 test.py -f tools/taosdemoTestTblAlt.py
python3 test.py -f tools/taosdemoTestSampleData.py
-#python3 test.py -f tools/taosdemoTestInterlace.py
-# python3 test.py -f tools/taosdemoTestQuery.py
+python3 test.py -f tools/taosdemoTestInterlace.py
+python3 test.py -f tools/taosdemoTestQuery.py
python3 ./test.py -f tools/taosdemoTestdatatype.py
#======================p2-end===============
#======================p3-start===============
-
# nano support
-#python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoQuery.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanosubscribe.py
python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_step.py
@@ -31,29 +26,14 @@ python3 test.py -f tools/taosdumpTestNanoSupport.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
#======================p3-end===============
#======================p4-start===============
-
-#python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
-#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertAllType.py
python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
-
-#python3 test.py -f tools/taosdemoAllTest/TD-10539/creatfe_taosdemo.py
-#python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertWithJsonSml.py
python3 test.py -f tools/taosdemoAllTest/taosdemoTestInsertShell.py
-
#======================p4-end===============
#======================p5-start===============
-
#======================p5-end===============
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py b/tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
index 34acbb2c0112b56cee6a637b9e1fbd5ddb42ddf7..f6928dffefde2420969492c2160456297d99e8bf 100644
--- a/tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+++ b/tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
@@ -12,7 +12,7 @@
# -*- coding: utf-8 -*-
import sys
-import os
+import os, time
from util.log import *
from util.cases import *
from util.sql import *
@@ -107,6 +107,7 @@ class TDTestCase:
# insert by csv files and timetamp is long int , strings in ts and
# cols
+
os.system(
"%staosBenchmark -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestNanoDatabasecsv.json -y " %
binPath)
@@ -117,9 +118,11 @@ class TDTestCase:
tdSql.checkData(0, 0, 10000)
tdSql.query("describe stb0")
tdSql.checkDataType(3, 1, "TIMESTAMP")
+
tdSql.query(
- "select count(*) from stb0 where ts > \"2021-07-01 00:00:00.490000000\"")
+ "select count(*) from nsdbcsv.stb0 where ts > \"2021-07-01 00:00:00.490000000\"")
tdSql.checkData(0, 0, 5000)
+
tdSql.query("select count(*) from stb0 where ts < 1626918583000000000")
tdSql.checkData(0, 0, 10000)
@@ -134,31 +137,9 @@ class TDTestCase:
binPath)
tdSql.query("select count(*) from test.meters")
tdSql.checkData(0, 0, 600)
- # check taosdemo -s
-
- sqls_ls = [
- 'drop database if exists nsdbsql;',
- 'create database nsdbsql precision "ns" keep 3600 days 6 update 1;',
- 'use nsdbsql;',
- 'CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int);',
- 'CREATE TABLE d1001 USING meters TAGS ("Beijing.Chaoyang", 2);',
- 'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 10.2, 219, 0.32);',
- 'INSERT INTO d1001 USING METERS TAGS ("Beijng.Chaoyang", 2) VALUES (now, 85, 32, 0.76);']
-
- with open("./taosdemoTestNanoCreateDB.sql", mode="a") as sql_files:
- for sql in sqls_ls:
- sql_files.write(sql + "\n")
- sql_files.close()
-
- sleep(10)
-
- os.system("%staosBenchmark -s taosdemoTestNanoCreateDB.sql -y " % binPath)
- tdSql.query("select count(*) from nsdbsql.meters")
- tdSql.checkData(0, 0, 2)
os.system("rm -rf ./res.txt")
os.system("rm -rf ./*.py.sql")
- os.system("rm -rf ./taosdemoTestNanoCreateDB.sql")
def stop(self):
tdSql.close()
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
index 1b255a37f19b584211430b2f13e8754faedd5577..66885ebab89f7221830e66d642ca17b99de0e397 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-json-alltype.json
@@ -56,7 +56,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
- "tags": [{"type": "INT", "count":1}]
+ "tags": [{"type": "INT", "count":6}]
},
{
"name": "stb1",
@@ -81,8 +81,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "TINYINT", "count":1}],
- "tags": [{"type": "TINYINT", "count":1}]
+ "columns": [{"type": "TINYINT", "count":6}],
+ "tags": [{"type": "TINYINT", "count":6}]
},
{
"name": "stb2",
@@ -108,7 +108,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "BIGINT"}],
- "tags": [{"type": "BIGINT", "count":1}]
+ "tags": [{"type": "BIGINT", "count":6}]
},
{
"name": "stb3",
@@ -134,7 +134,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "SMALLINT"}],
- "tags": [{"type": "SMALLINT", "count":1}]
+ "tags": [{"type": "SMALLINT", "count":6}]
},
{
"name": "stb4",
@@ -160,7 +160,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "FLOAT"}],
- "tags": [{"type": "FLOAT", "count":1}]
+ "tags": [{"type": "FLOAT", "count":6}]
},
{
"name": "stb5",
@@ -186,7 +186,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "DOUBLE"}],
- "tags": [{"type": "DOUBLE", "count":1}]
+ "tags": [{"type": "DOUBLE", "count":6}]
},
{
"name": "stb6",
@@ -212,7 +212,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UINT"}],
- "tags": [{"type": "UINT", "count":1}]
+ "tags": [{"type": "UINT", "count":6}]
},
{
"name": "stb7",
@@ -237,8 +237,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [ {"type": "BOOL"}],
- "tags": [{"type": "BOOL", "count":1}]
+ "columns": [ {"type": "INT"}],
+ "tags": [{"type": "INT", "count":3}]
},
{
"name": "stb8",
@@ -263,8 +263,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "NCHAR","len": 16, "count":1}],
- "tags": [{"type": "NCHAR", "count":1}]
+ "columns": [{"type": "NCHAR","len": 16, "count":6}],
+ "tags": [{"type": "NCHAR", "count":6}]
},
{
"name": "stb9",
@@ -289,8 +289,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "BINARY", "len": 16, "count":1}],
- "tags": [{"type": "BINARY", "count":1}]
+ "columns": [{"type": "BINARY", "len": 16, "count":6}],
+ "tags": [{"type": "BINARY", "count":6}]
},
{
"name": "stb10",
@@ -316,7 +316,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UBIGINT"}],
- "tags": [{"type": "UBIGINT", "count":1}]
+ "tags": [{"type": "UBIGINT", "count":6}]
},
{
"name": "stb11",
@@ -342,7 +342,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UTINYINT"}],
- "tags": [{"type": "UTINYINT", "count":1}]
+ "tags": [{"type": "UTINYINT", "count":3}]
},
{
"name": "stb12",
@@ -368,7 +368,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [ {"type": "USMALLINT"}],
- "tags": [{"type": "USMALLINT", "count":1}]
+ "tags": [{"type": "USMALLINT", "count":6}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
index 983a3009db68e95fecf3f8eda91f0aa3f41aff37..a786e93696e8b13b39d45a9c4c8ef1aae829fef8 100644
--- a/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
+++ b/tests/pytest/tools/taosdemoAllTest/sml/insert-sml-telnet-alltype.json
@@ -56,7 +56,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
- "tags": [{"type": "INT", "count":1}]
+ "tags": [{"type": "INT", "count":6}]
},
{
"name": "stb1",
@@ -82,7 +82,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UINT"}],
- "tags": [{"type": "UINT", "count":1}]
+ "tags": [{"type": "UINT", "count":6}]
},
{
"name": "stb2",
@@ -107,8 +107,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "TINYINT", "count":1}],
- "tags": [{"type": "TINYINT", "count":1}]
+ "columns": [{"type": "TINYINT", "count":6}],
+ "tags": [{"type": "TINYINT", "count":6}]
},
{
"name": "stb3",
@@ -134,7 +134,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "BIGINT"}],
- "tags": [{"type": "BIGINT", "count":1}]
+ "tags": [{"type": "BIGINT", "count":6}]
},
{
"name": "stb4",
@@ -160,7 +160,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "SMALLINT"}],
- "tags": [{"type": "SMALLINT", "count":1}]
+ "tags": [{"type": "SMALLINT", "count":6}]
},
{
"name": "stb5",
@@ -186,7 +186,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "FLOAT"}],
- "tags": [{"type": "FLOAT", "count":1}]
+ "tags": [{"type": "FLOAT", "count":6}]
},
{
"name": "stb6",
@@ -212,7 +212,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "DOUBLE"}],
- "tags": [{"type": "DOUBLE", "count":1}]
+ "tags": [{"type": "DOUBLE", "count":6}]
},
{
"name": "stb7",
@@ -237,8 +237,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [ {"type": "BOOL"}],
- "tags": [{"type": "BOOL", "count":1}]
+ "columns": [ {"type": "int"}],
+ "tags": [{"type": "int", "count":6}]
},
{
"name": "stb8",
@@ -263,8 +263,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "NCHAR","len": 16, "count":1}],
- "tags": [{"type": "NCHAR", "count":1}]
+ "columns": [{"type": "NCHAR","len": 16, "count":6}],
+ "tags": [{"type": "NCHAR", "count":6}]
},
{
"name": "stb9",
@@ -289,8 +289,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
- "columns": [{"type": "BINARY", "len": 16, "count":1}],
- "tags": [{"type": "BINARY", "count":1}]
+ "columns": [{"type": "BINARY", "len": 16, "count":6}],
+ "tags": [{"type": "BINARY", "count":6}]
},
{
"name": "stb10",
@@ -316,7 +316,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UBIGINT"}],
- "tags": [{"type": "UBIGINT", "count":1}]
+ "tags": [{"type": "UBIGINT", "count":6}]
},
{
"name": "stb11",
@@ -342,7 +342,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UTINYINT"}],
- "tags": [{"type": "UTINYINT", "count":1}]
+ "tags": [{"type": "UTINYINT", "count":6}]
},
{
"name": "stb12",
@@ -368,7 +368,7 @@
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [ {"type": "USMALLINT"}],
- "tags": [{"type": "USMALLINT", "count":1}]
+ "tags": [{"type": "USMALLINT", "count":6}]
}]
}]
}
diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
index 05ccce79101b5bec1b541bd0436b86fc0151492c..6a5a3f767f1c5787680d75ee8cb98ee284a44741 100644
--- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
+++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
@@ -268,16 +268,16 @@ class TDTestCase:
tdSql.checkData(0, 0, 10)
# insert: sample json
- os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath)
- tdSql.execute("use dbtest123")
- tdSql.query("select c2 from stb0")
- tdSql.checkData(0, 0, 2147483647)
- tdSql.query("select * from stb1 where t1=-127")
- tdSql.checkRows(20)
- tdSql.query("select * from stb1 where t2=127")
- tdSql.checkRows(10)
- tdSql.query("select * from stb1 where t2=126")
- tdSql.checkRows(10)
+ #os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-sample-stmt.json -y " % binPath)
+ #tdSql.execute("use dbtest123")
+ #tdSql.query("select c2 from stb0")
+ #tdSql.checkData(0, 0, 2147483647)
+ #tdSql.query("select * from stb1 where t1=-127")
+ #tdSql.checkRows(20)
+ #tdSql.query("select * from stb1 where t2=127")
+ #tdSql.checkRows(10)
+ #tdSql.query("select * from stb1 where t2=126")
+ #tdSql.checkRows(10)
# insert: test interlace parament
os.system("%staosBenchmark -f tools/taosdemoAllTest/stmt/insert-interlace-row-stmt.json -y " % binPath)
diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt
index 9a8f602901507bc4fc31d3902461394446a3067b..67eadbf851a7185c131220c94d046247ff89d166 100644
--- a/tests/script/jenkins/basic.txt
+++ b/tests/script/jenkins/basic.txt
@@ -1,8 +1,6 @@
cd ../../../debug; cmake ..
cd ../../../debug; make
-
#======================b1-start===============
-
./test.sh -f general/field/2.sim
./test.sh -f general/field/3.sim
./test.sh -f general/field/4.sim
@@ -14,8 +12,6 @@ cd ../../../debug; make
./test.sh -f general/field/single.sim
./test.sh -f general/field/smallint.sim
./test.sh -f general/field/tinyint.sim
-
-
# ./test.sh -f general/http/autocreate.sim
# ./test.sh -f general/http/chunked.sim
# ./test.sh -f general/http/gzip.sim
@@ -27,7 +23,6 @@ cd ../../../debug; make
# ./test.sh -f general/http/telegraf.sim
# ./test.sh -f general/http/grafana_bug.sim
# ./test.sh -f general/http/grafana.sim
-
./test.sh -f general/insert/basic.sim
./test.sh -f general/insert/insert_drop.sim
./test.sh -f general/insert/query_block1_memory.sim
@@ -37,7 +32,6 @@ cd ../../../debug; make
./test.sh -f general/insert/query_file_memory.sim
./test.sh -f general/insert/query_multi_file.sim
./test.sh -f general/insert/tcp.sim
-
./test.sh -f general/parser/alter.sim
./test.sh -f general/parser/alter1.sim
./test.sh -f general/parser/alter_stable.sim
@@ -90,30 +84,22 @@ cd ../../../debug; make
./test.sh -f general/db/nosuchfile.sim
./test.sh -f general/parser/function.sim
./test.sh -f unique/cluster/vgroup100.sim
-
# ./test.sh -f unique/http/admin.sim
# ./test.sh -f unique/http/opentsdb.sim
-
./test.sh -f unique/import/replica2.sim
./test.sh -f unique/import/replica3.sim
-
./test.sh -f general/alter/cached_schema_after_alter.sim
-
#======================b1-end===============
#======================b2-start===============
-
-
#./test.sh -f general/wal/sync.sim
./test.sh -f general/wal/kill.sim
./test.sh -f general/wal/maxtables.sim
-
./test.sh -f general/user/authority.sim
./test.sh -f general/user/monitor.sim
./test.sh -f general/user/pass_alter.sim
./test.sh -f general/user/pass_len.sim
./test.sh -f general/user/user_create.sim
./test.sh -f general/user/user_len.sim
-
./test.sh -f general/vector/metrics_field.sim
./test.sh -f general/vector/metrics_mix.sim
./test.sh -f general/vector/metrics_query.sim
@@ -125,7 +111,6 @@ cd ../../../debug; make
./test.sh -f general/vector/table_mix.sim
./test.sh -f general/vector/table_query.sim
./test.sh -f general/vector/table_time.sim
-
./test.sh -f unique/account/account_create.sim
./test.sh -f unique/account/account_delete.sim
./test.sh -f unique/account/account_len.sim
@@ -137,24 +122,17 @@ cd ../../../debug; make
./test.sh -f unique/account/usage.sim
./test.sh -f unique/account/user_create.sim
./test.sh -f unique/account/user_len.sim
-
./test.sh -f unique/big/maxvnodes.sim
./test.sh -f unique/big/tcp.sim
-
./test.sh -f unique/cluster/alter.sim
./test.sh -f unique/cluster/cache.sim
#./test.sh -f unique/http/admin.sim
#./test.sh -f unique/http/opentsdb.sim
-
./test.sh -f unique/import/replica2.sim
./test.sh -f unique/import/replica3.sim
-
./test.sh -f general/alter/cached_schema_after_alter.sim
-
-
#======================b2-end===============
#======================b3-start===============
-
./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim
#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim
./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim
@@ -175,7 +153,6 @@ cd ../../../debug; make
./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim
./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim
./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim
-
./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim
./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim
./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim
@@ -189,19 +166,16 @@ cd ../../../debug; make
./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim
./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim
./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim
-
./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim
./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim
./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim
./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim
./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim
./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim
-
./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim
./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
-
./test.sh -f unique/stable/balance_replica1.sim
./test.sh -f unique/stable/dnode2_stop.sim
./test.sh -f unique/stable/dnode2.sim
@@ -210,11 +184,8 @@ cd ../../../debug; make
./test.sh -f unique/stable/replica2_vnode3.sim
./test.sh -f unique/stable/replica3_dnode6.sim
./test.sh -f unique/stable/replica3_vnode3.sim
-
#======================b3-end===============
#======================b4-start===============
-
-
./test.sh -f general/alter/count.sim
./test.sh -f general/alter/dnode.sim
./test.sh -f general/alter/import.sim
@@ -222,22 +193,17 @@ cd ../../../debug; make
./test.sh -f general/alter/insert2.sim
./test.sh -f general/alter/metrics.sim
./test.sh -f general/alter/table.sim
-
./test.sh -f general/cache/new_metrics.sim
./test.sh -f general/cache/restart_metrics.sim
./test.sh -f general/cache/restart_table.sim
-
./test.sh -f general/connection/connection.sim
-
./test.sh -f general/column/commit.sim
./test.sh -f general/column/metrics.sim
./test.sh -f general/column/table.sim
-
./test.sh -f general/compress/commitlog.sim
./test.sh -f general/compress/compress.sim
./test.sh -f general/compress/compress2.sim
./test.sh -f general/compress/uncompress.sim
-
./test.sh -f general/stable/disk.sim
./test.sh -f general/stable/dnode3.sim
./test.sh -f general/stable/metrics.sim
@@ -245,7 +211,6 @@ cd ../../../debug; make
./test.sh -f general/stable/show.sim
./test.sh -f general/stable/values.sim
./test.sh -f general/stable/vnode3.sim
-
./test.sh -f unique/column/replica3.sim
./test.sh -f issue/TD-2713.sim
./test.sh -f general/parser/select_distinct_tag.sim
@@ -253,10 +218,8 @@ cd ../../../debug; make
./test.sh -f issue/TD-2677.sim
./test.sh -f issue/TD-2680.sim
./test.sh -f unique/dnode/lossdata.sim
-
#======================b4-end===============
#======================b5-start===============
-
./test.sh -f unique/dnode/alternativeRole.sim
./test.sh -f unique/dnode/balance1.sim
./test.sh -f unique/dnode/balance2.sim
@@ -264,7 +227,6 @@ cd ../../../debug; make
./test.sh -f unique/dnode/balancex.sim
./test.sh -f unique/dnode/offline1.sim
./test.sh -f unique/dnode/offline2.sim
-
./test.sh -f general/stream/metrics_del.sim
./test.sh -f general/stream/metrics_replica1_vnoden.sim
./test.sh -f general/stream/restart_stream.sim
@@ -272,22 +234,18 @@ cd ../../../debug; make
./test.sh -f general/stream/stream_restart.sim
./test.sh -f general/stream/table_del.sim
./test.sh -f general/stream/table_replica1_vnoden.sim
-
./test.sh -f general/connection/test_old_data.sim
./test.sh -f unique/dnode/datatrans_3node.sim
./test.sh -f unique/dnode/datatrans_3node_2.sim
./test.sh -f general/db/alter_tables_d2.sim
./test.sh -f general/db/alter_tables_v1.sim
./test.sh -f general/db/alter_tables_v4.sim
-
#======================b5-end===============
#======================b6-start===============
-
./test.sh -f unique/dnode/reason.sim
./test.sh -f unique/dnode/remove1.sim
./test.sh -f unique/dnode/remove2.sim
./test.sh -f unique/dnode/vnode_clean.sim
-
./test.sh -f unique/db/commit.sim
./test.sh -f unique/db/delete.sim
./test.sh -f unique/db/delete_part.sim
@@ -298,14 +256,12 @@ cd ../../../debug; make
./test.sh -f unique/db/replica_reduce32.sim
./test.sh -f unique/db/replica_reduce31.sim
./test.sh -f unique/db/replica_part.sim
-
./test.sh -f unique/vnode/many.sim
./test.sh -f unique/vnode/replica2_basic2.sim
./test.sh -f unique/vnode/replica2_repeat.sim
./test.sh -f unique/vnode/replica3_basic.sim
./test.sh -f unique/vnode/replica3_repeat.sim
./test.sh -f unique/vnode/replica3_vgroup.sim
-
./test.sh -f unique/dnode/monitor.sim
./test.sh -f unique/dnode/monitor_bug.sim
./test.sh -f unique/dnode/simple.sim
@@ -315,7 +271,6 @@ cd ../../../debug; make
./test.sh -f unique/dnode/offline3.sim
./test.sh -f general/wal/kill.sim
./test.sh -f general/wal/maxtables.sim
-
./test.sh -f general/import/basic.sim
./test.sh -f general/import/commit.sim
./test.sh -f general/import/large.sim
@@ -323,10 +278,8 @@ cd ../../../debug; make
./test.sh -f unique/cluster/balance1.sim
./test.sh -f unique/cluster/balance2.sim
./test.sh -f unique/cluster/balance3.sim
-
#======================b6-end===============
#======================b7-start===============
-
./test.sh -f general/compute/avg.sim
./test.sh -f general/compute/bottom.sim
./test.sh -f general/compute/count.sim
@@ -343,7 +296,6 @@ cd ../../../debug; make
./test.sh -f general/compute/stddev.sim
./test.sh -f general/compute/sum.sim
./test.sh -f general/compute/top.sim
-
./test.sh -f general/db/alter_option.sim
./test.sh -f general/db/alter_vgroups.sim
./test.sh -f general/db/basic.sim
@@ -392,7 +344,6 @@ cd ../../../debug; make
./test.sh -f general/table/tinyint.sim
./test.sh -f general/table/vgroup.sim
./test.sh -f general/table/createmulti.sim
-
./test.sh -f unique/mnode/mgmt20.sim
./test.sh -f unique/mnode/mgmt21.sim
./test.sh -f unique/mnode/mgmt22.sim
@@ -403,7 +354,6 @@ cd ../../../debug; make
./test.sh -f unique/mnode/mgmt33.sim
./test.sh -f unique/mnode/mgmt34.sim
./test.sh -f unique/mnode/mgmtr2.sim
-
#./test.sh -f unique/arbitrator/insert_duplicationTs.sim
./test.sh -f general/parser/join_manyblocks.sim
./test.sh -f general/parser/stableOp.sim
@@ -415,9 +365,7 @@ cd ../../../debug; make
./test.sh -f general/parser/last_cache.sim
./test.sh -f unique/big/balance.sim
./test.sh -f general/parser/nestquery.sim
-
./test.sh -f general/parser/udf.sim
./test.sh -f general/parser/udf_dll.sim
./test.sh -f general/parser/udf_dll_stable.sim
-
#======================b7-end===============
diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
index e5f2928748896a2aaa811ddc76bfb16b9626bf1d..e3623c7c629d671eedc7b6a416b9e77e6445c4ff 100644
--- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
+++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
@@ -51,7 +51,7 @@ sleep 1000
sql connect
sleep 1000
sql create dnode $hostname2
-sleep 1000
+sleep 3000
print ============== step2: create database with replica 2, and create table, insert data
$totalTableNum = 10
diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
index 8d063020e73be449bc95463e966d9081b0cd5be5..c88e26d7eb19a533be84f646321e103480b2d10a 100644
--- a/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
+++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
@@ -51,7 +51,7 @@ sleep 1000
sql connect
sleep 1000
sql create dnode $hostname2
-sleep 1000
+sleep 2000
print ============== step2: create database with replica 2, and create table, insert data
$totalTableNum = 10
diff --git a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
index 8f837b7e477ab801b296b32ddcf9a5c683c351f0..ed3f9b8274c204727a08c163596316ed17808d6b 100644
--- a/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
+++ b/tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
@@ -51,7 +51,7 @@ sleep 1000
sql connect
sleep 1000
sql create dnode $hostname2
-sleep 1000
+sleep 2000
print ============== step2: create database with replica 2, and create table, insert data
$totalTableNum = 10
diff --git a/tests/system-test/2-query/TD-11483.py b/tests/system-test/2-query/TD-11483.py
new file mode 100644
index 0000000000000000000000000000000000000000..c477047a1fb06f05f8321c82855cf320cce722d1
--- /dev/null
+++ b/tests/system-test/2-query/TD-11483.py
@@ -0,0 +1,122 @@
+###################################################################
+# Copyright (c) 2020 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 posixpath import split
+import sys
+import os
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 caseDescription(self):
+
+ '''
+ case1 :[TD-11483] :
+ this test case is an test case for support nest query to select key timestamp col in outer query .
+ '''
+ return
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 getcfgPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+ print(selfPath)
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ cfgPath = projPath + "/sim/dnode1/cfg "
+ return cfgPath
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("create database if not exists testdb keep 36500;")
+ tdSql.execute("use testdb;")
+ tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
+ for i in range(self.num):
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
+
+ tdSql.query('select ts ,max(value) from st;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,19)
+
+ cfg_path = self.getcfgPath()
+ taos_cmd1= "taos -c %s -s 'create table testdb.elapsed_vol as select elapsed(ts) from testdb.st interval(10s) sliding(5s) group by tbname;' " % (cfg_path)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+
+ flag = 0
+
+ while flag <1:
+ tdSql.query('select count(*) from testdb.elapsed_vol;')
+ data = tdSql.getResult("select count(*) from testdb.elapsed_vol;")
+ if data ==[]:
+ sleep(1)
+ else:
+ flag =1
+ tdSql.checkData(0,0,20)
+ break
+
+
+
+
+ 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/2-query/TD-12145.py b/tests/system-test/2-query/TD-12145.py
new file mode 100644
index 0000000000000000000000000000000000000000..449c028c0f4d173f7d24b806071737478fa49890
--- /dev/null
+++ b/tests/system-test/2-query/TD-12145.py
@@ -0,0 +1,97 @@
+###################################################################
+# Copyright (c) 2020 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 posixpath import split
+import sys
+import os
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 caseDescription(self):
+
+ '''
+ case1 : [TD-12145]
+ this test case is an test case for support nest query to select key timestamp col in outer query .
+ '''
+ return
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("create database if not exists testdb keep 36500;")
+ tdSql.execute("use testdb;")
+ tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
+ for i in range(self.num):
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
+
+ tdSql.query('select ts ,max(value) from st;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,19)
+
+ tdSql.error('select ts ,max(value) from (select * from st);')
+ tdSql.error('select ts ,max(value) from (select ts ,value from st);')
+ tdSql.error('select ts ,elapsed(ts) from (select ts ,value from st);')
+ tdSql.query('select ts from (select ts ,value from tb1);')
+ tdSql.checkRows(4)
+ tdSql.query('select ts, value from (select * from tb1);')
+ tdSql.checkRows(4)
+ tdSql.error('select _c0,max(value) from (select ts ,value from tb1);')
+ tdSql.query('select max(value) from (select ts ,value from tb1);')
+ tdSql.checkRows(1)
+ tdSql.query('select ts,max(value) from (select csum(value) value from tb1);')
+ tdSql.checkRows(1)
+ tdSql.query('select ts,max(value) from (select diff(value) value from tb1);')
+ tdSql.checkRows(1)
+ tdSql.query('select ts ,max(value) from (select csum(value) value from st group by tbname);')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,76)
+
+ 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/2-query/TD-12164.py b/tests/system-test/2-query/TD-12164.py
new file mode 100644
index 0000000000000000000000000000000000000000..217147868d95f593725d77a078078cb719e326a8
--- /dev/null
+++ b/tests/system-test/2-query/TD-12164.py
@@ -0,0 +1,116 @@
+###################################################################
+# Copyright (c) 2020 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 posixpath import split
+import sys
+import os
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 caseDescription(self):
+
+ '''
+ case1 : [TD-12164]
+ this test case is an test case for key timestamp colum , such as elapsed function ,it will occur unexpected results ;
+ Root Cause: elapse parameter column is checked that both the index and id is 0
+
+ '''
+ return
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("create database if not exists testdb keep 36500;")
+ tdSql.execute("use testdb;")
+ tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
+ for i in range(self.num):
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
+
+ # basic query
+ tdSql.query("select elapsed(ts) from st group by tbname ; ")
+ tdSql.query("select elapsed(ts) from tb1 ; ")
+ tdSql.error("select elapsed(ts) from tb1 group by tbname ; ")
+ tdSql.query("select elapsed(ts) from st group by tbname order by ts; ")
+ tdSql.checkRows(10)
+ tdSql.checkData(0,0,0)
+ tdSql.checkData(1,0,9900)
+ tdSql.checkData(9,0,89100)
+
+ # nest query
+ tdSql.error('select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from tb1) ;')
+ tdSql.error('select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from st group by tbname ) ;')
+ tdSql.error('select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from tb1 group by tbname ) ;')
+
+ tdSql.query('select max(ts00) from (select elapsed(ts,1s) ts00 from st group by tbname ) ;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,89.1)
+
+ tdSql.error('select elapsed(data) from (select elapsed(ts,1s) data from st group by tbname ) ;')
+ tdSql.error('select elapsed(data) from (select elapsed(ts,1s) data from tb2 ) ;')
+
+ tdSql.error('select elapsed(data) from (select ts data from st group by tbname ) ;')
+ tdSql.error('select elapsed(data) from (select ts data from tb2 ) ;')
+
+ tdSql.error('select elapsed(data) from (select value data from st group by tbname ) ;')
+ tdSql.error('select elapsed(data) from (select value data from tb2 ) ;')
+
+ tdSql.query('select elapsed(ts) from (select csum(value) data from tb2 ) ;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,19800)
+
+ tdSql.query('select elapsed(ts) from (select diff(value) data from tb2 ) ;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,19600.0)
+
+ # another bug : it will be forbidden in the feature .
+ # tdSql.error('select elapsed(ts) from (select csum(value) data from st group by tbname ) ;')
+
+
+ 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/2-query/TD-12165.py b/tests/system-test/2-query/TD-12165.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a16d0e99facf5dde919ea3aad1a6444d07dd6c4
--- /dev/null
+++ b/tests/system-test/2-query/TD-12165.py
@@ -0,0 +1,104 @@
+###################################################################
+# Copyright (c) 2020 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 posixpath import split
+import sys
+import os
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 caseDescription(self):
+
+ '''
+ case1 : [TD-12165]
+ this test case is an test case for unexpectd use way for alias _c0 ,it should be regarded as keywords ;
+
+ '''
+ return
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("create database if not exists testdb keep 36500;")
+ tdSql.execute("use testdb;")
+ tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
+ for i in range(self.num):
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
+
+ # basic alis
+ tdSql.error('select value ,value as _c0 from st;')
+ tdSql.error('select value _c0 from st;')
+ tdSql.error('select ind ,ind as _c0 from st;')
+ tdSql.error('select ind _c0 from st;')
+ tdSql.error('select ts ,ts as _c0 from st;')
+ tdSql.error('select ts _c0 from st;')
+ tdSql.error('select value ,value as _c0 from tb1;')
+ tdSql.error('select value _c0 from tb2;')
+ tdSql.error('select ts ,ts as _c0 from tb1;')
+ tdSql.error('select ts _c0 from tb2;')
+
+ # nest query alis name
+
+ tdSql.error('select ts , ts _c0 from (select ts ,value from st);')
+ tdSql.error('select ts , ts as _c0 from (select ts ,value from tb1);')
+ tdSql.error('select ts , ts _c0 from (select * from st);')
+ tdSql.error('select ts , ts as _c0 from (select * from tb1);')
+ tdSql.error('select ts , _c0 from (select max(value) _c0 from st);')
+ tdSql.error('select ts , _c0 from (select max(value) _c0 from tb1);')
+ tdSql.query('select _c0,data from (select max(value) data from tb1);')
+ tdSql.query('select _c0,data from (select max(value) data from st);')
+ tdSql.query('select _c0,data from (select ts ,max(value) data from st);')
+ tdSql.checkData(0,1,'19.0')
+ tdSql.query('select _c0,data from (select ts ,max(value) data from tb1);')
+ tdSql.checkData(0,1,'11.0')
+ tdSql.query('select _c0,data from (select csum(value) data from tb1);')
+ tdSql.checkData(0,1,'11.0')
+
+ 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/2-query/TD-12614.py b/tests/system-test/2-query/TD-12614.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d495dfe13089adde00d2bde99f1c6078d2c8c1f
--- /dev/null
+++ b/tests/system-test/2-query/TD-12614.py
@@ -0,0 +1,88 @@
+###################################################################
+# Copyright (c) 2020 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 posixpath import split
+import sys
+import os
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+import subprocess
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ 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")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" 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 caseDescription(self):
+
+ '''
+ case1 :wenzhouwww [TD-12614] :
+ this test case is an function error about nest query inner group by tbname for some cases .
+ '''
+ return
+
+ def run(self):
+ tdSql.prepare()
+ tdSql.execute("create database if not exists testdb keep 36500;")
+ tdSql.execute("use testdb;")
+ tdSql.execute("create stable st (ts timestamp , id int , value double) tags(hostname binary(10) ,ind int);")
+ for i in range(self.num):
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+100*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+200*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+300*i,i*2,i+10.00))
+ tdSql.execute("insert into tb%s using st tags('host_%s' , %d) values (%d , %d , %f );"%(str(i),str(i),i*10,self.ts+10000*i,i*2,i+10.00))
+
+ tdSql.query('select ts ,max(value) from st;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,19)
+
+ tdSql.query(' select elapsed(ts) from (select csum(value) from tb1);')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9900)
+
+ tdSql.query(' select elapsed(ts) from (select csum(value) from tb2);')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,19800)
+
+ tdSql.error(' select elapsed(ts) from (select csum(value) from st group by tbname );')
+
+
+ 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/5-taos-tools/dump_col_tag.py b/tests/system-test/5-taos-tools/dump_col_tag.py
index 35c324a0871478b6e5995e76e2aed1a81d68af56..659dbeb67bedb95551d95bc0d8c6b87627261fe2 100644
--- a/tests/system-test/5-taos-tools/dump_col_tag.py
+++ b/tests/system-test/5-taos-tools/dump_col_tag.py
@@ -23,231 +23,267 @@ 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
+ 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 table1_checkall(self,sql):
- tdLog.info(sql)
+ 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")]
+
+ 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.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)
+ tdSql.checkData(0, 1, 1)
- def table1_checkall_2(self,sql):
+ def table1_checkall_2(self, sql):
self.table1_checkall_1(sql)
- tdSql.checkData(0,2,2)
+ tdSql.checkData(0, 2, 2)
- def table1_checkall_3(self,sql):
+ def table1_checkall_3(self, sql):
self.table1_checkall_2(sql)
- tdSql.checkData(0,3,3)
+ tdSql.checkData(0, 3, 3)
- def table1_checkall_4(self,sql):
+ def table1_checkall_4(self, sql):
self.table1_checkall_3(sql)
- tdSql.checkData(0,4,4)
+ tdSql.checkData(0, 4, 4)
- def table1_checkall_5(self,sql):
+ def table1_checkall_5(self, sql):
self.table1_checkall_4(sql)
- tdSql.checkData(0,5,'True')
+ tdSql.checkData(0, 5, 'True')
- def table1_checkall_6(self,sql):
+ def table1_checkall_6(self, sql):
self.table1_checkall_5(sql)
- tdSql.checkData(0,6,6)
+ tdSql.checkData(0, 6, 6)
- def table1_checkall_7(self,sql):
+ def table1_checkall_7(self, sql):
self.table1_checkall_6(sql)
- tdSql.checkData(0,7,7)
+ tdSql.checkData(0, 7, 7)
- def table1_checkall_8(self,sql):
+ def table1_checkall_8(self, sql):
self.table1_checkall_7(sql)
- tdSql.checkData(0,8,8)
+ tdSql.checkData(0, 8, 8)
- def table1_checkall_9(self,sql):
+ def table1_checkall_9(self, sql):
self.table1_checkall_8(sql)
- tdSql.checkData(0,9,9)
+ tdSql.checkData(0, 9, 9)
- def table1_checkall_10(self,sql):
+ def table1_checkall_10(self, sql):
self.table1_checkall_9(sql)
- tdSql.checkData(0,10,'1970-01-01 08:00:00.010')
+ 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 db*")
+ 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(
+ "==============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
+ 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.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 ,
+ 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)
+ % (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 _block_dist() from db.`%s` ; " %self.stb1)
+ tdSql.query("select _block_dist() from db.`%s` ; " % self.stb1)
tdSql.checkRows(0)
- tdSql.query("show create stable db.`%s` ; " %self.stb1)
+ 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)
+ 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)")
+ 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)
+ % (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) )
+ 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 _block_dist() from db.`%s` ; " %self.stb1)
+ tdSql.checkData(0, 0, 2)
+ tdSql.query("select _block_dist() 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.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.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
+ 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)
+ % (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)
+ 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
+ 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)
+ % (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.query("select count(*) from db.`%s`; " % self.tb1)
tdSql.checkData(0, 0, 2)
- sql = "select * from db.`%s` ; " %self.stb1
+ 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.query("select count(*) from db.`%s`; " % self.stb1)
tdSql.checkData(0, 0, 4)
- sql = "select * from (select * from db.`%s`) ; " %self.stb1
+ 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.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)
+ % (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)
+ % (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)
+ % (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)
@@ -257,325 +293,442 @@ class TDTestCase:
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.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("==============drop\ add\ change\ modify column or tag")
+ 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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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.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.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.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.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.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.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
+ 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.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.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.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.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
+ 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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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)
+ 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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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
+ 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)
+ tdSql.query("describe db.`%s` ; " % self.tb1)
+ tdSql.checkRows(22)
- print("==============drop table\stable")
+ print(r"==============drop table\stable")
try:
- tdSql.execute("drop table db.`%s` " %self.tb1)
+ tdSql.execute("drop table db.`%s` " % self.tb1)
except Exception as e:
tdLog.exit(e)
- tdSql.error("select * from db.`%s`" %self.tb1)
+ 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)
+ 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)
-
-
+ 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.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 _block_dist() from `%s` ; " %self.stb2)
+ tdSql.query("select _block_dist() from `%s` ; " % self.stb2)
tdSql.checkRows(0)
- tdSql.query("show create stable `%s` ; " %self.stb2)
+ 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.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.execute("create table `table!2` using `%s` tags(1)" % self.stb2)
tdSql.query("describe `table!2` ; ")
tdSql.checkRows(3)
@@ -583,34 +736,42 @@ class TDTestCase:
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.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 _block_dist() from `%s` ; " %self.stb2)
+ tdSql.query("select _block_dist() 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.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.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.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.query("select count(*) from `%s`; " % self.tb2)
tdSql.checkData(0, 0, 1)
- tdSql.query("select * from `%s` ; " %self.stb2)
+ tdSql.query("select * from `%s` ; " % self.stb2)
tdSql.checkRows(2)
- tdSql.query("select count(*) from `%s`; " %self.stb2)
+ tdSql.query("select count(*) from `%s`; " % self.stb2)
tdSql.checkData(0, 0, 2)
- tdSql.query("select * from (select * from `%s`) ; " %self.stb2)
+ tdSql.query("select * from (select * from `%s`) ; " % self.stb2)
tdSql.checkRows(2)
- tdSql.query("select count(*) from (select * from `%s` ); " %self.stb2)
+ tdSql.query("select count(*) from (select * from `%s` ); " % self.stb2)
tdSql.checkData(0, 0, 2)
tdSql.query("show stables like 'stable_2%' ")
@@ -618,278 +779,348 @@ class TDTestCase:
tdSql.query("show tables like 'table%' ")
tdSql.checkRows(2)
-
- #TD-10536
+ # TD-10536
self.cr_tb2 = "create_table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
- tdSql.execute("create table `%s` as select * from `%s` ;" %(self.cr_tb2,self.stb2))
+ 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
+ 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
+ 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)
+ `%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 _block_dist() from `%s` ; " %self.regular_table)
+ tdSql.query("select _block_dist() from `%s` ; " % self.regular_table)
tdSql.checkRows(1)
- tdSql.query("show create table `%s` ; " %self.regular_table)
+ 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.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
+ 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)
+ % (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
+ 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)
+ % (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.query("select count(*) from `%s`; " % self.regular_table)
tdSql.checkData(0, 0, 2)
- tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
+ tdSql.query("select _block_dist() from `%s` ; " % self.regular_table)
tdSql.checkRows(1)
- sql = "select * from (select * from `%s`) ; " %self.regular_table
+ 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)
+ % (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.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.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("==============drop\ add\ change\ modify column ")
+ 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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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.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.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.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.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.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.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
+ 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.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.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.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.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
+ 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
+ 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
+ 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)
+ 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("taosdump -D db2 ") == 0
+ assert os.system(
+ "%staosdump -D db2 -o %s" %
+ (binPath, self.tmpdir)) == 0
tdSql.execute('''drop database if exists db2 ;''')
- assert os.system("taosdump -i . -g") == 0
+ 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
+ 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)
+ 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 _block_dist() from `%s` ; " %self.regular_table)
+ tdSql.query("select _block_dist() from `%s` ; " % self.regular_table)
tdSql.checkRows(1)
- tdSql.query("show create table `%s` ; " %self.regular_table)
+ 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.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
+ 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)
+ % (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
+ 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)
+ % (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(3)
+# CBD tdSql.checkRows(3)
- tdSql.query("select count(*) from `%s` order by ts desc; " %self.regular_table)
+ tdSql.query(
+ "select count(*) from `%s` order by ts desc; " %
+ self.regular_table)
tdSql.checkData(0, 0, 6)
- tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
+ tdSql.query("select _block_dist() from `%s` ; " % self.regular_table)
tdSql.checkRows(1)
- sql = "select * from (select * from `%s` order by ts desc) ; " %self.regular_table
+ 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)
+ % (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(3)
-
- tdSql.query("select count(*) from (select * from `%s` ); " %self.regular_table)
+# 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%' ")
@@ -898,114 +1129,157 @@ class TDTestCase:
tdSql.query("show db2.tables like 'create_r_table%' ")
tdSql.checkRows(1)
- print("==============drop\ add\ change\ modify column ")
+ 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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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
+ 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.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.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.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.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.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.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.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
+ 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.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.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.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.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
+ 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
+ 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
+ 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)
+ tdSql.query("describe `%s` ; " % self.regular_table)
+ tdSql.checkRows(11)
- os.system("rm db*")
- os.system("rm dump_result.txt*")
+ os.system("rm %s/db*" % self.tmpdir)
+ os.system("rm dump_result.txt*")
def stop(self):
tdSql.close()
diff --git a/tests/system-test/fulltest-query.sh b/tests/system-test/fulltest-query.sh
index b3314a5e0e39c5e34fac04f8b44e3eceb21523f0..f89b3e694d9e8ab7530980ef5c3ac97d38e26619 100755
--- a/tests/system-test/fulltest-query.sh
+++ b/tests/system-test/fulltest-query.sh
@@ -7,4 +7,3 @@ python3 ./test.py -f 2-query/TD-11561.py
python3 ./test.py -f 2-query/TD-12204.py
-
diff --git a/tests/test-CI.sh b/tests/test-CI.sh
index c3790fa74bdf8f471cda7b2564fd742e32239eb7..b9fd8aa89f6fe08fd17786eb8f42aa2ee9cc149c 100755
--- a/tests/test-CI.sh
+++ b/tests/test-CI.sh
@@ -51,7 +51,52 @@ function dohavecore(){
fi
fi
}
+function runSimCaseOneByOnefq {
+ end=`sed -n '$=' jenkins/basic.txt`
+ for ((i=1;i<=$end;i++)) ; do
+ if [[ $(($i%$1)) -eq $3 ]];then
+ line=`sed -n "$i"p jenkins/basic.txt`
+ if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then
+ case=`echo $line | grep sim$ |awk '{print $NF}'`
+ start_time=`date +%s`
+ date +%F\ %T | tee -a out.log
+ if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
+ echo -n $case
+ ./test.sh -f $case > case.log 2>&1 && \
+ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
+ ( grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
+ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat case.log )
+ else
+ echo -n $case
+ ./test.sh -f $case > ../../sim/case.log 2>&1 && \
+ ( grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \
+ ( grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \
+ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat case.log )
+ fi
+
+ out_log=`tail -1 out.log `
+ if [[ $out_log =~ 'failed' ]];then
+ rm case.log
+ if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
+ cp -r ../../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S"`
+ else
+ cp -r ../../sim ~/sim_`date "+%Y_%m_%d_%H:%M:%S" `
+ fi
+ dohavecore $2 1
+ if [[ $2 == 1 ]];then
+ exit 8
+ fi
+ fi
+ end_time=`date +%s`
+ echo execution time of $case was `expr $end_time - $start_time`s. | tee -a out.log
+ dohavecore $2 1
+ fi
+ fi
+ done
+ rm -rf ../../../sim/case.log
+ rm -rf ../../sim/case.log
+}
function runPyCaseOneByOne {
while read -r line; do
@@ -173,7 +218,6 @@ if [ "${OS}" == "Linux" ]; then
fi
-echo "### run Python test case ###"
cd $tests_dir
@@ -204,6 +248,10 @@ if [ "$1" == "full" ]; then
runPyCaseOneByOne fulltest-other.sh
runPyCaseOneByOne fulltest-insert.sh
runPyCaseOneByOne fulltest-connector.sh
+elif [ "$1" == "sim" ]; then
+ echo "### run sim $2 test ###"
+ cd $tests_dir/script
+ runSimCaseOneByOnefq $2 1 $3
else
echo "### run $1 $2 test ###"