提交 bb2e8164 编写于 作者: J jiajingbin

[TD-11800]<test>: add perf scripts for td-11800

......@@ -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
}
......
......@@ -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
```
......@@ -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
```
......@@ -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 ...]
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PropertyGroup>
<TargetFrameworks>net5;netstandard2.0;net45</TargetFrameworks>
<PackageId>TDengine.Connector</PackageId>
<PackageIcon>logo.jpg</PackageIcon>
<Version>1.0.3</Version>
<Authors>taosdata</Authors>
<Company>www.taosdata.com</Company>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>Taos;Data;Microsoft.NET.Sdk;IOT;bigdata;TDengine;taosdata</PackageTags>
<Description>
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
</Description>
<RepositoryUrl>https://github.com/taosdata/TDengine/tree/develop/src/connector/C%23</RepositoryUrl>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<None Include="resource\logo.jpg" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
......@@ -7,10 +7,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>..\doc\FunctionTest.XML</DocumentationFile>
<NoWarn>CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>..\doc\FunctionTest.XML</DocumentationFile>
</PropertyGroup>
</Project>
......@@ -3,13 +3,12 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<NoWarn>CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>..\doc\UnitTest.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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))
......
Subproject commit ed92906f2d09d0bfa75598f4a019de06710cffb0
Subproject commit 59f00a69f36b08cea86a70a22c29b2c27ef506ae
......@@ -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 {
......
......@@ -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 {
......
......@@ -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
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Subproject commit 273b5219f8bcc604e43beebc6f1f95abed85170a
Subproject commit fd84b35d3a30c9bcf3939d565f717b7f98ff9eb7
......@@ -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);
......
......@@ -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;
......
......@@ -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));
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 };
......
......@@ -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));
......
......@@ -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__)
......
......@@ -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();
......
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="TDengine.Connector" Version="1.0.2" />
<PackageReference Include="TDengine.Connector" Version="1.0.3" />
</ItemGroup>
<PropertyGroup>
......
......@@ -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()
#!/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===============
#!/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===============
#!/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===============
......@@ -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()
......
......@@ -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}]
}]
}]
}
......@@ -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}]
}]
}]
}
......@@ -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)
......
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===============
......@@ -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
......
......@@ -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
......
......@@ -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
......
###################################################################
# 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-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())
###################################################################
# 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-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())
###################################################################
# 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-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())
###################################################################
# 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-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())
###################################################################
# 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 <author>: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())
......@@ -7,4 +7,3 @@ python3 ./test.py -f 2-query/TD-11561.py
python3 ./test.py -f 2-query/TD-12204.py
......@@ -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 ###"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册