diff --git a/cmake/install.inc b/cmake/install.inc index b0e5c71022..a5b01f43cb 100755 --- a/cmake/install.inc +++ b/cmake/install.inc @@ -32,7 +32,7 @@ ELSEIF (TD_WINDOWS) #INSTALL(TARGETS taos RUNTIME DESTINATION driver) #INSTALL(TARGETS shell RUNTIME DESTINATION .) IF (TD_MVN_INSTALLED) - INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.16-dist.jar DESTINATION connector/jdbc) + INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.17-dist.jar DESTINATION connector/jdbc) ENDIF () ELSEIF (TD_DARWIN) SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh") diff --git a/cmake/version.inc b/cmake/version.inc old mode 100644 new mode 100755 index 0509a5ce1b..f9927bf1c6 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -16,13 +16,25 @@ ENDIF () IF (DEFINED GITINFO) SET(TD_VER_GIT ${GITINFO}) ELSE () - SET(TD_VER_GIT "community") + execute_process( + COMMAND git log -1 --format=%H + WORKING_DIRECTORY ${TD_COMMUNITY_DIR} + OUTPUT_VARIABLE GIT_COMMITID + ) + string (REGEX REPLACE "[\n\t\r]" "" GIT_COMMITID ${GIT_COMMITID}) + SET(TD_VER_GIT ${GIT_COMMITID}) ENDIF () IF (DEFINED GITINFOI) SET(TD_VER_GIT_INTERNAL ${GITINFOI}) ELSE () - SET(TD_VER_GIT_INTERNAL "internal") + execute_process( + COMMAND git log -1 --format=%H + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMITID + ) + string (REGEX REPLACE "[\n\t\r]" "" GIT_COMMITID ${GIT_COMMITID}) + SET(TD_VER_GIT_INTERNAL ${GIT_COMMITID}) ENDIF () IF (DEFINED VERDATE) diff --git a/documentation20/webdocs/markdowndocs/Queries-ch.md b/documentation20/webdocs/markdowndocs/Queries-ch.md index 960bb39e63..839809ccba 100644 --- a/documentation20/webdocs/markdowndocs/Queries-ch.md +++ b/documentation20/webdocs/markdowndocs/Queries-ch.md @@ -9,7 +9,7 @@ TDengine 采用 SQL 作为查询语言。应用程序可以通过 C/C++, Java, Go, Python 连接器发送 SQL 语句,用户可以通过 TDengine 提供的命令行(Command Line Interface, CLI)工具 TAOS Shell 手动执行 SQL 即席查询(Ad-Hoc Query)。TDengine 支持如下查询功能: - 单列、多列数据查询 -- 标签和数值的多种过滤条件:\>, \<, =, \<>, like 等 +- 标签和数值的多种过滤条件:>, <, =, <>, like 等 - 聚合结果的分组(Group by)、排序(Order by)、约束输出(Limit/Offset) - 数值列及聚合结果的四则运算 - 时间戳对齐的连接查询(Join Query: 隐式连接)操作 diff --git a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md index 4563b5b5fc..ae01b51a52 100644 --- a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md +++ b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md @@ -58,26 +58,26 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic - **创建数据库** - ```mysql - CREATE DATABASE [IF NOT EXISTS] db_name [KEEP keep] [UPDATE 1]; - ``` - 说明: - - 1) KEEP是该数据库的数据保留多长天数,缺省是3650天(10年),数据库会自动删除超过时限的数据; - - 2) UPDATE 标志数据库支持更新相同时间戳数据; - - 3) 数据库名最大长度为33; - - 4) 一条SQL 语句的最大长度为65480个字符; - - 5) 数据库还有更多与存储相关的配置参数,请参见系统管理。 + ```mysql + CREATE DATABASE [IF NOT EXISTS] db_name [KEEP keep] [UPDATE 1]; + ``` + 说明: + + 1) KEEP是该数据库的数据保留多长天数,缺省是3650天(10年),数据库会自动删除超过时限的数据; + + 2) UPDATE 标志数据库支持更新相同时间戳数据; + + 3) 数据库名最大长度为33; + + 4) 一条SQL 语句的最大长度为65480个字符; + + 5) 数据库还有更多与存储相关的配置参数,请参见系统管理。 - **显示系统当前参数** - ```mysql - SHOW VARIABLES; - ``` + ```mysql + SHOW VARIABLES; + ``` - **使用数据库** @@ -1125,11 +1125,8 @@ SELECT function_list FROM stb_name - WHERE语句可以指定查询的起止时间和其他过滤条件 - FILL语句指定某一时间区间数据缺失的情况下的填充模式。填充模式包括以下几种: 1. 不进行填充:NONE(默认填充模式)。 - 2. VALUE填充:固定值填充,此时需要指定填充的数值。例如:fill(value, 1.23)。 - 3. NULL填充:使用NULL填充数据。例如:fill(null)。 - 4. PREV填充:使用前一个非NULL值填充数据。例如:fill(prev)。 说明: diff --git a/documentation20/webdocs/markdowndocs/advanced features-ch.md b/documentation20/webdocs/markdowndocs/advanced features-ch.md index cdd9ee8104..0ca8428ece 100644 --- a/documentation20/webdocs/markdowndocs/advanced features-ch.md +++ b/documentation20/webdocs/markdowndocs/advanced features-ch.md @@ -197,7 +197,7 @@ select * from meters where ts > now - 1d and current > 10; 且`restart`是 **false**(**0**),用户程序就不会读到之前已经读取的数据了。 `taos_subscribe`的最后一个参数是以毫秒为单位的轮询周期。 -在同步模式下,如过前后两次调用`taos_consume`的时间间隔小于此时间, +在同步模式下,如果前后两次调用`taos_consume`的时间间隔小于此时间, `taos_consume`会阻塞,直到间隔超过此时间。 异步模式下,这个时间是两次调用回调函数的最小时间间隔。 @@ -414,7 +414,7 @@ TDengine通过查询函数向用户提供毫秒级的数据获取能力。直接 TDengine分配固定大小的内存空间作为缓存空间,缓存空间可根据应用的需求和硬件资源配置。通过适当的设置缓存空间,TDengine可以提供极高性能的写入和查询的支持。TDengine中每个虚拟节点(virtual node)创建时分配独立的缓存池。每个虚拟节点管理自己的缓存池,不同虚拟节点间不共享缓存池。每个虚拟节点内部所属的全部表共享该虚拟节点的缓存池。 -TDengine将内存池按块划分进行管理,数据在内存块里按照列式存储。一个vnode的内存池是在vnode创建时按块分配好的,而且每个内存块按照先进先出的原则进行管理。一张表所需要的内存块是从vnode的内存池中进行分配的,块的大小由系统配置参数cache决定。每张表最大内存块的数目由配置参数tblocks决定,每张表平均的内存块的个数由配置参数ablocks决定。因此对于一个vnode, 总的内存大小为: `cache * ablocks * tables`。内存块参数cache不宜过小,一个cache block需要能存储至少几十条以上记录,才会有效率。参数ablocks最小为2,保证每张表平均至少能分配两个内存块。 +TDengine将内存池按块划分进行管理,数据在内存块里是以行(row)的形式存储。一个vnode的内存池是在vnode创建时按块分配好,而且每个内存块按照先进先出的原则进行管理。在创建内存池时,块的大小由系统配置参数cache决定;每个vnode中内存块的数目则由配置参数blocks决定。因此对于一个vnode,总的内存大小为:`cache * blocks`。一个cache block需要保证每张表能存储至少几十条以上记录,才会有效率。 你可以通过函数last_row快速获取一张表或一张超级表的最后一条记录,这样很便于在大屏显示各设备的实时状态或采集值。例如: diff --git a/documentation20/webdocs/markdowndocs/cluster-ch.md b/documentation20/webdocs/markdowndocs/cluster-ch.md index f3f6f2b300..f6019b1a5a 100644 --- a/documentation20/webdocs/markdowndocs/cluster-ch.md +++ b/documentation20/webdocs/markdowndocs/cluster-ch.md @@ -225,7 +225,7 @@ SHOW MNODES; ## Arbitrator的使用 -如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。 +如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了Arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含Arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到Arbitrator,那么节点B就能正常工作。 -TDengine提供一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。请点击[安装包下载](https://www.taosdata.com/cn/all-downloads/),在TDengine Arbitrator Linux一节中,选择适合的版本下载并安装。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数时,系统将自动连接配置的arbitrator。如果副本数为奇数,即使配置了arbitrator, 系统也不会去建立连接。 +TDengine提供一个执行程序,名为 tarbitrator,找任何一台Linux服务器运行它即可。请点击[安装包下载](https://www.taosdata.com/cn/all-downloads/),在TDengine Arbitrator Linux一节中,选择适合的版本下载并安装。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为Arbitrator的End Point。如果该参数配置了,当副本数为偶数时,系统将自动连接配置的Arbitrator。如果副本数为奇数,即使配置了Arbitrator,系统也不会去建立连接。 diff --git a/documentation20/webdocs/markdowndocs/cluster.md b/documentation20/webdocs/markdowndocs/cluster.md deleted file mode 100644 index 8cf7065f72..0000000000 --- a/documentation20/webdocs/markdowndocs/cluster.md +++ /dev/null @@ -1,146 +0,0 @@ -#集群安装、管理 - -多个taosd的运行实例可以组成一个集群,以保证TDengine的高可靠运行,并提供水平扩展能力。要了解TDengine 2.0的集群管理,需要对集群的基本概念有所了解,请看TDengine 2.0整体架构一章。 - -集群的每个节点是由End Point来唯一标识的,End Point是由FQDN(Fully Qualified Domain Name)外加Port组成,比如 h1.taosdata.com:6030。一般FQDN就是服务器的hostname,可通过Linux命令“hostname"获取。端口是这个节点对外服务的端口号,缺省是6030,但可以通过taos.cfg里配置参数serverPort进行修改。 - -TDengine的集群管理极其简单,除添加和删除节点需要人工干预之外,其他全部是自动完成,最大程度的降低了运维的工作量。本章对集群管理的操作做详细的描述。 - -##安装、创建第一个节点 - -集群是由一个一个dnode组成的,是从一个dnode的创建开始的。创建第一个节点很简单,就按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法进行安装、启动即可。 - -启动后,请执行taos, 启动taos shell,从shell里执行命令"show dnodes;",如下所示: - ``` -Welcome to the TDengine shell from Linux, Client Version:2.0.0.0 -Copyright (c) 2017 by TAOS Data, Inc. All rights reserved. - -taos> show dnodes; - id | end_point | vnodes | cores | status | role | create_time | -===================================================================================== - 1 | h1.taos.com:6030 | 0 | 2 | ready | any | 2020-07-31 03:49:29.202 | -Query OK, 1 row(s) in set (0.006385s) - -taos> - ``` -上述命令里,可以看到这个刚启动的这个节点的End Point是:h1.taos.com:6030 - -## 安装、创建后续节点 - -将新的节点添加到现有集群,具体有以下几步: - -1. 按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法进行安装,但不要启动taosd - -2. 如果是使用涛思数据的官方安装包进行安装,在安装结束时,会询问集群的End Port, 输入第一个节点的End Point即可。如果是源码安装,请编辑配置文件taos.cfg(缺省是在/etc/taos/目录),增加一行: - - ``` - firstEp h1.taos.com:6030 - ``` - - 请注意将示例的“h1.taos.com:6030" 替换为你自己第一个节点的End Point - -3. 按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法启动taosd - -4. 在Linux shell里执行命令"hostname"找出本机的FQDN, 假设为h2.taos.com。如果无法找到,可以查看taosd日志文件taosdlog.0里前面几行日志(一般在/var/log/taos目录),fqdn以及port都会打印出来。 - -5. 在第一个节点,使用CLI程序taos, 登录进TDengine系统, 使用命令: - - ``` - CREATE DNODE "h2.taos.com:6030"; - ``` - - 将新节点的End Point添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。请注意将示例的“h2.taos.com:6030" 替换为你自己第一个节点的End Point - -6. 使用命令 - - ``` - SHOW DNODES; - ``` - - 查看新节点是否被成功加入。 - -按照上述步骤可以源源不断的将新的节点加入到集群。 - -**提示:** - -- firstEp, secondEp这两个参数仅仅在该节点第一次加入集群时有作用,加入集群后,该节点会保存最新的mnode的End Point列表,不再依赖这两个参数。 -- 两个没有配置first, second参数的dnode启动后,会独立运行起来。这个时候,无法将其中一个节点加入到另外一个节点,形成集群。**无法将两个独立的集群合并成为新的集群**。 - -##节点管理 - -###添加节点 -执行CLI程序taos, 使用root账号登录进系统, 执行: -``` -CREATE DNODE "fqdn:port"; -``` -将新节点的End Point添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。一个节点对外服务的fqdn和port可以通过配置文件taos.cfg进行配置,缺省是自动获取。 - -###删除节点 -执行CLI程序taos, 使用root账号登录进TDengine系统,执行: -``` -DROP DNODE "fqdn:port"; -``` -其中fqdn是被删除的节点的FQDN,port是其对外服务器的端口号 - -###查看节点 -执行CLI程序taos,使用root账号登录进TDengine系统,执行: -``` -SHOW DNODES; -``` -它将列出集群中所有的dnode,每个dnode的fqdn:port, 状态(ready, offline等),vnode数目,还未使用的vnode数目等信息。在添加或删除一个节点后,可以使用该命令查看。 - -如果集群配置了Arbitrator,那么它也会在这个节点列表中显示出来,其role列的值会是“arb”。 - -###查看虚拟节点组 - -为充分利用多核技术,并提供scalability,数据需要分片处理。因此TDengine会将一个DB的数据切分成多份,存放在多个vnode里。这些vnode可能分布在多个dnode里,这样就实现了水平扩展。一个vnode仅仅属于一个DB,但一个DB可以有多个vnode。vnode的是mnode根据当前系统资源的情况,自动进行分配的,无需任何人工干预。 - -执行CLI程序taos,使用root账号登录进TDengine系统,执行: -``` -SHOW VGROUPS; -``` -##高可用性 -TDengine通过多副本的机制来提供系统的高可用性。副本数是与DB关联的,一个集群里可以有多个DB,根据运营的需求,每个DB可以配置不同的副本数。创建数据库时,通过参数replica 指定副本数(缺省为1)。如果副本数为1,系统的可靠性无法保证,只要数据所在的节点宕机,就将无法提供服务。集群的节点数必须大于等于副本数,否则创建表时将返回错误“more dnodes are needed"。比如下面的命令将创建副本数为3的数据库demo: -``` -CREATE DATABASE demo replica 3; -``` -一个DB里的数据会被切片分到多个vnode group,vnode group里的vnode数目就是DB的副本数,同一个vnode group里各vnode的数据是完全一致的。为保证高可用性,vnode group里的vnode一定要分布在不同的dnode里(实际部署时,需要在不同的物理机上),只要一个vgroup里超过半数的vnode处于工作状态,这个vgroup就能正常的对外服务。 - -一个dnode里可能有多个DB的数据,因此一个dnode离线时,可能会影响到多个DB。如果一个vnode group里的一半或一半以上的vnode不工作,那么该vnode group就无法对外服务,无法插入或读取数据,这样会影响到它所属的DB的一部分表的d读写操作。 - -因为vnode的引入,无法简单的给出结论:“集群中过半dnode工作,集群就应该工作”。但是对于简单的情形,很好下结论。比如副本数为3,只有三个dnode,那如果仅有一个节点不工作,整个集群还是可以正常工作的,但如果有两个节点不工作,那整个集群就无法正常工作了。 - -##Mnode的高可用 -TDengine集群是由mnode (taosd的一个模块,逻辑节点) 负责管理的,为保证mnode的高可用,可以配置多个mnode副本,副本数由系统配置参数numOfMnodes决定,有效范围为1-3。为保证元数据的强一致性,mnode副本之间是通过同步的方式进行数据复制的。 - -一个集群有多个dnode, 但一个dnode至多运行一个mnode实例。多个dnode情况下,哪个dnode可以作为mnode呢?这是完全由系统根据整个系统资源情况,自动指定的。用户可通过CLI程序taos,在TDengine的console里,执行如下命令: -``` -SHOW MNODES; -``` -来查看mnode列表,该列表将列出mnode所处的dnode的End Point和角色(master, slave, unsynced 或offline)。 -当集群中第一个节点启动时,该节点一定会运行一个mnode实例,否则该dnode无法正常工作,因为一个系统是必须有至少一个mnode的。如果numOfMnodes配置为2,启动第二个dnode时,该dnode也将运行一个mnode实例。 - -为保证mnode服务的高可用性,numOfMnodes必须设置为2或更大。因为mnode保存的元数据必须是强一致的,如果numOfMnodes大于2,复制参数quorum自动设为2,也就是说,至少要保证有两个副本写入数据成功,才通知客户端应用写入成功。 - -##负载均衡 - -有三种情况,将触发负载均衡,而且都无需人工干预。 - -- 当一个新节点添加进集群时,系统将自动触发负载均衡,一些节点上的数据将被自动转移到新节点上,无需任何人工干预。 -- 当一个节点从集群中移除时,系统将自动把该节点上的数据转移到其他节点,无需任何人工干预。 -- 如果一个节点过热(数据量过大),系统将自动进行负载均衡,将该节点的一些vnode自动挪到其他节点。 - -当上述三种情况发生时,系统将启动一各个节点的负载计算,从而决定如何挪动。 - -##节点离线处理 -如果一个节点离线,TDengine集群将自动检测到。有如下两种情况: -- 改节点离线超过一定时间(taos.cfg里配置参数offlineThreshold控制时长),系统将自动把该节点删除,产生系统报警信息,触发负载均衡流程。如果该被删除的节点重现上线时,它将无法加入集群,需要系统管理员重新将其添加进集群才会开始工作。 -- 离线后,在offlineThreshold的时长内重新上线,系统将自动启动数据恢复流程,等数据完全恢复后,该节点将开始正常工作。 - -##Arbitrator的使用 - -如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。 - -TDengine安装包里带有一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6030。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为Arbitrator的End Point。如果该参数配置了,当副本数为偶数时,系统将自动连接配置的Arbitrator。 - -在配置了Arbitrator的情况下,它也会显示在“show dnodes;”指令给出的节点列表中。 diff --git a/documentation20/webdocs/markdowndocs/connector-java-ch.md b/documentation20/webdocs/markdowndocs/connector-java-ch.md index 759dd43e1c..b8390e7af5 100644 --- a/documentation20/webdocs/markdowndocs/connector-java-ch.md +++ b/documentation20/webdocs/markdowndocs/connector-java-ch.md @@ -2,7 +2,7 @@ TDengine 提供了遵循 JDBC 标准(3.0)API 规范的 `taos-jdbcdriver` 实现,可在 maven 的中央仓库 [Sonatype Repository][1] 搜索下载。 -`taos-jdbcdriver的` 实现包括 2 种形式: JDBC-JNI 和 JDBC-RESTful(taos-jdbcdriver-2.0.16 开始支持 JDBC-RESTful)。 JDBC-JNI 通过调用客户端 libtaos.so(或 taos.dll )的本地方法实现, JDBC-RESTful 则在内部封装了 RESTful 接口实现。 +`taos-jdbcdriver` 的实现包括 2 种形式: JDBC-JNI 和 JDBC-RESTful(taos-jdbcdriver-2.0.17 开始支持 JDBC-RESTful)。 JDBC-JNI 通过调用客户端 libtaos.so(或 taos.dll )的本地方法实现, JDBC-RESTful 则在内部封装了 RESTful 接口实现。 ![tdengine-connector](../assets/tdengine-jdbc-connector.png) @@ -67,7 +67,7 @@ maven 项目中使用如下 pom.xml 配置即可: com.taosdata.jdbc taos-jdbcdriver - 2.0.16 + 2.0.17 ``` diff --git a/documentation20/webdocs/markdowndocs/insert-ch.md b/documentation20/webdocs/markdowndocs/insert-ch.md index 3fa48c1f50..7d380ac952 100644 --- a/documentation20/webdocs/markdowndocs/insert-ch.md +++ b/documentation20/webdocs/markdowndocs/insert-ch.md @@ -222,7 +222,7 @@ MQTT是一流行的物联网数据传输协议,TDengine 可以很方便的接 ## EMQ Broker 直接写入 -EMQ是一开源的MQTT Broker软件,无需任何代码,只需要在EMQ Dashboard里使用“规则”做简单配置,即可将MQTT的数据直接写入TDengine。EMQ X 支持通过 发送到 Web 服务 的方式保存数据到 TDengine,也在企业版上提供原生的 TDEngine 驱动实现直接保存。详细使用方法请参考EMQ 官方文档。 +EMQ是一开源的MQTT Broker软件,无需任何代码,只需要在EMQ Dashboard里使用“规则”做简单配置,即可将MQTT的数据直接写入TDengine。EMQ X 支持通过 发送到 Web 服务 的方式保存数据到 TDengine,也在企业版上提供原生的 TDengine 驱动实现直接保存。详细使用方法请参考EMQ 官方文档。 ## HiveMQ Broker 直接写入 diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 44ccafd044..e13cad4120 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -1,14 +1,16 @@ -FROM ubuntu:20.04 +FROM ubuntu:18.04 WORKDIR /root -ARG version -RUN echo $version -COPY tdengine.tar.gz /root/ -RUN tar -zxf tdengine.tar.gz -WORKDIR /root/TDengine-server-$version/ -RUN /bin/bash install.sh -e no +ARG pkgFile +ARG dirName +RUN echo ${pkgFile} +RUN echo ${dirName} +COPY ${pkgFile} /root/ +RUN tar -zxf ${pkgFile} +WORKDIR /root/${dirName}/ +RUN /bin/bash install.sh -e no ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" ENV LANG=en_US.UTF-8 diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh new file mode 100755 index 0000000000..ca2c3c66c9 --- /dev/null +++ b/packaging/docker/dockerManifest.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e +#set -x + +# dockerbuild.sh +# -n [version number] +# -p [xxxx] + +# set parameters by default value +verNumber="" +passWord="" + +while getopts "hn:p:" arg +do + case $arg in + n) + #echo "verNumber=$OPTARG" + verNumber=$(echo $OPTARG) + ;; + p) + #echo "passWord=$OPTARG" + passWord=$(echo $OPTARG) + ;; + h) + echo "Usage: `basename $0` -n [version number] " + echo " -p [password for docker hub] " + exit 0 + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +echo "verNumber=${verNumber}" + +docker manifest create -a tdengine/tdengine:${verNumber} tdengine/tdengine-amd64:${verNumber} tdengine/tdengine-aarch64:${verNumber} tdengine/tdengine-aarch32:${verNumber} + +docker login -u tdengine -p ${passWord} #replace the docker registry username and password + +docker manifest push tdengine/tdengine:${verNumber} + +# how set latest version ??? diff --git a/packaging/docker/dockerbuild-aarch64.sh b/packaging/docker/dockerbuild-aarch64.sh deleted file mode 100755 index 795eaed549..0000000000 --- a/packaging/docker/dockerbuild-aarch64.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -x -docker build --rm -f "Dockerfile" -t tdengine/tdengine-aarch64:$1 "." --build-arg version=$1 -docker login -u tdengine -p $2 #replace the docker registry username and password -docker push tdengine/tdengine-aarch64:$1 diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh index 48e2f7ead6..b7991465b0 100755 --- a/packaging/docker/dockerbuild.sh +++ b/packaging/docker/dockerbuild.sh @@ -1,5 +1,63 @@ #!/bin/bash -set -x -docker build --rm -f "Dockerfile" -t tdengine/tdengine:$1 "." --build-arg version=$1 -docker login -u tdengine -p $2 #replace the docker registry username and password -docker push tdengine/tdengine:$1 +set -e +#set -x + +# dockerbuild.sh +# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] +# -f [pkg file] +# -n [version number] +# -p [password for docker hub] + +# set parameters by default value +cpuType=amd64 +verNumber="" +passWord="" +pkgFile="" + +while getopts "hc:n:p:f:" arg +do + case $arg in + c) + #echo "cpuType=$OPTARG" + cpuType=$(echo $OPTARG) + ;; + n) + #echo "verNumber=$OPTARG" + verNumber=$(echo $OPTARG) + ;; + p) + #echo "passWord=$OPTARG" + passWord=$(echo $OPTARG) + ;; + f) + #echo "pkgFile=$OPTARG" + pkgFile=$(echo $OPTARG) + ;; + h) + echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] " + echo " -f [pkg file] " + echo " -n [version number] " + echo " -p [password for docker hub] " + exit 0 + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +echo "cpuType=${cpuType} verNumber=${verNumber} pkgFile=${pkgFile} " +echo "$(pwd)" +echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh====" + +dirName=${pkgFile%-Linux*} +#echo "dirName=${dirName}" + +docker build --rm -f "Dockerfile" -t tdengine/tdengine-${cpuType}:${verNumber} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} +docker login -u tdengine -p ${passWord} #replace the docker registry username and password +docker push tdengine/tdengine-${cpuType}:${verNumber} + +# set this version to latest version +docker tag tdengine/tdengine-${cpuType}:${verNumber} tdengine/tdengine-${cpuType}:latest +docker push tdengine/tdengine-${cpuType}:latest diff --git a/packaging/docker/dockerbuildi.sh b/packaging/docker/dockerbuildi.sh new file mode 100755 index 0000000000..a0a954e30f --- /dev/null +++ b/packaging/docker/dockerbuildi.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# + +set -e +#set -x + +# dockerbuild.sh +# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] +# -n [version number] +# -p [password for docker hub] + +# set parameters by default value +cpuType=aarch64 +verNumber="" +passWord="" + +while getopts "hc:n:p:f:" arg +do + case $arg in + c) + #echo "cpuType=$OPTARG" + cpuType=$(echo $OPTARG) + ;; + n) + #echo "verNumber=$OPTARG" + verNumber=$(echo $OPTARG) + ;; + p) + #echo "passWord=$OPTARG" + passWord=$(echo $OPTARG) + ;; + h) + echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] " + echo " -n [version number] " + echo " -p [password for docker hub] " + exit 0 + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +pkgFile=TDengine-server-${verNumber}-Linux-${cpuType}.tar.gz + +echo "cpuType=${cpuType} verNumber=${verNumber} pkgFile=${pkgFile} " + +scriptDir=`pwd` +pkgDir=$scriptDir/../../release/ + +cp -f ${pkgDir}/${pkgFile} . + +./dockerbuild.sh -c ${cpuType} -f ${pkgFile} -n ${verNumber} -p ${passWord} + +rm -f ${pkgFile} diff --git a/src/balance/src/bnThread.c b/src/balance/src/bnThread.c index 84f8694fca..3931acd053 100644 --- a/src/balance/src/bnThread.c +++ b/src/balance/src/bnThread.c @@ -56,7 +56,7 @@ int32_t bnInitThread() { pthread_attr_destroy(&thattr); if (ret != 0) { - mError("failed to create balance thread since %s", strerror(errno)); + mError("failed to create balance thread since %s", strerror(ret)); return -1; } diff --git a/src/client/inc/tscLocalMerge.h b/src/client/inc/tscLocalMerge.h index 0617645188..581cd37cbd 100644 --- a/src/client/inc/tscLocalMerge.h +++ b/src/client/inc/tscLocalMerge.h @@ -38,7 +38,7 @@ typedef struct SLocalDataSource { tFilePage filePage; } SLocalDataSource; -typedef struct SLocalReducer { +typedef struct SLocalMerger { SLocalDataSource ** pLocalDataSrc; int32_t numOfBuffer; int32_t numOfCompleted; @@ -62,7 +62,7 @@ typedef struct SLocalReducer { bool discard; int32_t offset; // limit offset value bool orderPrjOnSTable; // projection query on stable -} SLocalReducer; +} SLocalMerger; typedef struct SRetrieveSupport { tExtMemBuffer ** pExtMemBuffer; // for build loser tree @@ -89,10 +89,10 @@ int32_t tscFlushTmpBuffer(tExtMemBuffer *pMemoryBuf, tOrderDescriptor *pDesc, tF /* * create local reducer to launch the second-stage reduce process at client site */ -void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrderDescriptor *pDesc, +void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrderDescriptor *pDesc, SColumnModel *finalModel, SColumnModel *pFFModel, SSqlObj* pSql); -void tscDestroyLocalReducer(SSqlObj *pSql); +void tscDestroyLocalMerger(SSqlObj *pSql); int32_t tscDoLocalMerge(SSqlObj *pSql); diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 633512e324..e614ddc872 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -98,8 +98,7 @@ static FORCE_INLINE SQueryInfo* tscGetQueryInfoDetail(SSqlCmd* pCmd, int32_t sub return pCmd->pQueryInfo[subClauseIndex]; } -int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, const char* name, - STableMeta* pTableMeta, STableDataBlocks** dataBlocks); +int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks); void tscDestroyDataBlock(STableDataBlocks* pDataBlock); void tscSortRemoveDataBlockDupRows(STableDataBlocks* dataBuf); @@ -111,7 +110,7 @@ void* tscDestroyBlockHashTable(SHashObj* pBlockHashTable); int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock); int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap); -int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, const char* tableId, STableMeta* pTableMeta, +int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, SName* pName, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, SArray* pBlockList); /** @@ -142,10 +141,6 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo); bool tscIsInsertData(char* sqlstr); -/* use for keep current db info temporarily, for handle table with db prefix */ -// todo remove it -void tscGetDBInfoFromTableFullName(char* tableId, char* db); - int tscAllocPayload(SSqlCmd* pCmd, int size); TAOS_FIELD tscCreateField(int8_t type, const char* name, int16_t bytes); @@ -215,8 +210,8 @@ SQueryInfo *tscGetQueryInfoDetailSafely(SSqlCmd *pCmd, int32_t subClauseIndex); void tscClearTableMetaInfo(STableMetaInfo* pTableMetaInfo); -STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, STableMeta* pTableMeta, - SVgroupsInfo* vgroupList, SArray* pTagCols, SArray* pVgroupTables); +STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, SName* name, STableMeta* pTableMeta, + SVgroupsInfo* vgroupList, SArray* pTagCols, SArray* pVgroupTables); STableMetaInfo* tscAddEmptyMetaInfo(SQueryInfo *pQueryInfo); int32_t tscAddSubqueryInfo(SSqlCmd *pCmd); @@ -225,7 +220,7 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo); void tscClearSubqueryInfo(SSqlCmd* pCmd); void tscFreeVgroupTableInfo(SArray* pVgroupTables); -SArray* tscVgroupTableInfoClone(SArray* pVgroupTables); +SArray* tscVgroupTableInfoDup(SArray* pVgroupTables); void tscRemoveVgroupTableGroup(SArray* pVgroupTable, int32_t index); void tscVgroupTableCopy(SVgroupTableInfo* info, SVgroupTableInfo* pInfo); @@ -292,7 +287,7 @@ uint32_t tscGetTableMetaSize(STableMeta* pTableMeta); CChildTableMeta* tscCreateChildMeta(STableMeta* pTableMeta); uint32_t tscGetTableMetaMaxSize(); int32_t tscCreateTableMetaFromCChildMeta(STableMeta* pChild, const char* name); -STableMeta* tscTableMetaClone(STableMeta* pTableMeta); +STableMeta* tscTableMetaDup(STableMeta* pTableMeta); void* malloc_throw(size_t size); diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 085791e45c..0a26cc87e3 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -39,7 +39,7 @@ extern "C" { // forward declaration struct SSqlInfo; -struct SLocalReducer; +struct SLocalMerger; // data source from sql string or from file enum { @@ -67,7 +67,7 @@ typedef struct CChildTableMeta { int32_t vgId; STableId id; uint8_t tableType; - char sTableName[TSDB_TABLE_FNAME_LEN]; + char sTableName[TSDB_TABLE_FNAME_LEN]; //super table name, not full name } CChildTableMeta; typedef struct STableMeta { @@ -91,7 +91,7 @@ typedef struct STableMetaInfo { * 2. keep the vgroup index for multi-vnode insertion */ int32_t vgroupIndex; - char name[TSDB_TABLE_FNAME_LEN]; // (super) table name + SName name; char aliasName[TSDB_TABLE_NAME_LEN]; // alias name of table specified in query sql SArray *tagColList; // SArray, involved tag columns } STableMetaInfo; @@ -142,7 +142,7 @@ typedef struct SCond { } SCond; typedef struct SJoinNode { - char tableId[TSDB_TABLE_FNAME_LEN]; + char tableName[TSDB_TABLE_FNAME_LEN]; uint64_t uid; int16_t tagColId; } SJoinNode; @@ -176,7 +176,7 @@ typedef struct SParamInfo { } SParamInfo; typedef struct STableDataBlocks { - char tableName[TSDB_TABLE_FNAME_LEN]; + SName tableName; int8_t tsSource; // where does the UNIX timestamp come from, server or client bool ordered; // if current rows are ordered or not int64_t vgId; // virtual group id @@ -254,7 +254,7 @@ typedef struct { int8_t submitSchema; // submit block is built with table schema STagData tagData; // NOTE: pTagData->data is used as a variant length array - char **pTableNameList; // all involved tableMeta list of current insert sql statement. + SName **pTableNameList; // all involved tableMeta list of current insert sql statement. int32_t numOfTables; SHashObj *pTableBlockHashList; // data block for each table @@ -292,7 +292,7 @@ typedef struct { SColumnIndex* pColumnIndex; SArithmeticSupport *pArithSup; // support the arithmetic expression calculation on agg functions - struct SLocalReducer *pLocalReducer; + struct SLocalMerger *pLocalMerger; } SSqlRes; typedef struct STscObj { @@ -436,7 +436,7 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code); void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen); -void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql); +void tscImportDataFromFile(SSqlObj *pSql); void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen); bool tscIsUpdateQuery(SSqlObj* pSql); bool tscHasReachLimitation(SQueryInfo *pQueryInfo, SSqlRes *pRes); diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 599fa86460..4b1ab47730 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -569,10 +569,12 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch } char fullName[TSDB_TABLE_FNAME_LEN * 2] = {0}; - extractDBName(pTableMetaInfo->name, fullName); + tNameGetDbName(&pTableMetaInfo->name, fullName); + extractTableName(pMeta->sTableName, param->sTableName); snprintf(fullName + strlen(fullName), TSDB_TABLE_FNAME_LEN - strlen(fullName), ".%s", param->sTableName); - extractTableName(pTableMetaInfo->name, param->buf); + + strncpy(param->buf, tNameGetTableName(&pTableMetaInfo->name), TSDB_TABLE_NAME_LEN); param->pParentSql = pSql; param->pInterSql = pInterSql; @@ -602,6 +604,7 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch return TSDB_CODE_TSC_ACTION_IN_PROGRESS; } + static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName, char *ddl) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -675,8 +678,7 @@ static int32_t tscProcessShowCreateTable(SSqlObj *pSql) { STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); assert(pTableMetaInfo->pTableMeta != NULL); - char tableName[TSDB_TABLE_NAME_LEN] = {0}; - extractTableName(pTableMetaInfo->name, tableName); + const char* tableName = tNameGetTableName(&pTableMetaInfo->name); char *result = (char *)calloc(1, TSDB_MAX_BINARY_LEN); int32_t code = TSDB_CODE_SUCCESS; @@ -712,7 +714,9 @@ static int32_t tscProcessShowCreateDatabase(SSqlObj *pSql) { free(pInterSql); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - extractTableName(pTableMetaInfo->name, param->buf); + + strncpy(param->buf, tNameGetTableName(&pTableMetaInfo->name), TSDB_TABLE_NAME_LEN); + param->pParentSql = pSql; param->pInterSql = pInterSql; param->fp = tscRebuildCreateDBStatement; diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index c9c877c043..5b5fe8e798 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -56,7 +56,7 @@ int32_t treeComparator(const void *pLeft, const void *pRight, void *param) { } } -static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDescriptor *pDesc) { +static void tscInitSqlContext(SSqlCmd *pCmd, SLocalMerger *pReducer, tOrderDescriptor *pDesc) { /* * the fields and offset attributes in pCmd and pModel may be different due to * merge requirement. So, the final result in pRes structure is formatted in accordance with the pCmd object. @@ -166,7 +166,7 @@ static SFillColInfo* createFillColInfo(SQueryInfo* pQueryInfo) { return pFillCol; } -void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrderDescriptor *pDesc, +void tscCreateLocalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrderDescriptor *pDesc, SColumnModel *finalmodel, SColumnModel *pFFModel, SSqlObj* pSql) { SSqlCmd* pCmd = &pSql->cmd; SSqlRes* pRes = &pSql->res; @@ -212,9 +212,9 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd return; } - size_t size = sizeof(SLocalReducer) + POINTER_BYTES * numOfFlush; + size_t size = sizeof(SLocalMerger) + POINTER_BYTES * numOfFlush; - SLocalReducer *pReducer = (SLocalReducer *) calloc(1, size); + SLocalMerger *pReducer = (SLocalMerger *) calloc(1, size); if (pReducer == NULL) { tscError("%p failed to create local merge structure, out of memory", pSql); @@ -372,7 +372,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd pReducer->offset = (int32_t)pQueryInfo->limit.offset; - pRes->pLocalReducer = pReducer; + pRes->pLocalMerger = pReducer; pRes->numOfGroups = 0; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); @@ -477,13 +477,13 @@ int32_t saveToBuffer(tExtMemBuffer *pMemoryBuf, tOrderDescriptor *pDesc, tFilePa return 0; } -void tscDestroyLocalReducer(SSqlObj *pSql) { +void tscDestroyLocalMerger(SSqlObj *pSql) { if (pSql == NULL) { return; } SSqlRes *pRes = &(pSql->res); - if (pRes->pLocalReducer == NULL) { + if (pRes->pLocalMerger == NULL) { return; } @@ -491,14 +491,14 @@ void tscDestroyLocalReducer(SSqlObj *pSql) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); // there is no more result, so we release all allocated resource - SLocalReducer *pLocalReducer = (SLocalReducer *)atomic_exchange_ptr(&pRes->pLocalReducer, NULL); - if (pLocalReducer != NULL) { - pLocalReducer->pFillInfo = taosDestroyFillInfo(pLocalReducer->pFillInfo); + SLocalMerger *pLocalMerge = (SLocalMerger *)atomic_exchange_ptr(&pRes->pLocalMerger, NULL); + if (pLocalMerge != NULL) { + pLocalMerge->pFillInfo = taosDestroyFillInfo(pLocalMerge->pFillInfo); - if (pLocalReducer->pCtx != NULL) { + if (pLocalMerge->pCtx != NULL) { int32_t numOfExprs = (int32_t) tscSqlExprNumOfExprs(pQueryInfo); for (int32_t i = 0; i < numOfExprs; ++i) { - SQLFunctionCtx *pCtx = &pLocalReducer->pCtx[i]; + SQLFunctionCtx *pCtx = &pLocalMerge->pCtx[i]; tVariantDestroy(&pCtx->tag); tfree(pCtx->resultInfo); @@ -508,31 +508,31 @@ void tscDestroyLocalReducer(SSqlObj *pSql) { } } - tfree(pLocalReducer->pCtx); + tfree(pLocalMerge->pCtx); } - tfree(pLocalReducer->prevRowOfInput); + tfree(pLocalMerge->prevRowOfInput); - tfree(pLocalReducer->pTempBuffer); - tfree(pLocalReducer->pResultBuf); + tfree(pLocalMerge->pTempBuffer); + tfree(pLocalMerge->pResultBuf); - if (pLocalReducer->pLoserTree) { - tfree(pLocalReducer->pLoserTree->param); - tfree(pLocalReducer->pLoserTree); + if (pLocalMerge->pLoserTree) { + tfree(pLocalMerge->pLoserTree->param); + tfree(pLocalMerge->pLoserTree); } - tfree(pLocalReducer->pFinalRes); - tfree(pLocalReducer->discardData); + tfree(pLocalMerge->pFinalRes); + tfree(pLocalMerge->discardData); - tscLocalReducerEnvDestroy(pLocalReducer->pExtMemBuffer, pLocalReducer->pDesc, pLocalReducer->resColModel, pLocalReducer->finalModel, - pLocalReducer->numOfVnode); - for (int32_t i = 0; i < pLocalReducer->numOfBuffer; ++i) { - tfree(pLocalReducer->pLocalDataSrc[i]); + tscLocalReducerEnvDestroy(pLocalMerge->pExtMemBuffer, pLocalMerge->pDesc, pLocalMerge->resColModel, pLocalMerge->finalModel, + pLocalMerge->numOfVnode); + for (int32_t i = 0; i < pLocalMerge->numOfBuffer; ++i) { + tfree(pLocalMerge->pLocalDataSrc[i]); } - pLocalReducer->numOfBuffer = 0; - pLocalReducer->numOfCompleted = 0; - free(pLocalReducer); + pLocalMerge->numOfBuffer = 0; + pLocalMerge->numOfCompleted = 0; + free(pLocalMerge); } else { tscDebug("%p already freed or another free function is invoked", pSql); } @@ -604,7 +604,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm } } -bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage *tmpBuffer) { +bool isSameGroup(SSqlCmd *pCmd, SLocalMerger *pReducer, char *pPrev, tFilePage *tmpBuffer) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); // disable merge procedure for column projection query @@ -795,12 +795,12 @@ void tscLocalReducerEnvDestroy(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDe /** * - * @param pLocalReducer + * @param pLocalMerge * @param pOneInterDataSrc * @param treeList * @return the number of remain input source. if ret == 0, all data has been handled */ -int32_t loadNewDataFromDiskFor(SLocalReducer *pLocalReducer, SLocalDataSource *pOneInterDataSrc, +int32_t loadNewDataFromDiskFor(SLocalMerger *pLocalMerge, SLocalDataSource *pOneInterDataSrc, bool *needAdjustLoserTree) { pOneInterDataSrc->rowIdx = 0; pOneInterDataSrc->pageId += 1; @@ -817,17 +817,17 @@ int32_t loadNewDataFromDiskFor(SLocalReducer *pLocalReducer, SLocalDataSource *p #endif *needAdjustLoserTree = true; } else { - pLocalReducer->numOfCompleted += 1; + pLocalMerge->numOfCompleted += 1; pOneInterDataSrc->rowIdx = -1; pOneInterDataSrc->pageId = -1; *needAdjustLoserTree = true; } - return pLocalReducer->numOfBuffer; + return pLocalMerge->numOfBuffer; } -void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource *pOneInterDataSrc, +void adjustLoserTreeFromNewData(SLocalMerger *pLocalMerge, SLocalDataSource *pOneInterDataSrc, SLoserTreeInfo *pTree) { /* * load a new data page into memory for intermediate dataset source, @@ -835,7 +835,7 @@ void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource * */ bool needToAdjust = true; if (pOneInterDataSrc->filePage.num <= pOneInterDataSrc->rowIdx) { - loadNewDataFromDiskFor(pLocalReducer, pOneInterDataSrc, &needToAdjust); + loadNewDataFromDiskFor(pLocalMerge, pOneInterDataSrc, &needToAdjust); } /* @@ -843,7 +843,7 @@ void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource * * if the loser tree is rebuild completed, we do not need to adjust */ if (needToAdjust) { - int32_t leafNodeIdx = pTree->pNode[0].index + pLocalReducer->numOfBuffer; + int32_t leafNodeIdx = pTree->pNode[0].index + pLocalMerge->numOfBuffer; #ifdef _DEBUG_VIEW printf("before adjust:\t"); @@ -860,7 +860,7 @@ void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource * } } -void savePrevRecordAndSetupFillInfo(SLocalReducer *pLocalReducer, SQueryInfo *pQueryInfo, SFillInfo *pFillInfo) { +void savePrevRecordAndSetupFillInfo(SLocalMerger *pLocalMerge, SQueryInfo *pQueryInfo, SFillInfo *pFillInfo) { // discard following dataset in the same group and reset the interpolation information STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); @@ -873,28 +873,28 @@ void savePrevRecordAndSetupFillInfo(SLocalReducer *pLocalReducer, SQueryInfo *pQ taosResetFillInfo(pFillInfo, revisedSTime); } - pLocalReducer->discard = true; - pLocalReducer->discardData->num = 0; + pLocalMerge->discard = true; + pLocalMerge->discardData->num = 0; - SColumnModel *pModel = pLocalReducer->pDesc->pColumnModel; - tColModelAppend(pModel, pLocalReducer->discardData, pLocalReducer->prevRowOfInput, 0, 1, 1); + SColumnModel *pModel = pLocalMerge->pDesc->pColumnModel; + tColModelAppend(pModel, pLocalMerge->discardData, pLocalMerge->prevRowOfInput, 0, 1, 1); } -static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer, SQueryInfo* pQueryInfo) { +static void genFinalResWithoutFill(SSqlRes* pRes, SLocalMerger *pLocalMerge, SQueryInfo* pQueryInfo) { assert(pQueryInfo->interval.interval == 0 || pQueryInfo->fillType == TSDB_FILL_NONE); - tFilePage * pBeforeFillData = pLocalReducer->pResultBuf; + tFilePage * pBeforeFillData = pLocalMerge->pResultBuf; - pRes->data = pLocalReducer->pFinalRes; + pRes->data = pLocalMerge->pFinalRes; pRes->numOfRows = (int32_t) pBeforeFillData->num; if (pQueryInfo->limit.offset > 0) { if (pQueryInfo->limit.offset < pRes->numOfRows) { int32_t prevSize = (int32_t) pBeforeFillData->num; - tColModelErase(pLocalReducer->finalModel, pBeforeFillData, prevSize, 0, (int32_t)pQueryInfo->limit.offset - 1); + tColModelErase(pLocalMerge->finalModel, pBeforeFillData, prevSize, 0, (int32_t)pQueryInfo->limit.offset - 1); /* remove the hole in column model */ - tColModelCompact(pLocalReducer->finalModel, pBeforeFillData, prevSize); + tColModelCompact(pLocalMerge->finalModel, pBeforeFillData, prevSize); pRes->numOfRows -= (int32_t) pQueryInfo->limit.offset; pQueryInfo->limit.offset = 0; @@ -907,7 +907,7 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer, if (pRes->numOfRowsGroup >= pQueryInfo->limit.limit && pQueryInfo->limit.limit > 0) { pRes->numOfRows = 0; pBeforeFillData->num = 0; - pLocalReducer->discard = true; + pLocalMerge->discard = true; return; } @@ -923,29 +923,29 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer, pRes->numOfRows -= overflow; pBeforeFillData->num -= overflow; - tColModelCompact(pLocalReducer->finalModel, pBeforeFillData, prevSize); + tColModelCompact(pLocalMerge->finalModel, pBeforeFillData, prevSize); // set remain data to be discarded, and reset the interpolation information - savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pLocalReducer->pFillInfo); + savePrevRecordAndSetupFillInfo(pLocalMerge, pQueryInfo, pLocalMerge->pFillInfo); } - memcpy(pRes->data, pBeforeFillData->data, (size_t)(pRes->numOfRows * pLocalReducer->finalModel->rowSize)); + memcpy(pRes->data, pBeforeFillData->data, (size_t)(pRes->numOfRows * pLocalMerge->finalModel->rowSize)); pRes->numOfClauseTotal += pRes->numOfRows; pBeforeFillData->num = 0; } /* - * Note: pRes->pLocalReducer may be null, due to the fact that "tscDestroyLocalReducer" is called + * Note: pRes->pLocalMerge may be null, due to the fact that "tscDestroyLocalMerger" is called * by "interuptHandler" function in shell */ -static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneOutput) { +static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutput) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; - tFilePage *pBeforeFillData = pLocalReducer->pResultBuf; + tFilePage *pBeforeFillData = pLocalMerge->pResultBuf; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - SFillInfo *pFillInfo = pLocalReducer->pFillInfo; + SFillInfo *pFillInfo = pLocalMerge->pFillInfo; // todo extract function int64_t actualETime = (pQueryInfo->order.order == TSDB_ORDER_ASC)? pQueryInfo->window.ekey: pQueryInfo->window.skey; @@ -953,11 +953,11 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO tFilePage **pResPages = malloc(POINTER_BYTES * pQueryInfo->fieldsInfo.numOfOutput); for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); - pResPages[i] = calloc(1, sizeof(tFilePage) + pField->bytes * pLocalReducer->resColModel->capacity); + pResPages[i] = calloc(1, sizeof(tFilePage) + pField->bytes * pLocalMerge->resColModel->capacity); } while (1) { - int64_t newRows = taosFillResultDataBlock(pFillInfo, pResPages, pLocalReducer->resColModel->capacity); + int64_t newRows = taosFillResultDataBlock(pFillInfo, pResPages, pLocalMerge->resColModel->capacity); if (pQueryInfo->limit.offset < newRows) { newRows -= pQueryInfo->limit.offset; @@ -970,7 +970,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO } } - pRes->data = pLocalReducer->pFinalRes; + pRes->data = pLocalMerge->pFinalRes; pRes->numOfRows = (int32_t) newRows; pQueryInfo->limit.offset = 0; @@ -985,7 +985,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO } // all output in current group are completed - int32_t totalRemainRows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, actualETime, pLocalReducer->resColModel->capacity); + int32_t totalRemainRows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, actualETime, pLocalMerge->resColModel->capacity); if (totalRemainRows <= 0) { break; } @@ -1003,7 +1003,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO assert(pRes->numOfRows >= 0); /* set remain data to be discarded, and reset the interpolation information */ - savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pFillInfo); + savePrevRecordAndSetupFillInfo(pLocalMerge, pQueryInfo, pFillInfo); } int32_t offset = 0; @@ -1025,8 +1025,8 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO tfree(pResPages); } -static void savePreviousRow(SLocalReducer *pLocalReducer, tFilePage *tmpBuffer) { - SColumnModel *pColumnModel = pLocalReducer->pDesc->pColumnModel; +static void savePreviousRow(SLocalMerger *pLocalMerge, tFilePage *tmpBuffer) { + SColumnModel *pColumnModel = pLocalMerge->pDesc->pColumnModel; assert(pColumnModel->capacity == 1 && tmpBuffer->num == 1); // copy to previous temp buffer @@ -1034,20 +1034,20 @@ static void savePreviousRow(SLocalReducer *pLocalReducer, tFilePage *tmpBuffer) SSchema *pSchema = getColumnModelSchema(pColumnModel, i); int16_t offset = getColumnModelOffset(pColumnModel, i); - memcpy(pLocalReducer->prevRowOfInput + offset, tmpBuffer->data + offset, pSchema->bytes); + memcpy(pLocalMerge->prevRowOfInput + offset, tmpBuffer->data + offset, pSchema->bytes); } tmpBuffer->num = 0; - pLocalReducer->hasPrevRow = true; + pLocalMerge->hasPrevRow = true; } -static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalReducer *pLocalReducer, bool needInit) { +static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalMerger *pLocalMerge, bool needInit) { // the tag columns need to be set before all functions execution SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); size_t size = tscSqlExprNumOfExprs(pQueryInfo); for (int32_t j = 0; j < size; ++j) { - SQLFunctionCtx *pCtx = &pLocalReducer->pCtx[j]; + SQLFunctionCtx *pCtx = &pLocalMerge->pCtx[j]; // tags/tags_dummy function, the tag field of SQLFunctionCtx is from the input buffer int32_t functionId = pCtx->functionId; @@ -1074,20 +1074,20 @@ static void doExecuteSecondaryMerge(SSqlCmd *pCmd, SLocalReducer *pLocalReducer, } for (int32_t j = 0; j < size; ++j) { - int32_t functionId = pLocalReducer->pCtx[j].functionId; + int32_t functionId = pLocalMerge->pCtx[j].functionId; if (functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS_DUMMY) { continue; } - aAggs[functionId].mergeFunc(&pLocalReducer->pCtx[j]); + aAggs[functionId].mergeFunc(&pLocalMerge->pCtx[j]); } } -static void handleUnprocessedRow(SSqlCmd *pCmd, SLocalReducer *pLocalReducer, tFilePage *tmpBuffer) { - if (pLocalReducer->hasUnprocessedRow) { - pLocalReducer->hasUnprocessedRow = false; - doExecuteSecondaryMerge(pCmd, pLocalReducer, true); - savePreviousRow(pLocalReducer, tmpBuffer); +static void handleUnprocessedRow(SSqlCmd *pCmd, SLocalMerger *pLocalMerge, tFilePage *tmpBuffer) { + if (pLocalMerge->hasUnprocessedRow) { + pLocalMerge->hasUnprocessedRow = false; + doExecuteSecondaryMerge(pCmd, pLocalMerge, true); + savePreviousRow(pLocalMerge, tmpBuffer); } } @@ -1120,7 +1120,7 @@ static int64_t getNumOfResultLocal(SQueryInfo *pQueryInfo, SQLFunctionCtx *pCtx) * filled with the same result, which is the tags, specified in group by clause * */ -static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLocalReducer *pLocalReducer) { +static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLocalMerger *pLocalMerge) { int32_t maxBufSize = 0; // find the max tags column length to prepare the buffer size_t size = tscSqlExprNumOfExprs(pQueryInfo); @@ -1135,7 +1135,7 @@ static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLo char *buf = malloc((size_t)maxBufSize); for (int32_t k = 0; k < size; ++k) { - SQLFunctionCtx *pCtx = &pLocalReducer->pCtx[k]; + SQLFunctionCtx *pCtx = &pLocalMerge->pCtx[k]; if (pCtx->functionId != TSDB_FUNC_TAG) { continue; } @@ -1153,20 +1153,20 @@ static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLo free(buf); } -int32_t finalizeRes(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) { +int32_t finalizeRes(SQueryInfo *pQueryInfo, SLocalMerger *pLocalMerge) { size_t size = tscSqlExprNumOfExprs(pQueryInfo); for (int32_t k = 0; k < size; ++k) { - SQLFunctionCtx* pCtx = &pLocalReducer->pCtx[k]; + SQLFunctionCtx* pCtx = &pLocalMerge->pCtx[k]; aAggs[pCtx->functionId].xFinalize(pCtx); } - pLocalReducer->hasPrevRow = false; + pLocalMerge->hasPrevRow = false; - int32_t numOfRes = (int32_t)getNumOfResultLocal(pQueryInfo, pLocalReducer->pCtx); - pLocalReducer->pResultBuf->num += numOfRes; + int32_t numOfRes = (int32_t)getNumOfResultLocal(pQueryInfo, pLocalMerge->pCtx); + pLocalMerge->pResultBuf->num += numOfRes; - fillMultiRowsOfTagsVal(pQueryInfo, numOfRes, pLocalReducer); + fillMultiRowsOfTagsVal(pQueryInfo, numOfRes, pLocalMerge); return numOfRes; } @@ -1177,22 +1177,22 @@ int32_t finalizeRes(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) { * results generated by simple aggregation function, we merge them all into one points * *Exception*: column projection query, required no merge procedure */ -bool needToMerge(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer, tFilePage *tmpBuffer) { +bool needToMerge(SQueryInfo *pQueryInfo, SLocalMerger *pLocalMerge, tFilePage *tmpBuffer) { int32_t ret = 0; // merge all result by default - int16_t functionId = pLocalReducer->pCtx[0].functionId; + int16_t functionId = pLocalMerge->pCtx[0].functionId; // todo opt performance if ((/*functionId == TSDB_FUNC_PRJ || */functionId == TSDB_FUNC_ARITHM) || (tscIsProjectionQueryOnSTable(pQueryInfo, 0))) { // column projection query ret = 1; // disable merge procedure } else { - tOrderDescriptor *pDesc = pLocalReducer->pDesc; + tOrderDescriptor *pDesc = pLocalMerge->pDesc; if (pDesc->orderInfo.numOfCols > 0) { if (pDesc->tsOrder == TSDB_ORDER_ASC) { // asc // todo refactor comparator - ret = compare_a(pLocalReducer->pDesc, 1, 0, pLocalReducer->prevRowOfInput, 1, 0, tmpBuffer->data); + ret = compare_a(pLocalMerge->pDesc, 1, 0, pLocalMerge->prevRowOfInput, 1, 0, tmpBuffer->data); } else { // desc - ret = compare_d(pLocalReducer->pDesc, 1, 0, pLocalReducer->prevRowOfInput, 1, 0, tmpBuffer->data); + ret = compare_d(pLocalMerge->pDesc, 1, 0, pLocalMerge->prevRowOfInput, 1, 0, tmpBuffer->data); } } } @@ -1230,17 +1230,17 @@ static bool saveGroupResultInfo(SSqlObj *pSql) { /** * * @param pSql - * @param pLocalReducer + * @param pLocalMerge * @param noMoreCurrentGroupRes * @return if current group is skipped, return false, and do NOT record it into pRes->numOfGroups */ -bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCurrentGroupRes) { +bool genFinalResults(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool noMoreCurrentGroupRes) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - tFilePage * pResBuf = pLocalReducer->pResultBuf; - SColumnModel *pModel = pLocalReducer->resColModel; + tFilePage * pResBuf = pLocalMerge->pResultBuf; + SColumnModel *pModel = pLocalMerge->resColModel; pRes->code = TSDB_CODE_SUCCESS; @@ -1251,11 +1251,11 @@ bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCur if (pQueryInfo->slimit.offset > 0) { pRes->numOfRows = 0; pQueryInfo->slimit.offset -= 1; - pLocalReducer->discard = !noMoreCurrentGroupRes; + pLocalMerge->discard = !noMoreCurrentGroupRes; - if (pLocalReducer->discard) { - SColumnModel *pInternModel = pLocalReducer->pDesc->pColumnModel; - tColModelAppend(pInternModel, pLocalReducer->discardData, pLocalReducer->pTempBuffer->data, 0, 1, 1); + if (pLocalMerge->discard) { + SColumnModel *pInternModel = pLocalMerge->pDesc->pColumnModel; + tColModelAppend(pInternModel, pLocalMerge->discardData, pLocalMerge->pTempBuffer->data, 0, 1, 1); } return false; @@ -1264,19 +1264,14 @@ bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCur tColModelCompact(pModel, pResBuf, pModel->capacity); if (tscIsSecondStageQuery(pQueryInfo)) { - doArithmeticCalculate(pQueryInfo, pResBuf, pModel->rowSize, pLocalReducer->finalModel->rowSize); + doArithmeticCalculate(pQueryInfo, pResBuf, pModel->rowSize, pLocalMerge->finalModel->rowSize); } -#ifdef _DEBUG_VIEW - printf("final result before interpo:\n"); -// tColModelDisplay(pLocalReducer->resColModel, pLocalReducer->pBufForInterpo, pResBuf->num, pResBuf->num); -#endif - // no interval query, no fill operation if (pQueryInfo->interval.interval == 0 || pQueryInfo->fillType == TSDB_FILL_NONE) { - genFinalResWithoutFill(pRes, pLocalReducer, pQueryInfo); + genFinalResWithoutFill(pRes, pLocalMerge, pQueryInfo); } else { - SFillInfo* pFillInfo = pLocalReducer->pFillInfo; + SFillInfo* pFillInfo = pLocalMerge->pFillInfo; if (pFillInfo != NULL) { TSKEY ekey = (pQueryInfo->order.order == TSDB_ORDER_ASC)? pQueryInfo->window.ekey: pQueryInfo->window.skey; @@ -1284,34 +1279,34 @@ bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCur taosFillCopyInputDataFromOneFilePage(pFillInfo, pResBuf); } - doFillResult(pSql, pLocalReducer, noMoreCurrentGroupRes); + doFillResult(pSql, pLocalMerge, noMoreCurrentGroupRes); } return true; } -void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalReducer *pLocalReducer) {// reset output buffer to the beginning +void resetOutputBuf(SQueryInfo *pQueryInfo, SLocalMerger *pLocalMerge) {// reset output buffer to the beginning size_t t = tscSqlExprNumOfExprs(pQueryInfo); for (int32_t i = 0; i < t; ++i) { SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); - pLocalReducer->pCtx[i].aOutputBuf = pLocalReducer->pResultBuf->data + pExpr->offset * pLocalReducer->resColModel->capacity; + pLocalMerge->pCtx[i].aOutputBuf = pLocalMerge->pResultBuf->data + pExpr->offset * pLocalMerge->resColModel->capacity; if (pExpr->functionId == TSDB_FUNC_TOP || pExpr->functionId == TSDB_FUNC_BOTTOM || pExpr->functionId == TSDB_FUNC_DIFF) { - pLocalReducer->pCtx[i].ptsOutputBuf = pLocalReducer->pCtx[0].aOutputBuf; + pLocalMerge->pCtx[i].ptsOutputBuf = pLocalMerge->pCtx[0].aOutputBuf; } } - memset(pLocalReducer->pResultBuf, 0, pLocalReducer->nResultBufSize + sizeof(tFilePage)); + memset(pLocalMerge->pResultBuf, 0, pLocalMerge->nResultBufSize + sizeof(tFilePage)); } -static void resetEnvForNewResultset(SSqlRes *pRes, SSqlCmd *pCmd, SLocalReducer *pLocalReducer) { +static void resetEnvForNewResultset(SSqlRes *pRes, SSqlCmd *pCmd, SLocalMerger *pLocalMerge) { // In handling data in other groups, we need to reset the interpolation information for a new group data pRes->numOfRows = 0; pRes->numOfRowsGroup = 0; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - pQueryInfo->limit.offset = pLocalReducer->offset; + pQueryInfo->limit.offset = pLocalMerge->offset; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); @@ -1320,12 +1315,12 @@ static void resetEnvForNewResultset(SSqlRes *pRes, SSqlCmd *pCmd, SLocalReducer if (pQueryInfo->fillType != TSDB_FILL_NONE) { TSKEY skey = (pQueryInfo->order.order == TSDB_ORDER_ASC)? pQueryInfo->window.skey:pQueryInfo->window.ekey;//MIN(pQueryInfo->window.skey, pQueryInfo->window.ekey); int64_t newTime = taosTimeTruncate(skey, &pQueryInfo->interval, tinfo.precision); - taosResetFillInfo(pLocalReducer->pFillInfo, newTime); + taosResetFillInfo(pLocalMerge->pFillInfo, newTime); } } -static bool isAllSourcesCompleted(SLocalReducer *pLocalReducer) { - return (pLocalReducer->numOfBuffer == pLocalReducer->numOfCompleted); +static bool isAllSourcesCompleted(SLocalMerger *pLocalMerge) { + return (pLocalMerge->numOfBuffer == pLocalMerge->numOfCompleted); } static bool doBuildFilledResultForGroup(SSqlObj *pSql) { @@ -1333,19 +1328,19 @@ static bool doBuildFilledResultForGroup(SSqlObj *pSql) { SSqlRes *pRes = &pSql->res; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - SLocalReducer *pLocalReducer = pRes->pLocalReducer; - SFillInfo *pFillInfo = pLocalReducer->pFillInfo; + SLocalMerger *pLocalMerge = pRes->pLocalMerger; + SFillInfo *pFillInfo = pLocalMerge->pFillInfo; if (pFillInfo != NULL && taosFillHasMoreResults(pFillInfo)) { assert(pQueryInfo->fillType != TSDB_FILL_NONE); - tFilePage *pFinalDataBuf = pLocalReducer->pResultBuf; + tFilePage *pFinalDataBuf = pLocalMerge->pResultBuf; int64_t etime = *(int64_t *)(pFinalDataBuf->data + TSDB_KEYSIZE * (pFillInfo->numOfRows - 1)); // the first column must be the timestamp column - int32_t rows = (int32_t) getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalReducer->resColModel->capacity); + int32_t rows = (int32_t) getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalMerge->resColModel->capacity); if (rows > 0) { // do fill gap - doFillResult(pSql, pLocalReducer, false); + doFillResult(pSql, pLocalMerge, false); } return true; @@ -1358,23 +1353,23 @@ static bool doHandleLastRemainData(SSqlObj *pSql) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; - SLocalReducer *pLocalReducer = pRes->pLocalReducer; - SFillInfo *pFillInfo = pLocalReducer->pFillInfo; + SLocalMerger *pLocalMerge = pRes->pLocalMerger; + SFillInfo *pFillInfo = pLocalMerge->pFillInfo; - bool prevGroupCompleted = (!pLocalReducer->discard) && pLocalReducer->hasUnprocessedRow; + bool prevGroupCompleted = (!pLocalMerge->discard) && pLocalMerge->hasUnprocessedRow; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - if ((isAllSourcesCompleted(pLocalReducer) && !pLocalReducer->hasPrevRow) || pLocalReducer->pLocalDataSrc[0] == NULL || + if ((isAllSourcesCompleted(pLocalMerge) && !pLocalMerge->hasPrevRow) || pLocalMerge->pLocalDataSrc[0] == NULL || prevGroupCompleted) { // if fillType == TSDB_FILL_NONE, return directly if (pQueryInfo->fillType != TSDB_FILL_NONE && ((pRes->numOfRowsGroup < pQueryInfo->limit.limit && pQueryInfo->limit.limit > 0) || (pQueryInfo->limit.limit < 0))) { int64_t etime = (pQueryInfo->order.order == TSDB_ORDER_ASC)? pQueryInfo->window.ekey : pQueryInfo->window.skey; - int32_t rows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalReducer->resColModel->capacity); + int32_t rows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalMerge->resColModel->capacity); if (rows > 0) { - doFillResult(pSql, pLocalReducer, true); + doFillResult(pSql, pLocalMerge, true); } } @@ -1384,7 +1379,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) { * * No results will be generated and query completed. */ - if (pRes->numOfRows > 0 || (isAllSourcesCompleted(pLocalReducer) && (!pLocalReducer->hasUnprocessedRow))) { + if (pRes->numOfRows > 0 || (isAllSourcesCompleted(pLocalMerge) && (!pLocalMerge->hasUnprocessedRow))) { return true; } @@ -1393,7 +1388,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) { return true; } - resetEnvForNewResultset(pRes, pCmd, pLocalReducer); + resetEnvForNewResultset(pRes, pCmd, pLocalMerge); } return false; @@ -1403,12 +1398,12 @@ static void doProcessResultInNextWindow(SSqlObj *pSql, int32_t numOfRes) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; - SLocalReducer *pLocalReducer = pRes->pLocalReducer; + SLocalMerger *pLocalMerge = pRes->pLocalMerger; SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); size_t size = tscSqlExprNumOfExprs(pQueryInfo); for (int32_t k = 0; k < size; ++k) { - SQLFunctionCtx *pCtx = &pLocalReducer->pCtx[k]; + SQLFunctionCtx *pCtx = &pLocalMerge->pCtx[k]; pCtx->aOutputBuf += pCtx->outputBytes * numOfRes; // set the correct output timestamp column position @@ -1417,7 +1412,7 @@ static void doProcessResultInNextWindow(SSqlObj *pSql, int32_t numOfRes) { } } - doExecuteSecondaryMerge(pCmd, pLocalReducer, true); + doExecuteSecondaryMerge(pCmd, pLocalMerge, true); } int32_t tscDoLocalMerge(SSqlObj *pSql) { @@ -1426,18 +1421,18 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { tscResetForNextRetrieve(pRes); - if (pSql->signature != pSql || pRes == NULL || pRes->pLocalReducer == NULL) { // all data has been processed + if (pSql->signature != pSql || pRes == NULL || pRes->pLocalMerger == NULL) { // all data has been processed if (pRes->code == TSDB_CODE_SUCCESS) { return pRes->code; } - + tscError("%p local merge abort due to error occurs, code:%s", pSql, tstrerror(pRes->code)); return pRes->code; } - SLocalReducer *pLocalReducer = pRes->pLocalReducer; + SLocalMerger *pLocalMerge = pRes->pLocalMerger; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - tFilePage *tmpBuffer = pLocalReducer->pTempBuffer; + tFilePage *tmpBuffer = pLocalMerge->pTempBuffer; if (doHandleLastRemainData(pSql)) { return TSDB_CODE_SUCCESS; @@ -1447,24 +1442,24 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { return TSDB_CODE_SUCCESS; } - SLoserTreeInfo *pTree = pLocalReducer->pLoserTree; + SLoserTreeInfo *pTree = pLocalMerge->pLoserTree; // clear buffer - handleUnprocessedRow(pCmd, pLocalReducer, tmpBuffer); - SColumnModel *pModel = pLocalReducer->pDesc->pColumnModel; + handleUnprocessedRow(pCmd, pLocalMerge, tmpBuffer); + SColumnModel *pModel = pLocalMerge->pDesc->pColumnModel; while (1) { - if (isAllSourcesCompleted(pLocalReducer)) { + if (isAllSourcesCompleted(pLocalMerge)) { break; } #ifdef _DEBUG_VIEW printf("chosen data in pTree[0] = %d\n", pTree->pNode[0].index); #endif - assert((pTree->pNode[0].index < pLocalReducer->numOfBuffer) && (pTree->pNode[0].index >= 0) && tmpBuffer->num == 0); + assert((pTree->pNode[0].index < pLocalMerge->numOfBuffer) && (pTree->pNode[0].index >= 0) && tmpBuffer->num == 0); // chosen from loser tree - SLocalDataSource *pOneDataSrc = pLocalReducer->pLocalDataSrc[pTree->pNode[0].index]; + SLocalDataSource *pOneDataSrc = pLocalMerge->pLocalDataSrc[pTree->pNode[0].index]; tColModelAppend(pModel, tmpBuffer, pOneDataSrc->filePage.data, pOneDataSrc->rowIdx, 1, pOneDataSrc->pMemBuffer->pColumnModel->capacity); @@ -1477,76 +1472,76 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { tColModelDisplayEx(pModel, tmpBuffer->data, tmpBuffer->num, pModel->capacity, colInfo); #endif - if (pLocalReducer->discard) { - assert(pLocalReducer->hasUnprocessedRow == false); + if (pLocalMerge->discard) { + assert(pLocalMerge->hasUnprocessedRow == false); /* current record belongs to the same group of previous record, need to discard it */ - if (isSameGroup(pCmd, pLocalReducer, pLocalReducer->discardData->data, tmpBuffer)) { + if (isSameGroup(pCmd, pLocalMerge, pLocalMerge->discardData->data, tmpBuffer)) { tmpBuffer->num = 0; pOneDataSrc->rowIdx += 1; - adjustLoserTreeFromNewData(pLocalReducer, pOneDataSrc, pTree); + adjustLoserTreeFromNewData(pLocalMerge, pOneDataSrc, pTree); // all inputs are exhausted, abort current process - if (isAllSourcesCompleted(pLocalReducer)) { + if (isAllSourcesCompleted(pLocalMerge)) { break; } // data belongs to the same group needs to be discarded continue; } else { - pLocalReducer->discard = false; - pLocalReducer->discardData->num = 0; + pLocalMerge->discard = false; + pLocalMerge->discardData->num = 0; if (saveGroupResultInfo(pSql)) { return TSDB_CODE_SUCCESS; } - resetEnvForNewResultset(pRes, pCmd, pLocalReducer); + resetEnvForNewResultset(pRes, pCmd, pLocalMerge); } } - if (pLocalReducer->hasPrevRow) { - if (needToMerge(pQueryInfo, pLocalReducer, tmpBuffer)) { + if (pLocalMerge->hasPrevRow) { + if (needToMerge(pQueryInfo, pLocalMerge, tmpBuffer)) { // belong to the group of the previous row, continue process it - doExecuteSecondaryMerge(pCmd, pLocalReducer, false); + doExecuteSecondaryMerge(pCmd, pLocalMerge, false); // copy to buffer - savePreviousRow(pLocalReducer, tmpBuffer); + savePreviousRow(pLocalMerge, tmpBuffer); } else { /* * current row does not belong to the group of previous row. * so the processing of previous group is completed. */ - int32_t numOfRes = finalizeRes(pQueryInfo, pLocalReducer); - bool sameGroup = isSameGroup(pCmd, pLocalReducer, pLocalReducer->prevRowOfInput, tmpBuffer); + int32_t numOfRes = finalizeRes(pQueryInfo, pLocalMerge); + bool sameGroup = isSameGroup(pCmd, pLocalMerge, pLocalMerge->prevRowOfInput, tmpBuffer); - tFilePage *pResBuf = pLocalReducer->pResultBuf; + tFilePage *pResBuf = pLocalMerge->pResultBuf; /* * if the previous group does NOT generate any result (pResBuf->num == 0), * continue to process results instead of return results. */ - if ((!sameGroup && pResBuf->num > 0) || (pResBuf->num == pLocalReducer->resColModel->capacity)) { + if ((!sameGroup && pResBuf->num > 0) || (pResBuf->num == pLocalMerge->resColModel->capacity)) { // does not belong to the same group - bool notSkipped = genFinalResults(pSql, pLocalReducer, !sameGroup); + bool notSkipped = genFinalResults(pSql, pLocalMerge, !sameGroup); // this row needs to discard, since it belongs to the group of previous - if (pLocalReducer->discard && sameGroup) { - pLocalReducer->hasUnprocessedRow = false; + if (pLocalMerge->discard && sameGroup) { + pLocalMerge->hasUnprocessedRow = false; tmpBuffer->num = 0; } else { // current row does not belongs to the previous group, so it is not be handled yet. - pLocalReducer->hasUnprocessedRow = true; + pLocalMerge->hasUnprocessedRow = true; } - resetOutputBuf(pQueryInfo, pLocalReducer); + resetOutputBuf(pQueryInfo, pLocalMerge); pOneDataSrc->rowIdx += 1; // here we do not check the return value - adjustLoserTreeFromNewData(pLocalReducer, pOneDataSrc, pTree); + adjustLoserTreeFromNewData(pLocalMerge, pOneDataSrc, pTree); if (pRes->numOfRows == 0) { - handleUnprocessedRow(pCmd, pLocalReducer, tmpBuffer); + handleUnprocessedRow(pCmd, pLocalMerge, tmpBuffer); if (!sameGroup) { /* @@ -1557,7 +1552,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { return TSDB_CODE_SUCCESS; } - resetEnvForNewResultset(pRes, pCmd, pLocalReducer); + resetEnvForNewResultset(pRes, pCmd, pLocalMerge); } } else { /* @@ -1565,7 +1560,7 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { * We start the process in a new round. */ if (sameGroup) { - handleUnprocessedRow(pCmd, pLocalReducer, tmpBuffer); + handleUnprocessedRow(pCmd, pLocalMerge, tmpBuffer); } } @@ -1577,24 +1572,24 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { } } else { // result buffer is not full doProcessResultInNextWindow(pSql, numOfRes); - savePreviousRow(pLocalReducer, tmpBuffer); + savePreviousRow(pLocalMerge, tmpBuffer); } } } else { - doExecuteSecondaryMerge(pCmd, pLocalReducer, true); - savePreviousRow(pLocalReducer, tmpBuffer); // copy the processed row to buffer + doExecuteSecondaryMerge(pCmd, pLocalMerge, true); + savePreviousRow(pLocalMerge, tmpBuffer); // copy the processed row to buffer } pOneDataSrc->rowIdx += 1; - adjustLoserTreeFromNewData(pLocalReducer, pOneDataSrc, pTree); + adjustLoserTreeFromNewData(pLocalMerge, pOneDataSrc, pTree); } - if (pLocalReducer->hasPrevRow) { - finalizeRes(pQueryInfo, pLocalReducer); + if (pLocalMerge->hasPrevRow) { + finalizeRes(pQueryInfo, pLocalMerge); } - if (pLocalReducer->pResultBuf->num) { - genFinalResults(pSql, pLocalReducer, true); + if (pLocalMerge->pResultBuf->num) { + genFinalResults(pSql, pLocalMerge, true); } return TSDB_CODE_SUCCESS; @@ -1602,8 +1597,8 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) { void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen) { SSqlRes *pRes = &pObj->res; - if (pRes->pLocalReducer != NULL) { - tscDestroyLocalReducer(pObj); + if (pRes->pLocalMerger != NULL) { + tscDestroyLocalMerger(pObj); } pRes->qhandle = 1; // hack to pass the safety check in fetch_row function @@ -1611,17 +1606,17 @@ void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen) pRes->row = 0; pRes->rspType = 0; // used as a flag to denote if taos_retrieved() has been called yet - pRes->pLocalReducer = (SLocalReducer *)calloc(1, sizeof(SLocalReducer)); + pRes->pLocalMerger = (SLocalMerger *)calloc(1, sizeof(SLocalMerger)); /* * we need one additional byte space * the sprintf function needs one additional space to put '\0' at the end of string */ size_t allocSize = numOfRes * rowLen + sizeof(tFilePage) + 1; - pRes->pLocalReducer->pResultBuf = (tFilePage *)calloc(1, allocSize); + pRes->pLocalMerger->pResultBuf = (tFilePage *)calloc(1, allocSize); - pRes->pLocalReducer->pResultBuf->num = numOfRes; - pRes->data = pRes->pLocalReducer->pResultBuf->data; + pRes->pLocalMerger->pResultBuf->num = numOfRes; + pRes->data = pRes->pLocalMerger->pResultBuf->data; } int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize) { diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 0c7af5d4e3..2466ae060e 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -703,7 +703,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, SParsedDataColI STableDataBlocks *dataBuf = NULL; int32_t ret = tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_DEFAULT_PAYLOAD_SIZE, - sizeof(SSubmitBlk), tinfo.rowSize, pTableMetaInfo->name, pTableMeta, &dataBuf, NULL); + sizeof(SSubmitBlk), tinfo.rowSize, &pTableMetaInfo->name, pTableMeta, &dataBuf, NULL); if (ret != TSDB_CODE_SUCCESS) { return ret; } @@ -813,26 +813,26 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { tscAddEmptyMetaInfo(pQueryInfo); } - STableMetaInfo *pSTableMeterMetaInfo = tscGetMetaInfo(pQueryInfo, STABLE_INDEX); - code = tscSetTableFullName(pSTableMeterMetaInfo, &sToken, pSql); + STableMetaInfo *pSTableMetaInfo = tscGetMetaInfo(pQueryInfo, STABLE_INDEX); + code = tscSetTableFullName(pSTableMetaInfo, &sToken, pSql); if (code != TSDB_CODE_SUCCESS) { return code; } - tstrncpy(pCmd->tagData.name, pSTableMeterMetaInfo->name, sizeof(pCmd->tagData.name)); + tNameExtractFullName(&pSTableMetaInfo->name, pCmd->tagData.name); pCmd->tagData.dataLen = 0; - code = tscGetTableMeta(pSql, pSTableMeterMetaInfo); + code = tscGetTableMeta(pSql, pSTableMetaInfo); if (code != TSDB_CODE_SUCCESS) { return code; } - if (!UTIL_TABLE_IS_SUPER_TABLE(pSTableMeterMetaInfo)) { + if (!UTIL_TABLE_IS_SUPER_TABLE(pSTableMetaInfo)) { return tscInvalidSQLErrMsg(pCmd->payload, "create table only from super table is allowed", sToken.z); } - SSchema *pTagSchema = tscGetTableTagSchema(pSTableMeterMetaInfo->pTableMeta); - STableComInfo tinfo = tscGetTableInfo(pSTableMeterMetaInfo->pTableMeta); + SSchema *pTagSchema = tscGetTableTagSchema(pSTableMetaInfo->pTableMeta); + STableComInfo tinfo = tscGetTableInfo(pSTableMetaInfo->pTableMeta); index = 0; sToken = tStrGetToken(sql, &index, false, 0, NULL); @@ -840,7 +840,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { SParsedDataColInfo spd = {0}; - uint8_t numOfTags = tscGetNumOfTags(pSTableMeterMetaInfo->pTableMeta); + uint8_t numOfTags = tscGetNumOfTags(pSTableMetaInfo->pTableMeta); spd.numOfCols = numOfTags; // if specify some tags column @@ -1406,39 +1406,38 @@ typedef struct SImportFileSupport { FILE *fp; } SImportFileSupport; -static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) { +static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRows) { assert(param != NULL && tres != NULL); + char * tokenBuf = NULL; + size_t n = 0; + ssize_t readLen = 0; + char * line = NULL; + int32_t count = 0; + int32_t maxRows = 0; + FILE * fp = NULL; + SSqlObj *pSql = tres; SSqlCmd *pCmd = &pSql->cmd; - SImportFileSupport *pSupporter = (SImportFileSupport *) param; + SImportFileSupport *pSupporter = (SImportFileSupport *)param; SSqlObj *pParentSql = pSupporter->pSql; - FILE *fp = pSupporter->fp; + fp = pSupporter->fp; - if (taos_errno(pSql) != TSDB_CODE_SUCCESS) { // handle error - assert(taos_errno(pSql) == code); + int32_t code = pSql->res.code; - do { - if (code == TSDB_CODE_TDB_TABLE_RECONFIGURE) { - assert(pSql->res.numOfRows == 0); - int32_t errc = fseek(fp, 0, SEEK_SET); - if (errc < 0) { - tscError("%p failed to seek SEEK_SET since:%s", pSql, tstrerror(errno)); - } else { - break; - } - } - - taos_free_result(pSql); - tfree(pSupporter); - fclose(fp); - - pParentSql->res.code = code; - tscAsyncResultOnError(pParentSql); - return; - } while (0); + // retry parse data from file and import data from the begining again + if (code == TSDB_CODE_TDB_TABLE_RECONFIGURE) { + assert(pSql->res.numOfRows == 0); + int32_t ret = fseek(fp, 0, SEEK_SET); + if (ret < 0) { + tscError("%p failed to seek SEEK_SET since:%s", pSql, tstrerror(errno)); + code = TAOS_SYSTEM_ERROR(errno); + goto _error; + } + } else if (code != TSDB_CODE_SUCCESS) { + goto _error; } // accumulate the total submit records @@ -1452,28 +1451,32 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) { SParsedDataColInfo spd = {.numOfCols = tinfo.numOfColumns}; tscSetAssignedColumnInfo(&spd, pSchema, tinfo.numOfColumns); - size_t n = 0; - ssize_t readLen = 0; - char * line = NULL; - int32_t count = 0; - int32_t maxRows = 0; - tfree(pCmd->pTableNameList); pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks); if (pCmd->pTableBlockHashList == NULL) { pCmd->pTableBlockHashList = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); + if (pCmd->pTableBlockHashList == NULL) { + code = TSDB_CODE_TSC_OUT_OF_MEMORY; + goto _error; + } } STableDataBlocks *pTableDataBlock = NULL; - int32_t ret = tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, - sizeof(SSubmitBlk), tinfo.rowSize, pTableMetaInfo->name, pTableMeta, &pTableDataBlock, NULL); + int32_t ret = + tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk), + tinfo.rowSize, &pTableMetaInfo->name, pTableMeta, &pTableDataBlock, NULL); if (ret != TSDB_CODE_SUCCESS) { -// return ret; + pParentSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY; + goto _error; } tscAllocateMemIfNeed(pTableDataBlock, tinfo.rowSize, &maxRows); - char *tokenBuf = calloc(1, 4096); + tokenBuf = calloc(1, TSDB_MAX_BYTES_PER_ROW); + if (tokenBuf == NULL) { + code = TSDB_CODE_TSC_OUT_OF_MEMORY; + goto _error; + } while ((readLen = tgetline(&line, &n, fp)) != -1) { if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { @@ -1501,30 +1504,42 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) { } tfree(tokenBuf); - free(line); + tfree(line); - if (count > 0) { - code = doPackSendDataBlock(pSql, count, pTableDataBlock); - if (code != TSDB_CODE_SUCCESS) { - pParentSql->res.code = code; - tscAsyncResultOnError(pParentSql); + pParentSql->res.code = code; + if (code == TSDB_CODE_SUCCESS) { + if (count > 0) { + code = doPackSendDataBlock(pSql, count, pTableDataBlock); + if (code == TSDB_CODE_SUCCESS) { + return; + } else { + goto _error; + } + } else { + taos_free_result(pSql); + tfree(pSupporter); + fclose(fp); + + pParentSql->fp = pParentSql->fetchFp; + + // all data has been sent to vnode, call user function + int32_t v = (code != TSDB_CODE_SUCCESS) ? code : (int32_t)pParentSql->res.numOfRows; + (*pParentSql->fp)(pParentSql->param, pParentSql, v); return; } - - } else { - taos_free_result(pSql); - tfree(pSupporter); - fclose(fp); - - pParentSql->fp = pParentSql->fetchFp; - - // all data has been sent to vnode, call user function - int32_t v = (pParentSql->res.code != TSDB_CODE_SUCCESS) ? pParentSql->res.code : (int32_t)pParentSql->res.numOfRows; - (*pParentSql->fp)(pParentSql->param, pParentSql, v); } + +_error: + tfree(tokenBuf); + tfree(line); + taos_free_result(pSql); + tfree(pSupporter); + fclose(fp); + + tscAsyncResultOnError(pParentSql); } -void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) { +void tscImportDataFromFile(SSqlObj *pSql) { SSqlCmd *pCmd = &pSql->cmd; if (pCmd->command != TSDB_SQL_INSERT) { return; @@ -1543,12 +1558,11 @@ void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) { tfree(pSupporter); tscAsyncResultOnError(pSql); - return; } pSupporter->pSql = pSql; - pSupporter->fp = fp; + pSupporter->fp = fp; - parseFileSendDataBlock(pSupporter, pNew, 0); + parseFileSendDataBlock(pSupporter, pNew, TSDB_CODE_SUCCESS); } diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 7c69c16b04..c5f06a52f3 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -707,7 +707,7 @@ static int insertStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) { int32_t ret = tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk), - pTableMeta->tableInfo.rowSize, pTableMetaInfo->name, pTableMeta, &pBlock, NULL); + pTableMeta->tableInfo.rowSize, &pTableMetaInfo->name, pTableMeta, &pBlock, NULL); if (ret != 0) { // todo handle error } @@ -790,7 +790,7 @@ static int insertStmtExecute(STscStmt* stmt) { int32_t ret = tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk), - pTableMeta->tableInfo.rowSize, pTableMetaInfo->name, pTableMeta, &pBlock, NULL); + pTableMeta->tableInfo.rowSize, &pTableMetaInfo->name, pTableMeta, &pBlock, NULL); assert(ret == 0); pBlock->size = sizeof(SSubmitBlk) + pCmd->batchSize * pBlock->rowSize; SSubmitBlk* pBlk = (SSubmitBlk*) pBlock->pData; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 98c5374212..9745597d99 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -60,7 +60,7 @@ static int32_t setShowInfo(SSqlObj* pSql, SSqlInfo* pInfo); static char* getAccountId(SSqlObj* pSql); static bool has(SArray* pFieldList, int32_t startIdx, const char* name); -static void getCurrentDBName(SSqlObj* pSql, SStrToken* pDBToken); +static char* getCurrentDBName(SSqlObj* pSql); static bool hasSpecifyDB(SStrToken* pTableName); static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd); static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pCmd); @@ -100,8 +100,8 @@ static int32_t validateSqlFunctionInStreamSql(SSqlCmd* pCmd, SQueryInfo* pQueryI static int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo); static int32_t validateArithmeticSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQueryInfo, SColumnList* pList, int32_t* type); static int32_t validateEp(char* ep); -static int32_t validateDNodeConfig(tDCLSQL* pOptions); -static int32_t validateLocalConfig(tDCLSQL* pOptions); +static int32_t validateDNodeConfig(SMiscInfo* pOptions); +static int32_t validateLocalConfig(SMiscInfo* pOptions); static int32_t validateColumnName(char* name); static int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo, int32_t killType); @@ -110,7 +110,7 @@ static bool hasTimestampForPointInterpQuery(SQueryInfo* pQueryInfo); static bool hasNormalColumnFilter(SQueryInfo* pQueryInfo); static int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t index, SQuerySQL* pQuerySql, SSqlObj* pSql); -static int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql); +static int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql); static int32_t getColumnIndexByName(SSqlCmd* pCmd, const SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex); static int32_t getTableIndexByName(SStrToken* pToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex); static int32_t optrToString(tSQLExpr* pExpr, char** exprString); @@ -239,7 +239,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { int32_t code = TSDB_CODE_SUCCESS; if (!pInfo->valid || terrno == TSDB_CODE_TSC_SQL_SYNTAX_ERROR) { terrno = TSDB_CODE_SUCCESS; // clear the error number - return tscSQLSyntaxErrMsg(tscGetErrorMsgPayload(pCmd), NULL, pInfo->pzErrMsg); + return tscSQLSyntaxErrMsg(tscGetErrorMsgPayload(pCmd), NULL, pInfo->msg); } SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(pCmd, pCmd->clauseIndex); @@ -266,28 +266,27 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg3 = "param name too long"; const char* msg4 = "table is not super table"; - SStrToken* pzName = &pInfo->pDCLInfo->a[0]; + SStrToken* pzName = taosArrayGet(pInfo->pMiscInfo->a, 0); if ((pInfo->type != TSDB_SQL_DROP_DNODE) && (tscValidateName(pzName) != TSDB_CODE_SUCCESS)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } if (pInfo->type == TSDB_SQL_DROP_DB) { - assert(pInfo->pDCLInfo->nTokens == 1); - - code = setObjFullName(pTableMetaInfo->name, getAccountId(pSql), pzName, NULL, NULL); + assert(taosArrayGetSize(pInfo->pMiscInfo->a) == 1); + code = tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), pzName); if (code != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } } else if (pInfo->type == TSDB_SQL_DROP_TABLE) { - assert(pInfo->pDCLInfo->nTokens == 1); + assert(taosArrayGetSize(pInfo->pMiscInfo->a) == 1); code = tscSetTableFullName(pTableMetaInfo, pzName, pSql); if(code != TSDB_CODE_SUCCESS) { return code; } - if (pInfo->pDCLInfo->tableType == TSDB_SUPER_TABLE) { + if (pInfo->pMiscInfo->tableType == TSDB_SUPER_TABLE) { code = tscGetTableMeta(pSql, pTableMetaInfo); if (code != TSDB_CODE_SUCCESS) { return code; @@ -300,13 +299,13 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } else if (pInfo->type == TSDB_SQL_DROP_DNODE) { pzName->n = strdequote(pzName->z); - strncpy(pTableMetaInfo->name, pzName->z, pzName->n); - } else { // drop user + strncpy(pCmd->payload, pzName->z, pzName->n); + } else { // drop user/account if (pzName->n >= TSDB_USER_LEN) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); } - strncpy(pTableMetaInfo->name, pzName->z, pzName->n); + strncpy(pCmd->payload, pzName->z, pzName->n); } break; @@ -314,13 +313,13 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { case TSDB_SQL_USE_DB: { const char* msg = "invalid db name"; - SStrToken* pToken = &pInfo->pDCLInfo->a[0]; + SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0); if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } - int32_t ret = setObjFullName(pTableMetaInfo->name, getAccountId(pSql), pToken, NULL, NULL); + int32_t ret = tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), pToken); if (ret != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } @@ -345,12 +344,12 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg1 = "invalid db name"; const char* msg2 = "name too long"; - SCreateDBInfo* pCreateDB = &(pInfo->pDCLInfo->dbOpt); + SCreateDbInfo* pCreateDB = &(pInfo->pMiscInfo->dbOpt); if (tscValidateName(&pCreateDB->dbname) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } - int32_t ret = setObjFullName(pTableMetaInfo->name, getAccountId(pSql), &(pCreateDB->dbname), NULL, NULL); + int32_t ret = tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), &(pCreateDB->dbname)); if (ret != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } @@ -362,15 +361,15 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { break; } - case TSDB_SQL_CREATE_DNODE: { // todo hostname + case TSDB_SQL_CREATE_DNODE: { const char* msg = "invalid host name (ip address)"; - if (pInfo->pDCLInfo->nTokens > 1) { + if (taosArrayGetSize(pInfo->pMiscInfo->a) > 1) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } - SStrToken* pIpAddr = &pInfo->pDCLInfo->a[0]; - pIpAddr->n = strdequote(pIpAddr->z); + SStrToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0); + id->n = strdequote(id->z); break; } @@ -380,8 +379,8 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg2 = "invalid user/account name"; const char* msg3 = "name too long"; - SStrToken* pName = &pInfo->pDCLInfo->user.user; - SStrToken* pPwd = &pInfo->pDCLInfo->user.passwd; + SStrToken* pName = &pInfo->pMiscInfo->user.user; + SStrToken* pPwd = &pInfo->pMiscInfo->user.passwd; if (handlePassword(pCmd, pPwd) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; @@ -395,7 +394,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - SCreateAcctSQL* pAcctOpt = &pInfo->pDCLInfo->acctOpt; + SCreateAcctInfo* pAcctOpt = &pInfo->pMiscInfo->acctOpt; if (pAcctOpt->stat.n > 0) { if (pAcctOpt->stat.z[0] == 'r' && pAcctOpt->stat.n == 1) { } else if (pAcctOpt->stat.z[0] == 'w' && pAcctOpt->stat.n == 1) { @@ -410,10 +409,10 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } case TSDB_SQL_DESCRIBE_TABLE: { - SStrToken* pToken = &pInfo->pDCLInfo->a[0]; const char* msg1 = "invalid table name"; const char* msg2 = "table name too long"; + SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0); if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -431,10 +430,10 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { return tscGetTableMeta(pSql, pTableMetaInfo); } case TSDB_SQL_SHOW_CREATE_TABLE: { - SStrToken* pToken = &pInfo->pDCLInfo->a[0]; const char* msg1 = "invalid table name"; const char* msg2 = "table name is too long"; + SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0); if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -452,11 +451,12 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } case TSDB_SQL_SHOW_CREATE_DATABASE: { const char* msg1 = "invalid database name"; - SStrToken* pToken = &pInfo->pDCLInfo->a[0]; + SStrToken* pToken = taosArrayGet(pInfo->pMiscInfo->a, 0); if (tscValidateName(pToken) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } + if (pToken->n > TSDB_DB_NAME_LEN) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -468,29 +468,34 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg3 = "invalid dnode ep"; /* validate the ip address */ - tDCLSQL* pDCL = pInfo->pDCLInfo; + SMiscInfo* pMiscInfo = pInfo->pMiscInfo; /* validate the parameter names and options */ - if (validateDNodeConfig(pDCL) != TSDB_CODE_SUCCESS) { + if (validateDNodeConfig(pMiscInfo) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } char* pMsg = pCmd->payload; SCfgDnodeMsg* pCfg = (SCfgDnodeMsg*)pMsg; - pDCL->a[0].n = strdequote(pDCL->a[0].z); - - strncpy(pCfg->ep, pDCL->a[0].z, pDCL->a[0].n); + + SStrToken* t0 = taosArrayGet(pMiscInfo->a, 0); + SStrToken* t1 = taosArrayGet(pMiscInfo->a, 1); + + t0->n = strdequote(t0->z); + strncpy(pCfg->ep, t0->z, t0->n); if (validateEp(pCfg->ep) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); } - strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n); + strncpy(pCfg->config, t1->z, t1->n); - if (pDCL->nTokens == 3) { - pCfg->config[pDCL->a[1].n] = ' '; // add sep - strncpy(&pCfg->config[pDCL->a[1].n + 1], pDCL->a[2].z, pDCL->a[2].n); + if (taosArrayGetSize(pMiscInfo->a) == 3) { + SStrToken* t2 = taosArrayGet(pMiscInfo->a, 2); + + pCfg->config[t1->n] = ' '; // add sep + strncpy(&pCfg->config[t1->n + 1], t2->z, t2->n); } break; @@ -505,7 +510,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { pCmd->command = pInfo->type; - SUserInfo* pUser = &pInfo->pDCLInfo->user; + SUserInfo* pUser = &pInfo->pMiscInfo->user; SStrToken* pName = &pUser->user; SStrToken* pPwd = &pUser->passwd; @@ -549,18 +554,22 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { } case TSDB_SQL_CFG_LOCAL: { - tDCLSQL* pDCL = pInfo->pDCLInfo; - const char* msg = "invalid configure options or values"; + SMiscInfo *pMiscInfo = pInfo->pMiscInfo; + const char *msg = "invalid configure options or values"; // validate the parameter names and options - if (validateLocalConfig(pDCL) != TSDB_CODE_SUCCESS) { + if (validateLocalConfig(pMiscInfo) != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } - strncpy(pCmd->payload, pDCL->a[0].z, pDCL->a[0].n); - if (pDCL->nTokens == 2) { - pCmd->payload[pDCL->a[0].n] = ' '; // add sep - strncpy(&pCmd->payload[pDCL->a[0].n + 1], pDCL->a[1].z, pDCL->a[1].n); + int32_t numOfToken = (int32_t) taosArrayGetSize(pMiscInfo->a); + SStrToken* t = taosArrayGet(pMiscInfo->a, 0); + SStrToken* t1 = taosArrayGet(pMiscInfo->a, 1); + + strncpy(pCmd->payload, t->z, t->n); + if (numOfToken == 2) { + pCmd->payload[t->n] = ' '; // add sep + strncpy(&pCmd->payload[t->n + 1], t1->z, t1->n); } break; @@ -891,47 +900,47 @@ int32_t parseSlidingClause(SSqlObj* pSql, SQueryInfo* pQueryInfo, SQuerySQL* pQu return TSDB_CODE_SUCCESS; } -int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pzTableName, SSqlObj* pSql) { +int32_t tscSetTableFullName(STableMetaInfo* pTableMetaInfo, SStrToken* pTableName, SSqlObj* pSql) { const char* msg1 = "name too long"; SSqlCmd* pCmd = &pSql->cmd; int32_t code = TSDB_CODE_SUCCESS; - // backup the old name in pTableMetaInfo - char oldName[TSDB_TABLE_FNAME_LEN] = {0}; - tstrncpy(oldName, pTableMetaInfo->name, tListLen(oldName)); + if (hasSpecifyDB(pTableName)) { // db has been specified in sql string so we ignore current db path + tNameSetAcctId(&pTableMetaInfo->name, getAccountId(pSql)); - if (hasSpecifyDB(pzTableName)) { // db has been specified in sql string so we ignore current db path - code = setObjFullName(pTableMetaInfo->name, getAccountId(pSql), NULL, pzTableName, NULL); + char name[TSDB_TABLE_FNAME_LEN] = {0}; + strncpy(name, pTableName->z, pTableName->n); + + code = tNameFromString(&pTableMetaInfo->name, name, T_NAME_DB|T_NAME_TABLE); if (code != 0) { - invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } } else { // get current DB name first, and then set it into path - SStrToken t = {0}; - getCurrentDBName(pSql, &t); - if (t.n == 0) { // current database not available or not specified - code = TSDB_CODE_TSC_DB_NOT_SELECTED; - } else { - code = setObjFullName(pTableMetaInfo->name, NULL, &t, pzTableName, NULL); - if (code != 0) { - invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); - } + char* t = getCurrentDBName(pSql); + if (strlen(t) == 0) { + return TSDB_CODE_TSC_DB_NOT_SELECTED; + } + + code = tNameFromString(&pTableMetaInfo->name, t, T_NAME_ACCT | T_NAME_DB); + if (code != 0) { + return TSDB_CODE_TSC_DB_NOT_SELECTED; + } + + if (pTableName->n >= TSDB_TABLE_NAME_LEN) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } + + char name[TSDB_TABLE_FNAME_LEN] = {0}; + strncpy(name, pTableName->z, pTableName->n); + + code = tNameFromString(&pTableMetaInfo->name, name, T_NAME_TABLE); + if (code != 0) { + code = invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } } - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - /* - * the old name exists and is not equalled to the new name. Release the table meta - * that are corresponding to the old name for the new table name. - */ - if (strlen(oldName) > 0 && strncasecmp(oldName, pTableMetaInfo->name, tListLen(pTableMetaInfo->name)) != 0) { - tscClearTableMetaInfo(pTableMetaInfo); - } - - return TSDB_CODE_SUCCESS; + return code; } static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) { @@ -1231,9 +1240,8 @@ static bool has(SArray* pFieldList, int32_t startIdx, const char* name) { static char* getAccountId(SSqlObj* pSql) { return pSql->pTscObj->acctId; } -static void getCurrentDBName(SSqlObj* pSql, SStrToken* pDBToken) { - pDBToken->z = pSql->pTscObj->db; - pDBToken->n = (uint32_t)strlen(pSql->pTscObj->db); +static char* getCurrentDBName(SSqlObj* pSql) { + return pSql->pTscObj->db; } /* length limitation, strstr cannot be applied */ @@ -2608,10 +2616,10 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { const char* msg6 = "pattern string is empty"; /* - * database prefix in pInfo->pDCLInfo->a[0] - * wildcard in like clause in pInfo->pDCLInfo->a[1] + * database prefix in pInfo->pMiscInfo->a[0] + * wildcard in like clause in pInfo->pMiscInfo->a[1] */ - SShowInfo* pShowInfo = &pInfo->pDCLInfo->showOpt; + SShowInfo* pShowInfo = &pInfo->pMiscInfo->showOpt; int16_t showType = pShowInfo->showType; if (showType == TSDB_MGMT_TABLE_TABLE || showType == TSDB_MGMT_TABLE_METRIC || showType == TSDB_MGMT_TABLE_VGROUP) { // db prefix in tagCond, show table conds in payload @@ -2630,7 +2638,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } - int32_t ret = setObjFullName(pTableMetaInfo->name, getAccountId(pSql), pDbPrefixToken, NULL, NULL); + int32_t ret = tNameSetDbName(&pTableMetaInfo->name, getAccountId(pSql), pDbPrefixToken); if (ret != TSDB_CODE_SUCCESS) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -2676,7 +2684,7 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo, int32_t killType) { SSqlCmd* pCmd = &pSql->cmd; pCmd->command = pInfo->type; - SStrToken* idStr = &(pInfo->pDCLInfo->ip); + SStrToken* idStr = &(pInfo->pMiscInfo->id); if (idStr->n > TSDB_KILL_MSG_LEN) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -2911,7 +2919,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, SArray* pList, SSqlCmd* pCmd) STableMeta* pTableMeta = NULL; SSchema* pSchema = NULL; - SSchema s = tscGetTbnameColumnSchema(); + SSchema s = tGetTbnameColumnSchema(); int32_t tableIndex = COLUMN_INDEX_INITIAL_VAL; @@ -3434,6 +3442,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr* pExpr) { const char* msg1 = "invalid join query condition"; + const char* msg2 = "invalid table name in join query"; const char* msg3 = "type of join columns must be identical"; const char* msg4 = "invalid column name in join condition"; @@ -3459,7 +3468,11 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr* pLeft->uid = pTableMetaInfo->pTableMeta->id.uid; pLeft->tagColId = pTagSchema1->colId; - strcpy(pLeft->tableId, pTableMetaInfo->name); + + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pLeft->tableName); + if (code != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } index = (SColumnIndex)COLUMN_INDEX_INITIALIZER; if (getColumnIndexByName(pCmd, &pExpr->pRight->colInfo, pQueryInfo, &index) != TSDB_CODE_SUCCESS) { @@ -3471,7 +3484,11 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr* pRight->uid = pTableMetaInfo->pTableMeta->id.uid; pRight->tagColId = pTagSchema2->colId; - strcpy(pRight->tableId, pTableMetaInfo->name); + + code = tNameExtractFullName(&pTableMetaInfo->name, pRight->tableName); + if (code != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); + } if (pTagSchema1->type != pTagSchema2->type) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); @@ -4048,8 +4065,6 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStringBuilder sb1; memset(&sb1, 0, sizeof(sb1)); taosStringBuilderAppendStringLen(&sb1, QUERY_COND_REL_PREFIX_IN, QUERY_COND_REL_PREFIX_IN_LEN); - char db[TSDB_TABLE_FNAME_LEN] = {0}; - // remove the duplicated input table names int32_t num = 0; char* tableNameString = taosStringBuilderGetResult(sb, NULL); @@ -4065,7 +4080,8 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, } num = j; - char* name = extractDBName(pTableMetaInfo->name, db); + char name[TSDB_DB_NAME_LEN] = {0}; + tNameGetDbName(&pTableMetaInfo->name, name); SStrToken dbToken = { .type = TK_STRING, .z = name, .n = (uint32_t)strlen(name) }; for (int32_t i = 0; i < num; ++i) { @@ -4812,7 +4828,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { int32_t code = TSDB_CODE_SUCCESS; SSqlCmd* pCmd = &pSql->cmd; - SAlterTableSQL* pAlterSQL = pInfo->pAlterInfo; + SAlterTableInfo* pAlterSQL = pInfo->pAlterInfo; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, DEFAULT_TABLE_INDEX); @@ -5151,8 +5167,10 @@ int32_t validateEp(char* ep) { return TSDB_CODE_SUCCESS; } -int32_t validateDNodeConfig(tDCLSQL* pOptions) { - if (pOptions->nTokens < 2 || pOptions->nTokens > 3) { +int32_t validateDNodeConfig(SMiscInfo* pOptions) { + int32_t numOfToken = (int32_t) taosArrayGetSize(pOptions->a); + + if (numOfToken < 2 || numOfToken > 3) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -5170,9 +5188,9 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { {"cqDebugFlag", 11}, }; - SStrToken* pOptionToken = &pOptions->a[1]; + SStrToken* pOptionToken = taosArrayGet(pOptions->a, 1); - if (pOptions->nTokens == 2) { + if (numOfToken == 2) { // reset log and reset query cache does not need value for (int32_t i = 0; i < tokenLogEnd; ++i) { const SDNodeDynConfOption* pOption = &cfgOptions[i]; @@ -5182,7 +5200,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { } } else if ((strncasecmp(cfgOptions[tokenBalance].name, pOptionToken->z, pOptionToken->n) == 0) && (cfgOptions[tokenBalance].len == pOptionToken->n)) { - SStrToken* pValToken = &pOptions->a[2]; + SStrToken* pValToken = taosArrayGet(pOptions->a, 2); int32_t vnodeId = 0; int32_t dnodeId = 0; strdequote(pValToken->z); @@ -5193,14 +5211,14 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { return TSDB_CODE_SUCCESS; } else if ((strncasecmp(cfgOptions[tokenMonitor].name, pOptionToken->z, pOptionToken->n) == 0) && (cfgOptions[tokenMonitor].len == pOptionToken->n)) { - SStrToken* pValToken = &pOptions->a[2]; + SStrToken* pValToken = taosArrayGet(pOptions->a, 2); int32_t val = strtol(pValToken->z, NULL, 10); if (val != 0 && val != 1) { return TSDB_CODE_TSC_INVALID_SQL; // options value is invalid } return TSDB_CODE_SUCCESS; } else { - SStrToken* pValToken = &pOptions->a[2]; + SStrToken* pValToken = taosArrayGet(pOptions->a, 2); int32_t val = strtol(pValToken->z, NULL, 10); if (val < 0 || val > 256) { @@ -5211,8 +5229,8 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { for (int32_t i = tokenDebugFlag; i < tokenDebugFlagEnd; ++i) { const SDNodeDynConfOption* pOption = &cfgOptions[i]; + // options is valid if ((strncasecmp(pOption->name, pOptionToken->z, pOptionToken->n) == 0) && (pOption->len == pOptionToken->n)) { - /* options is valid */ return TSDB_CODE_SUCCESS; } } @@ -5221,17 +5239,18 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) { return TSDB_CODE_TSC_INVALID_SQL; } -int32_t validateLocalConfig(tDCLSQL* pOptions) { - if (pOptions->nTokens < 1 || pOptions->nTokens > 2) { +int32_t validateLocalConfig(SMiscInfo* pOptions) { + int32_t numOfToken = (int32_t) taosArrayGetSize(pOptions->a); + if (numOfToken < 1 || numOfToken > 2) { return TSDB_CODE_TSC_INVALID_SQL; } SDNodeDynConfOption LOCAL_DYNAMIC_CFG_OPTIONS[6] = {{"resetLog", 8}, {"rpcDebugFlag", 12}, {"tmrDebugFlag", 12}, {"cDebugFlag", 10}, {"uDebugFlag", 10}, {"debugFlag", 9}}; - SStrToken* pOptionToken = &pOptions->a[0]; + SStrToken* pOptionToken = taosArrayGet(pOptions->a, 0); - if (pOptions->nTokens == 1) { + if (numOfToken == 1) { // reset log does not need value for (int32_t i = 0; i < 1; ++i) { SDNodeDynConfOption* pOption = &LOCAL_DYNAMIC_CFG_OPTIONS[i]; @@ -5240,7 +5259,7 @@ int32_t validateLocalConfig(tDCLSQL* pOptions) { } } } else { - SStrToken* pValToken = &pOptions->a[1]; + SStrToken* pValToken = taosArrayGet(pOptions->a, 1); int32_t val = strtol(pValToken->z, NULL, 10); if (val < 131 || val > 199) { @@ -5392,7 +5411,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn return TSDB_CODE_SUCCESS; } -static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { +static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* pCreateDb) { const char* msg = "invalid number of options"; pMsg->daysToKeep = htonl(-1); @@ -5430,7 +5449,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* p return TSDB_CODE_SUCCESS; } -static int32_t setTimePrecision(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDbInfo) { +static int32_t setTimePrecision(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* pCreateDbInfo) { const char* msg = "invalid time precision"; pMsg->precision = TSDB_TIME_PRECISION_MILLI; // millisecond by default @@ -5454,7 +5473,7 @@ static int32_t setTimePrecision(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo return TSDB_CODE_SUCCESS; } -static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { +static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDbInfo* pCreateDb) { pMsg->maxTables = htonl(-1); // max tables can not be set anymore pMsg->cacheBlockSize = htonl(pCreateDb->cacheBlockSize); pMsg->totalBlocks = htonl(pCreateDb->numOfBlocks); @@ -5472,7 +5491,7 @@ static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { pMsg->cacheLastRow = pCreateDb->cachelast; } -int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) { +int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql) { SCreateDbMsg* pMsg = (SCreateDbMsg *)(pCmd->payload); setCreateDBOption(pMsg, pCreateDbSql); @@ -6233,9 +6252,9 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { } // get table meta from mnode - tstrncpy(pCreateTableInfo->tagdata.name, pStableMetaInfo->name, tListLen(pCreateTableInfo->tagdata.name)); - SArray* pList = pCreateTableInfo->pTagVals; + code = tNameExtractFullName(&pStableMetaInfo->name, pCreateTableInfo->tagdata.name); + SArray* pList = pCreateTableInfo->pTagVals; code = tscGetTableMeta(pSql, pStableMetaInfo); if (code != TSDB_CODE_SUCCESS) { return code; @@ -6313,7 +6332,11 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { return ret; } - pCreateTableInfo->fullname = strndup(pTableMetaInfo->name, TSDB_TABLE_FNAME_LEN); + pCreateTableInfo->fullname = calloc(1, tNameLen(&pTableMetaInfo->name) + 1); + ret = tNameExtractFullName(&pTableMetaInfo->name, pCreateTableInfo->fullname); + if (ret != TSDB_CODE_SUCCESS) { + return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); + } } return TSDB_CODE_SUCCESS; @@ -6560,7 +6583,7 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { // has no table alias name if (memcmp(pTableItem->pz, p1->pVar.pz, p1->pVar.nLen) == 0) { - extractTableName(pTableMetaInfo1->name, pTableMetaInfo1->aliasName); + strncpy(pTableMetaInfo1->aliasName, tNameGetTableName(&pTableMetaInfo1->name), tListLen(pTableMetaInfo->aliasName)); } else { tstrncpy(pTableMetaInfo1->aliasName, p1->pVar.pz, sizeof(pTableMetaInfo1->aliasName)); } diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index 47c3cd9716..67352ca71c 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -106,6 +106,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) { pTableMeta->sversion = pTableMetaMsg->sversion; pTableMeta->tversion = pTableMetaMsg->tversion; + tstrncpy(pTableMeta->sTableName, pTableMetaMsg->sTableName, TSDB_TABLE_FNAME_LEN); memcpy(pTableMeta->schema, pTableMetaMsg->schema, schemaSize); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 953680c43e..4b8fa45619 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -309,7 +309,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) { return; } - if (pEpSet) { // todo update this + if (pEpSet) { if (!tscEpSetIsEqual(&pSql->epSet, pEpSet)) { if (pCmd->command < TSDB_SQL_MGMT) { tscUpdateVgroupInfo(pSql, pEpSet); @@ -461,16 +461,20 @@ int doProcessSql(SSqlObj *pSql) { } int tscProcessSql(SSqlObj *pSql) { - char *name = NULL; + char name[TSDB_TABLE_FNAME_LEN] = {0}; + SSqlCmd *pCmd = &pSql->cmd; - + uint32_t type = 0; + SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); STableMetaInfo *pTableMetaInfo = NULL; - uint32_t type = 0; if (pQueryInfo != NULL) { pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - name = (pTableMetaInfo != NULL)? pTableMetaInfo->name:NULL; + if (pTableMetaInfo != NULL) { + tNameExtractFullName(&pTableMetaInfo->name, name); + } + type = pQueryInfo->type; // while numOfTables equals to 0, it must be Heartbeat @@ -669,10 +673,11 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char pMsg += sizeof(STableIdInfo); } } - - tscDebug("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), pTableMetaInfo->name, - pTableMeta->id.tid, pTableMeta->id.uid); - + + char n[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, n); + + tscDebug("%p vgId:%d, query on table:%s, tid:%d, uid:%" PRIu64, pSql, htonl(pQueryMsg->head.vgId), n, pTableMeta->id.tid, pTableMeta->id.uid); return pMsg; } @@ -755,8 +760,11 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSchema *pColSchema = &pSchema[pCol->colIndex.columnIndex]; if (pCol->colIndex.columnIndex >= tscGetNumOfColumns(pTableMeta) || !isValidDataType(pColSchema->type)) { + char n[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, n); + tscError("%p tid:%d uid:%" PRIu64" id:%s, column index out of range, numOfColumns:%d, index:%d, column name:%s", - pSql, pTableMeta->id.tid, pTableMeta->id.uid, pTableMetaInfo->name, tscGetNumOfColumns(pTableMeta), pCol->colIndex.columnIndex, + pSql, pTableMeta->id.tid, pTableMeta->id.uid, n, tscGetNumOfColumns(pTableMeta), pCol->colIndex.columnIndex, pColSchema->name); return TSDB_CODE_TSC_INVALID_SQL; } @@ -942,9 +950,11 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { if ((pCol->colIndex.columnIndex >= numOfTagColumns || pCol->colIndex.columnIndex < -1) || (!isValidDataType(pColSchema->type))) { + char n[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, n); + tscError("%p tid:%d uid:%" PRIu64 " id:%s, tag index out of range, totalCols:%d, numOfTags:%d, index:%d, column name:%s", - pSql, pTableMeta->id.tid, pTableMeta->id.uid, pTableMetaInfo->name, total, numOfTagColumns, - pCol->colIndex.columnIndex, pColSchema->name); + pSql, pTableMeta->id.tid, pTableMeta->id.uid, n, total, numOfTagColumns, pCol->colIndex.columnIndex, pColSchema->name); return TSDB_CODE_TSC_INVALID_SQL; } @@ -1021,7 +1031,8 @@ int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { assert(pCmd->numOfClause == 1); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pCreateDbMsg->db, pTableMetaInfo->name, sizeof(pCreateDbMsg->db)); + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pCreateDbMsg->db); + assert(code == TSDB_CODE_SUCCESS); return TSDB_CODE_SUCCESS; } @@ -1035,7 +1046,9 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } SCreateDnodeMsg *pCreate = (SCreateDnodeMsg *)pCmd->payload; - strncpy(pCreate->ep, pInfo->pDCLInfo->a[0].z, pInfo->pDCLInfo->a[0].n); + + SStrToken* t0 = taosArrayGet(pInfo->pMiscInfo->a, 0); + strncpy(pCreate->ep, t0->z, t0->n); pCmd->msgType = TSDB_MSG_TYPE_CM_CREATE_DNODE; @@ -1052,13 +1065,13 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCreateAcctMsg *pAlterMsg = (SCreateAcctMsg *)pCmd->payload; - SStrToken *pName = &pInfo->pDCLInfo->user.user; - SStrToken *pPwd = &pInfo->pDCLInfo->user.passwd; + SStrToken *pName = &pInfo->pMiscInfo->user.user; + SStrToken *pPwd = &pInfo->pMiscInfo->user.passwd; strncpy(pAlterMsg->user, pName->z, pName->n); strncpy(pAlterMsg->pass, pPwd->z, pPwd->n); - SCreateAcctSQL *pAcctOpt = &pInfo->pDCLInfo->acctOpt; + SCreateAcctInfo *pAcctOpt = &pInfo->pMiscInfo->acctOpt; pAlterMsg->cfg.maxUsers = htonl(pAcctOpt->maxUsers); pAlterMsg->cfg.maxDbs = htonl(pAcctOpt->maxDbs); @@ -1098,7 +1111,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCreateUserMsg *pAlterMsg = (SCreateUserMsg *)pCmd->payload; - SUserInfo *pUser = &pInfo->pDCLInfo->user; + SUserInfo *pUser = &pInfo->pMiscInfo->user; strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n); pAlterMsg->flag = (int8_t)pUser->type; @@ -1138,8 +1151,11 @@ int32_t tscBuildDropDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SDropDbMsg *pDropDbMsg = (SDropDbMsg*)pCmd->payload; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pDropDbMsg->db, pTableMetaInfo->name, sizeof(pDropDbMsg->db)); - pDropDbMsg->ignoreNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0; + + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pDropDbMsg->db); + assert(code == TSDB_CODE_SUCCESS && pTableMetaInfo->name.type == TSDB_DB_NAME_T); + + pDropDbMsg->ignoreNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0; pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_DB; return TSDB_CODE_SUCCESS; @@ -1156,15 +1172,19 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCMDropTableMsg *pDropTableMsg = (SCMDropTableMsg*)pCmd->payload; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - strcpy(pDropTableMsg->tableFname, pTableMetaInfo->name); - pDropTableMsg->igNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0; + tNameExtractFullName(&pTableMetaInfo->name, pDropTableMsg->name); + pDropTableMsg->igNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0; pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_TABLE; return TSDB_CODE_SUCCESS; } int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; + + char dnodeEp[TSDB_EP_LEN] = {0}; + tstrncpy(dnodeEp, pCmd->payload, TSDB_EP_LEN); + pCmd->payloadLen = sizeof(SDropDnodeMsg); if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { tscError("%p failed to malloc for query msg", pSql); @@ -1172,43 +1192,28 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } SDropDnodeMsg * pDrop = (SDropDnodeMsg *)pCmd->payload; - STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pDrop->ep, pTableMetaInfo->name, sizeof(pDrop->ep)); + tstrncpy(pDrop->ep, dnodeEp, tListLen(pDrop->ep)); pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_DNODE; return TSDB_CODE_SUCCESS; } -int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo * UNUSED_PARAM(pInfo)) { +int32_t tscBuildDropUserAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; + + char user[TSDB_USER_LEN] = {0}; + tstrncpy(user, pCmd->payload, TSDB_USER_LEN); + pCmd->payloadLen = sizeof(SDropUserMsg); - pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_USER; + pCmd->msgType = (pInfo->type == TSDB_SQL_DROP_USER)? TSDB_MSG_TYPE_CM_DROP_USER:TSDB_MSG_TYPE_CM_DROP_ACCT; if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { tscError("%p failed to malloc for query msg", pSql); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - SDropUserMsg * pDropMsg = (SDropUserMsg *)pCmd->payload; - STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pDropMsg->user, pTableMetaInfo->name, sizeof(pDropMsg->user)); - - return TSDB_CODE_SUCCESS; -} - -int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) { - SSqlCmd *pCmd = &pSql->cmd; - pCmd->payloadLen = sizeof(SDropUserMsg); - pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_ACCT; - - if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) { - tscError("%p failed to malloc for query msg", pSql); - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - - SDropUserMsg * pDropMsg = (SDropUserMsg *)pCmd->payload; - STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pDropMsg->user, pTableMetaInfo->name, sizeof(pDropMsg->user)); + SDropUserMsg *pDropMsg = (SDropUserMsg *)pCmd->payload; + tstrncpy(pDropMsg->user, user, tListLen(user)); return TSDB_CODE_SUCCESS; } @@ -1224,7 +1229,7 @@ int32_t tscBuildUseDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SUseDbMsg *pUseDbMsg = (SUseDbMsg *)pCmd->payload; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - strcpy(pUseDbMsg->db, pTableMetaInfo->name); + tNameExtractFullName(&pTableMetaInfo->name, pUseDbMsg->db); pCmd->msgType = TSDB_MSG_TYPE_CM_USE_DB; return TSDB_CODE_SUCCESS; @@ -1244,14 +1249,14 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SShowMsg *pShowMsg = (SShowMsg *)pCmd->payload; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - size_t nameLen = strlen(pTableMetaInfo->name); - if (nameLen > 0) { - tstrncpy(pShowMsg->db, pTableMetaInfo->name, sizeof(pShowMsg->db)); // prefix is set here - } else { + + if (tNameIsEmpty(&pTableMetaInfo->name)) { tstrncpy(pShowMsg->db, pObj->db, sizeof(pShowMsg->db)); + } else { + tNameGetFullDbName(&pTableMetaInfo->name, pShowMsg->db); } - SShowInfo *pShowInfo = &pInfo->pDCLInfo->showOpt; + SShowInfo *pShowInfo = &pInfo->pMiscInfo->showOpt; pShowMsg->type = pShowInfo->showType; if (pShowInfo->showType != TSDB_MGMT_TABLE_VNODES) { @@ -1310,12 +1315,12 @@ int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) { } int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { - int msgLen = 0; - SSchema * pSchema; - int size = 0; + int msgLen = 0; + int size = 0; + SSchema *pSchema; SSqlCmd *pCmd = &pSql->cmd; - SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); + SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); // Reallocate the payload size @@ -1346,11 +1351,10 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { pMsg += sizeof(SCreateTableMsg); SCreatedTableInfo* p = taosArrayGet(list, i); - strcpy(pCreate->tableFname, p->fullname); + strcpy(pCreate->tableName, p->fullname); pCreate->igExists = (p->igExist)? 1 : 0; // use dbinfo from table id without modifying current db info - tscGetDBInfoFromTableFullName(p->fullname, pCreate->db); pMsg = serializeTagData(&p->tagdata, pMsg); int32_t len = (int32_t)(pMsg - (char*) pCreate); @@ -1359,10 +1363,8 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } else { // create (super) table pCreateTableMsg->numOfTables = htonl(1); // only one table will be created - strcpy(pCreateMsg->tableFname, pTableMetaInfo->name); - - // use dbinfo from table id without modifying current db info - tscGetDBInfoFromTableFullName(pTableMetaInfo->name, pCreateMsg->db); + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pCreateMsg->tableName); + assert(code == 0); SCreateTableSQL *pCreateTable = pInfo->pCreateTableInfo; @@ -1420,7 +1422,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - SAlterTableSQL *pAlterInfo = pInfo->pAlterInfo; + SAlterTableInfo *pAlterInfo = pInfo->pAlterInfo; int size = tscEstimateAlterTableMsgLength(pCmd); if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, size)) { tscError("%p failed to malloc for alter table msg", pSql); @@ -1428,9 +1430,8 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } SAlterTableMsg *pAlterTableMsg = (SAlterTableMsg *)pCmd->payload; - tscGetDBInfoFromTableFullName(pTableMetaInfo->name, pAlterTableMsg->db); - strcpy(pAlterTableMsg->tableFname, pTableMetaInfo->name); + tNameExtractFullName(&pTableMetaInfo->name, pAlterTableMsg->tableFname); pAlterTableMsg->type = htons(pAlterInfo->type); pAlterTableMsg->numOfCols = htons(tscNumOfFields(pQueryInfo)); @@ -1485,7 +1486,7 @@ int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SAlterDbMsg *pAlterDbMsg = (SAlterDbMsg* )pCmd->payload; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - tstrncpy(pAlterDbMsg->db, pTableMetaInfo->name, sizeof(pAlterDbMsg->db)); + tNameExtractFullName(&pTableMetaInfo->name, pAlterDbMsg->db); return TSDB_CODE_SUCCESS; } @@ -1623,13 +1624,17 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) { } int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { - SSqlCmd * pCmd = &pSql->cmd; + SSqlCmd *pCmd = &pSql->cmd; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + STableInfoMsg *pInfoMsg = (STableInfoMsg *)pCmd->payload; + + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pInfoMsg->tableFname); + if (code != TSDB_CODE_SUCCESS) { + return TSDB_CODE_TSC_INVALID_SQL; + } - STableInfoMsg *pInfoMsg = (STableInfoMsg *)pCmd->payload; - strcpy(pInfoMsg->tableFname, pTableMetaInfo->name); pInfoMsg->createFlag = htons(pSql->cmd.autoCreated ? 1 : 0); char *pMsg = (char *)pInfoMsg + sizeof(STableInfoMsg); @@ -1686,33 +1691,6 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) { return 0; } -//static UNUSED_FUNC int32_t tscEstimateMetricMetaMsgSize(SSqlCmd *pCmd) { -//// const int32_t defaultSize = -//// minMsgSize() + sizeof(SSuperTableMetaMsg) + sizeof(SMgmtHead) + sizeof(int16_t) * TSDB_MAX_TAGS; -//// SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); -//// -//// int32_t n = 0; -//// size_t size = taosArrayGetSize(pQueryInfo->tagCond.pCond); -//// for (int32_t i = 0; i < size; ++i) { -//// assert(0); -////// n += strlen(pQueryInfo->tagCond.cond[i].cond); -//// } -//// -//// int32_t tagLen = n * TSDB_NCHAR_SIZE; -//// if (pQueryInfo->tagCond.tbnameCond.cond != NULL) { -//// tagLen += strlen(pQueryInfo->tagCond.tbnameCond.cond) * TSDB_NCHAR_SIZE; -//// } -//// -//// int32_t joinCondLen = (TSDB_TABLE_FNAME_LEN + sizeof(int16_t)) * 2; -//// int32_t elemSize = sizeof(SSuperTableMetaElemMsg) * pQueryInfo->numOfTables; -//// -//// int32_t colSize = pQueryInfo->groupbyExpr.numOfGroupCols*sizeof(SColIndex); -//// -//// int32_t len = tagLen + joinCondLen + elemSize + colSize + defaultSize; -//// -//// return MAX(len, TSDB_DEFAULT_PAYLOAD_SIZE); -//} - int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; @@ -1725,9 +1703,10 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) { for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, i); - size_t size = sizeof(pTableMetaInfo->name); - tstrncpy(pMsg, pTableMetaInfo->name, size); - pMsg += size; + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, pMsg); + assert(code == TSDB_CODE_SUCCESS); + + pMsg += TSDB_TABLE_FNAME_LEN; } pCmd->msgType = TSDB_MSG_TYPE_CM_STABLE_VGROUP; @@ -1827,7 +1806,6 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { assert(i == 0); } - assert(isValidDataType(pSchema->type)); pSchema++; } @@ -1835,8 +1813,8 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { assert(pTableMetaInfo->pTableMeta == NULL); STableMeta* pTableMeta = tscCreateTableMetaFromMsg(pMetaMsg); - if (!isValidSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.numOfTags)) { - tscError("%p invalid table meta from mnode, name:%s", pSql, pTableMetaInfo->name); + if (!tIsValidSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.numOfTags)) { + tscError("%p invalid table meta from mnode, name:%s", pSql, tNameGetTableName(&pTableMetaInfo->name)); return TSDB_CODE_TSC_INVALID_VALUE; } @@ -1854,11 +1832,19 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { tfree(pSupTableMeta); CChildTableMeta* cMeta = tscCreateChildMeta(pTableMeta); - taosHashPut(tscTableMetaInfo, pTableMetaInfo->name, strlen(pTableMetaInfo->name), cMeta, sizeof(CChildTableMeta)); + + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, name); + + taosHashPut(tscTableMetaInfo, name, strlen(name), cMeta, sizeof(CChildTableMeta)); tfree(cMeta); } else { uint32_t s = tscGetTableMetaSize(pTableMeta); - taosHashPut(tscTableMetaInfo, pTableMetaInfo->name, strlen(pTableMetaInfo->name), pTableMeta, s); + + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, name); + + taosHashPut(tscTableMetaInfo, name, strlen(name), pTableMeta, s); } // update the vgroupInfo if needed @@ -1877,9 +1863,10 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { } } - tscDebug("%p recv table meta, uid:%"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->id.uid, pTableMeta->id.tid, pTableMetaInfo->name); + tscDebug("%p recv table meta, uid:%" PRIu64 ", tid:%d, name:%s", pSql, pTableMeta->id.uid, pTableMeta->id.tid, + tNameGetTableName(&pTableMetaInfo->name)); + free(pTableMeta); - return TSDB_CODE_SUCCESS; } @@ -2174,9 +2161,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) { int tscProcessUseDbRsp(SSqlObj *pSql) { STscObj * pObj = pSql->pTscObj; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); - - tstrncpy(pObj->db, pTableMetaInfo->name, sizeof(pObj->db)); - return 0; + return tNameExtractFullName(&pTableMetaInfo->name, pObj->db); } int tscProcessDropDbRsp(SSqlObj *pSql) { @@ -2189,9 +2174,11 @@ int tscProcessDropTableRsp(SSqlObj *pSql) { STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); //The cached tableMeta is expired in this case, so clean it in hash table - taosHashRemove(tscTableMetaInfo, pTableMetaInfo->name, strnlen(pTableMetaInfo->name, TSDB_TABLE_FNAME_LEN)); - tscDebug("%p remove table meta after drop table:%s, numOfRemain:%d", pSql, pTableMetaInfo->name, - (int32_t) taosHashGetSize(tscTableMetaInfo)); + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, name); + + taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); + tscDebug("%p remove table meta after drop table:%s, numOfRemain:%d", pSql, name, (int32_t) taosHashGetSize(tscTableMetaInfo)); pTableMetaInfo->pTableMeta = NULL; return 0; @@ -2200,7 +2187,9 @@ int tscProcessDropTableRsp(SSqlObj *pSql) { int tscProcessAlterTableMsgRsp(SSqlObj *pSql) { STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); - char* name = pTableMetaInfo->name; + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, name); + tscDebug("%p remove tableMeta in hashMap after alter-table: %s", pSql, name); bool isSuperTable = UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo); @@ -2319,7 +2308,7 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn STableMetaInfo *pNewMeterMetaInfo = tscAddEmptyMetaInfo(pNewQueryInfo); assert(pNew->cmd.numOfClause == 1 && pNewQueryInfo->numOfTables == 1); - tstrncpy(pNewMeterMetaInfo->name, pTableMetaInfo->name, sizeof(pNewMeterMetaInfo->name)); + tNameAssign(&pNewMeterMetaInfo->name, &pTableMetaInfo->name); if (pSql->cmd.autoCreated) { int32_t code = copyTagData(&pNew->cmd.tagData, &pSql->cmd.tagData); @@ -2350,7 +2339,8 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn } int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) { - assert(strlen(pTableMetaInfo->name) != 0); + assert(tIsValidName(&pTableMetaInfo->name)); + tfree(pTableMetaInfo->pTableMeta); uint32_t size = tscGetTableMetaMaxSize(); @@ -2358,15 +2348,18 @@ int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) { pTableMetaInfo->pTableMeta->tableType = -1; pTableMetaInfo->pTableMeta->tableInfo.numOfColumns = -1; - int32_t len = (int32_t) strlen(pTableMetaInfo->name); - taosHashGetClone(tscTableMetaInfo, pTableMetaInfo->name, len, NULL, pTableMetaInfo->pTableMeta, -1); + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, name); + + size_t len = strlen(name); + taosHashGetClone(tscTableMetaInfo, name, len, NULL, pTableMetaInfo->pTableMeta, -1); // TODO resize the tableMeta STableMeta* pMeta = pTableMetaInfo->pTableMeta; if (pMeta->id.uid > 0) { if (pMeta->tableType == TSDB_CHILD_TABLE) { - int32_t code = tscCreateTableMetaFromCChildMeta(pTableMetaInfo->pTableMeta, pTableMetaInfo->name); + int32_t code = tscCreateTableMetaFromCChildMeta(pTableMetaInfo->pTableMeta, name); if (code != TSDB_CODE_SUCCESS) { return getTableMetaFromMnode(pSql, pTableMetaInfo); } @@ -2394,16 +2387,24 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, tableIndex); - const char* name = pTableMetaInfo->name; + + char name[TSDB_TABLE_FNAME_LEN] = {0}; + int32_t code = tNameExtractFullName(&pTableMetaInfo->name, name); + if (code != TSDB_CODE_SUCCESS) { + tscError("%p failed to generate the table full name", pSql); + return TSDB_CODE_TSC_INVALID_SQL; + } STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; if (pTableMeta) { tscDebug("%p update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%" PRId64, pSql, name, - tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid); + tscGetNumOfTags(pTableMeta), tscGetNumOfColumns(pTableMeta), pTableMeta->id.uid); } // remove stored tableMeta info in hash table - taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); + size_t len = strlen(name); + taosHashRemove(tscTableMetaInfo, name, len); + return getTableMetaFromMnode(pSql, pTableMetaInfo); } @@ -2444,8 +2445,8 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, clauseIndex); for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { STableMetaInfo *pMInfo = tscGetMetaInfo(pQueryInfo, i); - STableMeta* pTableMeta = tscTableMetaClone(pMInfo->pTableMeta); - tscAddTableMetaInfo(pNewQueryInfo, pMInfo->name, pTableMeta, NULL, pMInfo->tagColList, pMInfo->pVgroupTables); + STableMeta* pTableMeta = tscTableMetaDup(pMInfo->pTableMeta); + tscAddTableMetaInfo(pNewQueryInfo, &pMInfo->name, pTableMeta, NULL, pMInfo->tagColList, pMInfo->pVgroupTables); } if ((code = tscAllocPayload(&pNew->cmd, TSDB_DEFAULT_PAYLOAD_SIZE)) != TSDB_CODE_SUCCESS) { @@ -2485,8 +2486,8 @@ void tscInitMsgsFp() { tscBuildMsg[TSDB_SQL_ALTER_ACCT] = tscBuildAcctMsg; tscBuildMsg[TSDB_SQL_CREATE_TABLE] = tscBuildCreateTableMsg; - tscBuildMsg[TSDB_SQL_DROP_USER] = tscBuildDropUserMsg; - tscBuildMsg[TSDB_SQL_DROP_ACCT] = tscBuildDropAcctMsg; + tscBuildMsg[TSDB_SQL_DROP_USER] = tscBuildDropUserAcctMsg; + tscBuildMsg[TSDB_SQL_DROP_ACCT] = tscBuildDropUserAcctMsg; tscBuildMsg[TSDB_SQL_DROP_DB] = tscBuildDropDbMsg; tscBuildMsg[TSDB_SQL_DROP_TABLE] = tscBuildDropTableMsg; tscBuildMsg[TSDB_SQL_ALTER_USER] = tscBuildUserMsg; diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index a4f2976cad..106f62fb74 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -995,7 +995,8 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t return code; } - if (payloadLen + strlen(pTableMetaInfo->name) + 128 >= pCmd->allocSize) { + int32_t xlen = tNameLen(&pTableMetaInfo->name); + if (payloadLen + xlen + 128 >= pCmd->allocSize) { char *pNewMem = realloc(pCmd->payload, pCmd->allocSize + tblListLen); if (pNewMem == NULL) { code = TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -1008,7 +1009,9 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t pMsg = pCmd->payload; } - payloadLen += sprintf(pMsg + payloadLen, "%s,", pTableMetaInfo->name); + char n[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(&pTableMetaInfo->name, n); + payloadLen += sprintf(pMsg + payloadLen, "%s,", n); } *(pMsg + payloadLen) = '\0'; diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index a39fbc9420..f14538fba9 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -104,7 +104,7 @@ static void doLaunchQuery(void* param, TAOS_RES* tres, int32_t code) { // failed to get table Meta or vgroup list, retry in 10sec. if (code == TSDB_CODE_SUCCESS) { tscTansformSQLFuncForSTableQuery(pQueryInfo); - tscDebug("%p stream:%p, start stream query on:%s", pSql, pStream, pTableMetaInfo->name); + tscDebug("%p stream:%p, start stream query on:%s", pSql, pStream, tNameGetTableName(&pTableMetaInfo->name)); pSql->fp = tscProcessStreamQueryCallback; pSql->fetchFp = tscProcessStreamQueryCallback; @@ -191,8 +191,9 @@ static void tscProcessStreamQueryCallback(void *param, TAOS_RES *tres, int numOf STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pStream->pSql->cmd, 0, 0); - char* name = pTableMetaInfo->name; - taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); + assert(0); +// char* name = pTableMetaInfo->name; +// taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); tscSetRetryTimer(pStream, pStream->pSql, retryDelay); @@ -291,8 +292,8 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf pStream->stime += 1; } - tscDebug("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, pTableMetaInfo->name, - pStream->numOfRes); +// tscDebug("%p stream:%p, query on:%s, fetch result completed, fetched rows:%" PRId64, pSql, pStream, pTableMetaInfo->name, +// pStream->numOfRes); tfree(pTableMetaInfo->pTableMeta); @@ -555,8 +556,8 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) { taosTmrReset(tscProcessStreamTimer, (int32_t)starttime, pStream, tscTmr, &pStream->pTimer); - tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql, - pStream, pTableMetaInfo->name, pStream->interval.interval, pStream->interval.sliding, starttime, pSql->sqlstr); +// tscDebug("%p stream:%p is opened, query on:%s, interval:%" PRId64 ", sliding:%" PRId64 ", first launched in:%" PRId64 ", sql:%s", pSql, +// pStream, pTableMetaInfo->name, pStream->interval.interval, pStream->interval.sliding, starttime, pSql->sqlstr); } void tscSetStreamDestTable(SSqlStream* pStream, const char* dstTable) { diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index ee9526e297..4d928bc31a 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -534,7 +534,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { size_t numOfCols = taosArrayGetSize(pQueryInfo->colList); tscDebug("%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, name:%s", pSql, pNew, 0, pTableMetaInfo->vgroupIndex, pQueryInfo->type, taosArrayGetSize(pQueryInfo->exprList), - numOfCols, pQueryInfo->fieldsInfo.numOfOutput, pTableMetaInfo->name); + numOfCols, pQueryInfo->fieldsInfo.numOfOutput, tNameGetTableName(&pTableMetaInfo->name)); } //prepare the subqueries object failed, abort @@ -730,7 +730,7 @@ static void issueTSCompQuery(SSqlObj* pSql, SJoinSupporter* pSupporter, SSqlObj* "%p subquery:%p tableIndex:%d, vgroupIndex:%d, numOfVgroups:%d, type:%d, ts_comp query to retrieve timestamps, " "numOfExpr:%" PRIzu ", colList:%" PRIzu ", numOfOutputFields:%d, name:%s", pParent, pSql, 0, pTableMetaInfo->vgroupIndex, pTableMetaInfo->vgroupList->numOfVgroups, pQueryInfo->type, - tscSqlExprNumOfExprs(pQueryInfo), numOfCols, pQueryInfo->fieldsInfo.numOfOutput, pTableMetaInfo->name); + tscSqlExprNumOfExprs(pQueryInfo), numOfCols, pQueryInfo->fieldsInfo.numOfOutput, tNameGetTableName(&pTableMetaInfo->name)); tscProcessSql(pSql); } @@ -951,10 +951,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo2, s2); SSqlObj* psub1 = pParentSql->pSubs[0]; - ((SJoinSupporter*)psub1->param)->pVgroupTables = tscVgroupTableInfoClone(pTableMetaInfo1->pVgroupTables); + ((SJoinSupporter*)psub1->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo1->pVgroupTables); SSqlObj* psub2 = pParentSql->pSubs[1]; - ((SJoinSupporter*)psub2->param)->pVgroupTables = tscVgroupTableInfoClone(pTableMetaInfo2->pVgroupTables); + ((SJoinSupporter*)psub2->param)->pVgroupTables = tscVgroupTableInfoDup(pTableMetaInfo2->pVgroupTables); pParentSql->subState.numOfSub = 2; @@ -1636,7 +1636,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter "%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, transfer to tid_tag query to retrieve (tableId, tags), " "exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, tagIndex:%d, name:%s", pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo), - numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, colIndex.columnIndex, pNewQueryInfo->pTableMetaInfo[0]->name); + numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, colIndex.columnIndex, tNameGetTableName(&pNewQueryInfo->pTableMetaInfo[0]->name)); } else { SSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = 1}; SColumnIndex colIndex = {0, PRIMARYKEY_TIMESTAMP_COL_INDEX}; @@ -1671,7 +1671,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter "%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%u, transfer to ts_comp query to retrieve timestamps, " "exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, name:%s", pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo), - numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, pNewQueryInfo->pTableMetaInfo[0]->name); + numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, tNameGetTableName(&pNewQueryInfo->pTableMetaInfo[0]->name)); } } else { assert(0); @@ -2133,7 +2133,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, 0); tscClearInterpInfo(pPQueryInfo); - tscCreateLocalReducer(trsupport->pExtMemBuffer, pState->numOfSub, pDesc, trsupport->pFinalColModel, trsupport->pFFColModel, pParentSql); + tscCreateLocalMerger(trsupport->pExtMemBuffer, pState->numOfSub, pDesc, trsupport->pFinalColModel, trsupport->pFFColModel, pParentSql); tscDebug("%p build loser tree completed", pParentSql); pParentSql->res.precision = pSql->res.precision; @@ -2421,7 +2421,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows) tscFreeQueryInfo(&pSql->cmd); SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(&pSql->cmd, 0); STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pParentObj->cmd, pSql->cmd.clauseIndex, 0); - tscAddTableMetaInfo(pQueryInfo, pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL); + tscAddTableMetaInfo(pQueryInfo, &pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL); subquerySetState(pSql, &pParentObj->subState, i, 0); @@ -2434,7 +2434,8 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows) tscDebug("%p cleanup %d tableMeta in hashTable", pParentObj, pParentObj->cmd.numOfTables); for(int32_t i = 0; i < pParentObj->cmd.numOfTables; ++i) { - char* name = pParentObj->cmd.pTableNameList[i]; + char name[TSDB_TABLE_FNAME_LEN] = {0}; + tNameExtractFullName(pParentObj->cmd.pTableNameList[i], name); taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 438836468b..beca5bb2af 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -89,21 +89,6 @@ bool tscQueryTags(SQueryInfo* pQueryInfo) { return true; } -// todo refactor, extract methods and move the common module -void tscGetDBInfoFromTableFullName(char* tableId, char* db) { - char* st = strstr(tableId, TS_PATH_DELIMITER); - if (st != NULL) { - char* end = strstr(st + 1, TS_PATH_DELIMITER); - if (end != NULL) { - memcpy(db, tableId, (end - tableId)); - db[end - tableId] = 0; - return; - } - } - - db[0] = 0; -} - bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) { if (pQueryInfo == NULL) { return false; @@ -420,7 +405,7 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) { } void tscFreeSqlResult(SSqlObj* pSql) { - tscDestroyLocalReducer(pSql); + tscDestroyLocalMerger(pSql); SSqlRes* pRes = &pSql->res; tscDestroyResPointerInfo(pRes); @@ -612,15 +597,13 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) { // todo refactor // set the correct table meta object, the table meta has been locked in pDataBlocks, so it must be in the cache if (pTableMetaInfo->pTableMeta != pDataBlock->pTableMeta) { - tstrncpy(pTableMetaInfo->name, pDataBlock->tableName, sizeof(pTableMetaInfo->name)); + tNameAssign(&pTableMetaInfo->name, &pDataBlock->tableName); if (pTableMetaInfo->pTableMeta != NULL) { tfree(pTableMetaInfo->pTableMeta); } - pTableMetaInfo->pTableMeta = tscTableMetaClone(pDataBlock->pTableMeta); - } else { - assert(strncmp(pTableMetaInfo->name, pDataBlock->tableName, tListLen(pDataBlock->tableName)) == 0); + pTableMetaInfo->pTableMeta = tscTableMetaDup(pDataBlock->pTableMeta); } /* @@ -655,7 +638,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) { * @param dataBlocks * @return */ -int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, const char* name, +int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOffset, SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks) { STableDataBlocks* dataBuf = (STableDataBlocks*)calloc(1, sizeof(STableDataBlocks)); if (dataBuf == NULL) { @@ -683,18 +666,18 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff dataBuf->size = startOffset; dataBuf->tsSource = -1; - tstrncpy(dataBuf->tableName, name, sizeof(dataBuf->tableName)); + tNameAssign(&dataBuf->tableName, name); //Here we keep the tableMeta to avoid it to be remove by other threads. - dataBuf->pTableMeta = tscTableMetaClone(pTableMeta); + dataBuf->pTableMeta = tscTableMetaDup(pTableMeta); assert(initialSize > 0 && pTableMeta != NULL && dataBuf->pTableMeta != NULL); *dataBlocks = dataBuf; return TSDB_CODE_SUCCESS; } -int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, const char* tableId, STableMeta* pTableMeta, - STableDataBlocks** dataBlocks, SArray* pBlockList) { +int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, + SName* name, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, SArray* pBlockList) { *dataBlocks = NULL; STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)&id, sizeof(id)); if (t1 != NULL) { @@ -702,7 +685,7 @@ int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, i } if (*dataBlocks == NULL) { - int32_t ret = tscCreateDataBlock((size_t)size, rowSize, startOffset, tableId, pTableMeta, dataBlocks); + int32_t ret = tscCreateDataBlock((size_t)size, rowSize, startOffset, name, pTableMeta, dataBlocks); if (ret != TSDB_CODE_SUCCESS) { return ret; } @@ -803,7 +786,7 @@ static void extractTableNameList(SSqlCmd* pCmd, bool freeBlockMap) { int32_t i = 0; while(p1) { STableDataBlocks* pBlocks = *p1; - pCmd->pTableNameList[i++] = strndup(pBlocks->tableName, TSDB_TABLE_FNAME_LEN); + pCmd->pTableNameList[i++] = tNameDup(&pBlocks->tableName); p1 = taosHashIterate(pCmd->pTableBlockHashList, p1); } @@ -828,7 +811,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) { STableDataBlocks* dataBuf = NULL; int32_t ret = tscGetDataBlockFromList(pVnodeDataBlockHashList, pOneTableBlock->vgId, TSDB_PAYLOAD_SIZE, - INSERT_HEAD_SIZE, 0, pOneTableBlock->tableName, pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList); + INSERT_HEAD_SIZE, 0, &pOneTableBlock->tableName, pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList); if (ret != TSDB_CODE_SUCCESS) { tscError("%p failed to prepare the data block buffer for merging table data, code:%d", pSql, ret); taosHashCleanup(pVnodeDataBlockHashList); @@ -861,8 +844,8 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) { tscSortRemoveDataBlockDupRows(pOneTableBlock); char* ekey = (char*)pBlocks->data + pOneTableBlock->rowSize*(pBlocks->numOfRows-1); - - tscDebug("%p name:%s, sid:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql, pOneTableBlock->tableName, + + tscDebug("%p name:%s, name:%d rows:%d sversion:%d skey:%" PRId64 ", ekey:%" PRId64, pSql, tNameGetTableName(&pOneTableBlock->tableName), pBlocks->tid, pBlocks->numOfRows, pBlocks->sversion, GET_INT64_VAL(pBlocks->data), GET_INT64_VAL(ekey)); int32_t len = pBlocks->numOfRows * (pOneTableBlock->rowSize + expandSize) + sizeof(STColumn) * tscGetNumOfColumns(pOneTableBlock->pTableMeta); @@ -1310,7 +1293,7 @@ SColumn* tscColumnClone(const SColumn* src) { dst->colIndex = src->colIndex; dst->numOfFilters = src->numOfFilters; - dst->filterInfo = tscFilterInfoClone(src->filterInfo, src->numOfFilters); + dst->filterInfo = tFilterInfoDup(src->filterInfo, src->numOfFilters); return dst; } @@ -1816,10 +1799,10 @@ void tscVgroupTableCopy(SVgroupTableInfo* info, SVgroupTableInfo* pInfo) { info->vgInfo.epAddr[j].fqdn = strdup(pInfo->vgInfo.epAddr[j].fqdn); } - info->itemList = taosArrayClone(pInfo->itemList); + info->itemList = taosArrayDup(pInfo->itemList); } -SArray* tscVgroupTableInfoClone(SArray* pVgroupTables) { +SArray* tscVgroupTableInfoDup(SArray* pVgroupTables) { if (pVgroupTables == NULL) { return NULL; } @@ -1850,7 +1833,7 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo) { tfree(pQueryInfo->pTableMetaInfo); } -STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, STableMeta* pTableMeta, +STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, SName* name, STableMeta* pTableMeta, SVgroupsInfo* vgroupList, SArray* pTagCols, SArray* pVgroupTables) { void* pAlloc = realloc(pQueryInfo->pTableMetaInfo, (pQueryInfo->numOfTables + 1) * POINTER_BYTES); if (pAlloc == NULL) { @@ -1868,7 +1851,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST pQueryInfo->pTableMetaInfo[pQueryInfo->numOfTables] = pTableMetaInfo; if (name != NULL) { - tstrncpy(pTableMetaInfo->name, name, sizeof(pTableMetaInfo->name)); + tNameAssign(&pTableMetaInfo->name, name); } pTableMetaInfo->pTableMeta = pTableMeta; @@ -1887,7 +1870,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST tscColumnListCopy(pTableMetaInfo->tagColList, pTagCols, -1); } - pTableMetaInfo->pVgroupTables = tscVgroupTableInfoClone(pVgroupTables); + pTableMetaInfo->pVgroupTables = tscVgroupTableInfoDup(pVgroupTables); pQueryInfo->numOfTables += 1; return pTableMetaInfo; @@ -1965,7 +1948,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, __async_cb_func_t fp, void* param, in assert(pSql->cmd.clauseIndex == 0); STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, pSql->cmd.clauseIndex, 0); - tscAddTableMetaInfo(pQueryInfo, pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL); + tscAddTableMetaInfo(pQueryInfo, &pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL); registerSqlObj(pNew); return pNew; @@ -2070,7 +2053,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t pNewQueryInfo->groupbyExpr = pQueryInfo->groupbyExpr; if (pQueryInfo->groupbyExpr.columnInfo != NULL) { - pNewQueryInfo->groupbyExpr.columnInfo = taosArrayClone(pQueryInfo->groupbyExpr.columnInfo); + pNewQueryInfo->groupbyExpr.columnInfo = taosArrayDup(pQueryInfo->groupbyExpr.columnInfo); if (pNewQueryInfo->groupbyExpr.columnInfo == NULL) { terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; goto _error; @@ -2121,27 +2104,26 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t pNew->param = param; pNew->maxRetry = TSDB_MAX_REPLICA; - char* name = pTableMetaInfo->name; STableMetaInfo* pFinalInfo = NULL; if (pPrevSql == NULL) { - STableMeta* pTableMeta = tscTableMetaClone(pTableMetaInfo->pTableMeta); + STableMeta* pTableMeta = tscTableMetaDup(pTableMetaInfo->pTableMeta); assert(pTableMeta != NULL); - pFinalInfo = tscAddTableMetaInfo(pNewQueryInfo, name, pTableMeta, pTableMetaInfo->vgroupList, + pFinalInfo = tscAddTableMetaInfo(pNewQueryInfo, &pTableMetaInfo->name, pTableMeta, pTableMetaInfo->vgroupList, pTableMetaInfo->tagColList, pTableMetaInfo->pVgroupTables); } else { // transfer the ownership of pTableMeta to the newly create sql object. STableMetaInfo* pPrevInfo = tscGetTableMetaInfoFromCmd(&pPrevSql->cmd, pPrevSql->cmd.clauseIndex, 0); - STableMeta* pPrevTableMeta = tscTableMetaClone(pPrevInfo->pTableMeta); + STableMeta* pPrevTableMeta = tscTableMetaDup(pPrevInfo->pTableMeta); SVgroupsInfo* pVgroupsInfo = pPrevInfo->vgroupList; - pFinalInfo = tscAddTableMetaInfo(pNewQueryInfo, name, pPrevTableMeta, pVgroupsInfo, pTableMetaInfo->tagColList, + pFinalInfo = tscAddTableMetaInfo(pNewQueryInfo, &pTableMetaInfo->name, pPrevTableMeta, pVgroupsInfo, pTableMetaInfo->tagColList, pTableMetaInfo->pVgroupTables); } // this case cannot be happened if (pFinalInfo->pTableMeta == NULL) { - tscError("%p new subquery failed since no tableMeta, name:%s", pSql, name); + tscError("%p new subquery failed since no tableMeta, name:%s", pSql, tNameGetTableName(&pTableMetaInfo->name)); if (pPrevSql != NULL) { // pass the previous error to client assert(pPrevSql->res.code != TSDB_CODE_SUCCESS); @@ -2166,7 +2148,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t "%p new subquery:%p, tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%" PRIzu ", colList:%" PRIzu "," "fieldInfo:%d, name:%s, qrang:%" PRId64 " - %" PRId64 " order:%d, limit:%" PRId64, pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo), - size, pNewQueryInfo->fieldsInfo.numOfOutput, pFinalInfo->name, pNewQueryInfo->window.skey, + size, pNewQueryInfo->fieldsInfo.numOfOutput, tNameGetTableName(&pFinalInfo->name), pNewQueryInfo->window.skey, pNewQueryInfo->window.ekey, pNewQueryInfo->order.order, pNewQueryInfo->limit.limit); tscPrintSelectClause(pNew, 0); @@ -2203,7 +2185,7 @@ void tscDoQuery(SSqlObj* pSql) { } if (pCmd->dataSourceType == DATA_FROM_DATA_FILE) { - tscProcessMultiVnodesImportFromFile(pSql); + tscImportDataFromFile(pSql); } else { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); uint16_t type = pQueryInfo->type; @@ -2303,7 +2285,6 @@ int32_t tscSQLSyntaxErrMsg(char* msg, const char* additionalInfo, const char* s } return TSDB_CODE_TSC_SQL_SYNTAX_ERROR; - } int32_t tscInvalidSQLErrMsg(char* msg, const char* additionalInfo, const char* sql) { @@ -2701,7 +2682,7 @@ uint32_t tscGetTableMetaMaxSize() { return sizeof(STableMeta) + TSDB_MAX_COLUMNS * sizeof(SSchema); } -STableMeta* tscTableMetaClone(STableMeta* pTableMeta) { +STableMeta* tscTableMetaDup(STableMeta* pTableMeta) { assert(pTableMeta != NULL); uint32_t size = tscGetTableMetaSize(pTableMeta); STableMeta* p = calloc(1, size); diff --git a/src/common/inc/tname.h b/src/common/inc/tname.h index 44f1047543..bc1611cefe 100644 --- a/src/common/inc/tname.h +++ b/src/common/inc/tname.h @@ -21,6 +21,20 @@ typedef struct SColumnInfoData { void* pData; // the corresponding block data in memory } SColumnInfoData; +#define TSDB_DB_NAME_T 1 +#define TSDB_TABLE_NAME_T 2 + +#define T_NAME_ACCT 0x1u +#define T_NAME_DB 0x2u +#define T_NAME_TABLE 0x4u + +typedef struct SName { + uint8_t type; //db_name_t, table_name_t + char acctId[TSDB_ACCT_ID_LEN]; + char dbname[TSDB_DB_NAME_LEN]; + char tname[TSDB_TABLE_NAME_LEN]; +} SName; + void extractTableName(const char *tableId, char *name); char* extractDBName(const char *tableId, char *name); @@ -35,9 +49,9 @@ SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const bool tscValidateTableNameLength(size_t len); -SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters); +SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFilters); -SSchema tscGetTbnameColumnSchema(); +SSchema tGetTbnameColumnSchema(); /** * check if the schema is valid or not, including following aspects: @@ -51,6 +65,28 @@ SSchema tscGetTbnameColumnSchema(); * @param numOfCols * @return */ -bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags); +bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags); + +int32_t tNameExtractFullName(const SName* name, char* dst); +int32_t tNameLen(const SName* name); + +SName* tNameDup(const SName* name); + +bool tIsValidName(const SName* name); + +const char* tNameGetTableName(const SName* name); + +int32_t tNameGetDbName(const SName* name, char* dst); +int32_t tNameGetFullDbName(const SName* name, char* dst); + +bool tNameIsEmpty(const SName* name); + +void tNameAssign(SName* dst, const SName* src); + +int32_t tNameFromString(SName* dst, const char* str, uint32_t type); + +int32_t tNameSetAcctId(SName* dst, const char* acct); + +int32_t tNameSetDbName(SName* dst, const char* acct, SStrToken* dbToken); #endif // TDENGINE_NAME_H diff --git a/src/common/src/tname.c b/src/common/src/tname.c index f35867ede3..5c49e2e102 100644 --- a/src/common/src/tname.c +++ b/src/common/src/tname.c @@ -3,31 +3,12 @@ #include "tname.h" #include "tstoken.h" -#include "ttokendef.h" #include "tvariant.h" -#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS) - +#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS) #define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS) -// todo refactor -UNUSED_FUNC static FORCE_INLINE const char* skipSegments(const char* input, char delim, int32_t num) { - for (int32_t i = 0; i < num; ++i) { - while (*input != 0 && *input++ != delim) { - }; - } - return input; -} - -UNUSED_FUNC static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) { - size_t len = 0; - while (*src != delimiter && *src != 0) { - *dst++ = *src++; - len++; - } - - return len; -} +#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T) void extractTableName(const char* tableId, char* name) { size_t s1 = strcspn(tableId, &TS_PATH_DELIMITER[0]); @@ -85,7 +66,7 @@ bool tscValidateTableNameLength(size_t len) { return len < TSDB_TABLE_NAME_LEN; } -SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numOfFilters) { +SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFilters) { if (numOfFilters == 0) { assert(src == NULL); return NULL; @@ -200,7 +181,7 @@ void extractTableNameFromToken(SStrToken* pToken, SStrToken* pTable) { } } -SSchema tscGetTbnameColumnSchema() { +SSchema tGetTbnameColumnSchema() { struct SSchema s = { .colId = TSDB_TBNAME_COLUMN_INDEX, .type = TSDB_DATA_TYPE_BINARY, @@ -248,7 +229,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen return rowLen <= maxLen; } -bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags) { +bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags) { if (!VALIDNUMOFCOLS(numOfCols)) { return false; } @@ -272,3 +253,179 @@ bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags return true; } + +int32_t tNameExtractFullName(const SName* name, char* dst) { + assert(name != NULL && dst != NULL); + + // invalid full name format, abort + if (!tIsValidName(name)) { + return -1; + } + + int32_t len = snprintf(dst, TSDB_ACCT_ID_LEN + 1 + TSDB_DB_NAME_LEN, "%s.%s", name->acctId, name->dbname); + + size_t tnameLen = strlen(name->tname); + if (tnameLen > 0) { + assert(name->type == TSDB_TABLE_NAME_T); + dst[len] = TS_PATH_DELIMITER[0]; + + memcpy(dst + len + 1, name->tname, tnameLen); + dst[len + tnameLen + 1] = 0; + } + + return 0; +} + +int32_t tNameLen(const SName* name) { + assert(name != NULL); + int32_t len = (int32_t) strlen(name->acctId); + int32_t len1 = (int32_t) strlen(name->dbname); + int32_t len2 = (int32_t) strlen(name->tname); + + if (name->type == TSDB_DB_NAME_T) { + assert(len2 == 0); + return len + len1 + TS_PATH_DELIMITER_LEN; + } else { + assert(len2 > 0); + return len + len1 + len2 + TS_PATH_DELIMITER_LEN * 2; + } +} + +bool tIsValidName(const SName* name) { + assert(name != NULL); + + if (!VALID_NAME_TYPE(name->type)) { + return false; + } + + if (strlen(name->acctId) <= 0) { + return false; + } + + if (name->type == TSDB_DB_NAME_T) { + return strlen(name->dbname) > 0; + } else { + return strlen(name->dbname) > 0 && strlen(name->tname) > 0; + } +} + +SName* tNameDup(const SName* name) { + assert(name != NULL); + + SName* p = calloc(1, sizeof(SName)); + memcpy(p, name, sizeof(SName)); + return p; +} + +int32_t tNameGetDbName(const SName* name, char* dst) { + assert(name != NULL && dst != NULL); + strncpy(dst, name->dbname, tListLen(name->dbname)); + return 0; +} + +int32_t tNameGetFullDbName(const SName* name, char* dst) { + assert(name != NULL && dst != NULL); + snprintf(dst, TSDB_ACCT_ID_LEN + TS_PATH_DELIMITER_LEN + TSDB_DB_NAME_LEN, + "%s.%s", name->acctId, name->dbname); + return 0; +} + +bool tNameIsEmpty(const SName* name) { + assert(name != NULL); + return name->type == 0 || strlen(name->acctId) <= 0; +} + +const char* tNameGetTableName(const SName* name) { + assert(name != NULL && name->type == TSDB_TABLE_NAME_T); + return &name->tname[0]; +} + +void tNameAssign(SName* dst, const SName* src) { + memcpy(dst, src, sizeof(SName)); +} + +int32_t tNameSetDbName(SName* dst, const char* acct, SStrToken* dbToken) { + assert(dst != NULL && dbToken != NULL && acct != NULL); + + // too long account id or too long db name + if (strlen(acct) >= tListLen(dst->acctId) || dbToken->n >= tListLen(dst->dbname)) { + return -1; + } + + dst->type = TSDB_DB_NAME_T; + tstrncpy(dst->acctId, acct, tListLen(dst->acctId)); + tstrncpy(dst->dbname, dbToken->z, dbToken->n + 1); + return 0; +} + +int32_t tNameSetAcctId(SName* dst, const char* acct) { + assert(dst != NULL && acct != NULL); + + // too long account id or too long db name + if (strlen(acct) >= tListLen(dst->acctId)) { + return -1; + } + + tstrncpy(dst->acctId, acct, tListLen(dst->acctId)); + return 0; +} + +int32_t tNameFromString(SName* dst, const char* str, uint32_t type) { + assert(dst != NULL && str != NULL && strlen(str) > 0); + + char* p = NULL; + if ((type & T_NAME_ACCT) == T_NAME_ACCT) { + p = strstr(str, TS_PATH_DELIMITER); + if (p == NULL) { + return -1; + } + + int32_t len = (int32_t)(p - str); + + // too long account id or too long db name + if (len >= tListLen(dst->acctId) || len == 0) { + return -1; + } + + memcpy (dst->acctId, str, len); + dst->acctId[len] = 0; + } + + if ((type & T_NAME_DB) == T_NAME_DB) { + dst->type = TSDB_DB_NAME_T; + char* start = (char*)((p == NULL)? str:(p+1)); + + int32_t len = 0; + p = strstr(start, TS_PATH_DELIMITER); + if (p == NULL) { + len = (int32_t) strlen(start); + } else { + len = (int32_t) (p - start); + } + + // too long account id or too long db name + if (len >= tListLen(dst->dbname) || len == 0) { + return -1; + } + + memcpy (dst->dbname, start, len); + dst->dbname[len] = 0; + } + + if ((type & T_NAME_TABLE) == T_NAME_TABLE) { + dst->type = TSDB_TABLE_NAME_T; + char* start = (char*) ((p == NULL)? str: (p+1)); + + int32_t len = (int32_t) strlen(start); + + // too long account id or too long db name + if (len >= tListLen(dst->tname) || len == 0) { + return -1; + } + + memcpy (dst->tname, start, len); + dst->tname[len] = 0; + } + + return 0; +} diff --git a/src/connector/jdbc/CMakeLists.txt b/src/connector/jdbc/CMakeLists.txt index 7097e9bc5a..b64161e2e4 100644 --- a/src/connector/jdbc/CMakeLists.txt +++ b/src/connector/jdbc/CMakeLists.txt @@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED) ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME} POST_BUILD COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.16-dist.jar ${LIBRARY_OUTPUT_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.17-dist.jar ${LIBRARY_OUTPUT_PATH} COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml COMMENT "build jdbc driver") ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME}) diff --git a/src/connector/jdbc/deploy-pom.xml b/src/connector/jdbc/deploy-pom.xml index 5aa60c0df9..1f03c3c6fe 100755 --- a/src/connector/jdbc/deploy-pom.xml +++ b/src/connector/jdbc/deploy-pom.xml @@ -5,7 +5,7 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.16 + 2.0.17 jar JDBCDriver diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index d18d86258a..5481056763 100755 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.taosdata.jdbc taos-jdbcdriver - 2.0.16 + 2.0.17 jar JDBCDriver https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java index 3a01e2e092..3d7e6034dd 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/CatalogResultSet.java @@ -24,7 +24,6 @@ import java.sql.SQLException; */ public class CatalogResultSet extends TSDBResultSetWrapper { - public CatalogResultSet(ResultSet resultSet) { super.setOriginalResultSet(resultSet); } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java deleted file mode 100644 index e15415e037..0000000000 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/GetColumnsResultSet.java +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - *****************************************************************************/ -package com.taosdata.jdbc; - -import java.sql.ResultSet; - -/* - * TDengine only supports a subset of the standard SQL, thus this implemetation of the - * standard JDBC API contains more or less some adjustments customized for certain - * compatibility needs. - */ -public class GetColumnsResultSet extends TSDBResultSetWrapper { - private String catalog; - private String schemaPattern; - private String tableNamePattern; - private String columnNamePattern; - - public GetColumnsResultSet(ResultSet resultSet, String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) { - super.setOriginalResultSet(resultSet); - this.catalog = catalog; - this.schemaPattern = schemaPattern; - this.tableNamePattern = tableNamePattern; - this.columnNamePattern = columnNamePattern; - } - - @Override - public String getString(int columnIndex) { - switch (columnIndex) { - case 1: - return catalog; - case 2: - return null; - case 3: - return tableNamePattern; - default: - return null; - } - } -} diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java index 02556f6a73..53f3714555 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java @@ -620,6 +620,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData { ResultSet tables = stmt.executeQuery("show tables"); while (tables.next()) { TSDBResultSetRowData rowData = new TSDBResultSetRowData(10); + rowData.setString(0, dbname); rowData.setString(2, tables.getString("table_name")); rowData.setString(3, "TABLE"); rowData.setString(4, ""); @@ -629,6 +630,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData { ResultSet stables = stmt.executeQuery("show stables"); while (stables.next()) { TSDBResultSetRowData rowData = new TSDBResultSetRowData(10); + rowData.setString(0, dbname); rowData.setString(2, stables.getString("name")); rowData.setString(3, "TABLE"); rowData.setString(4, "STABLE"); diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java deleted file mode 100644 index d9227523d4..0000000000 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBParameterMetaData.java +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - *****************************************************************************/ -package com.taosdata.jdbc; - -import java.sql.ParameterMetaData; -import java.sql.SQLException; - -public class TSDBParameterMetaData implements ParameterMetaData { - @Override - public int getParameterCount() throws SQLException { - return 0; - } - - @Override - public int isNullable(int param) throws SQLException { - return 0; - } - - @Override - public boolean isSigned(int param) throws SQLException { - return false; - } - - @Override - public int getPrecision(int param) throws SQLException { - return 0; - } - - @Override - public int getScale(int param) throws SQLException { - return 0; - } - - @Override - public int getParameterType(int param) throws SQLException { - return 0; - } - - @Override - public String getParameterTypeName(int param) throws SQLException { - return null; - } - - @Override - public String getParameterClassName(int param) throws SQLException { - return null; - } - - @Override - public int getParameterMode(int param) throws SQLException { - return 0; - } - - @Override - public T unwrap(Class iface) throws SQLException { - return null; - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - return false; - } -} diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java deleted file mode 100644 index c1b9b02fa8..0000000000 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBSubscribeCallBack.java +++ /dev/null @@ -1,19 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - *****************************************************************************/ -package com.taosdata.jdbc; - -public interface TSDBSubscribeCallBack { - void invoke(TSDBResultSet resultSet); -} diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java index cb6ff369f2..fca8847114 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java @@ -44,6 +44,8 @@ public class RestfulDriver extends AbstractTaosDriver { String result = HttpClientPoolUtil.execute(loginUrl); JSONObject jsonResult = JSON.parseObject(result); String status = jsonResult.getString("status"); + String token = jsonResult.getString("desc"); + HttpClientPoolUtil.token = token; if (!status.equals("succ")) { throw new SQLException(jsonResult.getString("desc")); } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java index 23e8796980..9b1681ff94 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/util/HttpClientPoolUtil.java @@ -23,6 +23,7 @@ import java.nio.charset.Charset; public class HttpClientPoolUtil { public static PoolingHttpClientConnectionManager cm = null; public static CloseableHttpClient httpClient = null; + public static String token = "cm9vdDp0YW9zZGF0YQ=="; /** * 默认content 类型 */ @@ -61,9 +62,7 @@ public class HttpClientPoolUtil { try { return Long.parseLong(value) * 1000; } catch (Exception e) { - new Exception( - "format KeepAlive timeout exception, exception:" + e.toString()) - .printStackTrace(); + new Exception("format KeepAlive timeout exception, exception:" + e.toString()).printStackTrace(); } } } @@ -96,7 +95,7 @@ public class HttpClientPoolUtil { initPools(); } method = (HttpEntityEnclosingRequestBase) getRequest(uri, HttpPost.METHOD_NAME, DEFAULT_CONTENT_TYPE, 0); - method.setHeader("Authorization", "Basic cm9vdDp0YW9zZGF0YQ=="); + method.setHeader("Authorization", "Taosd " + token); method.setHeader("Content-Type", "text/plain"); method.setEntity(new StringEntity(data, Charset.forName("UTF-8"))); HttpContext context = HttpClientContext.create(); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java index 04e9ffab31..77223b40fa 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/TSDBDatabaseMetaDataTest.java @@ -642,6 +642,7 @@ public class TSDBDatabaseMetaDataTest { ResultSet tables = metaData.getTables("log", "", null, null); ResultSetMetaData metaData = tables.getMetaData(); while (tables.next()) { + System.out.print(metaData.getColumnLabel(1) + ":" + tables.getString(1) + "\t"); System.out.print(metaData.getColumnLabel(3) + ":" + tables.getString(3) + "\t"); System.out.print(metaData.getColumnLabel(4) + ":" + tables.getString(4) + "\t"); System.out.print(metaData.getColumnLabel(5) + ":" + tables.getString(5) + "\n"); diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java new file mode 100644 index 0000000000..e1e68766b9 --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/AuthenticationTest.java @@ -0,0 +1,66 @@ +package com.taosdata.jdbc.rs; + +import org.junit.Before; +import org.junit.Test; + +import java.sql.*; + +public class AuthenticationTest { + + // private static final String host = "127.0.0.1"; + private static final String host = "master"; + private static final String user = "root"; + private static final String password = "123456"; + private Connection conn; + + @Test + public void test() { + // change password + try { + conn = DriverManager.getConnection("jdbc:TAOS-RS://" + host + ":6041/restful_test?user=" + user + "&password=taosdata"); + Statement stmt = conn.createStatement(); + stmt.execute("alter user " + user + " pass '" + password + "'"); + stmt.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + // use new to login and execute query + try { + conn = DriverManager.getConnection("jdbc:TAOS-RS://" + host + ":6041/restful_test?user=" + user + "&password=" + password); + Statement stmt = conn.createStatement(); + stmt.execute("show databases"); + ResultSet rs = stmt.getResultSet(); + ResultSetMetaData meta = rs.getMetaData(); + while (rs.next()) { + for (int i = 1; i <= meta.getColumnCount(); i++) { + System.out.print(meta.getColumnLabel(i) + ":" + rs.getString(i) + "\t"); + } + System.out.println(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + // change password back + try { + conn = DriverManager.getConnection("jdbc:TAOS-RS://" + host + ":6041/restful_test?user=" + user + "&password=" + password); + Statement stmt = conn.createStatement(); + stmt.execute("alter user " + user + " pass 'taosdata'"); + stmt.close(); + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + + } + + @Before + public void before() { + try { + Class.forName("com.taosdata.jdbc.rs.RestfulDriver"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java index d07a6a2179..3416436615 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import java.sql.*; public class RestfulDriverTest { + private static final String host = "master"; @Test public void connect() { @@ -15,9 +16,9 @@ public class RestfulDriverTest { @Test public void acceptsURL() throws SQLException { Driver driver = new RestfulDriver(); - boolean isAccept = driver.acceptsURL("jdbc:TAOS-RS://master:6041"); + boolean isAccept = driver.acceptsURL("jdbc:TAOS-RS://" + host + ":6041"); Assert.assertTrue(isAccept); - isAccept = driver.acceptsURL("jdbc:TAOS://master:6041"); + isAccept = driver.acceptsURL("jdbc:TAOS://" + host + ":6041"); Assert.assertFalse(isAccept); } @@ -26,6 +27,9 @@ public class RestfulDriverTest { Driver driver = new RestfulDriver(); final String url = ""; DriverPropertyInfo[] propertyInfo = driver.getPropertyInfo(url, null); + for (DriverPropertyInfo prop : propertyInfo) { + System.out.println(prop); + } } @Test diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java index 0af6b91532..573ad027b8 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulJDBCTest.java @@ -1,6 +1,5 @@ package com.taosdata.jdbc.rs; - import org.junit.*; import org.junit.runners.MethodSorters; @@ -10,12 +9,13 @@ import java.util.Random; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RestfulJDBCTest { + private static final String host = "master"; private Connection connection; @Before public void before() throws ClassNotFoundException, SQLException { Class.forName("com.taosdata.jdbc.rs.RestfulDriver"); - connection = DriverManager.getConnection("jdbc:TAOS-RS://master:6041/restful_test?user=root&password=taosdata"); + connection = DriverManager.getConnection("jdbc:TAOS-RS://" + host + ":6041/restful_test?user=root&password=taosdata"); } @After diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java index ce84f967d0..c38958c6ce 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java @@ -21,4 +21,5 @@ public class SqlSyntaxValidatorTest { Assert.assertTrue(SqlSyntaxValidator.isUseSql("drop database test")); Assert.assertTrue(SqlSyntaxValidator.isUseSql("drop database if exist test")); } + } \ No newline at end of file diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index ff9598ecc5..c63536818a 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -291,7 +291,7 @@ int32_t dnodeInitTelemetry() { int32_t code = pthread_create(&tsTelemetryThread, &attr, telemetryThread, NULL); pthread_attr_destroy(&attr); if (code != 0) { - dTrace("failed to create telemetry thread, reason:%s", strerror(errno)); + dTrace("failed to create telemetry thread, reason:%s", strerror(code)); } dInfo("dnode telemetry is initialized"); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 4582efbc40..5b31fbf292 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -268,8 +268,7 @@ typedef struct { typedef struct { int32_t len; // one create table message - char tableFname[TSDB_TABLE_FNAME_LEN]; - char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN]; + char tableName[TSDB_TABLE_FNAME_LEN]; int8_t igExists; int8_t getMeta; int16_t numOfTags; @@ -285,7 +284,7 @@ typedef struct { } SCMCreateTableMsg; typedef struct { - char tableFname[TSDB_TABLE_FNAME_LEN]; + char name[TSDB_TABLE_FNAME_LEN]; int8_t igNotExists; } SCMDropTableMsg; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index c877ccfb72..dde74f4eb1 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -227,9 +227,6 @@ - - - #define TK_SPACE 300 #define TK_COMMENT 301 #define TK_ILLEGAL 302 diff --git a/src/kit/taosdemox/taosdemox.c b/src/kit/taosdemox/taosdemox.c index 2968d65331..a6d962df55 100644 --- a/src/kit/taosdemox/taosdemox.c +++ b/src/kit/taosdemox/taosdemox.c @@ -4507,6 +4507,7 @@ void setParaFromArg(){ strncpy(g_Dbs.db[0].superTbls[0].sTblName, "meters", MAX_TB_NAME_SIZE); g_Dbs.db[0].superTbls[0].childTblCount = g_args.num_of_tables; g_Dbs.threadCount = g_args.num_of_threads; + g_Dbs.threadCountByCreateTbl = 1; g_Dbs.queryMode = g_args.mode; g_Dbs.db[0].superTbls[0].autoCreateTable = PRE_CREATE_SUBTBL; diff --git a/src/mnode/inc/mnodeDb.h b/src/mnode/inc/mnodeDb.h index 9354b923d7..d03ba8d717 100644 --- a/src/mnode/inc/mnodeDb.h +++ b/src/mnode/inc/mnodeDb.h @@ -32,7 +32,7 @@ int32_t mnodeInitDbs(); void mnodeCleanupDbs(); int64_t mnodeGetDbNum(); SDbObj *mnodeGetDb(char *db); -SDbObj *mnodeGetDbByTableId(char *db); +SDbObj *mnodeGetDbByTableName(char *db); void * mnodeGetNextDb(void *pIter, SDbObj **pDb); void mnodeCancelGetNextDb(void *pIter); void mnodeIncDbRef(SDbObj *pDb); diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index fbcad151bc..d9ed22a567 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -199,18 +199,13 @@ void mnodeDecDbRef(SDbObj *pDb) { return sdbDecRef(tsDbSdb, pDb); } -SDbObj *mnodeGetDbByTableId(char *tableId) { - char db[TSDB_TABLE_FNAME_LEN], *pos; - - // tableId format should be : acct.db.table - pos = strstr(tableId, TS_PATH_DELIMITER); - assert(NULL != pos); +SDbObj *mnodeGetDbByTableName(char *tableName) { + SName name = {0}; + tNameFromString(&name, tableName, T_NAME_ACCT|T_NAME_DB|T_NAME_TABLE); - pos = strstr(pos + 1, TS_PATH_DELIMITER); - assert(NULL != pos); - - memset(db, 0, sizeof(db)); - strncpy(db, tableId, pos - tableId); + // validate the tableName? + char db[TSDB_TABLE_FNAME_LEN] = {0}; + tNameGetFullDbName(&name, db); return mnodeGetDb(db); } diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index bdf5a7fb8b..4229a4ce6e 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -297,7 +297,7 @@ static int32_t mnodeChildTableActionRestored() { pIter = mnodeGetNextChildTable(pIter, &pTable); if (pTable == NULL) break; - SDbObj *pDb = mnodeGetDbByTableId(pTable->info.tableId); + SDbObj *pDb = mnodeGetDbByTableName(pTable->info.tableId); if (pDb == NULL || pDb->status != TSDB_DB_STATUS_READY) { mError("ctable:%s, failed to get db or db in dropping, discard it", pTable->info.tableId); SSdbRow desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .pTable = tsChildTableSdb}; @@ -443,7 +443,7 @@ static int32_t mnodeSuperTableActionDestroy(SSdbRow *pRow) { static int32_t mnodeSuperTableActionInsert(SSdbRow *pRow) { SSTableObj *pStable = pRow->pObj; - SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId); + SDbObj *pDb = mnodeGetDbByTableName(pStable->info.tableId); if (pDb != NULL && pDb->status == TSDB_DB_STATUS_READY) { mnodeAddSuperTableIntoDb(pDb); } @@ -455,7 +455,7 @@ static int32_t mnodeSuperTableActionInsert(SSdbRow *pRow) { static int32_t mnodeSuperTableActionDelete(SSdbRow *pRow) { SSTableObj *pStable = pRow->pObj; - SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId); + SDbObj *pDb = mnodeGetDbByTableName(pStable->info.tableId); if (pDb != NULL) { mnodeRemoveSuperTableFromDb(pDb); mnodeDropAllChildTablesInStable((SSTableObj *)pStable); @@ -748,9 +748,12 @@ void mnodeDestroySubMsg(SMnodeMsg *pSubMsg) { } static int32_t mnodeValidateCreateTableMsg(SCreateTableMsg *pCreateTable, SMnodeMsg *pMsg) { - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pCreateTable->db); if (pMsg->pDb == NULL) { - mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname); + pMsg->pDb = mnodeGetDbByTableName(pCreateTable->tableName); + } + + if (pMsg->pDb == NULL) { + mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableName); return TSDB_CODE_MND_DB_NOT_SELECTED; } @@ -759,28 +762,28 @@ static int32_t mnodeValidateCreateTableMsg(SCreateTableMsg *pCreateTable, SMnode return TSDB_CODE_MND_DB_IN_DROPPING; } - if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreateTable->tableFname); + if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreateTable->tableName); if (pMsg->pTable != NULL && pMsg->retry == 0) { if (pCreateTable->getMeta) { - mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname); + mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableName); return mnodeGetChildTableMeta(pMsg); } else if (pCreateTable->igExists) { - mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname); + mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableName); return TSDB_CODE_SUCCESS; } else { mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle, - pCreateTable->tableFname); + pCreateTable->tableName); return TSDB_CODE_MND_TABLE_ALREADY_EXIST; } } if (pCreateTable->numOfTags != 0) { mDebug("msg:%p, app:%p table:%s, create stable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle, - pCreateTable->tableFname, pMsg->rpcMsg.handle); + pCreateTable->tableName, pMsg->rpcMsg.handle); return mnodeProcessCreateSuperTableMsg(pMsg); } else { mDebug("msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle, - pCreateTable->tableFname, pMsg->rpcMsg.handle); + pCreateTable->tableName, pMsg->rpcMsg.handle); return mnodeProcessCreateChildTableMsg(pMsg); } } @@ -860,9 +863,12 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) { } SCreateTableMsg *p = (SCreateTableMsg*)((char*) pCreate + sizeof(SCMCreateTableMsg)); - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(p->db); if (pMsg->pDb == NULL) { - mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, p->tableFname); + pMsg->pDb = mnodeGetDbByTableName(p->tableName); + } + + if (pMsg->pDb == NULL) { + mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, p->tableName); return TSDB_CODE_MND_DB_NOT_SELECTED; } @@ -871,37 +877,37 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) { return TSDB_CODE_MND_DB_IN_DROPPING; } - if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(p->tableFname); + if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(p->tableName); if (pMsg->pTable != NULL && pMsg->retry == 0) { if (p->getMeta) { - mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, p->tableFname); + mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, p->tableName); return mnodeGetChildTableMeta(pMsg); } else if (p->igExists) { - mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableFname); + mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableName); return TSDB_CODE_SUCCESS; } else { - mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableFname); + mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableName); return TSDB_CODE_MND_TABLE_ALREADY_EXIST; } } if (p->numOfTags != 0) { mDebug("msg:%p, app:%p table:%s, create stable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle, - p->tableFname, pMsg->rpcMsg.handle); + p->tableName, pMsg->rpcMsg.handle); return mnodeProcessCreateSuperTableMsg(pMsg); } else { mDebug("msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle, - p->tableFname, pMsg->rpcMsg.handle); + p->tableName, pMsg->rpcMsg.handle); return mnodeProcessCreateChildTableMsg(pMsg); } } static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) { SCMDropTableMsg *pDrop = pMsg->rpcMsg.pCont; - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pDrop->tableFname); + if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableName(pDrop->name); if (pMsg->pDb == NULL) { mError("msg:%p, app:%p table:%s, failed to drop table, db not selected or db in dropping", pMsg, - pMsg->rpcMsg.ahandle, pDrop->tableFname); + pMsg->rpcMsg.ahandle, pDrop->name); return TSDB_CODE_MND_DB_NOT_SELECTED; } @@ -912,17 +918,17 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) { if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) { mError("msg:%p, app:%p table:%s, failed to drop table, in monitor database", pMsg, pMsg->rpcMsg.ahandle, - pDrop->tableFname); + pDrop->name); return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN; } - if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->tableFname); + if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->name); if (pMsg->pTable == NULL) { if (pDrop->igNotExists) { - mDebug("msg:%p, app:%p table:%s is not exist, treat as success", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableFname); + mDebug("msg:%p, app:%p table:%s is not exist, treat as success", pMsg, pMsg->rpcMsg.ahandle, pDrop->name); return TSDB_CODE_SUCCESS; } else { - mError("msg:%p, app:%p table:%s, failed to drop, table not exist", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableFname); + mError("msg:%p, app:%p table:%s, failed to drop, table not exist", pMsg, pMsg->rpcMsg.ahandle, pDrop->name); return TSDB_CODE_MND_INVALID_TABLE_NAME; } } @@ -930,12 +936,12 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) { if (pMsg->pTable->type == TSDB_SUPER_TABLE) { SSTableObj *pSTable = (SSTableObj *)pMsg->pTable; mInfo("msg:%p, app:%p table:%s, start to drop stable, uid:%" PRIu64 ", numOfChildTables:%d, sizeOfVgList:%d", pMsg, - pMsg->rpcMsg.ahandle, pDrop->tableFname, pSTable->uid, pSTable->numOfTables, taosHashGetSize(pSTable->vgHash)); + pMsg->rpcMsg.ahandle, pDrop->name, pSTable->uid, pSTable->numOfTables, taosHashGetSize(pSTable->vgHash)); return mnodeProcessDropSuperTableMsg(pMsg); } else { SCTableObj *pCTable = (SCTableObj *)pMsg->pTable; mInfo("msg:%p, app:%p table:%s, start to drop ctable, vgId:%d tid:%d uid:%" PRIu64, pMsg, pMsg->rpcMsg.ahandle, - pDrop->tableFname, pCTable->vgId, pCTable->tid, pCTable->uid); + pDrop->name, pCTable->vgId, pCTable->tid, pCTable->uid); return mnodeProcessDropChildTableMsg(pMsg); } } @@ -946,7 +952,7 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) { mDebug("msg:%p, app:%p table:%s, table meta msg is received from thandle:%p, createFlag:%d", pMsg, pMsg->rpcMsg.ahandle, pInfo->tableFname, pMsg->rpcMsg.handle, pInfo->createFlag); - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pInfo->tableFname); + if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableName(pInfo->tableFname); if (pMsg->pDb == NULL) { mError("msg:%p, app:%p table:%s, failed to get table meta, db not selected", pMsg, pMsg->rpcMsg.ahandle, pInfo->tableFname); @@ -1006,12 +1012,12 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { SSTableObj * pStable = calloc(1, sizeof(SSTableObj)); if (pStable == NULL) { - mError("msg:%p, app:%p table:%s, failed to create, no enough memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mError("msg:%p, app:%p table:%s, failed to create, no enough memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return TSDB_CODE_MND_OUT_OF_MEMORY; } int64_t us = taosGetTimestampUs(); - pStable->info.tableId = strdup(pCreate->tableFname); + pStable->info.tableId = strdup(pCreate->tableName); pStable->info.type = TSDB_SUPER_TABLE; pStable->createdTime = taosGetTimestampMs(); pStable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); @@ -1025,14 +1031,14 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { pStable->schema = (SSchema *)calloc(1, schemaSize); if (pStable->schema == NULL) { free(pStable); - mError("msg:%p, app:%p table:%s, failed to create, no schema input", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mError("msg:%p, app:%p table:%s, failed to create, no schema input", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return TSDB_CODE_MND_INVALID_TABLE_NAME; } memcpy(pStable->schema, pCreate->schema, numOfCols * sizeof(SSchema)); if (pStable->numOfColumns > TSDB_MAX_COLUMNS || pStable->numOfTags > TSDB_MAX_TAGS) { - mError("msg:%p, app:%p table:%s, failed to create, too many columns", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mError("msg:%p, app:%p table:%s, failed to create, too many columns", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return TSDB_CODE_MND_INVALID_TABLE_NAME; } @@ -1044,8 +1050,8 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { tschema[col].bytes = htons(tschema[col].bytes); } - if (!isValidSchema(pStable->schema, pStable->numOfColumns, pStable->numOfTags)) { - mError("msg:%p, app:%p table:%s, failed to create table, invalid schema", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + if (!tIsValidSchema(pStable->schema, pStable->numOfColumns, pStable->numOfTags)) { + mError("msg:%p, app:%p table:%s, failed to create table, invalid schema", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return TSDB_CODE_MND_INVALID_CREATE_TABLE_MSG; } @@ -1065,7 +1071,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { mnodeDestroySuperTable(pStable); pMsg->pTable = NULL; - mError("msg:%p, app:%p table:%s, failed to create, sdb error", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mError("msg:%p, app:%p table:%s, failed to create, sdb error", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); } return code; @@ -1907,12 +1913,12 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { SCTableObj *pTable = calloc(1, sizeof(SCTableObj)); if (pTable == NULL) { - mError("msg:%p, app:%p table:%s, failed to alloc memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mError("msg:%p, app:%p table:%s, failed to alloc memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return TSDB_CODE_MND_OUT_OF_MEMORY; } pTable->info.type = (pCreate->numOfColumns == 0)? TSDB_CHILD_TABLE:TSDB_NORMAL_TABLE; - pTable->info.tableId = strdup(pCreate->tableFname); + pTable->info.tableId = strdup(pCreate->tableName); pTable->createdTime = taosGetTimestampMs(); pTable->tid = tid; pTable->vgId = pVgroup->vgId; @@ -1928,7 +1934,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { size_t prefixLen = tableIdPrefix(pMsg->pDb->name, prefix, 64); if (0 != strncasecmp(prefix, stableName, prefixLen)) { mError("msg:%p, app:%p table:%s, corresponding super table:%s not in this db", pMsg, pMsg->rpcMsg.ahandle, - pCreate->tableFname, stableName); + pCreate->tableName, stableName); mnodeDestroyChildTable(pTable); return TSDB_CODE_TDB_INVALID_CREATE_TB_MSG; } @@ -1936,7 +1942,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(stableName); if (pMsg->pSTable == NULL) { mError("msg:%p, app:%p table:%s, corresponding super table:%s does not exist", pMsg, pMsg->rpcMsg.ahandle, - pCreate->tableFname, stableName); + pCreate->tableName, stableName); mnodeDestroyChildTable(pTable); return TSDB_CODE_MND_INVALID_TABLE_NAME; } @@ -2003,7 +2009,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { mnodeDestroyChildTable(pTable); pMsg->pTable = NULL; - mError("msg:%p, app:%p table:%s, failed to create, reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname, + mError("msg:%p, app:%p table:%s, failed to create, reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName, tstrerror(code)); } else { mDebug("msg:%p, app:%p table:%s, allocated in vgroup, vgId:%d sid:%d uid:%" PRIu64, pMsg, pMsg->rpcMsg.ahandle, @@ -2020,7 +2026,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { int32_t code = grantCheck(TSDB_GRANT_TIMESERIES); if (code != TSDB_CODE_SUCCESS) { mError("msg:%p, app:%p table:%s, failed to create, grant timeseries failed", pMsg, pMsg->rpcMsg.ahandle, - pCreate->tableFname); + pCreate->tableName); return code; } @@ -2031,7 +2037,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &tid); if (code != TSDB_CODE_SUCCESS) { mDebug("msg:%p, app:%p table:%s, failed to get available vgroup, reason:%s", pMsg, pMsg->rpcMsg.ahandle, - pCreate->tableFname, tstrerror(code)); + pCreate->tableName, tstrerror(code)); return code; } @@ -2045,15 +2051,15 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { return mnodeDoCreateChildTable(pMsg, tid); } } else { - if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableFname); + if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableName); } if (pMsg->pTable == NULL) { - mError("msg:%p, app:%p table:%s, object not found, retry:%d reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname, pMsg->retry, + mError("msg:%p, app:%p table:%s, object not found, retry:%d reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName, pMsg->retry, tstrerror(terrno)); return terrno; } else { - mDebug("msg:%p, app:%p table:%s, send create msg to vnode again", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname); + mDebug("msg:%p, app:%p table:%s, send create msg to vnode again", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableName); return mnodeDoCreateChildTableFp(pMsg); } } @@ -2398,8 +2404,7 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) { SCreateTableMsg* pCreate = (SCreateTableMsg*) ((char*) pCreateMsg + sizeof(SCMCreateTableMsg)); size_t size = tListLen(pInfo->tableFname); - tstrncpy(pCreate->tableFname, pInfo->tableFname, size); - tstrncpy(pCreate->db, pMsg->pDb->name, sizeof(pCreate->db)); + tstrncpy(pCreate->tableName, pInfo->tableFname, size); pCreate->igExists = 1; pCreate->getMeta = 1; @@ -2767,7 +2772,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) { SCTableObj *pTable = mnodeGetChildTable(tableId); if (pTable == NULL) continue; - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(tableId); + if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableName(tableId); if (pMsg->pDb == NULL || pMsg->pDb->status != TSDB_DB_STATUS_READY) { mnodeDecTableRef(pTable); continue; @@ -2988,7 +2993,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) { mDebug("msg:%p, app:%p table:%s, alter table msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname, pMsg->rpcMsg.handle); - if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pAlter->tableFname); + if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableName(pAlter->tableFname); if (pMsg->pDb == NULL) { mError("msg:%p, app:%p table:%s, failed to alter table, db not selected", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname); return TSDB_CODE_MND_DB_NOT_SELECTED; diff --git a/src/plugins/http/inc/httpInt.h b/src/plugins/http/inc/httpInt.h index ac182b707b..3dac0dec93 100644 --- a/src/plugins/http/inc/httpInt.h +++ b/src/plugins/http/inc/httpInt.h @@ -39,7 +39,8 @@ #define HTTP_GC_TARGET_SIZE 512 #define HTTP_WRITE_RETRY_TIMES 500 #define HTTP_WRITE_WAIT_TIME_MS 5 -#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + TSDB_KEY_LEN) +#define HTTP_PASSWORD_LEN TSDB_UNI_LEN +#define HTTP_SESSION_ID_LEN (TSDB_USER_LEN + HTTP_PASSWORD_LEN) typedef enum HttpReqType { HTTP_REQTYPE_OTHERS = 0, @@ -147,7 +148,7 @@ typedef struct HttpContext { uint8_t parsed; char ipstr[22]; char user[TSDB_USER_LEN]; // parsed from auth token or login message - char pass[TSDB_KEY_LEN]; + char pass[HTTP_PASSWORD_LEN]; TAOS * taos; void * ppContext; HttpSession *session; diff --git a/src/plugins/http/src/httpAuth.c b/src/plugins/http/src/httpAuth.c index 56da8a7089..973f69f24e 100644 --- a/src/plugins/http/src/httpAuth.c +++ b/src/plugins/http/src/httpAuth.c @@ -51,7 +51,7 @@ int32_t httpParseBasicAuthToken(HttpContext *pContext, char *token, int32_t len) char *password = user + 1; int32_t pass_len = (int32_t)((base64 + outlen) - password); - if (pass_len < 1 || pass_len >= TSDB_KEY_LEN) { + if (pass_len < 1 || pass_len >= HTTP_PASSWORD_LEN) { httpError("context:%p, fd:%d, basic token:%s parse password error", pContext, pContext->fd, token); free(base64); return -1; @@ -73,7 +73,7 @@ int32_t httpParseTaosdAuthToken(HttpContext *pContext, char *token, int32_t len) if (base64) free(base64); return 01; } - if (outlen != (TSDB_USER_LEN + TSDB_KEY_LEN)) { + if (outlen != (TSDB_USER_LEN + HTTP_PASSWORD_LEN)) { httpError("context:%p, fd:%d, taosd token:%s length error", pContext, pContext->fd, token); free(base64); return -1; @@ -103,8 +103,8 @@ int32_t httpGenTaosdAuthToken(HttpContext *pContext, char *token, int32_t maxLen size = sizeof(pContext->pass); tstrncpy(buffer + sizeof(pContext->user), pContext->pass, size); - char *encrypt = taosDesEncode(KEY_DES_4, buffer, TSDB_USER_LEN + TSDB_KEY_LEN); - char *base64 = base64_encode((const unsigned char *)encrypt, TSDB_USER_LEN + TSDB_KEY_LEN); + char *encrypt = taosDesEncode(KEY_DES_4, buffer, TSDB_USER_LEN + HTTP_PASSWORD_LEN); + char *base64 = base64_encode((const unsigned char *)encrypt, TSDB_USER_LEN + HTTP_PASSWORD_LEN); size_t len = strlen(base64); tstrncpy(token, base64, len + 1); diff --git a/src/plugins/http/src/httpGcHandle.c b/src/plugins/http/src/httpGcHandle.c index c21799e736..4c10249672 100644 --- a/src/plugins/http/src/httpGcHandle.c +++ b/src/plugins/http/src/httpGcHandle.c @@ -59,11 +59,11 @@ bool gcGetUserFromUrl(HttpContext* pContext) { bool gcGetPassFromUrl(HttpContext* pContext) { HttpParser* pParser = pContext->parser; - if (pParser->path[GC_PASS_URL_POS].pos >= TSDB_KEY_LEN || pParser->path[GC_PASS_URL_POS].pos <= 0) { + if (pParser->path[GC_PASS_URL_POS].pos >= HTTP_PASSWORD_LEN || pParser->path[GC_PASS_URL_POS].pos <= 0) { return false; } - tstrncpy(pContext->pass, pParser->path[GC_PASS_URL_POS].str, TSDB_KEY_LEN); + tstrncpy(pContext->pass, pParser->path[GC_PASS_URL_POS].str, HTTP_PASSWORD_LEN); return true; } diff --git a/src/plugins/http/src/httpRestHandle.c b/src/plugins/http/src/httpRestHandle.c index 66f1db1a54..112137b3df 100644 --- a/src/plugins/http/src/httpRestHandle.c +++ b/src/plugins/http/src/httpRestHandle.c @@ -72,11 +72,11 @@ bool restGetUserFromUrl(HttpContext* pContext) { bool restGetPassFromUrl(HttpContext* pContext) { HttpParser* pParser = pContext->parser; - if (pParser->path[REST_PASS_URL_POS].pos >= TSDB_KEY_LEN || pParser->path[REST_PASS_URL_POS].pos <= 0) { + if (pParser->path[REST_PASS_URL_POS].pos >= HTTP_PASSWORD_LEN || pParser->path[REST_PASS_URL_POS].pos <= 0) { return false; } - tstrncpy(pContext->pass, pParser->path[REST_PASS_URL_POS].str, TSDB_KEY_LEN); + tstrncpy(pContext->pass, pParser->path[REST_PASS_URL_POS].str, HTTP_PASSWORD_LEN); return true; } diff --git a/src/plugins/http/src/httpServer.c b/src/plugins/http/src/httpServer.c index 4896d50c6c..bc768788d8 100644 --- a/src/plugins/http/src/httpServer.c +++ b/src/plugins/http/src/httpServer.c @@ -60,7 +60,10 @@ void httpCleanUpConnect() { HttpServer *pServer = &tsHttpServer; if (pServer->pThreads == NULL) return; - pthread_join(pServer->thread, NULL); + if (taosCheckPthreadValid(pServer->thread)) { + pthread_join(pServer->thread, NULL); + } + for (int32_t i = 0; i < pServer->numOfThreads; ++i) { HttpThread* pThread = pServer->pThreads + i; if (pThread != NULL) { diff --git a/src/plugins/http/src/httpTgHandle.c b/src/plugins/http/src/httpTgHandle.c index 0a3ef539e3..bae8c44490 100644 --- a/src/plugins/http/src/httpTgHandle.c +++ b/src/plugins/http/src/httpTgHandle.c @@ -324,7 +324,7 @@ bool tgGetUserFromUrl(HttpContext *pContext) { bool tgGetPassFromUrl(HttpContext *pContext) { HttpParser *pParser = pContext->parser; - if (pParser->path[TG_PASS_URL_POS].pos >= TSDB_KEY_LEN || pParser->path[TG_PASS_URL_POS].pos <= 0) { + if (pParser->path[TG_PASS_URL_POS].pos >= HTTP_PASSWORD_LEN || pParser->path[TG_PASS_URL_POS].pos <= 0) { return false; } diff --git a/src/plugins/monitor/src/monMain.c b/src/plugins/monitor/src/monMain.c index 9443b1ce12..3b0b6a2fef 100644 --- a/src/plugins/monitor/src/monMain.c +++ b/src/plugins/monitor/src/monMain.c @@ -246,7 +246,10 @@ void monStopSystem() { void monCleanupSystem() { tsMonitor.quiting = 1; monStopSystem(); - pthread_join(tsMonitor.thread, NULL); + if (taosCheckPthreadValid(tsMonitor.thread)) { + pthread_join(tsMonitor.thread, NULL); + } + if (tsMonitor.conn != NULL) { taos_close(tsMonitor.conn); tsMonitor.conn = NULL; diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index be79bc55e6..c225ebd44a 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -96,16 +96,16 @@ typedef struct SCreateTableSQL { SQuerySQL *pSelect; } SCreateTableSQL; -typedef struct SAlterTableSQL { +typedef struct SAlterTableInfo { SStrToken name; int16_t tableType; int16_t type; STagData tagData; SArray *pAddColumns; // SArray SArray *varList; // set t=val or: change src dst, SArray -} SAlterTableSQL; +} SAlterTableInfo; -typedef struct SCreateDBInfo { +typedef struct SCreateDbInfo { SStrToken dbname; int32_t replica; int32_t cacheBlockSize; @@ -123,11 +123,10 @@ typedef struct SCreateDBInfo { bool ignoreExists; int8_t update; int8_t cachelast; - - SArray *keep; -} SCreateDBInfo; + SArray *keep; +} SCreateDbInfo; -typedef struct SCreateAcctSQL { +typedef struct SCreateAcctInfo { int32_t maxUsers; int32_t maxDbs; int32_t maxTimeSeries; @@ -137,7 +136,7 @@ typedef struct SCreateAcctSQL { int64_t maxQueryTime; int32_t maxConnections; SStrToken stat; -} SCreateAcctSQL; +} SCreateAcctInfo; typedef struct SShowInfo { uint8_t showType; @@ -152,23 +151,18 @@ typedef struct SUserInfo { int16_t type; } SUserInfo; -typedef struct tDCLSQL { - int32_t nTokens; /* Number of expressions on the list */ - int32_t nAlloc; /* Number of entries allocated below */ - SStrToken *a; /* one entry for element */ - bool existsCheck; +typedef struct SMiscInfo { + SArray *a; // SArray + bool existsCheck; int16_t tableType; - + SUserInfo user; union { - SCreateDBInfo dbOpt; - SCreateAcctSQL acctOpt; - SShowInfo showOpt; - SStrToken ip; + SCreateDbInfo dbOpt; + SCreateAcctInfo acctOpt; + SShowInfo showOpt; + SStrToken id; }; - - SUserInfo user; - -} tDCLSQL; +} SMiscInfo; typedef struct SSubclauseInfo { // "UNION" multiple select sub-clause SQuerySQL **pClause; @@ -178,15 +172,13 @@ typedef struct SSubclauseInfo { // "UNION" multiple select sub-clause typedef struct SSqlInfo { int32_t type; bool valid; - - union { - SCreateTableSQL *pCreateTableInfo; - SAlterTableSQL *pAlterInfo; - tDCLSQL *pDCLInfo; - }; - SSubclauseInfo subclauseInfo; - char pzErrMsg[256]; + char msg[256]; + union { + SCreateTableSQL *pCreateTableInfo; + SAlterTableInfo *pAlterInfo; + SMiscInfo *pMiscInfo; + }; } SSqlInfo; typedef struct tSQLExpr { @@ -252,7 +244,7 @@ SCreateTableSQL *tSetCreateSqlElems(SArray *pCols, SArray *pTags, SQuerySQL *pSe void tSqlExprNodeDestroy(tSQLExpr *pExpr); -SAlterTableSQL * tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableTable); +SAlterTableInfo * tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableTable); SCreatedTableInfo createNewChildTableInfo(SStrToken *pTableName, SArray *pTagVals, SStrToken *pToken, SStrToken* igExists); void destroyAllSelectClause(SSubclauseInfo *pSql); @@ -272,16 +264,14 @@ void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParams, ...); void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck,int16_t tableType); void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* pPatterns); -tDCLSQL *tTokenListAppend(tDCLSQL *pTokenList, SStrToken *pToken); +void setCreateDbInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDbInfo *pDB, SStrToken *pIgExists); -void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDBInfo *pDB, SStrToken *pIgExists); - -void setCreateAcctSql(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPwd, SCreateAcctSQL *pAcctInfo); +void setCreateAcctSql(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPwd, SCreateAcctInfo *pAcctInfo); void setCreateUserSql(SSqlInfo *pInfo, SStrToken *pName, SStrToken *pPasswd); void setKillSql(SSqlInfo *pInfo, int32_t type, SStrToken *ip); void setAlterUserSql(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken* pPwd, SStrToken *pPrivilege); -void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo); +void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo); // prefix show db.tables; void setDbName(SStrToken *pCpxName, SStrToken *pDb); diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index f224d26551..2a4a91ac3a 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -36,7 +36,7 @@ %syntax_error { pInfo->valid = false; - int32_t outputBufLen = tListLen(pInfo->pzErrMsg); + int32_t outputBufLen = tListLen(pInfo->msg); int32_t len = 0; if(TOKEN.z) { @@ -46,13 +46,13 @@ if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > outputBufLen) { char tmpstr[128] = {0}; memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1); - len = sprintf(pInfo->pzErrMsg, msg, tmpstr); + len = sprintf(pInfo->msg, msg, tmpstr); } else { - len = sprintf(pInfo->pzErrMsg, msg, &TOKEN.z[0]); + len = sprintf(pInfo->msg, msg, &TOKEN.z[0]); } } else { - len = sprintf(pInfo->pzErrMsg, "Incomplete SQL statement"); + len = sprintf(pInfo->msg, "Incomplete SQL statement"); } assert(len <= outputBufLen); @@ -216,7 +216,7 @@ conns(Y) ::= CONNS INTEGER(X). { Y = X; } state(Y) ::= . { Y.n = 0; } state(Y) ::= STATE ids(X). { Y = X; } -%type acct_optr {SCreateAcctSQL} +%type acct_optr {SCreateAcctInfo} acct_optr(Y) ::= pps(C) tseries(D) storage(P) streams(F) qtime(Q) dbs(E) users(K) conns(L) state(M). { Y.maxUsers = (K.n>0)?atoi(K.z):-1; Y.maxDbs = (E.n>0)?atoi(E.z):-1; @@ -248,7 +248,7 @@ prec(Y) ::= PRECISION STRING(X). { Y = X; } update(Y) ::= UPDATE INTEGER(X). { Y = X; } cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; } -%type db_optr {SCreateDBInfo} +%type db_optr {SCreateDbInfo} db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);} db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); } @@ -267,7 +267,7 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; } db_optr(Y) ::= db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); } -%type alter_db_optr {SCreateDBInfo} +%type alter_db_optr {SCreateDbInfo} alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);} alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } @@ -692,7 +692,7 @@ cmd ::= RESET QUERY CACHE. { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} ///////////////////////////////////ALTER TABLE statement////////////////////////////////// cmd ::= ALTER TABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). { X.n += F.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -702,14 +702,14 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). { toTSDBType(A.type); SArray* K = tVariantListAppendToken(NULL, &A, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER TABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). { @@ -718,7 +718,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). { toTSDBType(Y.type); SArray* A = tVariantListAppendToken(NULL, &Y, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -731,7 +731,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { toTSDBType(Z.type); A = tVariantListAppendToken(A, &Z, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -742,7 +742,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { SArray* A = tVariantListAppendToken(NULL, &Y, -1); A = tVariantListAppend(A, &Z, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -750,7 +750,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). { ///////////////////////////////////ALTER STABLE statement////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). { X.n += F.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -760,14 +760,14 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). { toTSDBType(A.type); SArray* K = tVariantListAppendToken(NULL, &A, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } //////////////////////////////////ALTER TAGS statement///////////////////////////////////// cmd ::= ALTER STABLE ids(X) cpxName(Y) ADD TAG columnlist(A). { X.n += Y.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). { @@ -776,7 +776,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). { toTSDBType(Y.type); SArray* A = tVariantListAppendToken(NULL, &Y, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } @@ -789,7 +789,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). { toTSDBType(Z.type); A = tVariantListAppendToken(A, &Z, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } diff --git a/src/query/src/qAst.c b/src/query/src/qAst.c index 1e6dbe8e3d..bd87cacb4b 100644 --- a/src/query/src/qAst.c +++ b/src/query/src/qAst.c @@ -407,7 +407,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) { SSchema* pSchema = exception_calloc(1, sizeof(SSchema)); left->pSchema = pSchema; - *pSchema = tscGetTbnameColumnSchema(); + *pSchema = tGetTbnameColumnSchema(); tExprNode* right = exception_calloc(1, sizeof(tExprNode)); expr->_node.pRight = right; diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 110b0d198c..f8b5d0497a 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1875,6 +1875,7 @@ static int32_t setCtxTagColumnInfo(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx return TSDB_CODE_SUCCESS; } +// todo refactor static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order) { qDebug("QInfo:%p setup runtime env", GET_QINFO_ADDR(pRuntimeEnv)); SQuery *pQuery = pRuntimeEnv->pQuery; @@ -3849,11 +3850,6 @@ void setExecutionContext(SQInfo *pQInfo, int32_t groupIndex, TSKEY nextKey) { // lastKey needs to be updated pTableQueryInfo->lastKey = nextKey; - - if (pRuntimeEnv->hasTagResults || pRuntimeEnv->pTsBuf != NULL) { - setAdditionalInfo(pQInfo, pTableQueryInfo->pTable, pTableQueryInfo); - } - if (pRuntimeEnv->prevGroupId != INT32_MIN && pRuntimeEnv->prevGroupId == groupIndex) { return; } @@ -4779,19 +4775,17 @@ static void enableExecutionForNextTable(SQueryRuntimeEnv *pRuntimeEnv) { } } -// TODO refactor: setAdditionalInfo static FORCE_INLINE void setEnvForEachBlock(SQInfo* pQInfo, STableQueryInfo* pTableQueryInfo, SDataBlockInfo* pBlockInfo) { SQueryRuntimeEnv* pRuntimeEnv = &pQInfo->runtimeEnv; SQuery* pQuery = pQInfo->runtimeEnv.pQuery; int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - if (QUERY_IS_INTERVAL_QUERY(pQuery)) { - TSKEY nextKey = pBlockInfo->window.skey; - setIntervalQueryRange(pQInfo, nextKey); + if (pRuntimeEnv->hasTagResults || pRuntimeEnv->pTsBuf != NULL) { + setAdditionalInfo(pQInfo, pTableQueryInfo->pTable, pTableQueryInfo); + } - if (pRuntimeEnv->hasTagResults || pRuntimeEnv->pTsBuf != NULL) { - setAdditionalInfo(pQInfo, pTableQueryInfo->pTable, pTableQueryInfo); - } + if (QUERY_IS_INTERVAL_QUERY(pQuery)) { + setIntervalQueryRange(pQInfo, pBlockInfo->window.skey); } else { // non-interval query setExecutionContext(pQInfo, pTableQueryInfo->groupIndex, pBlockInfo->window.ekey + step); } @@ -4814,7 +4808,7 @@ static void doTableQueryInfoTimeWindowCheck(SQuery* pQuery, STableQueryInfo* pTa static int64_t scanMultiTableDataBlocks(SQInfo *pQInfo) { SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv; SQuery* pQuery = pRuntimeEnv->pQuery; - SQueryCostInfo* summary = &pRuntimeEnv->summary; + SQueryCostInfo* summary = &pRuntimeEnv->summary; int64_t st = taosGetTimestampMs(); @@ -5047,7 +5041,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { STsdbQueryCond cond = createTsdbQueryCond(pQuery, &pQuery->window); SArray *g1 = taosArrayInit(1, POINTER_BYTES); - SArray *tx = taosArrayClone(group); + SArray *tx = taosArrayDup(group); taosArrayPush(g1, &tx); STableGroupInfo gp = {.numOfTables = taosArrayGetSize(tx), .pGroupList = g1}; @@ -5107,7 +5101,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { STsdbQueryCond cond = createTsdbQueryCond(pQuery, &pQuery->window); SArray *g1 = taosArrayInit(1, POINTER_BYTES); - SArray *tx = taosArrayClone(group); + SArray *tx = taosArrayDup(group); taosArrayPush(g1, &tx); STableGroupInfo gp = {.numOfTables = taosArrayGetSize(tx), .pGroupList = g1}; @@ -5471,7 +5465,7 @@ static void doRestoreContext(SQInfo *pQInfo) { SET_MASTER_SCAN_FLAG(pRuntimeEnv); } -static void doCloseAllTimeWindowAfterScan(SQInfo *pQInfo) { +static void doCloseAllTimeWindow(SQInfo *pQInfo) { SQuery *pQuery = pQInfo->runtimeEnv.pQuery; if (QUERY_IS_INTERVAL_QUERY(pQuery)) { @@ -5523,7 +5517,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { } // close all time window results - doCloseAllTimeWindowAfterScan(pQInfo); + doCloseAllTimeWindow(pQInfo); if (needReverseScan(pQuery)) { int32_t code = doSaveContext(pQInfo); @@ -5848,8 +5842,7 @@ static void stableQueryImpl(SQInfo *pQInfo) { (isFixedOutputQuery(pRuntimeEnv) && (!isPointInterpoQuery(pQuery)) && (!pRuntimeEnv->groupbyColumn))) { multiTableQueryProcess(pQInfo); } else { - assert((pQuery->checkResultBuf == 1 && pQuery->interval.interval == 0) || isPointInterpoQuery(pQuery) || - pRuntimeEnv->groupbyColumn); + assert(pQuery->checkResultBuf == 1 || isPointInterpoQuery(pQuery) || pRuntimeEnv->groupbyColumn); sequentialTableProcess(pQInfo); } @@ -6377,7 +6370,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num if (functId == TSDB_FUNC_TOP || functId == TSDB_FUNC_BOTTOM) { int32_t j = getColumnIndexInSource(pQueryMsg, &pExprs[i].base, pTagCols); if (j < 0 || j >= pQueryMsg->numOfCols) { - assert(0); + return TSDB_CODE_QRY_INVALID_MSG; } else { SColumnInfo *pCol = &pQueryMsg->colList[j]; int32_t ret = @@ -6576,7 +6569,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou int32_t srcSize = 0; for (int16_t i = 0; i < numOfCols; ++i) { pQuery->colList[i] = pQueryMsg->colList[i]; - pQuery->colList[i].filters = tscFilterInfoClone(pQueryMsg->colList[i].filters, pQuery->colList[i].numOfFilters); + pQuery->colList[i].filters = tFilterInfoDup(pQueryMsg->colList[i].filters, pQuery->colList[i].numOfFilters); srcSize += pQuery->colList[i].bytes; } @@ -6642,7 +6635,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou pQInfo->runtimeEnv.summary.tableInfoSize += (pTableGroupInfo->numOfTables * sizeof(STableQueryInfo)); pQInfo->runtimeEnv.pResultRowHashTable = taosHashInit(pTableGroupInfo->numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - pQInfo->runtimeEnv.keyBuf = malloc(TSDB_MAX_BYTES_PER_ROW); + pQInfo->runtimeEnv.keyBuf = malloc(TSDB_MAX_BYTES_PER_ROW); // todo opt size pQInfo->runtimeEnv.pool = initResultRowPool(getResultRowSize(&pQInfo->runtimeEnv)); pQInfo->runtimeEnv.prevRow = malloc(POINTER_BYTES * pQuery->numOfCols + srcSize); diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index 62e221ff4e..6dff550755 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -54,7 +54,7 @@ SSqlInfo qSQLParse(const char *pStr) { case TK_QUESTION: case TK_ILLEGAL: { - snprintf(sqlInfo.pzErrMsg, tListLen(sqlInfo.pzErrMsg), "unrecognized token: \"%s\"", t0.z); + snprintf(sqlInfo.msg, tListLen(sqlInfo.msg), "unrecognized token: \"%s\"", t0.z); sqlInfo.valid = false; goto abort_parse; } @@ -585,8 +585,8 @@ SCreatedTableInfo createNewChildTableInfo(SStrToken *pTableName, SArray *pTagVal return info; } -SAlterTableSQL *tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableType) { - SAlterTableSQL *pAlterTable = calloc(1, sizeof(SAlterTableSQL)); +SAlterTableInfo *tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableType) { + SAlterTableInfo *pAlterTable = calloc(1, sizeof(SAlterTableInfo)); pAlterTable->name = *pTableName; pAlterTable->type = type; @@ -632,15 +632,15 @@ void SqlInfoDestroy(SSqlInfo *pInfo) { tfree(pInfo->pAlterInfo->tagData.data); tfree(pInfo->pAlterInfo); } else { - if (pInfo->pDCLInfo != NULL && pInfo->pDCLInfo->nAlloc > 0) { - free(pInfo->pDCLInfo->a); + if (pInfo->pMiscInfo != NULL) { + taosArrayDestroy(pInfo->pMiscInfo->a); } - if (pInfo->pDCLInfo != NULL && pInfo->type == TSDB_SQL_CREATE_DB) { - taosArrayDestroyEx(pInfo->pDCLInfo->dbOpt.keep, freeVariant); + if (pInfo->pMiscInfo != NULL && pInfo->type == TSDB_SQL_CREATE_DB) { + taosArrayDestroyEx(pInfo->pMiscInfo->dbOpt.keep, freeVariant); } - tfree(pInfo->pDCLInfo); + tfree(pInfo->pMiscInfo); } } @@ -697,58 +697,49 @@ void setCreatedTableName(SSqlInfo *pInfo, SStrToken *pTableNameToken, SStrToken pInfo->pCreateTableInfo->existCheck = (pIfNotExists->n != 0); } -void tTokenListBuyMoreSpace(tDCLSQL *pTokenList) { - if (pTokenList->nAlloc <= pTokenList->nTokens) { // - pTokenList->nAlloc = (pTokenList->nAlloc << 1u) + 4; - pTokenList->a = realloc(pTokenList->a, pTokenList->nAlloc * sizeof(pTokenList->a[0])); - if (pTokenList->a == 0) { - pTokenList->nTokens = pTokenList->nAlloc = 0; - } - } -} - -tDCLSQL *tTokenListAppend(tDCLSQL *pTokenList, SStrToken *pToken) { - if (pToken == NULL) return NULL; - - if (pTokenList == NULL) pTokenList = calloc(1, sizeof(tDCLSQL)); - - tTokenListBuyMoreSpace(pTokenList); - pTokenList->a[pTokenList->nTokens++] = *pToken; - - return pTokenList; -} - void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) { pInfo->type = type; + if (nParam == 0) { + return; + } - if (nParam == 0) return; - if (pInfo->pDCLInfo == NULL) pInfo->pDCLInfo = (tDCLSQL *)calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = (SMiscInfo *)calloc(1, sizeof(SMiscInfo)); + pInfo->pMiscInfo->a = taosArrayInit(4, sizeof(SStrToken)); + } va_list va; va_start(va, nParam); - while (nParam-- > 0) { + while ((nParam--) > 0) { SStrToken *pToken = va_arg(va, SStrToken *); - pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken); + taosArrayPush(pInfo->pMiscInfo->a, pToken); } va_end(va); } void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck, int16_t tableType) { pInfo->type = type; - pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken); - pInfo->pDCLInfo->tableType = tableType; - pInfo->pDCLInfo->existsCheck = (existsCheck->n == 1); + + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = (SMiscInfo *)calloc(1, sizeof(SMiscInfo)); + pInfo->pMiscInfo->a = taosArrayInit(4, sizeof(SStrToken)); + } + + taosArrayPush(pInfo->pMiscInfo->a, pToken); + + pInfo->pMiscInfo->existsCheck = (existsCheck->n == 1); + pInfo->pMiscInfo->tableType = tableType; } void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* pPatterns) { - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } pInfo->type = TSDB_SQL_SHOW; - SShowInfo* pShowInfo = &pInfo->pDCLInfo->showOpt; + SShowInfo* pShowInfo = &pInfo->pMiscInfo->showOpt; pShowInfo->showType = type; if (prefix != NULL && prefix->type != 0) { @@ -764,54 +755,54 @@ void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* } } -void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDBInfo *pDB, SStrToken *pIgExists) { +void setCreateDbInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDbInfo *pDB, SStrToken *pIgExists) { pInfo->type = type; - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } - pInfo->pDCLInfo->dbOpt = *pDB; - pInfo->pDCLInfo->dbOpt.dbname = *pToken; - pInfo->pDCLInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;} + pInfo->pMiscInfo->dbOpt = *pDB; + pInfo->pMiscInfo->dbOpt.dbname = *pToken; + pInfo->pMiscInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;} } -void setCreateAcctSql(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPwd, SCreateAcctSQL *pAcctInfo) { +void setCreateAcctSql(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPwd, SCreateAcctInfo *pAcctInfo) { pInfo->type = type; - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } - pInfo->pDCLInfo->acctOpt = *pAcctInfo; + pInfo->pMiscInfo->acctOpt = *pAcctInfo; assert(pName != NULL); - pInfo->pDCLInfo->user.user = *pName; + pInfo->pMiscInfo->user.user = *pName; if (pPwd != NULL) { - pInfo->pDCLInfo->user.passwd = *pPwd; + pInfo->pMiscInfo->user.passwd = *pPwd; } } void setCreateUserSql(SSqlInfo *pInfo, SStrToken *pName, SStrToken *pPasswd) { pInfo->type = TSDB_SQL_CREATE_USER; - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } assert(pName != NULL && pPasswd != NULL); - pInfo->pDCLInfo->user.user = *pName; - pInfo->pDCLInfo->user.passwd = *pPasswd; + pInfo->pMiscInfo->user.user = *pName; + pInfo->pMiscInfo->user.passwd = *pPasswd; } void setAlterUserSql(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken* pPwd, SStrToken *pPrivilege) { pInfo->type = TSDB_SQL_ALTER_USER; - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } assert(pName != NULL); - SUserInfo* pUser = &pInfo->pDCLInfo->user; + SUserInfo* pUser = &pInfo->pMiscInfo->user; pUser->type = type; pUser->user = *pName; @@ -828,18 +819,17 @@ void setAlterUserSql(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken* } } -void setKillSql(SSqlInfo *pInfo, int32_t type, SStrToken *ip) { +void setKillSql(SSqlInfo *pInfo, int32_t type, SStrToken *id) { pInfo->type = type; - if (pInfo->pDCLInfo == NULL) { - pInfo->pDCLInfo = calloc(1, sizeof(tDCLSQL)); + if (pInfo->pMiscInfo == NULL) { + pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); } - assert(ip != NULL); - - pInfo->pDCLInfo->ip = *ip; + assert(id != NULL); + pInfo->pMiscInfo->id = *id; } -void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) { +void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo) { pDBInfo->compressionLevel = -1; pDBInfo->walLevel = -1; diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 0f03499974..cc5d6c0b4a 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -23,7 +23,6 @@ ** input grammar file: */ #include -#include /************ Begin %include sections from the grammar ************************/ #include @@ -77,10 +76,8 @@ ** zero the stack is dynamically sized using realloc() ** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument -** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter ** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser -** ParseCTX_* As ParseARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -100,45 +97,38 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 278 +#define YYNOCODE 280 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SStrToken typedef union { int yyinit; ParseTOKENTYPE yy0; + SQuerySQL* yy30; SCreateTableSQL* yy38; - SCreateAcctSQL yy71; - tSQLExpr* yy78; - int yy96; - SQuerySQL* yy148; - SCreatedTableInfo yy152; + SCreatedTableInfo yy78; + SLimitVal yy126; + int yy130; + SArray* yy135; SSubclauseInfo* yy153; - tSQLExprList* yy166; - SLimitVal yy167; - TAOS_FIELD yy183; - SCreateDBInfo yy234; - int64_t yy325; - SIntervalVal yy400; - SArray* yy421; - tVariant yy430; + SIntervalVal yy160; + TAOS_FIELD yy181; + SCreateDbInfo yy256; + tSQLExprList* yy266; + SCreateAcctInfo yy277; + tVariant yy308; + tSQLExpr* yy316; + int64_t yy531; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_PDECL ,SSqlInfo* pInfo -#define ParseARG_PARAM ,pInfo -#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo; -#define ParseARG_STORE yypParser->pInfo=pInfo; -#define ParseCTX_SDECL -#define ParseCTX_PDECL -#define ParseCTX_PARAM -#define ParseCTX_FETCH -#define ParseCTX_STORE +#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo +#define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 #define YYNSTATE 282 #define YYNRULE 248 -#define YYNRULE_WITH_ACTION 248 #define YYNTOKEN 209 #define YY_MAX_SHIFT 281 #define YY_MIN_SHIFTREDUCE 461 @@ -149,7 +139,6 @@ typedef union { #define YY_MIN_REDUCE 712 #define YY_MAX_REDUCE 959 /************* End control #defines *******************************************/ -#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. @@ -214,15 +203,15 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (623) +#define YY_ACTTAB_COUNT (622) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 158, 505, 158, 710, 281, 857, 659, 578, 182, 506, - /* 10 */ 941, 185, 942, 41, 42, 15, 43, 44, 26, 179, + /* 0 */ 158, 505, 158, 710, 281, 857, 15, 578, 182, 506, + /* 10 */ 941, 185, 942, 41, 42, 157, 43, 44, 26, 179, /* 20 */ 190, 35, 505, 505, 231, 47, 45, 49, 46, 868, /* 30 */ 506, 506, 846, 40, 39, 256, 255, 38, 37, 36, - /* 40 */ 41, 42, 660, 43, 44, 857, 951, 190, 35, 178, + /* 40 */ 41, 42, 162, 43, 44, 857, 951, 190, 35, 178, /* 50 */ 279, 231, 47, 45, 49, 46, 180, 195, 843, 214, - /* 60 */ 40, 39, 157, 61, 38, 37, 36, 462, 463, 464, + /* 60 */ 40, 39, 938, 61, 38, 37, 36, 462, 463, 464, /* 70 */ 465, 466, 467, 468, 469, 470, 471, 472, 473, 280, /* 80 */ 198, 846, 204, 41, 42, 865, 43, 44, 246, 266, /* 90 */ 190, 35, 158, 834, 231, 47, 45, 49, 46, 122, @@ -231,149 +220,149 @@ static const YYACTIONTYPE yy_action[] = { /* 120 */ 270, 269, 239, 268, 267, 38, 37, 36, 813, 657, /* 130 */ 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, /* 140 */ 811, 812, 814, 815, 42, 200, 43, 44, 253, 252, - /* 150 */ 190, 35, 835, 275, 231, 47, 45, 49, 46, 228, + /* 150 */ 190, 35, 937, 275, 231, 47, 45, 49, 46, 228, /* 160 */ 895, 66, 226, 40, 39, 115, 894, 38, 37, 36, /* 170 */ 26, 43, 44, 32, 26, 190, 35, 846, 207, 231, - /* 180 */ 47, 45, 49, 46, 26, 211, 210, 162, 40, 39, - /* 190 */ 196, 845, 38, 37, 36, 189, 670, 117, 938, 661, - /* 200 */ 71, 664, 26, 667, 122, 189, 670, 188, 193, 661, - /* 210 */ 843, 664, 194, 667, 843, 189, 670, 16, 21, 661, - /* 220 */ 90, 664, 249, 667, 843, 266, 32, 186, 187, 246, - /* 230 */ 26, 230, 837, 166, 278, 277, 109, 186, 187, 167, - /* 240 */ 250, 615, 843, 199, 102, 101, 165, 186, 187, 4, - /* 250 */ 20, 26, 274, 273, 219, 197, 26, 272, 248, 271, - /* 260 */ 270, 269, 10, 268, 267, 67, 70, 132, 254, 819, - /* 270 */ 843, 217, 817, 818, 21, 844, 27, 820, 905, 822, + /* 180 */ 47, 45, 49, 46, 26, 211, 210, 754, 40, 39, + /* 190 */ 146, 845, 38, 37, 36, 189, 670, 117, 835, 661, + /* 200 */ 71, 664, 26, 667, 763, 189, 670, 146, 193, 661, + /* 210 */ 843, 664, 194, 667, 843, 189, 670, 16, 26, 661, + /* 220 */ 936, 664, 249, 667, 843, 10, 21, 186, 187, 70, + /* 230 */ 132, 230, 837, 166, 32, 196, 69, 186, 187, 167, + /* 240 */ 250, 615, 843, 122, 102, 101, 165, 186, 187, 174, + /* 250 */ 20, 26, 274, 273, 219, 905, 254, 272, 843, 271, + /* 260 */ 270, 269, 607, 268, 267, 832, 833, 25, 836, 819, + /* 270 */ 216, 90, 817, 818, 21, 246, 266, 820, 68, 822, /* 280 */ 823, 821, 32, 824, 825, 47, 45, 49, 46, 258, - /* 290 */ 663, 843, 666, 40, 39, 48, 842, 38, 37, 36, - /* 300 */ 754, 232, 213, 146, 69, 48, 904, 669, 763, 173, - /* 310 */ 755, 146, 68, 146, 662, 48, 665, 669, 599, 638, - /* 320 */ 639, 596, 668, 597, 33, 598, 612, 669, 603, 607, - /* 330 */ 604, 22, 668, 832, 833, 25, 836, 216, 625, 88, - /* 340 */ 92, 937, 668, 119, 936, 82, 97, 100, 91, 201, - /* 350 */ 202, 191, 588, 629, 94, 3, 136, 27, 52, 152, - /* 360 */ 148, 29, 77, 73, 76, 150, 105, 104, 103, 40, - /* 370 */ 39, 630, 689, 38, 37, 36, 18, 17, 671, 53, - /* 380 */ 56, 174, 234, 17, 589, 81, 80, 27, 175, 52, - /* 390 */ 12, 11, 99, 98, 673, 87, 86, 57, 54, 160, - /* 400 */ 59, 161, 577, 14, 13, 163, 601, 164, 602, 114, - /* 410 */ 112, 170, 171, 901, 169, 900, 156, 168, 159, 192, - /* 420 */ 257, 116, 867, 859, 600, 872, 32, 874, 118, 133, - /* 430 */ 887, 886, 131, 134, 135, 765, 238, 154, 30, 215, - /* 440 */ 247, 762, 956, 78, 955, 953, 137, 251, 113, 950, - /* 450 */ 84, 949, 947, 138, 783, 31, 28, 155, 752, 93, - /* 460 */ 750, 95, 624, 220, 96, 181, 748, 747, 203, 147, - /* 470 */ 58, 745, 224, 744, 743, 856, 742, 741, 149, 151, - /* 480 */ 738, 55, 50, 123, 229, 227, 736, 734, 225, 732, - /* 490 */ 223, 730, 221, 153, 89, 34, 218, 63, 259, 260, - /* 500 */ 64, 888, 261, 262, 263, 264, 265, 276, 708, 176, - /* 510 */ 205, 206, 707, 208, 236, 237, 209, 177, 172, 706, - /* 520 */ 74, 694, 212, 216, 609, 746, 60, 106, 233, 6, - /* 530 */ 120, 141, 140, 784, 139, 142, 143, 740, 144, 145, - /* 540 */ 107, 739, 2, 108, 841, 731, 65, 626, 1, 129, - /* 550 */ 126, 124, 125, 183, 127, 128, 130, 222, 7, 631, - /* 560 */ 121, 23, 24, 672, 8, 5, 674, 9, 19, 235, - /* 570 */ 72, 546, 542, 70, 540, 539, 538, 535, 509, 245, - /* 580 */ 79, 27, 75, 580, 51, 83, 85, 579, 576, 530, - /* 590 */ 528, 520, 526, 522, 524, 518, 516, 548, 547, 545, - /* 600 */ 544, 543, 541, 537, 536, 52, 507, 477, 475, 712, - /* 610 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, - /* 620 */ 711, 110, 111, + /* 290 */ 33, 843, 199, 40, 39, 48, 26, 38, 37, 36, + /* 300 */ 197, 217, 213, 248, 67, 48, 27, 669, 659, 173, + /* 310 */ 278, 277, 109, 755, 232, 48, 146, 669, 599, 638, + /* 320 */ 639, 596, 668, 597, 844, 598, 612, 669, 175, 40, + /* 330 */ 39, 22, 668, 38, 37, 36, 842, 160, 625, 88, + /* 340 */ 92, 188, 668, 119, 660, 82, 97, 100, 91, 201, + /* 350 */ 202, 99, 98, 629, 94, 3, 136, 161, 52, 152, + /* 360 */ 148, 29, 77, 73, 76, 150, 105, 104, 103, 630, + /* 370 */ 689, 671, 53, 56, 18, 17, 17, 663, 163, 666, + /* 380 */ 662, 588, 665, 4, 81, 80, 27, 234, 589, 164, + /* 390 */ 57, 54, 27, 52, 12, 11, 87, 86, 59, 603, + /* 400 */ 577, 604, 14, 13, 601, 170, 602, 673, 114, 112, + /* 410 */ 171, 169, 156, 168, 159, 859, 904, 191, 901, 116, + /* 420 */ 900, 192, 257, 867, 600, 872, 874, 887, 118, 886, + /* 430 */ 133, 134, 32, 131, 135, 765, 238, 154, 30, 247, + /* 440 */ 762, 956, 78, 955, 953, 137, 251, 950, 84, 113, + /* 450 */ 949, 947, 138, 783, 31, 28, 155, 752, 93, 750, + /* 460 */ 215, 95, 96, 748, 624, 58, 747, 203, 147, 745, + /* 470 */ 744, 743, 742, 220, 741, 55, 149, 50, 181, 229, + /* 480 */ 224, 856, 227, 124, 151, 738, 736, 734, 732, 730, + /* 490 */ 225, 223, 221, 153, 34, 218, 89, 63, 64, 259, + /* 500 */ 260, 888, 261, 262, 264, 263, 265, 276, 708, 205, + /* 510 */ 206, 707, 208, 209, 706, 176, 236, 237, 694, 177, + /* 520 */ 172, 212, 74, 216, 65, 609, 746, 60, 233, 106, + /* 530 */ 6, 183, 740, 141, 107, 140, 784, 139, 142, 144, + /* 540 */ 143, 145, 739, 1, 108, 841, 731, 2, 626, 129, + /* 550 */ 127, 125, 123, 126, 128, 120, 222, 130, 631, 121, + /* 560 */ 23, 7, 8, 672, 24, 5, 9, 674, 19, 72, + /* 570 */ 235, 546, 542, 70, 540, 539, 538, 535, 509, 245, + /* 580 */ 79, 75, 27, 83, 51, 580, 579, 576, 530, 528, + /* 590 */ 520, 526, 522, 85, 524, 518, 516, 548, 547, 545, + /* 600 */ 544, 543, 541, 537, 536, 52, 507, 477, 475, 110, + /* 610 */ 712, 711, 711, 711, 711, 711, 711, 711, 711, 711, + /* 620 */ 711, 111, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 267, 1, 267, 209, 210, 251, 1, 5, 229, 9, - /* 10 */ 277, 276, 277, 13, 14, 267, 16, 17, 212, 265, - /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 212, - /* 30 */ 9, 9, 253, 33, 34, 33, 34, 37, 38, 39, - /* 40 */ 13, 14, 37, 16, 17, 251, 253, 20, 21, 211, - /* 50 */ 212, 24, 25, 26, 27, 28, 250, 229, 252, 265, - /* 60 */ 33, 34, 267, 217, 37, 38, 39, 45, 46, 47, + /* 0 */ 268, 1, 268, 210, 211, 252, 268, 5, 230, 9, + /* 10 */ 278, 277, 278, 13, 14, 268, 16, 17, 213, 266, + /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 213, + /* 30 */ 9, 9, 254, 33, 34, 33, 34, 37, 38, 39, + /* 40 */ 13, 14, 268, 16, 17, 252, 254, 20, 21, 212, + /* 50 */ 213, 24, 25, 26, 27, 28, 251, 230, 253, 266, + /* 60 */ 33, 34, 268, 218, 37, 38, 39, 45, 46, 47, /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 66, 253, 60, 13, 14, 268, 16, 17, 77, 79, - /* 90 */ 20, 21, 267, 247, 24, 25, 26, 27, 28, 212, - /* 100 */ 212, 276, 277, 33, 34, 212, 106, 37, 38, 39, + /* 80 */ 66, 254, 60, 13, 14, 269, 16, 17, 77, 79, + /* 90 */ 20, 21, 268, 248, 24, 25, 26, 27, 28, 213, + /* 100 */ 213, 277, 278, 33, 34, 213, 106, 37, 38, 39, /* 110 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 120 */ 96, 97, 98, 99, 100, 37, 38, 39, 228, 102, - /* 130 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 140 */ 240, 241, 242, 243, 14, 131, 16, 17, 134, 135, - /* 150 */ 20, 21, 0, 229, 24, 25, 26, 27, 28, 271, - /* 160 */ 273, 273, 275, 33, 34, 101, 273, 37, 38, 39, - /* 170 */ 212, 16, 17, 109, 212, 20, 21, 253, 130, 24, - /* 180 */ 25, 26, 27, 28, 212, 137, 138, 267, 33, 34, - /* 190 */ 66, 253, 37, 38, 39, 1, 2, 212, 267, 5, - /* 200 */ 217, 7, 212, 9, 212, 1, 2, 59, 250, 5, - /* 210 */ 252, 7, 250, 9, 252, 1, 2, 44, 101, 5, - /* 220 */ 74, 7, 250, 9, 252, 79, 109, 33, 34, 77, - /* 230 */ 212, 37, 249, 60, 63, 64, 65, 33, 34, 66, - /* 240 */ 250, 37, 252, 212, 71, 72, 73, 33, 34, 101, - /* 250 */ 86, 212, 88, 89, 269, 131, 212, 93, 134, 95, - /* 260 */ 96, 97, 101, 99, 100, 273, 105, 106, 250, 228, - /* 270 */ 252, 102, 231, 232, 101, 244, 107, 236, 245, 238, - /* 280 */ 239, 240, 109, 242, 243, 25, 26, 27, 28, 250, - /* 290 */ 5, 252, 7, 33, 34, 101, 252, 37, 38, 39, - /* 300 */ 216, 15, 129, 219, 217, 101, 245, 113, 216, 136, - /* 310 */ 216, 219, 254, 219, 5, 101, 7, 113, 2, 119, - /* 320 */ 120, 5, 128, 7, 266, 9, 107, 113, 5, 102, - /* 330 */ 7, 112, 128, 246, 247, 248, 249, 110, 102, 61, - /* 340 */ 62, 267, 128, 107, 267, 67, 68, 69, 70, 33, - /* 350 */ 34, 245, 102, 102, 76, 61, 62, 107, 107, 61, - /* 360 */ 62, 67, 68, 69, 70, 67, 68, 69, 70, 33, - /* 370 */ 34, 102, 102, 37, 38, 39, 107, 107, 102, 107, - /* 380 */ 107, 267, 102, 107, 102, 132, 133, 107, 267, 107, - /* 390 */ 132, 133, 74, 75, 108, 132, 133, 124, 126, 267, - /* 400 */ 101, 267, 103, 132, 133, 267, 5, 267, 7, 61, - /* 410 */ 62, 267, 267, 245, 267, 245, 267, 267, 267, 245, - /* 420 */ 245, 212, 212, 251, 108, 212, 109, 212, 212, 212, - /* 430 */ 274, 274, 255, 212, 212, 212, 212, 212, 212, 251, - /* 440 */ 212, 212, 212, 212, 212, 212, 212, 212, 59, 212, - /* 450 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, - /* 460 */ 212, 212, 113, 270, 212, 270, 212, 212, 212, 212, - /* 470 */ 123, 212, 270, 212, 212, 264, 212, 212, 212, 212, - /* 480 */ 212, 125, 122, 263, 117, 121, 212, 212, 116, 212, - /* 490 */ 115, 212, 114, 212, 85, 127, 213, 213, 84, 49, - /* 500 */ 213, 213, 81, 83, 53, 82, 80, 77, 5, 213, - /* 510 */ 139, 5, 5, 139, 213, 213, 5, 213, 213, 5, - /* 520 */ 217, 87, 130, 110, 102, 213, 111, 214, 104, 101, - /* 530 */ 101, 221, 225, 227, 226, 224, 222, 213, 223, 220, - /* 540 */ 214, 213, 215, 214, 251, 213, 107, 102, 218, 257, - /* 550 */ 260, 262, 261, 1, 259, 258, 256, 101, 118, 102, - /* 560 */ 101, 107, 107, 102, 118, 101, 108, 101, 101, 104, - /* 570 */ 74, 9, 5, 105, 5, 5, 5, 5, 78, 15, - /* 580 */ 133, 107, 74, 5, 16, 133, 133, 5, 102, 5, - /* 590 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 600 */ 5, 5, 5, 5, 5, 107, 78, 59, 58, 0, - /* 610 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 620 */ 278, 21, 21, 278, 278, 278, 278, 278, 278, 278, - /* 630 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 640 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 650 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 660 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 670 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 680 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 690 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 700 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 710 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 720 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 730 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 740 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 750 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 770 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 790 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 800 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 810 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 820 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 830 */ 278, 278, + /* 120 */ 96, 97, 98, 99, 100, 37, 38, 39, 229, 102, + /* 130 */ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + /* 140 */ 241, 242, 243, 244, 14, 131, 16, 17, 134, 135, + /* 150 */ 20, 21, 268, 230, 24, 25, 26, 27, 28, 272, + /* 160 */ 274, 274, 276, 33, 34, 101, 274, 37, 38, 39, + /* 170 */ 213, 16, 17, 109, 213, 20, 21, 254, 130, 24, + /* 180 */ 25, 26, 27, 28, 213, 137, 138, 217, 33, 34, + /* 190 */ 220, 254, 37, 38, 39, 1, 2, 213, 0, 5, + /* 200 */ 218, 7, 213, 9, 217, 1, 2, 220, 251, 5, + /* 210 */ 253, 7, 251, 9, 253, 1, 2, 44, 213, 5, + /* 220 */ 268, 7, 251, 9, 253, 101, 101, 33, 34, 105, + /* 230 */ 106, 37, 250, 60, 109, 66, 218, 33, 34, 66, + /* 240 */ 251, 37, 253, 213, 71, 72, 73, 33, 34, 268, + /* 250 */ 86, 213, 88, 89, 270, 246, 251, 93, 253, 95, + /* 260 */ 96, 97, 102, 99, 100, 247, 248, 249, 250, 229, + /* 270 */ 110, 74, 232, 233, 101, 77, 79, 237, 255, 239, + /* 280 */ 240, 241, 109, 243, 244, 25, 26, 27, 28, 251, + /* 290 */ 267, 253, 213, 33, 34, 101, 213, 37, 38, 39, + /* 300 */ 131, 102, 129, 134, 274, 101, 107, 113, 1, 136, + /* 310 */ 63, 64, 65, 217, 15, 101, 220, 113, 2, 119, + /* 320 */ 120, 5, 128, 7, 245, 9, 107, 113, 268, 33, + /* 330 */ 34, 112, 128, 37, 38, 39, 253, 268, 102, 61, + /* 340 */ 62, 59, 128, 107, 37, 67, 68, 69, 70, 33, + /* 350 */ 34, 74, 75, 102, 76, 61, 62, 268, 107, 61, + /* 360 */ 62, 67, 68, 69, 70, 67, 68, 69, 70, 102, + /* 370 */ 102, 102, 107, 107, 107, 107, 107, 5, 268, 7, + /* 380 */ 5, 102, 7, 101, 132, 133, 107, 102, 102, 268, + /* 390 */ 124, 126, 107, 107, 132, 133, 132, 133, 101, 5, + /* 400 */ 103, 7, 132, 133, 5, 268, 7, 108, 61, 62, + /* 410 */ 268, 268, 268, 268, 268, 252, 246, 246, 246, 213, + /* 420 */ 246, 246, 246, 213, 108, 213, 213, 275, 213, 275, + /* 430 */ 213, 213, 109, 256, 213, 213, 213, 213, 213, 213, + /* 440 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 59, + /* 450 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, + /* 460 */ 252, 213, 213, 213, 113, 123, 213, 213, 213, 213, + /* 470 */ 213, 213, 213, 271, 213, 125, 213, 122, 271, 117, + /* 480 */ 271, 265, 121, 263, 213, 213, 213, 213, 213, 213, + /* 490 */ 116, 115, 114, 213, 127, 214, 85, 214, 214, 84, + /* 500 */ 49, 214, 81, 83, 82, 53, 80, 77, 5, 139, + /* 510 */ 5, 5, 139, 5, 5, 214, 214, 214, 87, 214, + /* 520 */ 214, 130, 218, 110, 107, 102, 214, 111, 104, 215, + /* 530 */ 101, 1, 214, 222, 215, 226, 228, 227, 225, 224, + /* 540 */ 223, 221, 214, 219, 215, 252, 214, 216, 102, 258, + /* 550 */ 260, 262, 264, 261, 259, 101, 101, 257, 102, 101, + /* 560 */ 107, 118, 118, 102, 107, 101, 101, 108, 101, 74, + /* 570 */ 104, 9, 5, 105, 5, 5, 5, 5, 78, 15, + /* 580 */ 133, 74, 107, 133, 16, 5, 5, 102, 5, 5, + /* 590 */ 5, 5, 5, 133, 5, 5, 5, 5, 5, 5, + /* 600 */ 5, 5, 5, 5, 5, 107, 78, 59, 58, 21, + /* 610 */ 0, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 620 */ 279, 21, 279, 279, 279, 279, 279, 279, 279, 279, + /* 630 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 640 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 650 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 660 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 670 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 680 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 690 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 700 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 710 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 720 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 730 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 740 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 750 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 760 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 770 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 780 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 790 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 800 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 810 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 820 */ 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, + /* 830 */ 279, }; #define YY_SHIFT_COUNT (281) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (609) +#define YY_SHIFT_MAX (610) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 173, 24, 164, 11, 194, 214, 21, 21, 21, 21, /* 10 */ 21, 21, 21, 21, 21, 0, 22, 214, 316, 316, - /* 20 */ 316, 117, 21, 21, 21, 152, 21, 21, 146, 11, - /* 30 */ 10, 10, 623, 204, 214, 214, 214, 214, 214, 214, + /* 20 */ 316, 125, 21, 21, 21, 198, 21, 21, 197, 11, + /* 30 */ 10, 10, 622, 204, 214, 214, 214, 214, 214, 214, /* 40 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, /* 50 */ 214, 316, 316, 2, 2, 2, 2, 2, 2, 2, /* 60 */ 64, 21, 21, 21, 21, 21, 200, 200, 219, 21, @@ -381,45 +370,45 @@ static const unsigned short int yy_shift_ofst[] = { /* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 90 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* 100 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - /* 110 */ 21, 21, 21, 21, 21, 317, 389, 389, 389, 349, - /* 120 */ 349, 349, 389, 347, 356, 360, 367, 364, 372, 375, - /* 130 */ 378, 368, 317, 389, 389, 389, 11, 389, 389, 409, - /* 140 */ 414, 450, 421, 420, 451, 423, 426, 389, 430, 389, - /* 150 */ 430, 389, 430, 389, 623, 623, 27, 70, 70, 70, - /* 160 */ 130, 155, 260, 260, 260, 278, 294, 298, 336, 336, - /* 170 */ 336, 336, 14, 48, 88, 88, 161, 124, 171, 227, - /* 180 */ 169, 236, 251, 269, 270, 276, 285, 309, 5, 148, - /* 190 */ 286, 272, 273, 250, 280, 282, 253, 258, 263, 299, - /* 200 */ 271, 323, 401, 318, 348, 503, 371, 506, 507, 374, - /* 210 */ 511, 514, 434, 392, 413, 422, 415, 424, 428, 439, - /* 220 */ 445, 429, 552, 456, 457, 459, 454, 440, 455, 446, - /* 230 */ 461, 464, 458, 466, 424, 467, 465, 468, 496, 562, - /* 240 */ 567, 569, 570, 571, 572, 500, 564, 508, 447, 474, - /* 250 */ 474, 568, 452, 453, 474, 578, 582, 486, 474, 584, - /* 260 */ 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, - /* 270 */ 595, 596, 597, 598, 599, 498, 528, 600, 601, 548, - /* 280 */ 550, 609, + /* 110 */ 21, 21, 21, 21, 21, 323, 390, 390, 390, 351, + /* 120 */ 351, 351, 390, 342, 350, 355, 362, 361, 374, 376, + /* 130 */ 378, 367, 323, 390, 390, 390, 11, 390, 390, 411, + /* 140 */ 415, 451, 421, 420, 452, 422, 426, 390, 430, 390, + /* 150 */ 430, 390, 430, 390, 622, 622, 27, 70, 70, 70, + /* 160 */ 130, 155, 260, 260, 260, 278, 294, 298, 296, 296, + /* 170 */ 296, 296, 14, 48, 88, 88, 124, 169, 247, 160, + /* 180 */ 199, 236, 251, 267, 268, 269, 372, 375, 307, 282, + /* 190 */ 299, 265, 266, 279, 285, 286, 252, 262, 264, 297, + /* 200 */ 270, 394, 399, 277, 347, 503, 370, 505, 506, 373, + /* 210 */ 508, 509, 431, 391, 413, 423, 416, 424, 429, 417, + /* 220 */ 446, 454, 530, 455, 456, 458, 453, 443, 457, 444, + /* 230 */ 461, 464, 459, 465, 424, 467, 466, 468, 495, 562, + /* 240 */ 567, 569, 570, 571, 572, 500, 564, 507, 447, 475, + /* 250 */ 475, 568, 450, 460, 475, 580, 581, 485, 475, 583, + /* 260 */ 584, 585, 586, 587, 589, 590, 591, 592, 593, 594, + /* 270 */ 595, 596, 597, 598, 599, 498, 528, 588, 600, 548, + /* 280 */ 550, 610, }; #define YY_REDUCE_COUNT (155) -#define YY_REDUCE_MIN (-267) +#define YY_REDUCE_MIN (-268) #define YY_REDUCE_MAX (332) static const short yy_reduce_ofst[] = { - /* 0 */ -206, -100, 41, 87, -265, -175, -194, -113, -112, -42, - /* 10 */ -38, -28, -10, 18, 39, -183, -162, -267, -221, -172, - /* 20 */ -76, -246, -15, -107, -8, -17, 31, 44, 84, -154, - /* 30 */ 92, 94, 58, -252, -205, -80, -69, 74, 77, 114, - /* 40 */ 121, 132, 134, 138, 140, 144, 145, 147, 149, 150, - /* 50 */ 151, -207, -62, 33, 61, 106, 168, 170, 174, 175, - /* 60 */ 172, 209, 210, 213, 215, 216, 156, 157, 177, 217, - /* 70 */ 221, 222, 223, 224, 225, 226, 228, 229, 230, 231, - /* 80 */ 232, 233, 234, 235, 237, 238, 239, 240, 241, 242, - /* 90 */ 243, 244, 245, 246, 247, 248, 249, 252, 254, 255, - /* 100 */ 256, 257, 259, 261, 262, 264, 265, 266, 267, 268, - /* 110 */ 274, 275, 277, 279, 281, 188, 283, 284, 287, 193, - /* 120 */ 195, 202, 288, 211, 220, 289, 291, 290, 295, 297, - /* 130 */ 292, 300, 293, 296, 301, 302, 303, 304, 305, 306, - /* 140 */ 308, 307, 310, 311, 314, 315, 319, 312, 313, 324, - /* 150 */ 326, 328, 329, 332, 330, 327, + /* 0 */ -207, -101, 40, 18, -266, -176, -195, -114, -113, -43, + /* 10 */ -39, -29, -11, 5, 38, -184, -163, -268, -222, -173, + /* 20 */ -77, -247, -16, -108, 30, -18, 79, 83, -30, -155, + /* 30 */ -13, 96, 23, -262, -253, -226, -206, -116, -48, -19, + /* 40 */ 60, 69, 89, 110, 121, 137, 142, 143, 144, 145, + /* 50 */ 146, -208, -63, 9, 170, 171, 172, 174, 175, 176, + /* 60 */ 163, 206, 210, 212, 213, 215, 152, 154, 177, 217, + /* 70 */ 218, 221, 222, 223, 224, 225, 226, 227, 228, 229, + /* 80 */ 230, 231, 232, 233, 234, 235, 237, 238, 239, 240, + /* 90 */ 241, 242, 243, 244, 245, 246, 248, 249, 250, 253, + /* 100 */ 254, 255, 256, 257, 258, 259, 261, 263, 271, 272, + /* 110 */ 273, 274, 275, 276, 280, 208, 281, 283, 284, 202, + /* 120 */ 207, 209, 287, 216, 288, 220, 289, 292, 290, 295, + /* 130 */ 291, 300, 293, 301, 302, 303, 304, 305, 306, 308, + /* 140 */ 310, 309, 311, 313, 317, 315, 320, 312, 314, 318, + /* 150 */ 319, 328, 329, 332, 324, 331, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 709, 764, 753, 761, 944, 944, 709, 709, 709, 709, @@ -718,7 +707,6 @@ struct yyParser { int yyerrcnt; /* Shifts left before out of the error */ #endif ParseARG_SDECL /* A place to hold %extra_argument */ - ParseCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ @@ -975,75 +963,76 @@ static const char *const yyTokenName[] = { /* 206 */ "INSERT", /* 207 */ "INTO", /* 208 */ "VALUES", - /* 209 */ "program", - /* 210 */ "cmd", - /* 211 */ "dbPrefix", - /* 212 */ "ids", - /* 213 */ "cpxName", - /* 214 */ "ifexists", - /* 215 */ "alter_db_optr", - /* 216 */ "acct_optr", - /* 217 */ "ifnotexists", - /* 218 */ "db_optr", - /* 219 */ "pps", - /* 220 */ "tseries", - /* 221 */ "dbs", - /* 222 */ "streams", - /* 223 */ "storage", - /* 224 */ "qtime", - /* 225 */ "users", - /* 226 */ "conns", - /* 227 */ "state", - /* 228 */ "keep", - /* 229 */ "tagitemlist", - /* 230 */ "cache", - /* 231 */ "replica", - /* 232 */ "quorum", - /* 233 */ "days", - /* 234 */ "minrows", - /* 235 */ "maxrows", - /* 236 */ "blocks", - /* 237 */ "ctime", - /* 238 */ "wal", - /* 239 */ "fsync", - /* 240 */ "comp", - /* 241 */ "prec", - /* 242 */ "update", - /* 243 */ "cachelast", - /* 244 */ "typename", - /* 245 */ "signed", - /* 246 */ "create_table_args", - /* 247 */ "create_stable_args", - /* 248 */ "create_table_list", - /* 249 */ "create_from_stable", - /* 250 */ "columnlist", - /* 251 */ "select", - /* 252 */ "column", - /* 253 */ "tagitem", - /* 254 */ "selcollist", - /* 255 */ "from", - /* 256 */ "where_opt", - /* 257 */ "interval_opt", - /* 258 */ "fill_opt", - /* 259 */ "sliding_opt", - /* 260 */ "groupby_opt", - /* 261 */ "orderby_opt", - /* 262 */ "having_opt", - /* 263 */ "slimit_opt", - /* 264 */ "limit_opt", - /* 265 */ "union", - /* 266 */ "sclp", - /* 267 */ "expr", - /* 268 */ "as", - /* 269 */ "tablelist", - /* 270 */ "tmvar", - /* 271 */ "sortlist", - /* 272 */ "sortitem", - /* 273 */ "item", - /* 274 */ "sortorder", - /* 275 */ "grouplist", - /* 276 */ "exprlist", - /* 277 */ "expritem", + /* 209 */ "error", + /* 210 */ "program", + /* 211 */ "cmd", + /* 212 */ "dbPrefix", + /* 213 */ "ids", + /* 214 */ "cpxName", + /* 215 */ "ifexists", + /* 216 */ "alter_db_optr", + /* 217 */ "acct_optr", + /* 218 */ "ifnotexists", + /* 219 */ "db_optr", + /* 220 */ "pps", + /* 221 */ "tseries", + /* 222 */ "dbs", + /* 223 */ "streams", + /* 224 */ "storage", + /* 225 */ "qtime", + /* 226 */ "users", + /* 227 */ "conns", + /* 228 */ "state", + /* 229 */ "keep", + /* 230 */ "tagitemlist", + /* 231 */ "cache", + /* 232 */ "replica", + /* 233 */ "quorum", + /* 234 */ "days", + /* 235 */ "minrows", + /* 236 */ "maxrows", + /* 237 */ "blocks", + /* 238 */ "ctime", + /* 239 */ "wal", + /* 240 */ "fsync", + /* 241 */ "comp", + /* 242 */ "prec", + /* 243 */ "update", + /* 244 */ "cachelast", + /* 245 */ "typename", + /* 246 */ "signed", + /* 247 */ "create_table_args", + /* 248 */ "create_stable_args", + /* 249 */ "create_table_list", + /* 250 */ "create_from_stable", + /* 251 */ "columnlist", + /* 252 */ "select", + /* 253 */ "column", + /* 254 */ "tagitem", + /* 255 */ "selcollist", + /* 256 */ "from", + /* 257 */ "where_opt", + /* 258 */ "interval_opt", + /* 259 */ "fill_opt", + /* 260 */ "sliding_opt", + /* 261 */ "groupby_opt", + /* 262 */ "orderby_opt", + /* 263 */ "having_opt", + /* 264 */ "slimit_opt", + /* 265 */ "limit_opt", + /* 266 */ "union", + /* 267 */ "sclp", + /* 268 */ "expr", + /* 269 */ "as", + /* 270 */ "tablelist", + /* 271 */ "tmvar", + /* 272 */ "sortlist", + /* 273 */ "sortitem", + /* 274 */ "item", + /* 275 */ "sortorder", + /* 276 */ "grouplist", + /* 277 */ "exprlist", + /* 278 */ "expritem", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1347,29 +1336,28 @@ static int yyGrowStack(yyParser *p){ /* Initialize a new parser that has already been allocated. */ -void ParseInit(void *yypRawParser ParseCTX_PDECL){ - yyParser *yypParser = (yyParser*)yypRawParser; - ParseCTX_STORE +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; #ifdef YYTRACKMAXSTACKDEPTH - yypParser->yyhwm = 0; + pParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 - yypParser->yytos = NULL; - yypParser->yystack = NULL; - yypParser->yystksz = 0; - if( yyGrowStack(yypParser) ){ - yypParser->yystack = &yypParser->yystk0; - yypParser->yystksz = 1; + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY - yypParser->yyerrcnt = -1; + pParser->yyerrcnt = -1; #endif - yypParser->yytos = yypParser->yystack; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; #endif } @@ -1386,14 +1374,11 @@ void ParseInit(void *yypRawParser ParseCTX_PDECL){ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ -void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ - yyParser *yypParser; - yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); - if( yypParser ){ - ParseCTX_STORE - ParseInit(yypParser ParseCTX_PARAM); - } - return (void*)yypParser; +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; } #endif /* Parse_ENGINEALWAYSONSTACK */ @@ -1410,8 +1395,7 @@ static void yy_destructor( YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen @@ -1424,51 +1408,51 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 228: /* keep */ - case 229: /* tagitemlist */ - case 250: /* columnlist */ - case 258: /* fill_opt */ - case 260: /* groupby_opt */ - case 261: /* orderby_opt */ - case 271: /* sortlist */ - case 275: /* grouplist */ + case 229: /* keep */ + case 230: /* tagitemlist */ + case 251: /* columnlist */ + case 259: /* fill_opt */ + case 261: /* groupby_opt */ + case 262: /* orderby_opt */ + case 272: /* sortlist */ + case 276: /* grouplist */ { -taosArrayDestroy((yypminor->yy421)); +taosArrayDestroy((yypminor->yy135)); } break; - case 248: /* create_table_list */ + case 249: /* create_table_list */ { destroyCreateTableSql((yypminor->yy38)); } break; - case 251: /* select */ + case 252: /* select */ { -doDestroyQuerySql((yypminor->yy148)); +doDestroyQuerySql((yypminor->yy30)); } break; - case 254: /* selcollist */ - case 266: /* sclp */ - case 276: /* exprlist */ + case 255: /* selcollist */ + case 267: /* sclp */ + case 277: /* exprlist */ { -tSqlExprListDestroy((yypminor->yy166)); +tSqlExprListDestroy((yypminor->yy266)); } break; - case 256: /* where_opt */ - case 262: /* having_opt */ - case 267: /* expr */ - case 277: /* expritem */ + case 257: /* where_opt */ + case 263: /* having_opt */ + case 268: /* expr */ + case 278: /* expritem */ { -tSqlExprDestroy((yypminor->yy78)); +tSqlExprDestroy((yypminor->yy316)); } break; - case 265: /* union */ + case 266: /* union */ { destroyAllSelectClause((yypminor->yy153)); } break; - case 272: /* sortitem */ + case 273: /* sortitem */ { -tVariantDestroy(&(yypminor->yy430)); +tVariantDestroy(&(yypminor->yy308)); } break; /********* End destructor definitions *****************************************/ @@ -1580,12 +1564,13 @@ int ParseCoverage(FILE *out){ ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ -static YYACTIONTYPE yy_find_shift_action( - YYCODETYPE iLookAhead, /* The look-ahead token */ - YYACTIONTYPE stateno /* Current state number */ +static unsigned int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; - + int stateno = pParser->yytos->stateno; + if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) @@ -1593,19 +1578,15 @@ static YYACTIONTYPE yy_find_shift_action( #endif do{ i = yy_shift_ofst[stateno]; - assert( i>=0 ); - assert( i<=YY_ACTTAB_COUNT ); - assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); + assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); assert( iLookAhead!=YYNOCODE ); assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i<(int)YY_NLOOKAHEAD ); if( yy_lookahead[i]!=iLookAhead ){ #ifdef YYFALLBACK YYCODETYPE iFallback; /* Fallback token */ - assert( iLookAhead %s\n", @@ -1620,8 +1601,15 @@ static YYACTIONTYPE yy_find_shift_action( #ifdef YYWILDCARD { int j = i - iLookAhead + YYWILDCARD; - assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) ); - if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){ + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", @@ -1635,7 +1623,6 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && iyytos; - yytos->stateno = yyNewState; - yytos->major = yyMajor; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } -/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side -** of that rule */ -static const YYCODETYPE yyRuleInfoLhs[] = { - 209, /* (0) program ::= cmd */ - 210, /* (1) cmd ::= SHOW DATABASES */ - 210, /* (2) cmd ::= SHOW MNODES */ - 210, /* (3) cmd ::= SHOW DNODES */ - 210, /* (4) cmd ::= SHOW ACCOUNTS */ - 210, /* (5) cmd ::= SHOW USERS */ - 210, /* (6) cmd ::= SHOW MODULES */ - 210, /* (7) cmd ::= SHOW QUERIES */ - 210, /* (8) cmd ::= SHOW CONNECTIONS */ - 210, /* (9) cmd ::= SHOW STREAMS */ - 210, /* (10) cmd ::= SHOW VARIABLES */ - 210, /* (11) cmd ::= SHOW SCORES */ - 210, /* (12) cmd ::= SHOW GRANTS */ - 210, /* (13) cmd ::= SHOW VNODES */ - 210, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - 211, /* (15) dbPrefix ::= */ - 211, /* (16) dbPrefix ::= ids DOT */ - 213, /* (17) cpxName ::= */ - 213, /* (18) cpxName ::= DOT ids */ - 210, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ - 210, /* (20) cmd ::= SHOW CREATE DATABASE ids */ - 210, /* (21) cmd ::= SHOW dbPrefix TABLES */ - 210, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - 210, /* (23) cmd ::= SHOW dbPrefix STABLES */ - 210, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - 210, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ - 210, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ - 210, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ - 210, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */ - 210, /* (29) cmd ::= DROP DATABASE ifexists ids */ - 210, /* (30) cmd ::= DROP DNODE ids */ - 210, /* (31) cmd ::= DROP USER ids */ - 210, /* (32) cmd ::= DROP ACCOUNT ids */ - 210, /* (33) cmd ::= USE ids */ - 210, /* (34) cmd ::= DESCRIBE ids cpxName */ - 210, /* (35) cmd ::= ALTER USER ids PASS ids */ - 210, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */ - 210, /* (37) cmd ::= ALTER DNODE ids ids */ - 210, /* (38) cmd ::= ALTER DNODE ids ids ids */ - 210, /* (39) cmd ::= ALTER LOCAL ids */ - 210, /* (40) cmd ::= ALTER LOCAL ids ids */ - 210, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */ - 210, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */ - 210, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - 212, /* (44) ids ::= ID */ - 212, /* (45) ids ::= STRING */ - 214, /* (46) ifexists ::= IF EXISTS */ - 214, /* (47) ifexists ::= */ - 217, /* (48) ifnotexists ::= IF NOT EXISTS */ - 217, /* (49) ifnotexists ::= */ - 210, /* (50) cmd ::= CREATE DNODE ids */ - 210, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - 210, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - 210, /* (53) cmd ::= CREATE USER ids PASS ids */ - 219, /* (54) pps ::= */ - 219, /* (55) pps ::= PPS INTEGER */ - 220, /* (56) tseries ::= */ - 220, /* (57) tseries ::= TSERIES INTEGER */ - 221, /* (58) dbs ::= */ - 221, /* (59) dbs ::= DBS INTEGER */ - 222, /* (60) streams ::= */ - 222, /* (61) streams ::= STREAMS INTEGER */ - 223, /* (62) storage ::= */ - 223, /* (63) storage ::= STORAGE INTEGER */ - 224, /* (64) qtime ::= */ - 224, /* (65) qtime ::= QTIME INTEGER */ - 225, /* (66) users ::= */ - 225, /* (67) users ::= USERS INTEGER */ - 226, /* (68) conns ::= */ - 226, /* (69) conns ::= CONNS INTEGER */ - 227, /* (70) state ::= */ - 227, /* (71) state ::= STATE ids */ - 216, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - 228, /* (73) keep ::= KEEP tagitemlist */ - 230, /* (74) cache ::= CACHE INTEGER */ - 231, /* (75) replica ::= REPLICA INTEGER */ - 232, /* (76) quorum ::= QUORUM INTEGER */ - 233, /* (77) days ::= DAYS INTEGER */ - 234, /* (78) minrows ::= MINROWS INTEGER */ - 235, /* (79) maxrows ::= MAXROWS INTEGER */ - 236, /* (80) blocks ::= BLOCKS INTEGER */ - 237, /* (81) ctime ::= CTIME INTEGER */ - 238, /* (82) wal ::= WAL INTEGER */ - 239, /* (83) fsync ::= FSYNC INTEGER */ - 240, /* (84) comp ::= COMP INTEGER */ - 241, /* (85) prec ::= PRECISION STRING */ - 242, /* (86) update ::= UPDATE INTEGER */ - 243, /* (87) cachelast ::= CACHELAST INTEGER */ - 218, /* (88) db_optr ::= */ - 218, /* (89) db_optr ::= db_optr cache */ - 218, /* (90) db_optr ::= db_optr replica */ - 218, /* (91) db_optr ::= db_optr quorum */ - 218, /* (92) db_optr ::= db_optr days */ - 218, /* (93) db_optr ::= db_optr minrows */ - 218, /* (94) db_optr ::= db_optr maxrows */ - 218, /* (95) db_optr ::= db_optr blocks */ - 218, /* (96) db_optr ::= db_optr ctime */ - 218, /* (97) db_optr ::= db_optr wal */ - 218, /* (98) db_optr ::= db_optr fsync */ - 218, /* (99) db_optr ::= db_optr comp */ - 218, /* (100) db_optr ::= db_optr prec */ - 218, /* (101) db_optr ::= db_optr keep */ - 218, /* (102) db_optr ::= db_optr update */ - 218, /* (103) db_optr ::= db_optr cachelast */ - 215, /* (104) alter_db_optr ::= */ - 215, /* (105) alter_db_optr ::= alter_db_optr replica */ - 215, /* (106) alter_db_optr ::= alter_db_optr quorum */ - 215, /* (107) alter_db_optr ::= alter_db_optr keep */ - 215, /* (108) alter_db_optr ::= alter_db_optr blocks */ - 215, /* (109) alter_db_optr ::= alter_db_optr comp */ - 215, /* (110) alter_db_optr ::= alter_db_optr wal */ - 215, /* (111) alter_db_optr ::= alter_db_optr fsync */ - 215, /* (112) alter_db_optr ::= alter_db_optr update */ - 215, /* (113) alter_db_optr ::= alter_db_optr cachelast */ - 244, /* (114) typename ::= ids */ - 244, /* (115) typename ::= ids LP signed RP */ - 244, /* (116) typename ::= ids UNSIGNED */ - 245, /* (117) signed ::= INTEGER */ - 245, /* (118) signed ::= PLUS INTEGER */ - 245, /* (119) signed ::= MINUS INTEGER */ - 210, /* (120) cmd ::= CREATE TABLE create_table_args */ - 210, /* (121) cmd ::= CREATE TABLE create_stable_args */ - 210, /* (122) cmd ::= CREATE STABLE create_stable_args */ - 210, /* (123) cmd ::= CREATE TABLE create_table_list */ - 248, /* (124) create_table_list ::= create_from_stable */ - 248, /* (125) create_table_list ::= create_table_list create_from_stable */ - 246, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - 247, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - 249, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - 246, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */ - 250, /* (130) columnlist ::= columnlist COMMA column */ - 250, /* (131) columnlist ::= column */ - 252, /* (132) column ::= ids typename */ - 229, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */ - 229, /* (134) tagitemlist ::= tagitem */ - 253, /* (135) tagitem ::= INTEGER */ - 253, /* (136) tagitem ::= FLOAT */ - 253, /* (137) tagitem ::= STRING */ - 253, /* (138) tagitem ::= BOOL */ - 253, /* (139) tagitem ::= NULL */ - 253, /* (140) tagitem ::= MINUS INTEGER */ - 253, /* (141) tagitem ::= MINUS FLOAT */ - 253, /* (142) tagitem ::= PLUS INTEGER */ - 253, /* (143) tagitem ::= PLUS FLOAT */ - 251, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - 265, /* (145) union ::= select */ - 265, /* (146) union ::= LP union RP */ - 265, /* (147) union ::= union UNION ALL select */ - 265, /* (148) union ::= union UNION ALL LP select RP */ - 210, /* (149) cmd ::= union */ - 251, /* (150) select ::= SELECT selcollist */ - 266, /* (151) sclp ::= selcollist COMMA */ - 266, /* (152) sclp ::= */ - 254, /* (153) selcollist ::= sclp expr as */ - 254, /* (154) selcollist ::= sclp STAR */ - 268, /* (155) as ::= AS ids */ - 268, /* (156) as ::= ids */ - 268, /* (157) as ::= */ - 255, /* (158) from ::= FROM tablelist */ - 269, /* (159) tablelist ::= ids cpxName */ - 269, /* (160) tablelist ::= ids cpxName ids */ - 269, /* (161) tablelist ::= tablelist COMMA ids cpxName */ - 269, /* (162) tablelist ::= tablelist COMMA ids cpxName ids */ - 270, /* (163) tmvar ::= VARIABLE */ - 257, /* (164) interval_opt ::= INTERVAL LP tmvar RP */ - 257, /* (165) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - 257, /* (166) interval_opt ::= */ - 258, /* (167) fill_opt ::= */ - 258, /* (168) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - 258, /* (169) fill_opt ::= FILL LP ID RP */ - 259, /* (170) sliding_opt ::= SLIDING LP tmvar RP */ - 259, /* (171) sliding_opt ::= */ - 261, /* (172) orderby_opt ::= */ - 261, /* (173) orderby_opt ::= ORDER BY sortlist */ - 271, /* (174) sortlist ::= sortlist COMMA item sortorder */ - 271, /* (175) sortlist ::= item sortorder */ - 273, /* (176) item ::= ids cpxName */ - 274, /* (177) sortorder ::= ASC */ - 274, /* (178) sortorder ::= DESC */ - 274, /* (179) sortorder ::= */ - 260, /* (180) groupby_opt ::= */ - 260, /* (181) groupby_opt ::= GROUP BY grouplist */ - 275, /* (182) grouplist ::= grouplist COMMA item */ - 275, /* (183) grouplist ::= item */ - 262, /* (184) having_opt ::= */ - 262, /* (185) having_opt ::= HAVING expr */ - 264, /* (186) limit_opt ::= */ - 264, /* (187) limit_opt ::= LIMIT signed */ - 264, /* (188) limit_opt ::= LIMIT signed OFFSET signed */ - 264, /* (189) limit_opt ::= LIMIT signed COMMA signed */ - 263, /* (190) slimit_opt ::= */ - 263, /* (191) slimit_opt ::= SLIMIT signed */ - 263, /* (192) slimit_opt ::= SLIMIT signed SOFFSET signed */ - 263, /* (193) slimit_opt ::= SLIMIT signed COMMA signed */ - 256, /* (194) where_opt ::= */ - 256, /* (195) where_opt ::= WHERE expr */ - 267, /* (196) expr ::= LP expr RP */ - 267, /* (197) expr ::= ID */ - 267, /* (198) expr ::= ID DOT ID */ - 267, /* (199) expr ::= ID DOT STAR */ - 267, /* (200) expr ::= INTEGER */ - 267, /* (201) expr ::= MINUS INTEGER */ - 267, /* (202) expr ::= PLUS INTEGER */ - 267, /* (203) expr ::= FLOAT */ - 267, /* (204) expr ::= MINUS FLOAT */ - 267, /* (205) expr ::= PLUS FLOAT */ - 267, /* (206) expr ::= STRING */ - 267, /* (207) expr ::= NOW */ - 267, /* (208) expr ::= VARIABLE */ - 267, /* (209) expr ::= BOOL */ - 267, /* (210) expr ::= ID LP exprlist RP */ - 267, /* (211) expr ::= ID LP STAR RP */ - 267, /* (212) expr ::= expr IS NULL */ - 267, /* (213) expr ::= expr IS NOT NULL */ - 267, /* (214) expr ::= expr LT expr */ - 267, /* (215) expr ::= expr GT expr */ - 267, /* (216) expr ::= expr LE expr */ - 267, /* (217) expr ::= expr GE expr */ - 267, /* (218) expr ::= expr NE expr */ - 267, /* (219) expr ::= expr EQ expr */ - 267, /* (220) expr ::= expr AND expr */ - 267, /* (221) expr ::= expr OR expr */ - 267, /* (222) expr ::= expr PLUS expr */ - 267, /* (223) expr ::= expr MINUS expr */ - 267, /* (224) expr ::= expr STAR expr */ - 267, /* (225) expr ::= expr SLASH expr */ - 267, /* (226) expr ::= expr REM expr */ - 267, /* (227) expr ::= expr LIKE expr */ - 267, /* (228) expr ::= expr IN LP exprlist RP */ - 276, /* (229) exprlist ::= exprlist COMMA expritem */ - 276, /* (230) exprlist ::= expritem */ - 277, /* (231) expritem ::= expr */ - 277, /* (232) expritem ::= */ - 210, /* (233) cmd ::= RESET QUERY CACHE */ - 210, /* (234) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - 210, /* (235) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - 210, /* (236) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - 210, /* (237) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - 210, /* (238) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - 210, /* (239) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - 210, /* (240) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - 210, /* (241) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - 210, /* (242) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - 210, /* (243) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - 210, /* (244) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - 210, /* (245) cmd ::= KILL CONNECTION INTEGER */ - 210, /* (246) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - 210, /* (247) cmd ::= KILL QUERY INTEGER COLON INTEGER */ -}; - -/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number -** of symbols on the right-hand side of that rule. */ -static const signed char yyRuleInfoNRhs[] = { - -1, /* (0) program ::= cmd */ - -2, /* (1) cmd ::= SHOW DATABASES */ - -2, /* (2) cmd ::= SHOW MNODES */ - -2, /* (3) cmd ::= SHOW DNODES */ - -2, /* (4) cmd ::= SHOW ACCOUNTS */ - -2, /* (5) cmd ::= SHOW USERS */ - -2, /* (6) cmd ::= SHOW MODULES */ - -2, /* (7) cmd ::= SHOW QUERIES */ - -2, /* (8) cmd ::= SHOW CONNECTIONS */ - -2, /* (9) cmd ::= SHOW STREAMS */ - -2, /* (10) cmd ::= SHOW VARIABLES */ - -2, /* (11) cmd ::= SHOW SCORES */ - -2, /* (12) cmd ::= SHOW GRANTS */ - -2, /* (13) cmd ::= SHOW VNODES */ - -3, /* (14) cmd ::= SHOW VNODES IPTOKEN */ - 0, /* (15) dbPrefix ::= */ - -2, /* (16) dbPrefix ::= ids DOT */ - 0, /* (17) cpxName ::= */ - -2, /* (18) cpxName ::= DOT ids */ - -5, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ - -4, /* (20) cmd ::= SHOW CREATE DATABASE ids */ - -3, /* (21) cmd ::= SHOW dbPrefix TABLES */ - -5, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ - -3, /* (23) cmd ::= SHOW dbPrefix STABLES */ - -5, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ - -3, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ - -4, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ - -5, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ - -5, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */ - -4, /* (29) cmd ::= DROP DATABASE ifexists ids */ - -3, /* (30) cmd ::= DROP DNODE ids */ - -3, /* (31) cmd ::= DROP USER ids */ - -3, /* (32) cmd ::= DROP ACCOUNT ids */ - -2, /* (33) cmd ::= USE ids */ - -3, /* (34) cmd ::= DESCRIBE ids cpxName */ - -5, /* (35) cmd ::= ALTER USER ids PASS ids */ - -5, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */ - -4, /* (37) cmd ::= ALTER DNODE ids ids */ - -5, /* (38) cmd ::= ALTER DNODE ids ids ids */ - -3, /* (39) cmd ::= ALTER LOCAL ids */ - -4, /* (40) cmd ::= ALTER LOCAL ids ids */ - -4, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */ - -4, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */ - -6, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ - -1, /* (44) ids ::= ID */ - -1, /* (45) ids ::= STRING */ - -2, /* (46) ifexists ::= IF EXISTS */ - 0, /* (47) ifexists ::= */ - -3, /* (48) ifnotexists ::= IF NOT EXISTS */ - 0, /* (49) ifnotexists ::= */ - -3, /* (50) cmd ::= CREATE DNODE ids */ - -6, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ - -5, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ - -5, /* (53) cmd ::= CREATE USER ids PASS ids */ - 0, /* (54) pps ::= */ - -2, /* (55) pps ::= PPS INTEGER */ - 0, /* (56) tseries ::= */ - -2, /* (57) tseries ::= TSERIES INTEGER */ - 0, /* (58) dbs ::= */ - -2, /* (59) dbs ::= DBS INTEGER */ - 0, /* (60) streams ::= */ - -2, /* (61) streams ::= STREAMS INTEGER */ - 0, /* (62) storage ::= */ - -2, /* (63) storage ::= STORAGE INTEGER */ - 0, /* (64) qtime ::= */ - -2, /* (65) qtime ::= QTIME INTEGER */ - 0, /* (66) users ::= */ - -2, /* (67) users ::= USERS INTEGER */ - 0, /* (68) conns ::= */ - -2, /* (69) conns ::= CONNS INTEGER */ - 0, /* (70) state ::= */ - -2, /* (71) state ::= STATE ids */ - -9, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ - -2, /* (73) keep ::= KEEP tagitemlist */ - -2, /* (74) cache ::= CACHE INTEGER */ - -2, /* (75) replica ::= REPLICA INTEGER */ - -2, /* (76) quorum ::= QUORUM INTEGER */ - -2, /* (77) days ::= DAYS INTEGER */ - -2, /* (78) minrows ::= MINROWS INTEGER */ - -2, /* (79) maxrows ::= MAXROWS INTEGER */ - -2, /* (80) blocks ::= BLOCKS INTEGER */ - -2, /* (81) ctime ::= CTIME INTEGER */ - -2, /* (82) wal ::= WAL INTEGER */ - -2, /* (83) fsync ::= FSYNC INTEGER */ - -2, /* (84) comp ::= COMP INTEGER */ - -2, /* (85) prec ::= PRECISION STRING */ - -2, /* (86) update ::= UPDATE INTEGER */ - -2, /* (87) cachelast ::= CACHELAST INTEGER */ - 0, /* (88) db_optr ::= */ - -2, /* (89) db_optr ::= db_optr cache */ - -2, /* (90) db_optr ::= db_optr replica */ - -2, /* (91) db_optr ::= db_optr quorum */ - -2, /* (92) db_optr ::= db_optr days */ - -2, /* (93) db_optr ::= db_optr minrows */ - -2, /* (94) db_optr ::= db_optr maxrows */ - -2, /* (95) db_optr ::= db_optr blocks */ - -2, /* (96) db_optr ::= db_optr ctime */ - -2, /* (97) db_optr ::= db_optr wal */ - -2, /* (98) db_optr ::= db_optr fsync */ - -2, /* (99) db_optr ::= db_optr comp */ - -2, /* (100) db_optr ::= db_optr prec */ - -2, /* (101) db_optr ::= db_optr keep */ - -2, /* (102) db_optr ::= db_optr update */ - -2, /* (103) db_optr ::= db_optr cachelast */ - 0, /* (104) alter_db_optr ::= */ - -2, /* (105) alter_db_optr ::= alter_db_optr replica */ - -2, /* (106) alter_db_optr ::= alter_db_optr quorum */ - -2, /* (107) alter_db_optr ::= alter_db_optr keep */ - -2, /* (108) alter_db_optr ::= alter_db_optr blocks */ - -2, /* (109) alter_db_optr ::= alter_db_optr comp */ - -2, /* (110) alter_db_optr ::= alter_db_optr wal */ - -2, /* (111) alter_db_optr ::= alter_db_optr fsync */ - -2, /* (112) alter_db_optr ::= alter_db_optr update */ - -2, /* (113) alter_db_optr ::= alter_db_optr cachelast */ - -1, /* (114) typename ::= ids */ - -4, /* (115) typename ::= ids LP signed RP */ - -2, /* (116) typename ::= ids UNSIGNED */ - -1, /* (117) signed ::= INTEGER */ - -2, /* (118) signed ::= PLUS INTEGER */ - -2, /* (119) signed ::= MINUS INTEGER */ - -3, /* (120) cmd ::= CREATE TABLE create_table_args */ - -3, /* (121) cmd ::= CREATE TABLE create_stable_args */ - -3, /* (122) cmd ::= CREATE STABLE create_stable_args */ - -3, /* (123) cmd ::= CREATE TABLE create_table_list */ - -1, /* (124) create_table_list ::= create_from_stable */ - -2, /* (125) create_table_list ::= create_table_list create_from_stable */ - -6, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ - -10, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ - -10, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ - -5, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */ - -3, /* (130) columnlist ::= columnlist COMMA column */ - -1, /* (131) columnlist ::= column */ - -2, /* (132) column ::= ids typename */ - -3, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */ - -1, /* (134) tagitemlist ::= tagitem */ - -1, /* (135) tagitem ::= INTEGER */ - -1, /* (136) tagitem ::= FLOAT */ - -1, /* (137) tagitem ::= STRING */ - -1, /* (138) tagitem ::= BOOL */ - -1, /* (139) tagitem ::= NULL */ - -2, /* (140) tagitem ::= MINUS INTEGER */ - -2, /* (141) tagitem ::= MINUS FLOAT */ - -2, /* (142) tagitem ::= PLUS INTEGER */ - -2, /* (143) tagitem ::= PLUS FLOAT */ - -12, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ - -1, /* (145) union ::= select */ - -3, /* (146) union ::= LP union RP */ - -4, /* (147) union ::= union UNION ALL select */ - -6, /* (148) union ::= union UNION ALL LP select RP */ - -1, /* (149) cmd ::= union */ - -2, /* (150) select ::= SELECT selcollist */ - -2, /* (151) sclp ::= selcollist COMMA */ - 0, /* (152) sclp ::= */ - -3, /* (153) selcollist ::= sclp expr as */ - -2, /* (154) selcollist ::= sclp STAR */ - -2, /* (155) as ::= AS ids */ - -1, /* (156) as ::= ids */ - 0, /* (157) as ::= */ - -2, /* (158) from ::= FROM tablelist */ - -2, /* (159) tablelist ::= ids cpxName */ - -3, /* (160) tablelist ::= ids cpxName ids */ - -4, /* (161) tablelist ::= tablelist COMMA ids cpxName */ - -5, /* (162) tablelist ::= tablelist COMMA ids cpxName ids */ - -1, /* (163) tmvar ::= VARIABLE */ - -4, /* (164) interval_opt ::= INTERVAL LP tmvar RP */ - -6, /* (165) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ - 0, /* (166) interval_opt ::= */ - 0, /* (167) fill_opt ::= */ - -6, /* (168) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ - -4, /* (169) fill_opt ::= FILL LP ID RP */ - -4, /* (170) sliding_opt ::= SLIDING LP tmvar RP */ - 0, /* (171) sliding_opt ::= */ - 0, /* (172) orderby_opt ::= */ - -3, /* (173) orderby_opt ::= ORDER BY sortlist */ - -4, /* (174) sortlist ::= sortlist COMMA item sortorder */ - -2, /* (175) sortlist ::= item sortorder */ - -2, /* (176) item ::= ids cpxName */ - -1, /* (177) sortorder ::= ASC */ - -1, /* (178) sortorder ::= DESC */ - 0, /* (179) sortorder ::= */ - 0, /* (180) groupby_opt ::= */ - -3, /* (181) groupby_opt ::= GROUP BY grouplist */ - -3, /* (182) grouplist ::= grouplist COMMA item */ - -1, /* (183) grouplist ::= item */ - 0, /* (184) having_opt ::= */ - -2, /* (185) having_opt ::= HAVING expr */ - 0, /* (186) limit_opt ::= */ - -2, /* (187) limit_opt ::= LIMIT signed */ - -4, /* (188) limit_opt ::= LIMIT signed OFFSET signed */ - -4, /* (189) limit_opt ::= LIMIT signed COMMA signed */ - 0, /* (190) slimit_opt ::= */ - -2, /* (191) slimit_opt ::= SLIMIT signed */ - -4, /* (192) slimit_opt ::= SLIMIT signed SOFFSET signed */ - -4, /* (193) slimit_opt ::= SLIMIT signed COMMA signed */ - 0, /* (194) where_opt ::= */ - -2, /* (195) where_opt ::= WHERE expr */ - -3, /* (196) expr ::= LP expr RP */ - -1, /* (197) expr ::= ID */ - -3, /* (198) expr ::= ID DOT ID */ - -3, /* (199) expr ::= ID DOT STAR */ - -1, /* (200) expr ::= INTEGER */ - -2, /* (201) expr ::= MINUS INTEGER */ - -2, /* (202) expr ::= PLUS INTEGER */ - -1, /* (203) expr ::= FLOAT */ - -2, /* (204) expr ::= MINUS FLOAT */ - -2, /* (205) expr ::= PLUS FLOAT */ - -1, /* (206) expr ::= STRING */ - -1, /* (207) expr ::= NOW */ - -1, /* (208) expr ::= VARIABLE */ - -1, /* (209) expr ::= BOOL */ - -4, /* (210) expr ::= ID LP exprlist RP */ - -4, /* (211) expr ::= ID LP STAR RP */ - -3, /* (212) expr ::= expr IS NULL */ - -4, /* (213) expr ::= expr IS NOT NULL */ - -3, /* (214) expr ::= expr LT expr */ - -3, /* (215) expr ::= expr GT expr */ - -3, /* (216) expr ::= expr LE expr */ - -3, /* (217) expr ::= expr GE expr */ - -3, /* (218) expr ::= expr NE expr */ - -3, /* (219) expr ::= expr EQ expr */ - -3, /* (220) expr ::= expr AND expr */ - -3, /* (221) expr ::= expr OR expr */ - -3, /* (222) expr ::= expr PLUS expr */ - -3, /* (223) expr ::= expr MINUS expr */ - -3, /* (224) expr ::= expr STAR expr */ - -3, /* (225) expr ::= expr SLASH expr */ - -3, /* (226) expr ::= expr REM expr */ - -3, /* (227) expr ::= expr LIKE expr */ - -5, /* (228) expr ::= expr IN LP exprlist RP */ - -3, /* (229) exprlist ::= exprlist COMMA expritem */ - -1, /* (230) exprlist ::= expritem */ - -1, /* (231) expritem ::= expr */ - 0, /* (232) expritem ::= */ - -3, /* (233) cmd ::= RESET QUERY CACHE */ - -7, /* (234) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (235) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - -7, /* (236) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - -7, /* (237) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - -8, /* (238) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - -9, /* (239) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - -7, /* (240) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ - -7, /* (241) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ - -7, /* (242) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ - -7, /* (243) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ - -8, /* (244) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ - -3, /* (245) cmd ::= KILL CONNECTION INTEGER */ - -5, /* (246) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - -5, /* (247) cmd ::= KILL QUERY INTEGER COLON INTEGER */ +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ +} yyRuleInfo[] = { + { 210, -1 }, /* (0) program ::= cmd */ + { 211, -2 }, /* (1) cmd ::= SHOW DATABASES */ + { 211, -2 }, /* (2) cmd ::= SHOW MNODES */ + { 211, -2 }, /* (3) cmd ::= SHOW DNODES */ + { 211, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */ + { 211, -2 }, /* (5) cmd ::= SHOW USERS */ + { 211, -2 }, /* (6) cmd ::= SHOW MODULES */ + { 211, -2 }, /* (7) cmd ::= SHOW QUERIES */ + { 211, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ + { 211, -2 }, /* (9) cmd ::= SHOW STREAMS */ + { 211, -2 }, /* (10) cmd ::= SHOW VARIABLES */ + { 211, -2 }, /* (11) cmd ::= SHOW SCORES */ + { 211, -2 }, /* (12) cmd ::= SHOW GRANTS */ + { 211, -2 }, /* (13) cmd ::= SHOW VNODES */ + { 211, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */ + { 212, 0 }, /* (15) dbPrefix ::= */ + { 212, -2 }, /* (16) dbPrefix ::= ids DOT */ + { 214, 0 }, /* (17) cpxName ::= */ + { 214, -2 }, /* (18) cpxName ::= DOT ids */ + { 211, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */ + { 211, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */ + { 211, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */ + { 211, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */ + { 211, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */ + { 211, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */ + { 211, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */ + { 211, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */ + { 211, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */ + { 211, -5 }, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */ + { 211, -4 }, /* (29) cmd ::= DROP DATABASE ifexists ids */ + { 211, -3 }, /* (30) cmd ::= DROP DNODE ids */ + { 211, -3 }, /* (31) cmd ::= DROP USER ids */ + { 211, -3 }, /* (32) cmd ::= DROP ACCOUNT ids */ + { 211, -2 }, /* (33) cmd ::= USE ids */ + { 211, -3 }, /* (34) cmd ::= DESCRIBE ids cpxName */ + { 211, -5 }, /* (35) cmd ::= ALTER USER ids PASS ids */ + { 211, -5 }, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */ + { 211, -4 }, /* (37) cmd ::= ALTER DNODE ids ids */ + { 211, -5 }, /* (38) cmd ::= ALTER DNODE ids ids ids */ + { 211, -3 }, /* (39) cmd ::= ALTER LOCAL ids */ + { 211, -4 }, /* (40) cmd ::= ALTER LOCAL ids ids */ + { 211, -4 }, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */ + { 211, -4 }, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */ + { 211, -6 }, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ + { 213, -1 }, /* (44) ids ::= ID */ + { 213, -1 }, /* (45) ids ::= STRING */ + { 215, -2 }, /* (46) ifexists ::= IF EXISTS */ + { 215, 0 }, /* (47) ifexists ::= */ + { 218, -3 }, /* (48) ifnotexists ::= IF NOT EXISTS */ + { 218, 0 }, /* (49) ifnotexists ::= */ + { 211, -3 }, /* (50) cmd ::= CREATE DNODE ids */ + { 211, -6 }, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ + { 211, -5 }, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */ + { 211, -5 }, /* (53) cmd ::= CREATE USER ids PASS ids */ + { 220, 0 }, /* (54) pps ::= */ + { 220, -2 }, /* (55) pps ::= PPS INTEGER */ + { 221, 0 }, /* (56) tseries ::= */ + { 221, -2 }, /* (57) tseries ::= TSERIES INTEGER */ + { 222, 0 }, /* (58) dbs ::= */ + { 222, -2 }, /* (59) dbs ::= DBS INTEGER */ + { 223, 0 }, /* (60) streams ::= */ + { 223, -2 }, /* (61) streams ::= STREAMS INTEGER */ + { 224, 0 }, /* (62) storage ::= */ + { 224, -2 }, /* (63) storage ::= STORAGE INTEGER */ + { 225, 0 }, /* (64) qtime ::= */ + { 225, -2 }, /* (65) qtime ::= QTIME INTEGER */ + { 226, 0 }, /* (66) users ::= */ + { 226, -2 }, /* (67) users ::= USERS INTEGER */ + { 227, 0 }, /* (68) conns ::= */ + { 227, -2 }, /* (69) conns ::= CONNS INTEGER */ + { 228, 0 }, /* (70) state ::= */ + { 228, -2 }, /* (71) state ::= STATE ids */ + { 217, -9 }, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */ + { 229, -2 }, /* (73) keep ::= KEEP tagitemlist */ + { 231, -2 }, /* (74) cache ::= CACHE INTEGER */ + { 232, -2 }, /* (75) replica ::= REPLICA INTEGER */ + { 233, -2 }, /* (76) quorum ::= QUORUM INTEGER */ + { 234, -2 }, /* (77) days ::= DAYS INTEGER */ + { 235, -2 }, /* (78) minrows ::= MINROWS INTEGER */ + { 236, -2 }, /* (79) maxrows ::= MAXROWS INTEGER */ + { 237, -2 }, /* (80) blocks ::= BLOCKS INTEGER */ + { 238, -2 }, /* (81) ctime ::= CTIME INTEGER */ + { 239, -2 }, /* (82) wal ::= WAL INTEGER */ + { 240, -2 }, /* (83) fsync ::= FSYNC INTEGER */ + { 241, -2 }, /* (84) comp ::= COMP INTEGER */ + { 242, -2 }, /* (85) prec ::= PRECISION STRING */ + { 243, -2 }, /* (86) update ::= UPDATE INTEGER */ + { 244, -2 }, /* (87) cachelast ::= CACHELAST INTEGER */ + { 219, 0 }, /* (88) db_optr ::= */ + { 219, -2 }, /* (89) db_optr ::= db_optr cache */ + { 219, -2 }, /* (90) db_optr ::= db_optr replica */ + { 219, -2 }, /* (91) db_optr ::= db_optr quorum */ + { 219, -2 }, /* (92) db_optr ::= db_optr days */ + { 219, -2 }, /* (93) db_optr ::= db_optr minrows */ + { 219, -2 }, /* (94) db_optr ::= db_optr maxrows */ + { 219, -2 }, /* (95) db_optr ::= db_optr blocks */ + { 219, -2 }, /* (96) db_optr ::= db_optr ctime */ + { 219, -2 }, /* (97) db_optr ::= db_optr wal */ + { 219, -2 }, /* (98) db_optr ::= db_optr fsync */ + { 219, -2 }, /* (99) db_optr ::= db_optr comp */ + { 219, -2 }, /* (100) db_optr ::= db_optr prec */ + { 219, -2 }, /* (101) db_optr ::= db_optr keep */ + { 219, -2 }, /* (102) db_optr ::= db_optr update */ + { 219, -2 }, /* (103) db_optr ::= db_optr cachelast */ + { 216, 0 }, /* (104) alter_db_optr ::= */ + { 216, -2 }, /* (105) alter_db_optr ::= alter_db_optr replica */ + { 216, -2 }, /* (106) alter_db_optr ::= alter_db_optr quorum */ + { 216, -2 }, /* (107) alter_db_optr ::= alter_db_optr keep */ + { 216, -2 }, /* (108) alter_db_optr ::= alter_db_optr blocks */ + { 216, -2 }, /* (109) alter_db_optr ::= alter_db_optr comp */ + { 216, -2 }, /* (110) alter_db_optr ::= alter_db_optr wal */ + { 216, -2 }, /* (111) alter_db_optr ::= alter_db_optr fsync */ + { 216, -2 }, /* (112) alter_db_optr ::= alter_db_optr update */ + { 216, -2 }, /* (113) alter_db_optr ::= alter_db_optr cachelast */ + { 245, -1 }, /* (114) typename ::= ids */ + { 245, -4 }, /* (115) typename ::= ids LP signed RP */ + { 245, -2 }, /* (116) typename ::= ids UNSIGNED */ + { 246, -1 }, /* (117) signed ::= INTEGER */ + { 246, -2 }, /* (118) signed ::= PLUS INTEGER */ + { 246, -2 }, /* (119) signed ::= MINUS INTEGER */ + { 211, -3 }, /* (120) cmd ::= CREATE TABLE create_table_args */ + { 211, -3 }, /* (121) cmd ::= CREATE TABLE create_stable_args */ + { 211, -3 }, /* (122) cmd ::= CREATE STABLE create_stable_args */ + { 211, -3 }, /* (123) cmd ::= CREATE TABLE create_table_list */ + { 249, -1 }, /* (124) create_table_list ::= create_from_stable */ + { 249, -2 }, /* (125) create_table_list ::= create_table_list create_from_stable */ + { 247, -6 }, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ + { 248, -10 }, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ + { 250, -10 }, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */ + { 247, -5 }, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */ + { 251, -3 }, /* (130) columnlist ::= columnlist COMMA column */ + { 251, -1 }, /* (131) columnlist ::= column */ + { 253, -2 }, /* (132) column ::= ids typename */ + { 230, -3 }, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */ + { 230, -1 }, /* (134) tagitemlist ::= tagitem */ + { 254, -1 }, /* (135) tagitem ::= INTEGER */ + { 254, -1 }, /* (136) tagitem ::= FLOAT */ + { 254, -1 }, /* (137) tagitem ::= STRING */ + { 254, -1 }, /* (138) tagitem ::= BOOL */ + { 254, -1 }, /* (139) tagitem ::= NULL */ + { 254, -2 }, /* (140) tagitem ::= MINUS INTEGER */ + { 254, -2 }, /* (141) tagitem ::= MINUS FLOAT */ + { 254, -2 }, /* (142) tagitem ::= PLUS INTEGER */ + { 254, -2 }, /* (143) tagitem ::= PLUS FLOAT */ + { 252, -12 }, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ + { 266, -1 }, /* (145) union ::= select */ + { 266, -3 }, /* (146) union ::= LP union RP */ + { 266, -4 }, /* (147) union ::= union UNION ALL select */ + { 266, -6 }, /* (148) union ::= union UNION ALL LP select RP */ + { 211, -1 }, /* (149) cmd ::= union */ + { 252, -2 }, /* (150) select ::= SELECT selcollist */ + { 267, -2 }, /* (151) sclp ::= selcollist COMMA */ + { 267, 0 }, /* (152) sclp ::= */ + { 255, -3 }, /* (153) selcollist ::= sclp expr as */ + { 255, -2 }, /* (154) selcollist ::= sclp STAR */ + { 269, -2 }, /* (155) as ::= AS ids */ + { 269, -1 }, /* (156) as ::= ids */ + { 269, 0 }, /* (157) as ::= */ + { 256, -2 }, /* (158) from ::= FROM tablelist */ + { 270, -2 }, /* (159) tablelist ::= ids cpxName */ + { 270, -3 }, /* (160) tablelist ::= ids cpxName ids */ + { 270, -4 }, /* (161) tablelist ::= tablelist COMMA ids cpxName */ + { 270, -5 }, /* (162) tablelist ::= tablelist COMMA ids cpxName ids */ + { 271, -1 }, /* (163) tmvar ::= VARIABLE */ + { 258, -4 }, /* (164) interval_opt ::= INTERVAL LP tmvar RP */ + { 258, -6 }, /* (165) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ + { 258, 0 }, /* (166) interval_opt ::= */ + { 259, 0 }, /* (167) fill_opt ::= */ + { 259, -6 }, /* (168) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ + { 259, -4 }, /* (169) fill_opt ::= FILL LP ID RP */ + { 260, -4 }, /* (170) sliding_opt ::= SLIDING LP tmvar RP */ + { 260, 0 }, /* (171) sliding_opt ::= */ + { 262, 0 }, /* (172) orderby_opt ::= */ + { 262, -3 }, /* (173) orderby_opt ::= ORDER BY sortlist */ + { 272, -4 }, /* (174) sortlist ::= sortlist COMMA item sortorder */ + { 272, -2 }, /* (175) sortlist ::= item sortorder */ + { 274, -2 }, /* (176) item ::= ids cpxName */ + { 275, -1 }, /* (177) sortorder ::= ASC */ + { 275, -1 }, /* (178) sortorder ::= DESC */ + { 275, 0 }, /* (179) sortorder ::= */ + { 261, 0 }, /* (180) groupby_opt ::= */ + { 261, -3 }, /* (181) groupby_opt ::= GROUP BY grouplist */ + { 276, -3 }, /* (182) grouplist ::= grouplist COMMA item */ + { 276, -1 }, /* (183) grouplist ::= item */ + { 263, 0 }, /* (184) having_opt ::= */ + { 263, -2 }, /* (185) having_opt ::= HAVING expr */ + { 265, 0 }, /* (186) limit_opt ::= */ + { 265, -2 }, /* (187) limit_opt ::= LIMIT signed */ + { 265, -4 }, /* (188) limit_opt ::= LIMIT signed OFFSET signed */ + { 265, -4 }, /* (189) limit_opt ::= LIMIT signed COMMA signed */ + { 264, 0 }, /* (190) slimit_opt ::= */ + { 264, -2 }, /* (191) slimit_opt ::= SLIMIT signed */ + { 264, -4 }, /* (192) slimit_opt ::= SLIMIT signed SOFFSET signed */ + { 264, -4 }, /* (193) slimit_opt ::= SLIMIT signed COMMA signed */ + { 257, 0 }, /* (194) where_opt ::= */ + { 257, -2 }, /* (195) where_opt ::= WHERE expr */ + { 268, -3 }, /* (196) expr ::= LP expr RP */ + { 268, -1 }, /* (197) expr ::= ID */ + { 268, -3 }, /* (198) expr ::= ID DOT ID */ + { 268, -3 }, /* (199) expr ::= ID DOT STAR */ + { 268, -1 }, /* (200) expr ::= INTEGER */ + { 268, -2 }, /* (201) expr ::= MINUS INTEGER */ + { 268, -2 }, /* (202) expr ::= PLUS INTEGER */ + { 268, -1 }, /* (203) expr ::= FLOAT */ + { 268, -2 }, /* (204) expr ::= MINUS FLOAT */ + { 268, -2 }, /* (205) expr ::= PLUS FLOAT */ + { 268, -1 }, /* (206) expr ::= STRING */ + { 268, -1 }, /* (207) expr ::= NOW */ + { 268, -1 }, /* (208) expr ::= VARIABLE */ + { 268, -1 }, /* (209) expr ::= BOOL */ + { 268, -4 }, /* (210) expr ::= ID LP exprlist RP */ + { 268, -4 }, /* (211) expr ::= ID LP STAR RP */ + { 268, -3 }, /* (212) expr ::= expr IS NULL */ + { 268, -4 }, /* (213) expr ::= expr IS NOT NULL */ + { 268, -3 }, /* (214) expr ::= expr LT expr */ + { 268, -3 }, /* (215) expr ::= expr GT expr */ + { 268, -3 }, /* (216) expr ::= expr LE expr */ + { 268, -3 }, /* (217) expr ::= expr GE expr */ + { 268, -3 }, /* (218) expr ::= expr NE expr */ + { 268, -3 }, /* (219) expr ::= expr EQ expr */ + { 268, -3 }, /* (220) expr ::= expr AND expr */ + { 268, -3 }, /* (221) expr ::= expr OR expr */ + { 268, -3 }, /* (222) expr ::= expr PLUS expr */ + { 268, -3 }, /* (223) expr ::= expr MINUS expr */ + { 268, -3 }, /* (224) expr ::= expr STAR expr */ + { 268, -3 }, /* (225) expr ::= expr SLASH expr */ + { 268, -3 }, /* (226) expr ::= expr REM expr */ + { 268, -3 }, /* (227) expr ::= expr LIKE expr */ + { 268, -5 }, /* (228) expr ::= expr IN LP exprlist RP */ + { 277, -3 }, /* (229) exprlist ::= exprlist COMMA expritem */ + { 277, -1 }, /* (230) exprlist ::= expritem */ + { 278, -1 }, /* (231) expritem ::= expr */ + { 278, 0 }, /* (232) expritem ::= */ + { 211, -3 }, /* (233) cmd ::= RESET QUERY CACHE */ + { 211, -7 }, /* (234) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 211, -7 }, /* (235) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 211, -7 }, /* (236) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 211, -7 }, /* (237) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 211, -8 }, /* (238) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 211, -9 }, /* (239) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 211, -7 }, /* (240) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ + { 211, -7 }, /* (241) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ + { 211, -7 }, /* (242) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ + { 211, -7 }, /* (243) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ + { 211, -8 }, /* (244) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ + { 211, -3 }, /* (245) cmd ::= KILL CONNECTION INTEGER */ + { 211, -5 }, /* (246) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 211, -5 }, /* (247) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2272,34 +2008,30 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ -static YYACTIONTYPE yy_reduce( +static void yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ - ParseCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ - YYACTIONTYPE yyact; /* The next action */ + int yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ - ParseARG_FETCH + ParseARG_FETCH; (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; + yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n", yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; @@ -2317,19 +2049,13 @@ static YYACTIONTYPE yy_reduce( #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; + return; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; + return; } yymsp = yypParser->yytos; } @@ -2507,13 +2233,14 @@ static YYACTIONTYPE yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; case 41: /* cmd ::= ALTER DATABASE ids alter_db_optr */ -{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &t);} +{ SStrToken t = {0}; + setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy256, &t);} break; case 42: /* cmd ::= ALTER ACCOUNT ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy71);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy277);} break; case 43: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);} +{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy277);} break; case 44: /* ids ::= ID */ case 45: /* ids ::= STRING */ yytestcase(yyruleno==45); @@ -2534,10 +2261,11 @@ static YYACTIONTYPE yy_reduce( { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);} break; case 51: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ -{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);} +{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy277);} break; case 52: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ -{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &yymsp[-2].minor.yy0);} +{ + setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy256, &yymsp[-2].minor.yy0);} break; case 53: /* cmd ::= CREATE USER ids PASS ids */ { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} @@ -2566,20 +2294,20 @@ static YYACTIONTYPE yy_reduce( break; case 72: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ { - yylhsminor.yy71.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; - yylhsminor.yy71.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; - yylhsminor.yy71.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; - yylhsminor.yy71.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; - yylhsminor.yy71.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; - yylhsminor.yy71.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy71.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; - yylhsminor.yy71.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; - yylhsminor.yy71.stat = yymsp[0].minor.yy0; + yylhsminor.yy277.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; + yylhsminor.yy277.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; + yylhsminor.yy277.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; + yylhsminor.yy277.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; + yylhsminor.yy277.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; + yylhsminor.yy277.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy277.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; + yylhsminor.yy277.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; + yylhsminor.yy277.stat = yymsp[0].minor.yy0; } - yymsp[-8].minor.yy71 = yylhsminor.yy71; + yymsp[-8].minor.yy277 = yylhsminor.yy277; break; case 73: /* keep ::= KEEP tagitemlist */ -{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; } +{ yymsp[-1].minor.yy135 = yymsp[0].minor.yy135; } break; case 74: /* cache ::= CACHE INTEGER */ case 75: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==75); @@ -2598,116 +2326,116 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } break; case 88: /* db_optr ::= */ -{setDefaultCreateDbOption(&yymsp[1].minor.yy234);} +{setDefaultCreateDbOption(&yymsp[1].minor.yy256);} break; case 89: /* db_optr ::= db_optr cache */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 90: /* db_optr ::= db_optr replica */ case 105: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==105); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 91: /* db_optr ::= db_optr quorum */ case 106: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==106); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 92: /* db_optr ::= db_optr days */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 93: /* db_optr ::= db_optr minrows */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 94: /* db_optr ::= db_optr maxrows */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 95: /* db_optr ::= db_optr blocks */ case 108: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==108); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 96: /* db_optr ::= db_optr ctime */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 97: /* db_optr ::= db_optr wal */ case 110: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==110); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 98: /* db_optr ::= db_optr fsync */ case 111: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==111); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 99: /* db_optr ::= db_optr comp */ case 109: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==109); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 100: /* db_optr ::= db_optr prec */ -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.precision = yymsp[0].minor.yy0; } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.precision = yymsp[0].minor.yy0; } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 101: /* db_optr ::= db_optr keep */ case 107: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==107); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.keep = yymsp[0].minor.yy421; } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.keep = yymsp[0].minor.yy135; } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 102: /* db_optr ::= db_optr update */ case 112: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==112); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 103: /* db_optr ::= db_optr cachelast */ case 113: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==113); -{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[-1].minor.yy234 = yylhsminor.yy234; +{ yylhsminor.yy256 = yymsp[-1].minor.yy256; yylhsminor.yy256.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[-1].minor.yy256 = yylhsminor.yy256; break; case 104: /* alter_db_optr ::= */ -{ setDefaultCreateDbOption(&yymsp[1].minor.yy234);} +{ setDefaultCreateDbOption(&yymsp[1].minor.yy256);} break; case 114: /* typename ::= ids */ { yymsp[0].minor.yy0.type = 0; - tSqlSetColumnType (&yylhsminor.yy183, &yymsp[0].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy181, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy183 = yylhsminor.yy183; + yymsp[0].minor.yy181 = yylhsminor.yy181; break; case 115: /* typename ::= ids LP signed RP */ { - if (yymsp[-1].minor.yy325 <= 0) { + if (yymsp[-1].minor.yy531 <= 0) { yymsp[-3].minor.yy0.type = 0; - tSqlSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0); + tSqlSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0); } else { - yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy325; // negative value of name length - tSqlSetColumnType(&yylhsminor.yy183, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy531; // negative value of name length + tSqlSetColumnType(&yylhsminor.yy181, &yymsp[-3].minor.yy0); } } - yymsp[-3].minor.yy183 = yylhsminor.yy183; + yymsp[-3].minor.yy181 = yylhsminor.yy181; break; case 116: /* typename ::= ids UNSIGNED */ { yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); - tSqlSetColumnType (&yylhsminor.yy183, &yymsp[-1].minor.yy0); + tSqlSetColumnType (&yylhsminor.yy181, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy183 = yylhsminor.yy183; + yymsp[-1].minor.yy181 = yylhsminor.yy181; break; case 117: /* signed ::= INTEGER */ -{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } - yymsp[0].minor.yy325 = yylhsminor.yy325; +{ yylhsminor.yy531 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + yymsp[0].minor.yy531 = yylhsminor.yy531; break; case 118: /* signed ::= PLUS INTEGER */ -{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy531 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; case 119: /* signed ::= MINUS INTEGER */ -{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} +{ yymsp[-1].minor.yy531 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} break; case 123: /* cmd ::= CREATE TABLE create_table_list */ { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy38;} @@ -2717,7 +2445,7 @@ static YYACTIONTYPE yy_reduce( SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); - taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy152); + taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy78); pCreateTable->type = TSQL_CREATE_TABLE_FROM_STABLE; yylhsminor.yy38 = pCreateTable; } @@ -2725,14 +2453,14 @@ static YYACTIONTYPE yy_reduce( break; case 125: /* create_table_list ::= create_table_list create_from_stable */ { - taosArrayPush(yymsp[-1].minor.yy38->childTableInfo, &yymsp[0].minor.yy152); + taosArrayPush(yymsp[-1].minor.yy38->childTableInfo, &yymsp[0].minor.yy78); yylhsminor.yy38 = yymsp[-1].minor.yy38; } yymsp[-1].minor.yy38 = yylhsminor.yy38; break; case 126: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { - yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-1].minor.yy421, NULL, NULL, TSQL_CREATE_TABLE); + yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-1].minor.yy135, NULL, NULL, TSQL_CREATE_TABLE); setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2742,7 +2470,7 @@ static YYACTIONTYPE yy_reduce( break; case 127: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { - yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, TSQL_CREATE_STABLE); + yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-5].minor.yy135, yymsp[-1].minor.yy135, NULL, TSQL_CREATE_STABLE); setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; @@ -2754,13 +2482,13 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; - yylhsminor.yy152 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy421, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); + yylhsminor.yy78 = createNewChildTableInfo(&yymsp[-5].minor.yy0, yymsp[-1].minor.yy135, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); } - yymsp[-9].minor.yy152 = yylhsminor.yy152; + yymsp[-9].minor.yy78 = yylhsminor.yy78; break; case 129: /* create_table_args ::= ifnotexists ids cpxName AS select */ { - yylhsminor.yy38 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy148, TSQL_CREATE_STREAM); + yylhsminor.yy38 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy30, TSQL_CREATE_STREAM); setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE); yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; @@ -2769,37 +2497,37 @@ static YYACTIONTYPE yy_reduce( yymsp[-4].minor.yy38 = yylhsminor.yy38; break; case 130: /* columnlist ::= columnlist COMMA column */ -{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy183); yylhsminor.yy421 = yymsp[-2].minor.yy421; } - yymsp[-2].minor.yy421 = yylhsminor.yy421; +{taosArrayPush(yymsp[-2].minor.yy135, &yymsp[0].minor.yy181); yylhsminor.yy135 = yymsp[-2].minor.yy135; } + yymsp[-2].minor.yy135 = yylhsminor.yy135; break; case 131: /* columnlist ::= column */ -{yylhsminor.yy421 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy183);} - yymsp[0].minor.yy421 = yylhsminor.yy421; +{yylhsminor.yy135 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy135, &yymsp[0].minor.yy181);} + yymsp[0].minor.yy135 = yylhsminor.yy135; break; case 132: /* column ::= ids typename */ { - tSqlSetColumnInfo(&yylhsminor.yy183, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183); + tSqlSetColumnInfo(&yylhsminor.yy181, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy181); } - yymsp[-1].minor.yy183 = yylhsminor.yy183; + yymsp[-1].minor.yy181 = yylhsminor.yy181; break; case 133: /* tagitemlist ::= tagitemlist COMMA tagitem */ -{ yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); } - yymsp[-2].minor.yy421 = yylhsminor.yy421; +{ yylhsminor.yy135 = tVariantListAppend(yymsp[-2].minor.yy135, &yymsp[0].minor.yy308, -1); } + yymsp[-2].minor.yy135 = yylhsminor.yy135; break; case 134: /* tagitemlist ::= tagitem */ -{ yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); } - yymsp[0].minor.yy421 = yylhsminor.yy421; +{ yylhsminor.yy135 = tVariantListAppend(NULL, &yymsp[0].minor.yy308, -1); } + yymsp[0].minor.yy135 = yylhsminor.yy135; break; case 135: /* tagitem ::= INTEGER */ case 136: /* tagitem ::= FLOAT */ yytestcase(yyruleno==136); case 137: /* tagitem ::= STRING */ yytestcase(yyruleno==137); case 138: /* tagitem ::= BOOL */ yytestcase(yyruleno==138); -{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy430 = yylhsminor.yy430; +{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy308, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy308 = yylhsminor.yy308; break; case 139: /* tagitem ::= NULL */ -{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy430 = yylhsminor.yy430; +{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy308, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy308 = yylhsminor.yy308; break; case 140: /* tagitem ::= MINUS INTEGER */ case 141: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==141); @@ -2809,29 +2537,29 @@ static YYACTIONTYPE yy_reduce( yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; toTSDBType(yymsp[-1].minor.yy0.type); - tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy308, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy430 = yylhsminor.yy430; + yymsp[-1].minor.yy308 = yylhsminor.yy308; break; case 144: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */ { - yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy166, yymsp[-9].minor.yy421, yymsp[-8].minor.yy78, yymsp[-4].minor.yy421, yymsp[-3].minor.yy421, &yymsp[-7].minor.yy400, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy421, &yymsp[0].minor.yy167, &yymsp[-1].minor.yy167); + yylhsminor.yy30 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy266, yymsp[-9].minor.yy135, yymsp[-8].minor.yy316, yymsp[-4].minor.yy135, yymsp[-3].minor.yy135, &yymsp[-7].minor.yy160, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy135, &yymsp[0].minor.yy126, &yymsp[-1].minor.yy126); } - yymsp[-11].minor.yy148 = yylhsminor.yy148; + yymsp[-11].minor.yy30 = yylhsminor.yy30; break; case 145: /* union ::= select */ -{ yylhsminor.yy153 = setSubclause(NULL, yymsp[0].minor.yy148); } +{ yylhsminor.yy153 = setSubclause(NULL, yymsp[0].minor.yy30); } yymsp[0].minor.yy153 = yylhsminor.yy153; break; case 146: /* union ::= LP union RP */ { yymsp[-2].minor.yy153 = yymsp[-1].minor.yy153; } break; case 147: /* union ::= union UNION ALL select */ -{ yylhsminor.yy153 = appendSelectClause(yymsp[-3].minor.yy153, yymsp[0].minor.yy148); } +{ yylhsminor.yy153 = appendSelectClause(yymsp[-3].minor.yy153, yymsp[0].minor.yy30); } yymsp[-3].minor.yy153 = yylhsminor.yy153; break; case 148: /* union ::= union UNION ALL LP select RP */ -{ yylhsminor.yy153 = appendSelectClause(yymsp[-5].minor.yy153, yymsp[-1].minor.yy148); } +{ yylhsminor.yy153 = appendSelectClause(yymsp[-5].minor.yy153, yymsp[-1].minor.yy30); } yymsp[-5].minor.yy153 = yylhsminor.yy153; break; case 149: /* cmd ::= union */ @@ -2839,29 +2567,29 @@ static YYACTIONTYPE yy_reduce( break; case 150: /* select ::= SELECT selcollist */ { - yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy166, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + yylhsminor.yy30 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy266, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - yymsp[-1].minor.yy148 = yylhsminor.yy148; + yymsp[-1].minor.yy30 = yylhsminor.yy30; break; case 151: /* sclp ::= selcollist COMMA */ -{yylhsminor.yy166 = yymsp[-1].minor.yy166;} - yymsp[-1].minor.yy166 = yylhsminor.yy166; +{yylhsminor.yy266 = yymsp[-1].minor.yy266;} + yymsp[-1].minor.yy266 = yylhsminor.yy266; break; case 152: /* sclp ::= */ -{yymsp[1].minor.yy166 = 0;} +{yymsp[1].minor.yy266 = 0;} break; case 153: /* selcollist ::= sclp expr as */ { - yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166, yymsp[-1].minor.yy78, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); + yylhsminor.yy266 = tSqlExprListAppend(yymsp[-2].minor.yy266, yymsp[-1].minor.yy316, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } - yymsp[-2].minor.yy166 = yylhsminor.yy166; + yymsp[-2].minor.yy266 = yylhsminor.yy266; break; case 154: /* selcollist ::= sclp STAR */ { tSQLExpr *pNode = tSqlExprIdValueCreate(NULL, TK_ALL); - yylhsminor.yy166 = tSqlExprListAppend(yymsp[-1].minor.yy166, pNode, 0); + yylhsminor.yy266 = tSqlExprListAppend(yymsp[-1].minor.yy266, pNode, 0); } - yymsp[-1].minor.yy166 = yylhsminor.yy166; + yymsp[-1].minor.yy266 = yylhsminor.yy266; break; case 155: /* as ::= AS ids */ { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } @@ -2874,61 +2602,61 @@ static YYACTIONTYPE yy_reduce( { yymsp[1].minor.yy0.n = 0; } break; case 158: /* from ::= FROM tablelist */ -{yymsp[-1].minor.yy421 = yymsp[0].minor.yy421;} +{yymsp[-1].minor.yy135 = yymsp[0].minor.yy135;} break; case 159: /* tablelist ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[-1].minor.yy0, -1); // table alias name + yylhsminor.yy135 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yylhsminor.yy135, &yymsp[-1].minor.yy0, -1); // table alias name } - yymsp[-1].minor.yy421 = yylhsminor.yy421; + yymsp[-1].minor.yy135 = yylhsminor.yy135; break; case 160: /* tablelist ::= ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy421 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[0].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yylhsminor.yy135, &yymsp[0].minor.yy0, -1); } - yymsp[-2].minor.yy421 = yylhsminor.yy421; + yymsp[-2].minor.yy135 = yylhsminor.yy135; break; case 161: /* tablelist ::= tablelist COMMA ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - yylhsminor.yy421 = tVariantListAppendToken(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy0, -1); - yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yymsp[-3].minor.yy135, &yymsp[-1].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yylhsminor.yy135, &yymsp[-1].minor.yy0, -1); } - yymsp[-3].minor.yy421 = yylhsminor.yy421; + yymsp[-3].minor.yy135 = yylhsminor.yy135; break; case 162: /* tablelist ::= tablelist COMMA ids cpxName ids */ { toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type); yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; - yylhsminor.yy421 = tVariantListAppendToken(yymsp[-4].minor.yy421, &yymsp[-2].minor.yy0, -1); - yylhsminor.yy421 = tVariantListAppendToken(yylhsminor.yy421, &yymsp[0].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yymsp[-4].minor.yy135, &yymsp[-2].minor.yy0, -1); + yylhsminor.yy135 = tVariantListAppendToken(yylhsminor.yy135, &yymsp[0].minor.yy0, -1); } - yymsp[-4].minor.yy421 = yylhsminor.yy421; + yymsp[-4].minor.yy135 = yylhsminor.yy135; break; case 163: /* tmvar ::= VARIABLE */ {yylhsminor.yy0 = yymsp[0].minor.yy0;} yymsp[0].minor.yy0 = yylhsminor.yy0; break; case 164: /* interval_opt ::= INTERVAL LP tmvar RP */ -{yymsp[-3].minor.yy400.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy400.offset.n = 0; yymsp[-3].minor.yy400.offset.z = NULL; yymsp[-3].minor.yy400.offset.type = 0;} +{yymsp[-3].minor.yy160.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy160.offset.n = 0; yymsp[-3].minor.yy160.offset.z = NULL; yymsp[-3].minor.yy160.offset.type = 0;} break; case 165: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ -{yymsp[-5].minor.yy400.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy400.offset = yymsp[-1].minor.yy0;} +{yymsp[-5].minor.yy160.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy160.offset = yymsp[-1].minor.yy0;} break; case 166: /* interval_opt ::= */ -{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));} +{memset(&yymsp[1].minor.yy160, 0, sizeof(yymsp[1].minor.yy160));} break; case 167: /* fill_opt ::= */ -{yymsp[1].minor.yy421 = 0; } +{yymsp[1].minor.yy135 = 0; } break; case 168: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { @@ -2936,14 +2664,14 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[-3].minor.yy0.type); tVariantCreate(&A, &yymsp[-3].minor.yy0); - tVariantListInsert(yymsp[-1].minor.yy421, &A, -1, 0); - yymsp[-5].minor.yy421 = yymsp[-1].minor.yy421; + tVariantListInsert(yymsp[-1].minor.yy135, &A, -1, 0); + yymsp[-5].minor.yy135 = yymsp[-1].minor.yy135; } break; case 169: /* fill_opt ::= FILL LP ID RP */ { toTSDBType(yymsp[-1].minor.yy0.type); - yymsp[-3].minor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); + yymsp[-3].minor.yy135 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1); } break; case 170: /* sliding_opt ::= SLIDING LP tmvar RP */ @@ -2953,225 +2681,225 @@ static YYACTIONTYPE yy_reduce( {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } break; case 172: /* orderby_opt ::= */ -{yymsp[1].minor.yy421 = 0;} +{yymsp[1].minor.yy135 = 0;} break; case 173: /* orderby_opt ::= ORDER BY sortlist */ -{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} +{yymsp[-2].minor.yy135 = yymsp[0].minor.yy135;} break; case 174: /* sortlist ::= sortlist COMMA item sortorder */ { - yylhsminor.yy421 = tVariantListAppend(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96); + yylhsminor.yy135 = tVariantListAppend(yymsp[-3].minor.yy135, &yymsp[-1].minor.yy308, yymsp[0].minor.yy130); } - yymsp[-3].minor.yy421 = yylhsminor.yy421; + yymsp[-3].minor.yy135 = yylhsminor.yy135; break; case 175: /* sortlist ::= item sortorder */ { - yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96); + yylhsminor.yy135 = tVariantListAppend(NULL, &yymsp[-1].minor.yy308, yymsp[0].minor.yy130); } - yymsp[-1].minor.yy421 = yylhsminor.yy421; + yymsp[-1].minor.yy135 = yylhsminor.yy135; break; case 176: /* item ::= ids cpxName */ { toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; - tVariantCreate(&yylhsminor.yy430, &yymsp[-1].minor.yy0); + tVariantCreate(&yylhsminor.yy308, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy430 = yylhsminor.yy430; + yymsp[-1].minor.yy308 = yylhsminor.yy308; break; case 177: /* sortorder ::= ASC */ -{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; } +{ yymsp[0].minor.yy130 = TSDB_ORDER_ASC; } break; case 178: /* sortorder ::= DESC */ -{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;} +{ yymsp[0].minor.yy130 = TSDB_ORDER_DESC;} break; case 179: /* sortorder ::= */ -{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; } +{ yymsp[1].minor.yy130 = TSDB_ORDER_ASC; } break; case 180: /* groupby_opt ::= */ -{ yymsp[1].minor.yy421 = 0;} +{ yymsp[1].minor.yy135 = 0;} break; case 181: /* groupby_opt ::= GROUP BY grouplist */ -{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;} +{ yymsp[-2].minor.yy135 = yymsp[0].minor.yy135;} break; case 182: /* grouplist ::= grouplist COMMA item */ { - yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); + yylhsminor.yy135 = tVariantListAppend(yymsp[-2].minor.yy135, &yymsp[0].minor.yy308, -1); } - yymsp[-2].minor.yy421 = yylhsminor.yy421; + yymsp[-2].minor.yy135 = yylhsminor.yy135; break; case 183: /* grouplist ::= item */ { - yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); + yylhsminor.yy135 = tVariantListAppend(NULL, &yymsp[0].minor.yy308, -1); } - yymsp[0].minor.yy421 = yylhsminor.yy421; + yymsp[0].minor.yy135 = yylhsminor.yy135; break; case 184: /* having_opt ::= */ case 194: /* where_opt ::= */ yytestcase(yyruleno==194); case 232: /* expritem ::= */ yytestcase(yyruleno==232); -{yymsp[1].minor.yy78 = 0;} +{yymsp[1].minor.yy316 = 0;} break; case 185: /* having_opt ::= HAVING expr */ case 195: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==195); -{yymsp[-1].minor.yy78 = yymsp[0].minor.yy78;} +{yymsp[-1].minor.yy316 = yymsp[0].minor.yy316;} break; case 186: /* limit_opt ::= */ case 190: /* slimit_opt ::= */ yytestcase(yyruleno==190); -{yymsp[1].minor.yy167.limit = -1; yymsp[1].minor.yy167.offset = 0;} +{yymsp[1].minor.yy126.limit = -1; yymsp[1].minor.yy126.offset = 0;} break; case 187: /* limit_opt ::= LIMIT signed */ case 191: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==191); -{yymsp[-1].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy167.offset = 0;} +{yymsp[-1].minor.yy126.limit = yymsp[0].minor.yy531; yymsp[-1].minor.yy126.offset = 0;} break; case 188: /* limit_opt ::= LIMIT signed OFFSET signed */ -{ yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;} +{ yymsp[-3].minor.yy126.limit = yymsp[-2].minor.yy531; yymsp[-3].minor.yy126.offset = yymsp[0].minor.yy531;} break; case 189: /* limit_opt ::= LIMIT signed COMMA signed */ -{ yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;} +{ yymsp[-3].minor.yy126.limit = yymsp[0].minor.yy531; yymsp[-3].minor.yy126.offset = yymsp[-2].minor.yy531;} break; case 192: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ -{yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;} +{yymsp[-3].minor.yy126.limit = yymsp[-2].minor.yy531; yymsp[-3].minor.yy126.offset = yymsp[0].minor.yy531;} break; case 193: /* slimit_opt ::= SLIMIT signed COMMA signed */ -{yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;} +{yymsp[-3].minor.yy126.limit = yymsp[0].minor.yy531; yymsp[-3].minor.yy126.offset = yymsp[-2].minor.yy531;} break; case 196: /* expr ::= LP expr RP */ -{yylhsminor.yy78 = yymsp[-1].minor.yy78; yylhsminor.yy78->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy78->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = yymsp[-1].minor.yy316; yylhsminor.yy316->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy316->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 197: /* expr ::= ID */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 198: /* expr ::= ID DOT ID */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 199: /* expr ::= ID DOT STAR */ -{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 200: /* expr ::= INTEGER */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 201: /* expr ::= MINUS INTEGER */ case 202: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==202); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} - yymsp[-1].minor.yy78 = yylhsminor.yy78; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);} + yymsp[-1].minor.yy316 = yylhsminor.yy316; break; case 203: /* expr ::= FLOAT */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 204: /* expr ::= MINUS FLOAT */ case 205: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==205); -{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} - yymsp[-1].minor.yy78 = yylhsminor.yy78; +{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);} + yymsp[-1].minor.yy316 = yylhsminor.yy316; break; case 206: /* expr ::= STRING */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 207: /* expr ::= NOW */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); } + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 208: /* expr ::= VARIABLE */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 209: /* expr ::= BOOL */ -{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 210: /* expr ::= ID LP exprlist RP */ -{ yylhsminor.yy78 = tSqlExprCreateFunction(yymsp[-1].minor.yy166, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprCreateFunction(yymsp[-1].minor.yy266, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy316 = yylhsminor.yy316; break; case 211: /* expr ::= ID LP STAR RP */ -{ yylhsminor.yy78 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } - yymsp[-3].minor.yy78 = yylhsminor.yy78; +{ yylhsminor.yy316 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } + yymsp[-3].minor.yy316 = yylhsminor.yy316; break; case 212: /* expr ::= expr IS NULL */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, NULL, TK_ISNULL);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, NULL, TK_ISNULL);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 213: /* expr ::= expr IS NOT NULL */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-3].minor.yy78, NULL, TK_NOTNULL);} - yymsp[-3].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-3].minor.yy316, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy316 = yylhsminor.yy316; break; case 214: /* expr ::= expr LT expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LT);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_LT);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 215: /* expr ::= expr GT expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GT);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_GT);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 216: /* expr ::= expr LE expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LE);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_LE);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 217: /* expr ::= expr GE expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GE);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_GE);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 218: /* expr ::= expr NE expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_NE);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_NE);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 219: /* expr ::= expr EQ expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_EQ);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_EQ);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 220: /* expr ::= expr AND expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_AND);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_AND);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 221: /* expr ::= expr OR expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_OR); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_OR); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 222: /* expr ::= expr PLUS expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_PLUS); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_PLUS); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 223: /* expr ::= expr MINUS expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_MINUS); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_MINUS); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 224: /* expr ::= expr STAR expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_STAR); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_STAR); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 225: /* expr ::= expr SLASH expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_DIVIDE);} - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_DIVIDE);} + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 226: /* expr ::= expr REM expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_REM); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_REM); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 227: /* expr ::= expr LIKE expr */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LIKE); } - yymsp[-2].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-2].minor.yy316, yymsp[0].minor.yy316, TK_LIKE); } + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 228: /* expr ::= expr IN LP exprlist RP */ -{yylhsminor.yy78 = tSqlExprCreate(yymsp[-4].minor.yy78, (tSQLExpr*)yymsp[-1].minor.yy166, TK_IN); } - yymsp[-4].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = tSqlExprCreate(yymsp[-4].minor.yy316, (tSQLExpr*)yymsp[-1].minor.yy266, TK_IN); } + yymsp[-4].minor.yy316 = yylhsminor.yy316; break; case 229: /* exprlist ::= exprlist COMMA expritem */ -{yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166,yymsp[0].minor.yy78,0);} - yymsp[-2].minor.yy166 = yylhsminor.yy166; +{yylhsminor.yy266 = tSqlExprListAppend(yymsp[-2].minor.yy266,yymsp[0].minor.yy316,0);} + yymsp[-2].minor.yy266 = yylhsminor.yy266; break; case 230: /* exprlist ::= expritem */ -{yylhsminor.yy166 = tSqlExprListAppend(0,yymsp[0].minor.yy78,0);} - yymsp[0].minor.yy166 = yylhsminor.yy166; +{yylhsminor.yy266 = tSqlExprListAppend(0,yymsp[0].minor.yy316,0);} + yymsp[0].minor.yy266 = yylhsminor.yy266; break; case 231: /* expritem ::= expr */ -{yylhsminor.yy78 = yymsp[0].minor.yy78;} - yymsp[0].minor.yy78 = yylhsminor.yy78; +{yylhsminor.yy316 = yymsp[0].minor.yy316;} + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 233: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} @@ -3179,7 +2907,7 @@ static YYACTIONTYPE yy_reduce( case 234: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy135, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3190,14 +2918,14 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; case 236: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy135, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3208,7 +2936,7 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3222,7 +2950,7 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3232,16 +2960,16 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[-2].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1); - A = tVariantListAppend(A, &yymsp[0].minor.yy430, -1); + A = tVariantListAppend(A, &yymsp[0].minor.yy308, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; case 240: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy135, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3252,14 +2980,14 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; case 242: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy135, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3270,7 +2998,7 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3284,7 +3012,7 @@ static YYACTIONTYPE yy_reduce( toTSDBType(yymsp[0].minor.yy0.type); A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1); - SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); + SAlterTableInfo* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; @@ -3301,9 +3029,9 @@ static YYACTIONTYPE yy_reduce( break; /********** End reduce actions ************************************************/ }; - assert( yyrulenostateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); - return yyact; } /* @@ -3328,8 +3055,7 @@ static YYACTIONTYPE yy_reduce( static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); @@ -3340,8 +3066,7 @@ static void yy_parse_failed( ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } #endif /* YYNOERRORRECOVERY */ @@ -3353,13 +3078,12 @@ static void yy_syntax_error( int yymajor, /* The major type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ pInfo->valid = false; - int32_t outputBufLen = tListLen(pInfo->pzErrMsg); + int32_t outputBufLen = tListLen(pInfo->msg); int32_t len = 0; if(TOKEN.z) { @@ -3369,19 +3093,18 @@ static void yy_syntax_error( if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > outputBufLen) { char tmpstr[128] = {0}; memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1); - len = sprintf(pInfo->pzErrMsg, msg, tmpstr); + len = sprintf(pInfo->msg, msg, tmpstr); } else { - len = sprintf(pInfo->pzErrMsg, msg, &TOKEN.z[0]); + len = sprintf(pInfo->msg, msg, &TOKEN.z[0]); } } else { - len = sprintf(pInfo->pzErrMsg, "Incomplete SQL statement"); + len = sprintf(pInfo->msg, "Incomplete SQL statement"); } assert(len <= outputBufLen); /************ End %syntax_error code ******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* @@ -3390,8 +3113,7 @@ static void yy_syntax_error( static void yy_accept( yyParser *yypParser /* The parser */ ){ - ParseARG_FETCH - ParseCTX_FETCH + ParseARG_FETCH; #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); @@ -3406,8 +3128,7 @@ static void yy_accept( /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ - ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ - ParseCTX_STORE + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ } /* The main parser program. @@ -3436,47 +3157,45 @@ void Parse( ParseARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; - YYACTIONTYPE yyact; /* The parser action. */ + unsigned int yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif - yyParser *yypParser = (yyParser*)yyp; /* The parser */ - ParseCTX_FETCH - ParseARG_STORE + yyParser *yypParser; /* The parser */ + yypParser = (yyParser*)yyp; assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif + ParseARG_STORE; - yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ - if( yyact < YY_MIN_REDUCE ){ + int stateno = yypParser->yytos->stateno; + if( stateno < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact); + yyTracePrompt,yyTokenName[yymajor],stateno); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", - yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); + yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); } } #endif do{ - assert( yyact==yypParser->yytos->stateno ); - yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ - yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); + yy_shift(yypParser,yyact,yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif - break; + yymajor = YYNOCODE; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); @@ -3527,9 +3246,10 @@ void Parse( yymajor = YYNOCODE; }else{ while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL && (yyact = yy_find_reduce_action( yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE + YYERRORSYMBOL)) >= YY_MIN_REDUCE ){ yy_pop_parser_stack(yypParser); } @@ -3546,8 +3266,6 @@ void Parse( } yypParser->yyerrcnt = 3; yyerrorhit = 1; - if( yymajor==YYNOCODE ) break; - yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax @@ -3558,7 +3276,8 @@ void Parse( */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - break; + yymajor = YYNOCODE; + #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** @@ -3580,10 +3299,10 @@ void Parse( yypParser->yyerrcnt = -1; #endif } - break; + yymajor = YYNOCODE; #endif } - }while( yypParser->yytos>yypParser->yystack ); + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; @@ -3598,17 +3317,3 @@ void Parse( #endif return; } - -/* -** Return the fallback token corresponding to canonical token iToken, or -** 0 if iToken has no fallback. -*/ -int ParseFallback(int iToken){ -#ifdef YYFALLBACK - assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); - return yyFallback[iToken]; -#else - (void)iToken; - return 0; -#endif -} diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index daf3bd86c1..6cdf3eff9a 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -154,7 +154,7 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread if (code == 0) { code = pthread_create(&pServerObj->thread, &thattr, taosAcceptTcpConnection, (void *)pServerObj); if (code != 0) { - tError("%s failed to create TCP accept thread(%s)", label, strerror(errno)); + tError("%s failed to create TCP accept thread(%s)", label, strerror(code)); } } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 2444283435..90f673eaee 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -1388,8 +1388,8 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* break; } - if (((tsArray[pos] > pQueryHandle->window.ekey || pos > endPos) && ASCENDING_TRAVERSE(pQueryHandle->order)) || - ((tsArray[pos] < pQueryHandle->window.ekey || pos < endPos) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { + if (((pos > endPos || tsArray[pos] > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || + ((pos < endPos || tsArray[pos] < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { break; } diff --git a/src/util/inc/tarray.h b/src/util/inc/tarray.h index bf922fe9c4..35053c278e 100644 --- a/src/util/inc/tarray.h +++ b/src/util/inc/tarray.h @@ -110,7 +110,7 @@ void taosArrayCopy(SArray* pDst, const SArray* pSrc); * clone a new array * @param pSrc */ -SArray* taosArrayClone(const SArray* pSrc); +SArray* taosArrayDup(const SArray* pSrc); /** * clear the array (remove all element) diff --git a/src/util/src/tarray.c b/src/util/src/tarray.c index bec2fac7df..45cb6eee0f 100644 --- a/src/util/src/tarray.c +++ b/src/util/src/tarray.c @@ -165,7 +165,7 @@ void taosArrayCopy(SArray* pDst, const SArray* pSrc) { pDst->size = pSrc->size; } -SArray* taosArrayClone(const SArray* pSrc) { +SArray* taosArrayDup(const SArray* pSrc) { assert(pSrc != NULL); if (pSrc->size == 0) { // empty array list diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 3afdf41d05..c0cc8ce339 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -510,7 +510,9 @@ void taosCacheCleanup(SCacheObj *pCacheObj) { } pCacheObj->deleting = 1; - pthread_join(pCacheObj->refreshWorker, NULL); + if (taosCheckPthreadValid(pCacheObj->refreshWorker)) { + pthread_join(pCacheObj->refreshWorker, NULL); + } uInfo("cache:%s will be cleaned up", pCacheObj->name); doCleanupDataCache(pCacheObj); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index 5f6f3fe105..3e72562c55 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -201,6 +201,8 @@ int32_t vnodeOpen(int32_t vgId) { pthread_mutex_init(&pVnode->statusMutex, NULL); vnodeSetInitStatus(pVnode); + tsdbIncCommitRef(pVnode->vgId); + int32_t code = vnodeReadCfg(pVnode); if (code != TSDB_CODE_SUCCESS) { vnodeCleanUp(pVnode); @@ -297,7 +299,6 @@ int32_t vnodeOpen(int32_t vgId) { pVnode->events = NULL; vDebug("vgId:%d, vnode is opened in %s, pVnode:%p", pVnode->vgId, rootDir, pVnode); - tsdbIncCommitRef(pVnode->vgId); vnodeAddIntoHash(pVnode); diff --git a/tests/examples/JDBC/taosdemo/pom.xml b/tests/examples/JDBC/taosdemo/pom.xml index 72adbd0fa3..15f868a117 100644 --- a/tests/examples/JDBC/taosdemo/pom.xml +++ b/tests/examples/JDBC/taosdemo/pom.xml @@ -67,9 +67,9 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.16 - - + 2.0.17 + + diff --git a/tests/examples/c/CMakeLists.txt b/tests/examples/c/CMakeLists.txt index 59bcb6eaff..9e879d4c4c 100644 --- a/tests/examples/c/CMakeLists.txt +++ b/tests/examples/c/CMakeLists.txt @@ -3,6 +3,6 @@ PROJECT(TDengine) IF (TD_LINUX) INCLUDE_DIRECTORIES(. ${TD_COMMUNITY_DIR}/src/inc ${TD_COMMUNITY_DIR}/src/client/inc ${TD_COMMUNITY_DIR}/inc) AUX_SOURCE_DIRECTORY(. SRC) - ADD_EXECUTABLE(demo demo.c) + ADD_EXECUTABLE(demo apitest.c) TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread ) ENDIF () diff --git a/tests/pytest/concurrent_inquiry.py b/tests/pytest/concurrent_inquiry.py index 7bdab8bc67..e832c9a74e 100644 --- a/tests/pytest/concurrent_inquiry.py +++ b/tests/pytest/concurrent_inquiry.py @@ -18,6 +18,8 @@ import time import random import requests import argparse +import datetime +import string from requests.auth import HTTPBasicAuth func_list=['avg','count','twa','sum','stddev','leastsquares','min', 'max','first','last','top','bottom','percentile','apercentile', @@ -31,7 +33,7 @@ condition_list=[ 'fill(null)' ] -where_list = ['_c0>now-10d',' <50'," like \'%a%\'"] +where_list = ['_c0>now-10d',' <50','like',' is null'] class ConcurrentInquiry: # def __init__(self,ts=1500000001000,host='127.0.0.1',user='root',password='taosdata',dbname='test', # stb_prefix='st',subtb_prefix='t',n_Therads=10,r_Therads=10,probabilities=0.05,loop=5, @@ -54,13 +56,15 @@ class ConcurrentInquiry: self.subtb_stru_list=[] self.stb_tag_list=[] self.subtb_tag_list=[] - self.probabilities = [probabilities,1-probabilities] - self.ifjoin = [0,1] + self.probabilities = [1-probabilities,probabilities] + self.ifjoin = [1,0] self.loop = loop self.stableNum = stableNum self.subtableNum = subtableNum self.insertRows = insertRows self.mix_table = mix_table + self.max_ts = datetime.datetime.now() + self.min_ts = datetime.datetime.now() - datetime.timedelta(days=5) def SetThreadsNum(self,num): self.numOfTherads=num @@ -103,6 +107,14 @@ class ConcurrentInquiry: self.subtb_stru_list.append(tb) self.subtb_tag_list.append(tag) + def get_timespan(self,cl): #获取时间跨度(仅第一个超级表) + sql = 'select first(_c0),last(_c0) from ' + self.dbname + '.' + self.stb_list[0] + ';' + print(sql) + cl.execute(sql) + for data in cl: + self.max_ts = data[1] + self.min_ts = data[0] + def get_full(self): #获取所有的表、表结构 host = self.host user = self.user @@ -118,6 +130,7 @@ class ConcurrentInquiry: self.r_subtb_list(cl,i) self.r_stb_stru(cl) self.r_subtb_stru(cl) + self.get_timespan(cl) cl.close() conn.close() @@ -127,9 +140,21 @@ class ConcurrentInquiry: for i in range(random.randint(0,len(tlist))): c = random.choice(where_list) if c == '_c0>now-10d': - l.append(c) + rdate = self.min_ts + (self.max_ts - self.min_ts)/10 * random.randint(-11,11) + conlist = ' _c0 ' + random.choice(['<','>','>=','<=','<>']) + "'" + str(rdate) + "'" + if self.random_pick(): + l.append(conlist) + else: l.append(c) + elif '<50' in c: + conlist = ' ' + random.choice(tlist) + random.choice(['<','>','>=','<=','<>']) + str(random.randrange(-100,100)) + l.append(conlist) + elif 'is null' in c: + conlist = ' ' + random.choice(tlist) + random.choice([' is null',' is not null']) + l.append(conlist) else: - l.append(random.choice(tlist)+c) + s_all = string.ascii_letters + conlist = ' ' + random.choice(tlist) + " like \'%" + random.choice(s_all) + "%\' " + l.append(conlist) return 'where '+random.choice([' and ',' or ']).join(l) def con_interval(self,tlist,col_list,tag_list): @@ -195,8 +220,10 @@ class ConcurrentInquiry: if bool(random.getrandbits(1)): pick_func+=alias sel_col_list.append(pick_func) - - sql=sql+','.join(sel_col_list) #select col & func + if col_rand == 0: + sql = sql + '*' + else: + sql=sql+','.join(sel_col_list) #select col & func if self.mix_table == 0: sql = sql + ' from '+random.choice(self.stb_list+self.subtb_list)+' ' elif self.mix_table == 1: @@ -262,7 +289,26 @@ class ConcurrentInquiry: else: sel_col_tag.append('t1.' + str(random.choice(col_list[0] + tag_list[0]))) sel_col_tag.append('t2.' + str(random.choice(col_list[1] + tag_list[1]))) - sql += ','.join(sel_col_tag) + sel_col_list = [] + random.shuffle(func_list) + if self.random_pick(): + loop = 0 + for i,j in zip(sel_col_tag,func_list): #决定每个被查询col的函数 + alias = ' as '+ 'taos%d ' % loop + loop += 1 + pick_func = '' + if j == 'leastsquares': + pick_func=j+'('+i+',1,1)' + elif j == 'top' or j == 'bottom' or j == 'percentile' or j == 'apercentile': + pick_func=j+'('+i+',1)' + else: + pick_func=j+'('+i+')' + if bool(random.getrandbits(1)): + pick_func+=alias + sel_col_list.append(pick_func) + sql += ','.join(sel_col_list) + else: + sql += ','.join(sel_col_tag) sql = sql + ' from '+ str(tbname[0]) +' t1,' + str(tbname[1]) + ' t2 ' #select col & func join_section = None @@ -274,7 +320,6 @@ class ConcurrentInquiry: else: temp = random.choices(col_intersection+tag_intersection) join_section = temp.pop() - print(random.choices(col_intersection)) sql += 'where t1._c0 = t2._c0 and ' + 't1.' + str(join_section) + '=t2.' + str(join_section) return sql diff --git a/tests/script/general/alter/cached_schema_after_alter.sim b/tests/script/general/alter/cached_schema_after_alter.sim index 2d049ec595..96ee439084 100644 --- a/tests/script/general/alter/cached_schema_after_alter.sim +++ b/tests/script/general/alter/cached_schema_after_alter.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $db = csaa_db @@ -53,10 +53,10 @@ endi print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sleep 5000 +sleep 3000 sql connect sql use $db diff --git a/tests/script/general/alter/count.sim b/tests/script/general/alter/count.sim index 157b4c1371..fc936668b8 100644 --- a/tests/script/general/alter/count.sim +++ b/tests/script/general/alter/count.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 print ========= start dnode1 as master system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -141,9 +141,9 @@ endi print ============= step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb if $data00 != 24 then @@ -250,9 +250,9 @@ endi print ============== step18 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 #sql select count(g) from tb #if $data00 != 12 then diff --git a/tests/script/general/alter/dnode.sim b/tests/script/general/alter/dnode.sim index 73a095ec05..7b31218fc2 100644 --- a/tests/script/general/alter/dnode.sim +++ b/tests/script/general/alter/dnode.sim @@ -4,14 +4,14 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 sql alter dnode 1 resetlog sql alter dnode 1 monitor 1 -sleep 5000 +sleep 3000 sql select * from log.dn if $rows <= 0 then return -1 diff --git a/tests/script/general/alter/import.sim b/tests/script/general/alter/import.sim index 76388a26f2..aef0a258b2 100644 --- a/tests/script/general/alter/import.sim +++ b/tests/script/general/alter/import.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 print ========= start dnode1 as master system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/insert1.sim b/tests/script/general/alter/insert1.sim index 3b16214465..12ab09beb9 100644 --- a/tests/script/general/alter/insert1.sim +++ b/tests/script/general/alter/insert1.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -940,9 +940,9 @@ endi print ======== step9 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql select * from tb order by ts asc if $rows != 8 then diff --git a/tests/script/general/alter/insert2.sim b/tests/script/general/alter/insert2.sim index 28948b69d2..dcd9f50030 100644 --- a/tests/script/general/alter/insert2.sim +++ b/tests/script/general/alter/insert2.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -608,9 +608,9 @@ sql_error alter table tb drop column a print ======== step9 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql select * from tb order by ts desc if $rows != 7 then diff --git a/tests/script/general/alter/metrics.sim b/tests/script/general/alter/metrics.sim index 5ed8050b96..fd0b210cd1 100644 --- a/tests/script/general/alter/metrics.sim +++ b/tests/script/general/alter/metrics.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -367,9 +367,9 @@ endi print ======== step9 print ======== step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use d2 sql describe tb diff --git a/tests/script/general/alter/table.sim b/tests/script/general/alter/table.sim index 5a72fc9256..06704eeca6 100644 --- a/tests/script/general/alter/table.sim +++ b/tests/script/general/alter/table.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -318,9 +318,9 @@ endi print ======== step9 print ======== step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use d1 sql describe tb diff --git a/tests/script/general/cache/new_metrics.sim b/tests/script/general/cache/new_metrics.sim index 84f9e40de3..a13dd23bb6 100644 --- a/tests/script/general/cache/new_metrics.sim +++ b/tests/script/general/cache/new_metrics.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/cache/restart_metrics.sim b/tests/script/general/cache/restart_metrics.sim index f24768859f..f5035e1251 100644 --- a/tests/script/general/cache/restart_metrics.sim +++ b/tests/script/general/cache/restart_metrics.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -49,7 +49,7 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start diff --git a/tests/script/general/cache/restart_table.sim b/tests/script/general/cache/restart_table.sim index 8697c26bc3..fcdb2fb593 100644 --- a/tests/script/general/cache/restart_table.sim +++ b/tests/script/general/cache/restart_table.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -33,14 +33,14 @@ endi print =============== step2 system sh/exec.sh -n dnode1 -s stop -sleep 5000 +sleep 3000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start print =============== step3 print ==> sleep 8 seconds to renew cache -sleep 3000 +sleep 2000 sql reset query cache sleep 18000 diff --git a/tests/script/general/column/commit.sim b/tests/script/general/column/commit.sim index c574db1aa9..e1b98d3814 100644 --- a/tests/script/general/column/commit.sim +++ b/tests/script/general/column/commit.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 @@ -89,9 +89,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step5 diff --git a/tests/script/general/column/metrics.sim b/tests/script/general/column/metrics.sim index 673b66c9e2..a46ab6560a 100644 --- a/tests/script/general/column/metrics.sim +++ b/tests/script/general/column/metrics.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 @@ -157,9 +157,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step5 diff --git a/tests/script/general/column/table.sim b/tests/script/general/column/table.sim index aec0dc3c75..7c9302aa08 100644 --- a/tests/script/general/column/table.sim +++ b/tests/script/general/column/table.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 @@ -129,9 +129,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print ============== step5 diff --git a/tests/script/general/compress/commitlog.sim b/tests/script/general/compress/commitlog.sim index b5d653fe83..e8eab6ed0c 100644 --- a/tests/script/general/compress/commitlog.sim +++ b/tests/script/general/compress/commitlog.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -87,9 +87,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/compress.sim b/tests/script/general/compress/compress.sim index 6975f87996..0df2a0d4cb 100644 --- a/tests/script/general/compress/compress.sim +++ b/tests/script/general/compress/compress.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -82,9 +82,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/compress2.sim b/tests/script/general/compress/compress2.sim index cf96f572ac..007d1ec339 100644 --- a/tests/script/general/compress/compress2.sim +++ b/tests/script/general/compress/compress2.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c comp -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -82,9 +82,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step5 diff --git a/tests/script/general/compress/uncompress.sim b/tests/script/general/compress/uncompress.sim index 13d288451c..9c71c8c1cc 100644 --- a/tests/script/general/compress/uncompress.sim +++ b/tests/script/general/compress/uncompress.sim @@ -4,7 +4,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c comp -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -81,9 +81,9 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 -system sh/exec.sh -n dnode1 -s start sleep 3000 +system sh/exec.sh -n dnode1 -s start +sleep 2000 print =============== step5 diff --git a/tests/script/general/compute/avg.sim b/tests/script/general/compute/avg.sim index 52a270bc6d..027cfbe61d 100644 --- a/tests/script/general/compute/avg.sim +++ b/tests/script/general/compute/avg.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_av_db diff --git a/tests/script/general/compute/bottom.sim b/tests/script/general/compute/bottom.sim index 415bd36e2e..5c76d5d171 100644 --- a/tests/script/general/compute/bottom.sim +++ b/tests/script/general/compute/bottom.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_bo_db diff --git a/tests/script/general/compute/count.sim b/tests/script/general/compute/count.sim index d8aeb18752..fc481088a5 100644 --- a/tests/script/general/compute/count.sim +++ b/tests/script/general/compute/count.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_co_db diff --git a/tests/script/general/compute/diff.sim b/tests/script/general/compute/diff.sim index 88c2ecb09d..433a935609 100644 --- a/tests/script/general/compute/diff.sim +++ b/tests/script/general/compute/diff.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_di_db diff --git a/tests/script/general/compute/diff2.sim b/tests/script/general/compute/diff2.sim index 14675c823f..7406771ac6 100644 --- a/tests/script/general/compute/diff2.sim +++ b/tests/script/general/compute/diff2.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_di_db diff --git a/tests/script/general/compute/first.sim b/tests/script/general/compute/first.sim index 01b82cce62..f12ed2b73a 100644 --- a/tests/script/general/compute/first.sim +++ b/tests/script/general/compute/first.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_fi_db diff --git a/tests/script/general/compute/interval.sim b/tests/script/general/compute/interval.sim index 8f9bf2ecb3..79f3475222 100644 --- a/tests/script/general/compute/interval.sim +++ b/tests/script/general/compute/interval.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_in_db diff --git a/tests/script/general/compute/last.sim b/tests/script/general/compute/last.sim index 88a6a26846..7b7c45044f 100644 --- a/tests/script/general/compute/last.sim +++ b/tests/script/general/compute/last.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_la_db diff --git a/tests/script/general/compute/last_row.sim b/tests/script/general/compute/last_row.sim index 55d97fe53c..03fa9bc4af 100644 --- a/tests/script/general/compute/last_row.sim +++ b/tests/script/general/compute/last_row.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_la_db diff --git a/tests/script/general/compute/leastsquare.sim b/tests/script/general/compute/leastsquare.sim index 5a28e74bff..20e2cc9d17 100644 --- a/tests/script/general/compute/leastsquare.sim +++ b/tests/script/general/compute/leastsquare.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_le_db diff --git a/tests/script/general/compute/max.sim b/tests/script/general/compute/max.sim index 1029ba78cc..ba87416292 100644 --- a/tests/script/general/compute/max.sim +++ b/tests/script/general/compute/max.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_ma_db diff --git a/tests/script/general/compute/min.sim b/tests/script/general/compute/min.sim index d6a57f4f20..e981f8335f 100644 --- a/tests/script/general/compute/min.sim +++ b/tests/script/general/compute/min.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mi_db diff --git a/tests/script/general/compute/null.sim b/tests/script/general/compute/null.sim index 47f7a3c1b9..de2a834684 100644 --- a/tests/script/general/compute/null.sim +++ b/tests/script/general/compute/null.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = db diff --git a/tests/script/general/compute/percentile.sim b/tests/script/general/compute/percentile.sim index 0fb88e7a40..9798aa2f5c 100644 --- a/tests/script/general/compute/percentile.sim +++ b/tests/script/general/compute/percentile.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_pe_db diff --git a/tests/script/general/compute/stddev.sim b/tests/script/general/compute/stddev.sim index abe4025e96..2f6ffb097a 100644 --- a/tests/script/general/compute/stddev.sim +++ b/tests/script/general/compute/stddev.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_st_db diff --git a/tests/script/general/compute/sum.sim b/tests/script/general/compute/sum.sim index 9d42e766b6..230248a370 100644 --- a/tests/script/general/compute/sum.sim +++ b/tests/script/general/compute/sum.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_su_db diff --git a/tests/script/general/compute/top.sim b/tests/script/general/compute/top.sim index e6bcd4a5cb..a4f482b127 100644 --- a/tests/script/general/compute/top.sim +++ b/tests/script/general/compute/top.sim @@ -3,7 +3,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_to_db diff --git a/tests/script/general/connection/connection.sim b/tests/script/general/connection/connection.sim index abebbacbd9..1af6e1fda6 100644 --- a/tests/script/general/connection/connection.sim +++ b/tests/script/general/connection/connection.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= step1 diff --git a/tests/script/general/connection/mqtt.sim b/tests/script/general/connection/mqtt.sim index 4b291f91ea..c2c50ef17e 100644 --- a/tests/script/general/connection/mqtt.sim +++ b/tests/script/general/connection/mqtt.sim @@ -10,7 +10,7 @@ system sh/cfg.sh -n dnode1 -c mqtt -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database mqttdb; sql create table mqttdb.devices(ts timestamp, value double) tags(name binary(32), model binary(32), serial binary(16), param binary(16), unit binary(16)); diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim index 1c3f543ffd..b10182baa5 100644 --- a/tests/script/general/db/alter_option.sim +++ b/tests/script/general/db/alter_option.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= create database diff --git a/tests/script/general/db/alter_tables_d2.sim b/tests/script/general/db/alter_tables_d2.sim index cd3121057b..f74f98d571 100644 --- a/tests/script/general/db/alter_tables_d2.sim +++ b/tests/script/general/db/alter_tables_d2.sim @@ -264,10 +264,10 @@ endi print ============================ step7 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 sql reset query cache sleep 1000 diff --git a/tests/script/general/db/alter_tables_v4.sim b/tests/script/general/db/alter_tables_v4.sim index b57b2c0320..10bb4e108b 100644 --- a/tests/script/general/db/alter_tables_v4.sim +++ b/tests/script/general/db/alter_tables_v4.sim @@ -232,9 +232,9 @@ endi print ============================ step7 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql reset query cache sleep 1000 diff --git a/tests/script/general/db/alter_vgroups.sim b/tests/script/general/db/alter_vgroups.sim index 13928cf033..81ffc7d443 100644 --- a/tests/script/general/db/alter_vgroups.sim +++ b/tests/script/general/db/alter_vgroups.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ step1 @@ -70,9 +70,9 @@ endi print ============================ step3 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 2 -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql create table db.t100 using db.st tags(0) sql create table db.t101 using db.st tags(1) @@ -132,9 +132,9 @@ print ============================ step5 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3 -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql create table db.t200 using db.st tags(0) sql create table db.t201 using db.st tags(1) diff --git a/tests/script/general/db/backup/keep.sim b/tests/script/general/db/backup/keep.sim index 29771fc978..943022deba 100644 --- a/tests/script/general/db/backup/keep.sim +++ b/tests/script/general/db/backup/keep.sim @@ -23,7 +23,7 @@ sql connect print ========= start other dnodes sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 print ======== step1 create db sql create database keepdb replica 1 keep 30 days 7 @@ -50,9 +50,9 @@ endi print ======== step2 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 sql select * from tb print ===> rows $rows @@ -112,9 +112,9 @@ endi print ======== step5 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 sql select * from tb print ===> rows $rows @@ -153,9 +153,9 @@ endi print ======== step7 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 sql select * from tb print ===> rows $rows diff --git a/tests/script/general/db/basic.sim b/tests/script/general/db/basic.sim index 1c4939256b..684ce825fe 100644 --- a/tests/script/general/db/basic.sim +++ b/tests/script/general/db/basic.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/db/basic1.sim b/tests/script/general/db/basic1.sim index 302c5ac409..9ec1aabe98 100644 --- a/tests/script/general/db/basic1.sim +++ b/tests/script/general/db/basic1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database diff --git a/tests/script/general/db/basic2.sim b/tests/script/general/db/basic2.sim index afe5ee5d95..acd035bd74 100644 --- a/tests/script/general/db/basic2.sim +++ b/tests/script/general/db/basic2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database d1 diff --git a/tests/script/general/db/basic3.sim b/tests/script/general/db/basic3.sim index 88f5bf6460..fb64476696 100644 --- a/tests/script/general/db/basic3.sim +++ b/tests/script/general/db/basic3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database d1 diff --git a/tests/script/general/db/basic4.sim b/tests/script/general/db/basic4.sim index a0a9aaa627..ce6d352d12 100644 --- a/tests/script/general/db/basic4.sim +++ b/tests/script/general/db/basic4.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database d1 diff --git a/tests/script/general/db/basic5.sim b/tests/script/general/db/basic5.sim index 82b9bf9bf4..08c9db2332 100644 --- a/tests/script/general/db/basic5.sim +++ b/tests/script/general/db/basic5.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database d1 diff --git a/tests/script/general/db/delete.sim b/tests/script/general/db/delete.sim index e4d40bf5da..4384044885 100644 --- a/tests/script/general/db/delete.sim +++ b/tests/script/general/db/delete.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 @@ -44,7 +44,7 @@ endi print ======= step3 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start $x = 0 diff --git a/tests/script/general/db/delete_reuse1.sim b/tests/script/general/db/delete_reuse1.sim index feeb0152c1..b18bb285d1 100644 --- a/tests/script/general/db/delete_reuse1.sim +++ b/tests/script/general/db/delete_reuse1.sim @@ -22,7 +22,7 @@ system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/general/db/delete_reuse2.sim index 9053e8af01..c82457ec42 100644 --- a/tests/script/general/db/delete_reuse2.sim +++ b/tests/script/general/db/delete_reuse2.sim @@ -21,9 +21,9 @@ system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 print ========= start dnodes -sleep 2000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 + sql connect sql reset query cache @@ -65,7 +65,7 @@ endi print ======== step2 sql drop database d1 -sleep 1000 +sleep 500 sql insert into d1.t1 values(now, 2) -x step2 return -1 step2: @@ -73,7 +73,7 @@ step2: print ========= step3 sql create database db1 replica 1 sql reset query cache -sleep 1000 +sleep 500 sql create table db1.tb1 (ts timestamp, i int) sql insert into db1.tb1 values(now, 2) sql select * from db1.tb1 @@ -90,7 +90,7 @@ while $x < 20 sql use $db sql drop database $db - sleep 1000 + sleep 500 sql insert into $tb values(now, -1) -x step4 return -1 step4: @@ -100,7 +100,7 @@ while $x < 20 $tb = tb . $x sql reset query cache - sleep 1000 + sleep 500 sql create database $db replica 1 sql use $db diff --git a/tests/script/general/db/delete_reusevnode2.sim b/tests/script/general/db/delete_reusevnode2.sim index 0db2440b3b..c05db6b65a 100644 --- a/tests/script/general/db/delete_reusevnode2.sim +++ b/tests/script/general/db/delete_reusevnode2.sim @@ -4,7 +4,7 @@ system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/db/delete_writing1.sim b/tests/script/general/db/delete_writing1.sim index 8b369b4e3d..98e9a3d66f 100644 --- a/tests/script/general/db/delete_writing1.sim +++ b/tests/script/general/db/delete_writing1.sim @@ -43,7 +43,7 @@ while $x < 20 sql create database db sql create table db.tb (ts timestamp, i int) - sleep 3000 + sleep 2000 $x = $x + 1 endw diff --git a/tests/script/general/db/delete_writing2.sim b/tests/script/general/db/delete_writing2.sim index 3ea220cb8c..2d1b0c8d9c 100644 --- a/tests/script/general/db/delete_writing2.sim +++ b/tests/script/general/db/delete_writing2.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c wallevel -v 0 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database db @@ -39,7 +39,7 @@ while $x < 10 sql create database db sql create table db.tb (ts timestamp, i int) - sleep 3000 + sleep 2000 $x = $x + 1 endw diff --git a/tests/script/general/db/dropdnodes.sim b/tests/script/general/db/dropdnodes.sim index c7bbdf73a4..8a46d5f9ce 100644 --- a/tests/script/general/db/dropdnodes.sim +++ b/tests/script/general/db/dropdnodes.sim @@ -11,7 +11,7 @@ print ========== prepare data system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 @@ -72,7 +72,7 @@ endi print ========== step3 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql drop dnode $hostname2 sleep 2000 diff --git a/tests/script/general/db/len.sim b/tests/script/general/db/len.sim index 30abcbe100..561245e666 100644 --- a/tests/script/general/db/len.sim +++ b/tests/script/general/db/len.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 diff --git a/tests/script/general/db/nosuchfile.sim b/tests/script/general/db/nosuchfile.sim index 98ac4ec012..69db8c0dc5 100644 --- a/tests/script/general/db/nosuchfile.sim +++ b/tests/script/general/db/nosuchfile.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c wallevel -v 2 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ========== step3 sql create database d1 @@ -20,7 +20,7 @@ sql insert into d1.t1 values(now+5s, 31) print ========== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 print ========== step5 sql select * from d1.t1 order by t desc diff --git a/tests/script/general/db/repeat.sim b/tests/script/general/db/repeat.sim index aaa103234d..b3bbca2d19 100644 --- a/tests/script/general/db/repeat.sim +++ b/tests/script/general/db/repeat.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -21,13 +21,13 @@ sql create table d3.t1(ts timestamp, i int) sql create database d4 sql create table d4.t1(ts timestamp, i int) -sleep 3000 +sleep 2000 sql drop database d1 sql drop database d2 sql drop database d3 sql drop database d4 -sleep 3000 +sleep 2000 sql create database d5 sql create table d5.t1(ts timestamp, i int) @@ -41,14 +41,14 @@ sql create table d7.t1(ts timestamp, i int) sql create database d8 sql create table d8.t1(ts timestamp, i int) -sleep 3000 +sleep 2000 sql drop database d5 sql drop database d6 sql drop database d7 sql drop database d8 -sleep 3000 +sleep 2000 sql create database d9; sql create table d9.t1(ts timestamp, i int) diff --git a/tests/script/general/db/show_create_db.sim b/tests/script/general/db/show_create_db.sim index baa7b253e1..edaa971c5c 100644 --- a/tests/script/general/db/show_create_db.sim +++ b/tests/script/general/db/show_create_db.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step2 diff --git a/tests/script/general/db/show_create_table.sim b/tests/script/general/db/show_create_table.sim index 8338638709..0d7408748a 100644 --- a/tests/script/general/db/show_create_table.sim +++ b/tests/script/general/db/show_create_table.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ===============create three type table diff --git a/tests/script/general/db/tables.sim b/tests/script/general/db/tables.sim index d700bf8068..50b6805eca 100644 --- a/tests/script/general/db/tables.sim +++ b/tests/script/general/db/tables.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 4 system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step2 diff --git a/tests/script/general/db/vnodes.sim b/tests/script/general/db/vnodes.sim index b01e94206f..b123e91ad1 100644 --- a/tests/script/general/db/vnodes.sim +++ b/tests/script/general/db/vnodes.sim @@ -15,7 +15,7 @@ system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000 print ========== prepare data system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database db blocks 3 cache 1 sql use db diff --git a/tests/script/general/field/2.sim b/tests/script/general/field/2.sim index 28506b7cb8..812301dfbd 100644 --- a/tests/script/general/field/2.sim +++ b/tests/script/general/field/2.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/3.sim b/tests/script/general/field/3.sim index 453f4968bf..a531caaca0 100644 --- a/tests/script/general/field/3.sim +++ b/tests/script/general/field/3.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/4.sim b/tests/script/general/field/4.sim index 243424724f..c530ff62d1 100644 --- a/tests/script/general/field/4.sim +++ b/tests/script/general/field/4.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/5.sim b/tests/script/general/field/5.sim index ca1543b54b..a676281313 100644 --- a/tests/script/general/field/5.sim +++ b/tests/script/general/field/5.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/6.sim b/tests/script/general/field/6.sim index 23223e5c15..f187d7db10 100644 --- a/tests/script/general/field/6.sim +++ b/tests/script/general/field/6.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/bigint.sim b/tests/script/general/field/bigint.sim index 10060f7422..c9bda687e1 100644 --- a/tests/script/general/field/bigint.sim +++ b/tests/script/general/field/bigint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/binary.sim b/tests/script/general/field/binary.sim index b51f023efe..36a43272ca 100644 --- a/tests/script/general/field/binary.sim +++ b/tests/script/general/field/binary.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/bool.sim b/tests/script/general/field/bool.sim index 4528f79bc7..d8e613572a 100644 --- a/tests/script/general/field/bool.sim +++ b/tests/script/general/field/bool.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/double.sim b/tests/script/general/field/double.sim index 40650cb9bd..f7dac3192a 100644 --- a/tests/script/general/field/double.sim +++ b/tests/script/general/field/double.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/float.sim b/tests/script/general/field/float.sim index 0ead9fb48a..3ab5602c55 100644 --- a/tests/script/general/field/float.sim +++ b/tests/script/general/field/float.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/int.sim b/tests/script/general/field/int.sim index a095dc2176..5c3cec99cf 100644 --- a/tests/script/general/field/int.sim +++ b/tests/script/general/field/int.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/single.sim b/tests/script/general/field/single.sim index 8540608e96..d572f6df2a 100644 --- a/tests/script/general/field/single.sim +++ b/tests/script/general/field/single.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/smallint.sim b/tests/script/general/field/smallint.sim index 578de4ea44..8bd9972321 100644 --- a/tests/script/general/field/smallint.sim +++ b/tests/script/general/field/smallint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/field/tinyint.sim b/tests/script/general/field/tinyint.sim index f132b42702..3a2d7bc44e 100644 --- a/tests/script/general/field/tinyint.sim +++ b/tests/script/general/field/tinyint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/http/autocreate.sim b/tests/script/general/http/autocreate.sim index 98d64ab839..39af990b50 100644 --- a/tests/script/general/http/autocreate.sim +++ b/tests/script/general/http/autocreate.sim @@ -1,12 +1,12 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/chunked.sim b/tests/script/general/http/chunked.sim index 6592c761c6..c5855e5d29 100644 --- a/tests/script/general/http/chunked.sim +++ b/tests/script/general/http/chunked.sim @@ -1,12 +1,12 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/grafana.sim b/tests/script/general/http/grafana.sim index c7866e5f4c..128994640d 100644 --- a/tests/script/general/http/grafana.sim +++ b/tests/script/general/http/grafana.sim @@ -1,5 +1,5 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -94,7 +94,7 @@ if $system_content != @{"status":"error","code":4387,"desc":"invalid format of A return -1 endi -sleep 3000 +sleep 2000 system_content curl 127.0.0.1:7111/grafana/login/root/taosdata print 8-> $system_content if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then diff --git a/tests/script/general/http/grafana_bug.sim b/tests/script/general/http/grafana_bug.sim index 43c52ba75f..ce039af44c 100644 --- a/tests/script/general/http/grafana_bug.sim +++ b/tests/script/general/http/grafana_bug.sim @@ -1,5 +1,5 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 @@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ============================ dnode1 start diff --git a/tests/script/general/http/gzip.sim b/tests/script/general/http/gzip.sim index 9c77567abb..ce358d84a1 100644 --- a/tests/script/general/http/gzip.sim +++ b/tests/script/general/http/gzip.sim @@ -1,12 +1,12 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c maxSQLLength -v 340032 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/prepare.sim b/tests/script/general/http/prepare.sim index 0bcb42ad41..6803643caf 100644 --- a/tests/script/general/http/prepare.sim +++ b/tests/script/general/http/prepare.sim @@ -1,11 +1,11 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/restful.sim b/tests/script/general/http/restful.sim index 7d1169ca27..a06e899d93 100644 --- a/tests/script/general/http/restful.sim +++ b/tests/script/general/http/restful.sim @@ -1,12 +1,12 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim index 645ebd2788..69f8206347 100644 --- a/tests/script/general/http/restful_full.sim +++ b/tests/script/general/http/restful_full.sim @@ -1,11 +1,11 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/exec.sh -n dnode1 -s start -#sleep 3000 +#sleep 2000 sql connect print ============================ dnode1 start @@ -69,7 +69,7 @@ if $system_content != @{"status":"error","code":4387,"desc":"invalid format of A return -1 endi -sleep 3000 +sleep 2000 system_content curl 127.0.0.1:7111/rest/login/root/taosdata/ print 10-> $system_content diff --git a/tests/script/general/http/restful_insert.sim b/tests/script/general/http/restful_insert.sim index f230f98723..90bf7e1b15 100644 --- a/tests/script/general/http/restful_insert.sim +++ b/tests/script/general/http/restful_insert.sim @@ -1,12 +1,12 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/restful_limit.sim b/tests/script/general/http/restful_limit.sim index 7d2b6e9a02..c925656b36 100644 --- a/tests/script/general/http/restful_limit.sim +++ b/tests/script/general/http/restful_limit.sim @@ -1,10 +1,10 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/http/telegraf.sim b/tests/script/general/http/telegraf.sim index 4018d9661a..6825e5c479 100644 --- a/tests/script/general/http/telegraf.sim +++ b/tests/script/general/http/telegraf.sim @@ -1,5 +1,5 @@ system sh/stop_dnodes.sh -sleep 3000 +sleep 2000 system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c http -v 1 @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c httpEnableRecordSql -v 1 system sh/cfg.sh -n dnode1 -c telegrafUseFieldNum -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -245,7 +245,7 @@ if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table return -1 endi -sleep 3000 +sleep 2000 print =============== step2 - insert single data system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:7111/telegraf/db/ diff --git a/tests/script/general/import/basic.sim b/tests/script/general/import/basic.sim index 07febb2bd5..50c4059c52 100644 --- a/tests/script/general/import/basic.sim +++ b/tests/script/general/import/basic.sim @@ -26,7 +26,7 @@ system sh/cfg.sh -n dnode4 -c walLevel -v 0 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database ibadb diff --git a/tests/script/general/import/commit.sim b/tests/script/general/import/commit.sim index 36d201e9ef..0aa63b14ff 100644 --- a/tests/script/general/import/commit.sim +++ b/tests/script/general/import/commit.sim @@ -26,7 +26,7 @@ system sh/cfg.sh -n dnode4 -c walLevel -v 0 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ========= step1 @@ -72,9 +72,9 @@ endi print ========= step3 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print ========= step4 sql select * from ic2db.tb; diff --git a/tests/script/general/import/large.sim b/tests/script/general/import/large.sim index 5bf05a57fb..3b82c0355a 100644 --- a/tests/script/general/import/large.sim +++ b/tests/script/general/import/large.sim @@ -26,7 +26,7 @@ system sh/cfg.sh -n dnode4 -c walLevel -v 0 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database db diff --git a/tests/script/general/import/replica1.sim b/tests/script/general/import/replica1.sim index d450b3fb49..48d5455b79 100644 --- a/tests/script/general/import/replica1.sim +++ b/tests/script/general/import/replica1.sim @@ -27,7 +27,7 @@ system sh/cfg.sh -n dnode4 -c walLevel -v 2 print ========= start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database ir1db days 7 @@ -93,9 +93,9 @@ endi print ================== dnode restart system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use ir1db sql select * from tb; @@ -162,9 +162,9 @@ endi print ================= step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use ir1db sql select * from tb; diff --git a/tests/script/general/insert/basic.sim b/tests/script/general/insert/basic.sim index 3f0f25a95b..c688342fc5 100644 --- a/tests/script/general/insert/basic.sim +++ b/tests/script/general/insert/basic.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/insert_drop.sim b/tests/script/general/insert/insert_drop.sim index 9b68e5a6a6..8592637626 100644 --- a/tests/script/general/insert/insert_drop.sim +++ b/tests/script/general/insert/insert_drop.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $tbNum = 10 @@ -43,7 +43,7 @@ print ====== tables created print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed @@ -69,7 +69,7 @@ endw print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/insert/query_block1_file.sim b/tests/script/general/insert/query_block1_file.sim index 6d6daca7b5..63f46d84f1 100644 --- a/tests/script/general/insert/query_block1_file.sim +++ b/tests/script/general/insert/query_block1_file.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/query_block1_memory.sim b/tests/script/general/insert/query_block1_memory.sim index bec9190f9b..516085f93f 100644 --- a/tests/script/general/insert/query_block1_memory.sim +++ b/tests/script/general/insert/query_block1_memory.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/query_block2_file.sim b/tests/script/general/insert/query_block2_file.sim index 34da170a9e..a1fa920c0f 100644 --- a/tests/script/general/insert/query_block2_file.sim +++ b/tests/script/general/insert/query_block2_file.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/query_block2_memory.sim b/tests/script/general/insert/query_block2_memory.sim index 3f2c97a098..9ce0b942d4 100644 --- a/tests/script/general/insert/query_block2_memory.sim +++ b/tests/script/general/insert/query_block2_memory.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/query_file_memory.sim b/tests/script/general/insert/query_file_memory.sim index f923ebed13..d43328a65a 100644 --- a/tests/script/general/insert/query_file_memory.sim +++ b/tests/script/general/insert/query_file_memory.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/query_multi_file.sim b/tests/script/general/insert/query_multi_file.sim index 8622fa6f9b..3b70dd6214 100644 --- a/tests/script/general/insert/query_multi_file.sim +++ b/tests/script/general/insert/query_multi_file.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/insert/tcp.sim b/tests/script/general/insert/tcp.sim index 6f9752087d..50383efb49 100644 --- a/tests/script/general/insert/tcp.sim +++ b/tests/script/general/insert/tcp.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database d1; diff --git a/tests/script/general/parser/alter.sim b/tests/script/general/parser/alter.sim index eae9b88be9..56a677cc73 100644 --- a/tests/script/general/parser/alter.sim +++ b/tests/script/general/parser/alter.sim @@ -133,7 +133,7 @@ sleep 100 # return -1 #endi #sql alter table tb1 drop column c3 -#sleep 3000 +#sleep 2000 #sql insert into tb1 values (now, 2, 'taos') #sleep 30000 #sql select * from strm @@ -144,7 +144,7 @@ sleep 100 # return -1 #endi #sql alter table tb1 add column c3 int -#sleep 3000 +#sleep 2000 #sql insert into tb1 values (now, 3, 'taos', 3); #sleep 100 #sql select * from strm diff --git a/tests/script/general/parser/auto_create_tb.sim b/tests/script/general/parser/auto_create_tb.sim index 903f8f9881..e19eb0c667 100644 --- a/tests/script/general/parser/auto_create_tb.sim +++ b/tests/script/general/parser/auto_create_tb.sim @@ -208,7 +208,7 @@ endi print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/col_arithmetic_operation.sim b/tests/script/general/parser/col_arithmetic_operation.sim index ae6ecb88e2..9fd690a444 100644 --- a/tests/script/general/parser/col_arithmetic_operation.sim +++ b/tests/script/general/parser/col_arithmetic_operation.sim @@ -105,7 +105,7 @@ run general/parser/col_arithmetic_query.sim #======================================= all in files query ======================================= print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/commit.sim b/tests/script/general/parser/commit.sim index 67d98de207..533fbf48f0 100644 --- a/tests/script/general/parser/commit.sim +++ b/tests/script/general/parser/commit.sim @@ -82,7 +82,7 @@ endw print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start sleep 100 print ================== server restart completed diff --git a/tests/script/general/parser/first_last.sim b/tests/script/general/parser/first_last.sim index a16b5b1e07..9c1f0774ba 100644 --- a/tests/script/general/parser/first_last.sim +++ b/tests/script/general/parser/first_last.sim @@ -77,7 +77,7 @@ run general/parser/first_last_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/function.sim b/tests/script/general/parser/function.sim index 7d702e989e..c4d9d910e4 100644 --- a/tests/script/general/parser/function.sim +++ b/tests/script/general/parser/function.sim @@ -382,4 +382,29 @@ sql drop table cars; sql create table cars(ts timestamp, c int) tags(id int); sql create table car1 using cars tags(1); sql create table car2 using cars tags(2); -sql insert into car1 (ts, c) values (now,1) car2(ts, c) values(now, 2); \ No newline at end of file +sql insert into car1 (ts, c) values (now,1) car2(ts, c) values(now, 2); + +print ========================> TD-2700 +sql create table tx(ts timestamp, k int); +sql insert into tx values(1500000001000, 0); +sql select sum(k) from tx interval(1d) sliding(1h); +if $rows != 24 then + print expect 24, actual:$rows + return -1 +endi + +print ========================> TD-2740 +sql drop table if exists m1; +sql create table m1(ts timestamp, k int) tags(a int); +sql create table tm10 using m1 tags(0); +sql create table tm11 using m1 tags(1); +sql create table tm12 using m1 tags(2); +sql create table tm13 using m1 tags(3); +sql insert into tm10 values('2020-1-1 1:1:1', 0); +sql insert into tm11 values('2020-1-5 1:1:1', 0); +sql insert into tm12 values('2020-1-7 1:1:1', 0); +sql insert into tm13 values('2020-1-1 1:1:1', 0); +sql select count(*) from m1 where ts='2020-1-1 1:1:1' interval(1h) group by tbname; +if $rows != 2 then + return -1 +endi \ No newline at end of file diff --git a/tests/script/general/parser/import_commit1.sim b/tests/script/general/parser/import_commit1.sim index eb49be947c..27be5560c5 100644 --- a/tests/script/general/parser/import_commit1.sim +++ b/tests/script/general/parser/import_commit1.sim @@ -40,7 +40,7 @@ while $x < $rowNum endw print ====== tables created -sleep 3000 +sleep 2000 $ts = $ts0 + $delta $ts = $ts + 1 diff --git a/tests/script/general/parser/import_commit2.sim b/tests/script/general/parser/import_commit2.sim index 7222a5412b..72ee2b3844 100644 --- a/tests/script/general/parser/import_commit2.sim +++ b/tests/script/general/parser/import_commit2.sim @@ -39,7 +39,7 @@ while $x < $rowNum endw print ====== tables created -sleep 3000 +sleep 2000 $ts = $ts0 + $delta $ts = $ts + 1 diff --git a/tests/script/general/parser/import_commit3.sim b/tests/script/general/parser/import_commit3.sim index ea9980930a..a9f021b20c 100644 --- a/tests/script/general/parser/import_commit3.sim +++ b/tests/script/general/parser/import_commit3.sim @@ -39,7 +39,7 @@ while $x < $rowNum endw print ====== tables created -sleep 3000 +sleep 2000 $ts = $ts + 1 sql insert into $tb values ( $ts , -1, -1, -1, -1, -1) @@ -47,7 +47,7 @@ $ts = $ts0 + $delta $ts = $ts + 1 sql import into $tb values ( $ts , -2, -2, -2, -2, -2) -sleep 3000 +sleep 2000 sql show databases diff --git a/tests/script/general/parser/interp.sim b/tests/script/general/parser/interp.sim index 4078fc1ead..36a643c424 100644 --- a/tests/script/general/parser/interp.sim +++ b/tests/script/general/parser/interp.sim @@ -59,7 +59,7 @@ run general/parser/interp_test.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/lastrow.sim b/tests/script/general/parser/lastrow.sim index f997dc504f..682a6cd5df 100644 --- a/tests/script/general/parser/lastrow.sim +++ b/tests/script/general/parser/lastrow.sim @@ -62,7 +62,7 @@ run general/parser/lastrow_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/limit.sim b/tests/script/general/parser/limit.sim index 682b449ca3..22d52c4257 100644 --- a/tests/script/general/parser/limit.sim +++ b/tests/script/general/parser/limit.sim @@ -66,7 +66,7 @@ run general/parser/limit_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/limit1.sim b/tests/script/general/parser/limit1.sim index c047dc2844..0597723490 100644 --- a/tests/script/general/parser/limit1.sim +++ b/tests/script/general/parser/limit1.sim @@ -61,7 +61,7 @@ run general/parser/limit1_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/limit1_tblocks100.sim b/tests/script/general/parser/limit1_tblocks100.sim index 039a171ad7..43519d2df4 100644 --- a/tests/script/general/parser/limit1_tblocks100.sim +++ b/tests/script/general/parser/limit1_tblocks100.sim @@ -61,7 +61,7 @@ run general/parser/limit1_stb.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/limit2.sim b/tests/script/general/parser/limit2.sim index f9b46f5c3e..ddc5c10362 100644 --- a/tests/script/general/parser/limit2.sim +++ b/tests/script/general/parser/limit2.sim @@ -69,7 +69,7 @@ print ====== tables created print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/mixed_blocks.sim b/tests/script/general/parser/mixed_blocks.sim index 772dc1db59..79bf65d147 100644 --- a/tests/script/general/parser/mixed_blocks.sim +++ b/tests/script/general/parser/mixed_blocks.sim @@ -154,7 +154,7 @@ sql insert into t2 values('2020-1-1 1:5:1', 99); print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql select ts from m1 where ts='2020-1-1 1:5:1' diff --git a/tests/script/general/parser/projection_limit_offset.sim b/tests/script/general/parser/projection_limit_offset.sim index df5be140f6..e8a4c75a12 100644 --- a/tests/script/general/parser/projection_limit_offset.sim +++ b/tests/script/general/parser/projection_limit_offset.sim @@ -409,7 +409,7 @@ sql_error select k, sum(k)+1 from tm0; print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/selectResNum.sim b/tests/script/general/parser/selectResNum.sim index 071dd87bc9..8f18a41d41 100644 --- a/tests/script/general/parser/selectResNum.sim +++ b/tests/script/general/parser/selectResNum.sim @@ -118,7 +118,7 @@ endw print ====== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ====== server restart completed sleep 100 diff --git a/tests/script/general/parser/select_from_cache_disk.sim b/tests/script/general/parser/select_from_cache_disk.sim index 5feae91905..36a749cc3c 100644 --- a/tests/script/general/parser/select_from_cache_disk.sim +++ b/tests/script/general/parser/select_from_cache_disk.sim @@ -35,7 +35,7 @@ sql insert into $tb values ('2018-09-17 09:00:00.030', 3) print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/single_row_in_tb.sim b/tests/script/general/parser/single_row_in_tb.sim index 6f1535c390..651f44a3a4 100644 --- a/tests/script/general/parser/single_row_in_tb.sim +++ b/tests/script/general/parser/single_row_in_tb.sim @@ -32,7 +32,7 @@ run general/parser/single_row_in_tb_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/slimit.sim b/tests/script/general/parser/slimit.sim index 9aaf4a35ca..426104c168 100644 --- a/tests/script/general/parser/slimit.sim +++ b/tests/script/general/parser/slimit.sim @@ -97,7 +97,7 @@ run general/parser/slimit_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/slimit1.sim b/tests/script/general/parser/slimit1.sim index 2c8fa28d32..85cbe51aad 100644 --- a/tests/script/general/parser/slimit1.sim +++ b/tests/script/general/parser/slimit1.sim @@ -56,7 +56,7 @@ run general/parser/slimit1_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/slimit_alter_tags.sim b/tests/script/general/parser/slimit_alter_tags.sim index 3fe40dbe2e..1073e0a3cc 100644 --- a/tests/script/general/parser/slimit_alter_tags.sim +++ b/tests/script/general/parser/slimit_alter_tags.sim @@ -171,7 +171,7 @@ endi print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/parser/stableOp.sim b/tests/script/general/parser/stableOp.sim new file mode 100644 index 0000000000..133de95b9c --- /dev/null +++ b/tests/script/general/parser/stableOp.sim @@ -0,0 +1,97 @@ +system sh/stop_dnodes.sh + + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect +print ======================== dnode1 start + +$dbPrefix = fi_in_db +$tbPrefix = fi_in_tb +$stbPrefix = fi_in_stb +$mtPrefix = fi_in_mt +$tbNum = 10 +$rowNum = 20 +$totalNum = 200 + +print create_tb test +print =============== set up +$i = 0 +$db = $dbPrefix . $i +$mt = $mtPrefix . $i +$tb = $tbPrefix . $i +$stb = $stbPrefix . $i + +sql create database $db +sql use $db + +# case1: create stable test +print =========== stableOp.sim case1: create/alter/drop stable test +sql CREATE STABLE $stb (TS TIMESTAMP, COL1 INT) TAGS (ID INT); +sql show stables + +if $rows != 1 then + return -1 +endi +print data00 = $data00 +if $data00 != $stb then + return -1 +endi + +sql_error CREATE STABLE $tb using $stb tags (1); + +sql create table $tb using $stb tags (2); +sql show tables + +if $rows != 1 then + return -1 +endi + +sql alter stable $stb add column COL2 DOUBLE; + +sql insert into $tb values (now, 1, 2.0); + +sql select * from $tb ; + +if $rows != 1 then + return -1 +endi + +sql alter stable $stb drop column COL2; + +sql_error insert into $tb values (now, 1, 2.0); + +sql alter stable $stb add tag tag2 int; + +sql alter stable $stb change tag tag2 tag3; + +sql_error drop stable $tb + +sql drop table $tb ; + +sql show tables + +if $rows != 0 then + return -1 +endi + + +sql DROP STABLE $stb +sql show stables + +if $rows != 0 then + return -1 +endi + +print create/alter/drop stable test passed + +sql drop database $db +sql show databases +if $rows != 0 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/tbnameIn.sim b/tests/script/general/parser/tbnameIn.sim index e1d200e716..65ed1ed65d 100644 --- a/tests/script/general/parser/tbnameIn.sim +++ b/tests/script/general/parser/tbnameIn.sim @@ -67,7 +67,7 @@ run general/parser/tbnameIn_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed diff --git a/tests/script/general/parser/topbot.sim b/tests/script/general/parser/topbot.sim index 6188f42ff5..57378331e8 100644 --- a/tests/script/general/parser/topbot.sim +++ b/tests/script/general/parser/topbot.sim @@ -128,7 +128,7 @@ sql insert into test values(29999, 1)(70000, 2)(80000, 3) print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect diff --git a/tests/script/general/stable/disk.sim b/tests/script/general/stable/disk.sim index a67ef6d790..35088c757c 100644 --- a/tests/script/general/stable/disk.sim +++ b/tests/script/general/stable/disk.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -58,7 +58,7 @@ endi sleep 1000 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start sleep 6000 diff --git a/tests/script/general/stable/metrics.sim b/tests/script/general/stable/metrics.sim index b94c76429d..5bda2ad42e 100644 --- a/tests/script/general/stable/metrics.sim +++ b/tests/script/general/stable/metrics.sim @@ -4,7 +4,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_me_db diff --git a/tests/script/general/stable/refcount.sim b/tests/script/general/stable/refcount.sim index 5fe95dde9f..e609ccc055 100644 --- a/tests/script/general/stable/refcount.sim +++ b/tests/script/general/stable/refcount.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 diff --git a/tests/script/general/stable/show.sim b/tests/script/general/stable/show.sim index 66755edea7..836a848ce0 100644 --- a/tests/script/general/stable/show.sim +++ b/tests/script/general/stable/show.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== create stable diff --git a/tests/script/general/stable/values.sim b/tests/script/general/stable/values.sim index 51488aabef..5e5416e4e9 100644 --- a/tests/script/general/stable/values.sim +++ b/tests/script/general/stable/values.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stable/vnode3.sim b/tests/script/general/stable/vnode3.sim index 3409aef9f8..0889a8f0b7 100644 --- a/tests/script/general/stable/vnode3.sim +++ b/tests/script/general/stable/vnode3.sim @@ -6,7 +6,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/agg_stream.sim b/tests/script/general/stream/agg_stream.sim index 814438ac74..65657fc33b 100644 --- a/tests/script/general/stream/agg_stream.sim +++ b/tests/script/general/stream/agg_stream.sim @@ -13,7 +13,7 @@ system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 30000 system sh/cfg.sh -n dnode1 -c maxShellConns -v 30000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step2 diff --git a/tests/script/general/stream/column_stream.sim b/tests/script/general/stream/column_stream.sim index cb94904ff2..c43ca1fd5a 100644 --- a/tests/script/general/stream/column_stream.sim +++ b/tests/script/general/stream/column_stream.sim @@ -9,7 +9,7 @@ system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 @@ -121,7 +121,7 @@ endi print =============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start print sleep 22 seconds sleep 22000 diff --git a/tests/script/general/stream/metrics_del.sim b/tests/script/general/stream/metrics_del.sim index e21fa5999a..030f9fc527 100644 --- a/tests/script/general/stream/metrics_del.sim +++ b/tests/script/general/stream/metrics_del.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/metrics_replica1_vnoden.sim b/tests/script/general/stream/metrics_replica1_vnoden.sim index dcbc8ae7de..d7541bac66 100644 --- a/tests/script/general/stream/metrics_replica1_vnoden.sim +++ b/tests/script/general/stream/metrics_replica1_vnoden.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/restart_stream.sim b/tests/script/general/stream/restart_stream.sim index b5a2038d9b..ce06f24df7 100644 --- a/tests/script/general/stream/restart_stream.sim +++ b/tests/script/general/stream/restart_stream.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/stream_3.sim b/tests/script/general/stream/stream_3.sim index 88105a77d6..632fe78c7f 100644 --- a/tests/script/general/stream/stream_3.sim +++ b/tests/script/general/stream/stream_3.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/stream_restart.sim b/tests/script/general/stream/stream_restart.sim index 480b23055e..dd7bdf1a91 100644 --- a/tests/script/general/stream/stream_restart.sim +++ b/tests/script/general/stream/stream_restart.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/table_del.sim b/tests/script/general/stream/table_del.sim index ce4065a1a8..7ddce53c4f 100644 --- a/tests/script/general/stream/table_del.sim +++ b/tests/script/general/stream/table_del.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim index 13a4a56fb3..3c30897d2b 100644 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ b/tests/script/general/stream/table_replica1_vnoden.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 1000 system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 3 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/table/autocreate.sim b/tests/script/general/table/autocreate.sim index 8469a6484a..404c714ab4 100644 --- a/tests/script/general/table/autocreate.sim +++ b/tests/script/general/table/autocreate.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database diff --git a/tests/script/general/table/basic1.sim b/tests/script/general/table/basic1.sim index e8d0cd7bd8..c26c3c33e4 100644 --- a/tests/script/general/table/basic1.sim +++ b/tests/script/general/table/basic1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database diff --git a/tests/script/general/table/basic2.sim b/tests/script/general/table/basic2.sim index d1678e8abd..4286f9ee4a 100644 --- a/tests/script/general/table/basic2.sim +++ b/tests/script/general/table/basic2.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== one table diff --git a/tests/script/general/table/basic3.sim b/tests/script/general/table/basic3.sim index ded00e153a..41c276ae98 100644 --- a/tests/script/general/table/basic3.sim +++ b/tests/script/general/table/basic3.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== create database diff --git a/tests/script/general/table/bigint.sim b/tests/script/general/table/bigint.sim index dd61d25ef9..0b2841f0f8 100644 --- a/tests/script/general/table/bigint.sim +++ b/tests/script/general/table/bigint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/binary.sim b/tests/script/general/table/binary.sim index cdbfcd4cbf..fd2aa5ec44 100644 --- a/tests/script/general/table/binary.sim +++ b/tests/script/general/table/binary.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/bool.sim b/tests/script/general/table/bool.sim index fbb6fe823c..59297e90a9 100644 --- a/tests/script/general/table/bool.sim +++ b/tests/script/general/table/bool.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/column2.sim b/tests/script/general/table/column2.sim index 9251e31daa..85d59fef49 100644 --- a/tests/script/general/table/column2.sim +++ b/tests/script/general/table/column2.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 diff --git a/tests/script/general/table/column_name.sim b/tests/script/general/table/column_name.sim index 0b09f65129..480bcd0610 100644 --- a/tests/script/general/table/column_name.sim +++ b/tests/script/general/table/column_name.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/column_num.sim b/tests/script/general/table/column_num.sim index d1091528b2..b055027f59 100644 --- a/tests/script/general/table/column_num.sim +++ b/tests/script/general/table/column_num.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/column_value.sim b/tests/script/general/table/column_value.sim index 117c288b36..92ce02ade5 100644 --- a/tests/script/general/table/column_value.sim +++ b/tests/script/general/table/column_value.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/createmulti.sim b/tests/script/general/table/createmulti.sim new file mode 100644 index 0000000000..0da1ce96a7 --- /dev/null +++ b/tests/script/general/table/createmulti.sim @@ -0,0 +1,46 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print =============== create database +sql create database db +sql show databases +if $rows != 1 then + return -1 +endi + +print $data00 $data01 $data02 + +print =============== create super table +sql create table db.st1 (ts timestamp, i int) tags (j int) +sql create table db.st2 (ts timestamp, i int, j int) tags (t1 int, t2 int, t3 int) +sql show db.stables +if $rows != 2 then + return -1 +endi + +print $data00 $data01 $data02 + +print =============== create multiple child tables +sql create table db.ct1 using db.st1 tags(1) db.ct2 using db.st1 tags(2); + +sql show db.tables +if $rows != 2 then + return -1 +endi + +sql create table db.ct3 using db.st2 tags(1, 1, 1) db.ct4 using db.st2 tags(2, 2, 2); +sql show db.tables +if $rows != 4 then + return -1 +endi + +sql create table db.ct5 using db.st1 tags(3) db.ct6 using db.st2 tags(3, 3, 3); +sql show db.tables +if $rows != 6 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/table/date.sim b/tests/script/general/table/date.sim index 2e73a217a6..7dea76dbc4 100644 --- a/tests/script/general/table/date.sim +++ b/tests/script/general/table/date.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/db.table.sim b/tests/script/general/table/db.table.sim index 50224f83b5..717f5158c4 100644 --- a/tests/script/general/table/db.table.sim +++ b/tests/script/general/table/db.table.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/delete_reuse1.sim b/tests/script/general/table/delete_reuse1.sim index 17974ccf4d..26c82e201b 100644 --- a/tests/script/general/table/delete_reuse1.sim +++ b/tests/script/general/table/delete_reuse1.sim @@ -22,7 +22,7 @@ system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/table/delete_reuse2.sim b/tests/script/general/table/delete_reuse2.sim index 917893b2d2..2e3f01a3a2 100644 --- a/tests/script/general/table/delete_reuse2.sim +++ b/tests/script/general/table/delete_reuse2.sim @@ -22,7 +22,7 @@ system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/table/delete_writing.sim b/tests/script/general/table/delete_writing.sim index 2a7fb09104..342915f0e8 100644 --- a/tests/script/general/table/delete_writing.sim +++ b/tests/script/general/table/delete_writing.sim @@ -41,7 +41,7 @@ while $x < 15 sql create table db.tb (ts timestamp, i int) - sleep 3000 + sleep 2000 $x = $x + 1 endw diff --git a/tests/script/general/table/describe.sim b/tests/script/general/table/describe.sim index ebec004f19..ca5cf6f6e0 100644 --- a/tests/script/general/table/describe.sim +++ b/tests/script/general/table/describe.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/double.sim b/tests/script/general/table/double.sim index 10239568fe..c46029e391 100644 --- a/tests/script/general/table/double.sim +++ b/tests/script/general/table/double.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/fill.sim b/tests/script/general/table/fill.sim index 333573e577..fd79e09ba1 100644 --- a/tests/script/general/table/fill.sim +++ b/tests/script/general/table/fill.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =================== step1 @@ -42,9 +42,9 @@ sql select count(*), last(ts), min(k), max(k), avg(k) from db.mt where a=0 and t print =================== step2 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 -system sh/exec.sh -n dnode1 -s start sleep 3000 +system sh/exec.sh -n dnode1 -s start +sleep 2000 print =================== step3 sql select * from db.mt diff --git a/tests/script/general/table/float.sim b/tests/script/general/table/float.sim index e4ef8a42d6..bbeb56e370 100644 --- a/tests/script/general/table/float.sim +++ b/tests/script/general/table/float.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/int.sim b/tests/script/general/table/int.sim index 81bdcda47d..142c8b4f04 100644 --- a/tests/script/general/table/int.sim +++ b/tests/script/general/table/int.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/limit.sim b/tests/script/general/table/limit.sim index 18597f2e1c..45a20f680d 100644 --- a/tests/script/general/table/limit.sim +++ b/tests/script/general/table/limit.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 129 system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 8 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/table/smallint.sim b/tests/script/general/table/smallint.sim index b6f0d6948f..53dfbe15bf 100644 --- a/tests/script/general/table/smallint.sim +++ b/tests/script/general/table/smallint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/table.sim b/tests/script/general/table/table.sim index 6ad1b13b1c..5d6f2ee1a3 100644 --- a/tests/script/general/table/table.sim +++ b/tests/script/general/table/table.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/table/table_len.sim b/tests/script/general/table/table_len.sim index 2568ebc7a5..f4c27926fb 100644 --- a/tests/script/general/table/table_len.sim +++ b/tests/script/general/table/table_len.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/tinyint.sim b/tests/script/general/table/tinyint.sim index 017c007e84..5ad8a6933a 100644 --- a/tests/script/general/table/tinyint.sim +++ b/tests/script/general/table/tinyint.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/table/vgroup.sim b/tests/script/general/table/vgroup.sim index f4496e2f19..f7806e316e 100644 --- a/tests/script/general/table/vgroup.sim +++ b/tests/script/general/table/vgroup.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 4 system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/general/tag/3.sim b/tests/script/general/tag/3.sim index 4b3104fe1b..878fdc0414 100644 --- a/tests/script/general/tag/3.sim +++ b/tests/script/general/tag/3.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/4.sim b/tests/script/general/tag/4.sim index 120ef4e4e3..d5ac6476d9 100644 --- a/tests/script/general/tag/4.sim +++ b/tests/script/general/tag/4.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql reset query cache diff --git a/tests/script/general/tag/5.sim b/tests/script/general/tag/5.sim index efe88b3650..ae6d49e9f8 100644 --- a/tests/script/general/tag/5.sim +++ b/tests/script/general/tag/5.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql reset query cache diff --git a/tests/script/general/tag/6.sim b/tests/script/general/tag/6.sim index d5f0a6c4af..71957dad9f 100644 --- a/tests/script/general/tag/6.sim +++ b/tests/script/general/tag/6.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql reset query cache diff --git a/tests/script/general/tag/add.sim b/tests/script/general/tag/add.sim index 301ec4f825..4a3871235e 100644 --- a/tests/script/general/tag/add.sim +++ b/tests/script/general/tag/add.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/bigint.sim b/tests/script/general/tag/bigint.sim index 4fa22d3995..c8e6e72825 100644 --- a/tests/script/general/tag/bigint.sim +++ b/tests/script/general/tag/bigint.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/binary.sim b/tests/script/general/tag/binary.sim index 7c6f95b1ef..771e7dc263 100644 --- a/tests/script/general/tag/binary.sim +++ b/tests/script/general/tag/binary.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/binary_binary.sim b/tests/script/general/tag/binary_binary.sim index 077ec85b52..5660b1b320 100644 --- a/tests/script/general/tag/binary_binary.sim +++ b/tests/script/general/tag/binary_binary.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/bool.sim b/tests/script/general/tag/bool.sim index 349cb738bf..828e89f3c7 100644 --- a/tests/script/general/tag/bool.sim +++ b/tests/script/general/tag/bool.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/bool_binary.sim b/tests/script/general/tag/bool_binary.sim index a3f99e25ad..fc25399c5a 100644 --- a/tests/script/general/tag/bool_binary.sim +++ b/tests/script/general/tag/bool_binary.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/bool_int.sim b/tests/script/general/tag/bool_int.sim index 1a2726dbaa..aa443cca62 100644 --- a/tests/script/general/tag/bool_int.sim +++ b/tests/script/general/tag/bool_int.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/change.sim b/tests/script/general/tag/change.sim index a7b8554bd9..6f294c0f48 100644 --- a/tests/script/general/tag/change.sim +++ b/tests/script/general/tag/change.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -175,7 +175,7 @@ sql alter table $mt change tag tgcol3 tgcol9 sql alter table $mt change tag tgcol5 tgcol10 sql alter table $mt change tag tgcol6 tgcol11 -sleep 5000 +sleep 3000 sql reset query cache print =============== step2 diff --git a/tests/script/general/tag/column.sim b/tests/script/general/tag/column.sim index 4a36e832f1..36610d78da 100644 --- a/tests/script/general/tag/column.sim +++ b/tests/script/general/tag/column.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/commit.sim b/tests/script/general/tag/commit.sim index 8b07d98afb..bcd9d7c618 100644 --- a/tests/script/general/tag/commit.sim +++ b/tests/script/general/tag/commit.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -821,9 +821,9 @@ if $data07 != 12 then endi system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 print =============== step1 $i = 0 diff --git a/tests/script/general/tag/create.sim b/tests/script/general/tag/create.sim index adbb14e88a..d387b4345f 100644 --- a/tests/script/general/tag/create.sim +++ b/tests/script/general/tag/create.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/delete.sim b/tests/script/general/tag/delete.sim index f3d0735b5c..2a0aa27bde 100644 --- a/tests/script/general/tag/delete.sim +++ b/tests/script/general/tag/delete.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start @@ -409,7 +409,7 @@ sql alter table $mt drop tag tgcol3 sql alter table $mt drop tag tgcol4 sql alter table $mt drop tag tgcol6 -sleep 5000 +sleep 3000 print =============== step2 $i = 2 diff --git a/tests/script/general/tag/double.sim b/tests/script/general/tag/double.sim index 13dcb1fc72..514c35dc47 100644 --- a/tests/script/general/tag/double.sim +++ b/tests/script/general/tag/double.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/filter.sim b/tests/script/general/tag/filter.sim index 75a6ed00da..7a899a7e67 100644 --- a/tests/script/general/tag/filter.sim +++ b/tests/script/general/tag/filter.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/float.sim b/tests/script/general/tag/float.sim index 2352bbaf2e..bfc7e0f569 100644 --- a/tests/script/general/tag/float.sim +++ b/tests/script/general/tag/float.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/int.sim b/tests/script/general/tag/int.sim index a93df9a57a..2518aeb285 100644 --- a/tests/script/general/tag/int.sim +++ b/tests/script/general/tag/int.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/int_binary.sim b/tests/script/general/tag/int_binary.sim index d379500668..cb7aa16209 100644 --- a/tests/script/general/tag/int_binary.sim +++ b/tests/script/general/tag/int_binary.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/int_float.sim b/tests/script/general/tag/int_float.sim index 510c4f92d0..afd0a3644a 100644 --- a/tests/script/general/tag/int_float.sim +++ b/tests/script/general/tag/int_float.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/set.sim b/tests/script/general/tag/set.sim index 112695d37b..cbc964fad7 100644 --- a/tests/script/general/tag/set.sim +++ b/tests/script/general/tag/set.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/smallint.sim b/tests/script/general/tag/smallint.sim index 18b0957b15..598b397890 100644 --- a/tests/script/general/tag/smallint.sim +++ b/tests/script/general/tag/smallint.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/tag/tinyint.sim b/tests/script/general/tag/tinyint.sim index f104f8df04..3c173a66bf 100644 --- a/tests/script/general/tag/tinyint.sim +++ b/tests/script/general/tag/tinyint.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ======================== dnode1 start diff --git a/tests/script/general/user/authority.sim b/tests/script/general/user/authority.sim index 71f185043b..45230e3e8a 100644 --- a/tests/script/general/user/authority.sim +++ b/tests/script/general/user/authority.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ============= step1 sql create user read pass 'taosdata' diff --git a/tests/script/general/user/monitor.sim b/tests/script/general/user/monitor.sim index eb543612f5..fe12df9baa 100644 --- a/tests/script/general/user/monitor.sim +++ b/tests/script/general/user/monitor.sim @@ -7,7 +7,7 @@ system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ========== step2 @@ -23,7 +23,7 @@ step23: print ========== step3 -sleep 3000 +sleep 2000 sql select * from log.dn if $rows == 0 then return -1 diff --git a/tests/script/general/user/pass_alter.sim b/tests/script/general/user/pass_alter.sim index 857d658db1..964e311ec0 100644 --- a/tests/script/general/user/pass_alter.sim +++ b/tests/script/general/user/pass_alter.sim @@ -2,7 +2,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= step1 diff --git a/tests/script/general/user/pass_len.sim b/tests/script/general/user/pass_len.sim index d5d7b3250f..5eb200b51f 100644 --- a/tests/script/general/user/pass_len.sim +++ b/tests/script/general/user/pass_len.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/user/user_len.sim b/tests/script/general/user/user_len.sim index 79b72468bb..55e5eb19ef 100644 --- a/tests/script/general/user/user_len.sim +++ b/tests/script/general/user/user_len.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/general/vector/metrics_field.sim b/tests/script/general/vector/metrics_field.sim index 2a03ccea19..84c1ed37e7 100644 --- a/tests/script/general/vector/metrics_field.sim +++ b/tests/script/general/vector/metrics_field.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mf_db diff --git a/tests/script/general/vector/metrics_mix.sim b/tests/script/general/vector/metrics_mix.sim index 96b2f6a7a0..2c7fc86f9f 100644 --- a/tests/script/general/vector/metrics_mix.sim +++ b/tests/script/general/vector/metrics_mix.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mx_db diff --git a/tests/script/general/vector/metrics_query.sim b/tests/script/general/vector/metrics_query.sim index 824aa6f22e..46afe7df20 100644 --- a/tests/script/general/vector/metrics_query.sim +++ b/tests/script/general/vector/metrics_query.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mq_db diff --git a/tests/script/general/vector/metrics_tag.sim b/tests/script/general/vector/metrics_tag.sim index e7575cc9df..be13ac764b 100644 --- a/tests/script/general/vector/metrics_tag.sim +++ b/tests/script/general/vector/metrics_tag.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mtg_db diff --git a/tests/script/general/vector/metrics_time.sim b/tests/script/general/vector/metrics_time.sim index bbcabfd1b7..0b82153860 100644 --- a/tests/script/general/vector/metrics_time.sim +++ b/tests/script/general/vector/metrics_time.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mt_db diff --git a/tests/script/general/vector/multi.sim b/tests/script/general/vector/multi.sim index 105f210950..2ca9b7f48f 100644 --- a/tests/script/general/vector/multi.sim +++ b/tests/script/general/vector/multi.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_mu_db diff --git a/tests/script/general/vector/single.sim b/tests/script/general/vector/single.sim index 2292d6f44a..eee5364a4f 100644 --- a/tests/script/general/vector/single.sim +++ b/tests/script/general/vector/single.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_si_db diff --git a/tests/script/general/vector/table_field.sim b/tests/script/general/vector/table_field.sim index a9d6910f4d..65c50dadc2 100644 --- a/tests/script/general/vector/table_field.sim +++ b/tests/script/general/vector/table_field.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_tf_db diff --git a/tests/script/general/vector/table_mix.sim b/tests/script/general/vector/table_mix.sim index a6c4dc92da..12808fd6a6 100644 --- a/tests/script/general/vector/table_mix.sim +++ b/tests/script/general/vector/table_mix.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_tm_db diff --git a/tests/script/general/vector/table_query.sim b/tests/script/general/vector/table_query.sim index 812229afc4..3e9d2d0b77 100644 --- a/tests/script/general/vector/table_query.sim +++ b/tests/script/general/vector/table_query.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_tq_db diff --git a/tests/script/general/vector/table_time.sim b/tests/script/general/vector/table_time.sim index a83195beba..552bdb2a99 100644 --- a/tests/script/general/vector/table_time.sim +++ b/tests/script/general/vector/table_time.sim @@ -4,7 +4,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $dbPrefix = m_tt_db diff --git a/tests/script/general/wal/kill.sim b/tests/script/general/wal/kill.sim index 7f103874a5..94a35b636e 100644 --- a/tests/script/general/wal/kill.sim +++ b/tests/script/general/wal/kill.sim @@ -13,62 +13,62 @@ sql create table t1 (ts timestamp, i int) sql insert into t1 values(now, 1); print =============== step3 -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 3000 +sleep 2000 print =============== step4 system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 3000 +sleep 2000 print =============== step5 system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 3000 +sleep 2000 print =============== step6 system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 3000 +sleep 2000 print =============== step7 system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then return -1 endi system sh/exec.sh -n dnode1 -s stop -x SIGKILL -sleep 3000 +sleep 2000 print =============== step8 system sh/exec.sh -n dnode1 -s start -x SIGKILL -sleep 3000 +sleep 2000 sql select * from t1; print rows: $rows if $rows != 1 then diff --git a/tests/script/general/wal/maxtables.sim b/tests/script/general/wal/maxtables.sim index e504c7e92e..acd6af1d1a 100644 --- a/tests/script/general/wal/maxtables.sim +++ b/tests/script/general/wal/maxtables.sim @@ -32,11 +32,11 @@ endi system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 -sleep 3000 +sleep 2000 print =============== step4 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql select * from st; if $rows != 100 then diff --git a/tests/script/sh/mv_old_data.sh b/tests/script/sh/mv_old_data.sh index 112e9760d6..87fcbb6def 100755 --- a/tests/script/sh/mv_old_data.sh +++ b/tests/script/sh/mv_old_data.sh @@ -35,3 +35,6 @@ rm -rf $SIM_DIR/dnode3 rm -rf $SIM_DIR/tsim tar zxf $SCRIPT_DIR/general/connection/sim.tar.gz -C $SIM_DIR/../ +cd $SIM_DIR/../sim +fqdn=`hostname` +grep '${fqdn}' -l -r ./* | xargs sed -i 's/${fqdn}/${fqdn}/g' diff --git a/tests/script/tmp/mnodes.sim b/tests/script/tmp/mnodes.sim index 23f59d1d00..8bca76c38b 100644 --- a/tests/script/tmp/mnodes.sim +++ b/tests/script/tmp/mnodes.sim @@ -107,7 +107,7 @@ if $data4_3 != ready then endi $x = $x + 1 -sleep 5000 +sleep 3000 if $x == 100000 then return -1 endi diff --git a/tests/script/unique/account/account_create.sim b/tests/script/unique/account/account_create.sim index 9eecceb39d..e36de29e7c 100644 --- a/tests/script/unique/account/account_create.sim +++ b/tests/script/unique/account/account_create.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start diff --git a/tests/script/unique/account/account_delete.sim b/tests/script/unique/account/account_delete.sim index 564512228e..d99a8b559d 100644 --- a/tests/script/unique/account/account_delete.sim +++ b/tests/script/unique/account/account_delete.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= step1 diff --git a/tests/script/unique/account/account_len.sim b/tests/script/unique/account/account_len.sim index 75636be513..f8379bdf95 100644 --- a/tests/script/unique/account/account_len.sim +++ b/tests/script/unique/account/account_len.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/unique/account/authority.sim b/tests/script/unique/account/authority.sim index f88f254a79..8f2408de14 100644 --- a/tests/script/unique/account/authority.sim +++ b/tests/script/unique/account/authority.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= step1 diff --git a/tests/script/unique/account/basic.sim b/tests/script/unique/account/basic.sim index 0861c9305b..00e706a448 100644 --- a/tests/script/unique/account/basic.sim +++ b/tests/script/unique/account/basic.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/paras.sim b/tests/script/unique/account/paras.sim index ae511fe2b0..102f5b6a38 100644 --- a/tests/script/unique/account/paras.sim +++ b/tests/script/unique/account/paras.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/pass_alter.sim b/tests/script/unique/account/pass_alter.sim index bf939acce3..8b857b014a 100644 --- a/tests/script/unique/account/pass_alter.sim +++ b/tests/script/unique/account/pass_alter.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============= step1 diff --git a/tests/script/unique/account/pass_len.sim b/tests/script/unique/account/pass_len.sim index 1dd0a616f2..f4ceb76f7b 100644 --- a/tests/script/unique/account/pass_len.sim +++ b/tests/script/unique/account/pass_len.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/unique/account/usage.sim b/tests/script/unique/account/usage.sim index 7fde365201..3b9c20b159 100644 --- a/tests/script/unique/account/usage.sim +++ b/tests/script/unique/account/usage.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start #system sh/exec.sh -n monitor -s 1 system sh/exec.sh -n monitorInterval -s 1 -sleep 3000 +sleep 2000 sql connect print =============== show accounts diff --git a/tests/script/unique/account/user_create.sim b/tests/script/unique/account/user_create.sim index 029bda22ea..e54a380f0d 100644 --- a/tests/script/unique/account/user_create.sim +++ b/tests/script/unique/account/user_create.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 diff --git a/tests/script/unique/account/user_len.sim b/tests/script/unique/account/user_len.sim index 91a5ebfaab..b8d448f0ff 100644 --- a/tests/script/unique/account/user_len.sim +++ b/tests/script/unique/account/user_len.sim @@ -3,7 +3,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $i = 0 diff --git a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim index 915fef47da..7bf2c2ac42 100644 --- a/tests/script/unique/arbitrator/check_cluster_cfg_para.sim +++ b/tests/script/unique/arbitrator/check_cluster_cfg_para.sim @@ -90,7 +90,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2~7 and add into cluster diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim index 6f0f61d2e2..dbd0e2bd87 100644 --- a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim +++ b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim @@ -49,7 +49,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -57,7 +57,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 $totalTableNum = 1 $sleepTimer = 3000 @@ -178,7 +178,7 @@ endi print ============== step7: restart dnode3, waiting sync end system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 $loopCnt = 0 wait_dnode3_ready: diff --git a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim index 80a050f883..e15edb3f3d 100644 --- a/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim +++ b/tests/script/unique/arbitrator/dn2_mn1_cache_file_sync_second.sim @@ -9,11 +9,11 @@ # expect: in dnode2, the files 1837 and 1839 will be removed sql connect -sleep 3000 +sleep 2000 print ============== step7: restart dnode2, waiting sync end system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 wait_dnode2_ready: sql show dnodes diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim b/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim index 97433741f5..057654abb4 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim @@ -39,7 +39,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables @@ -49,7 +49,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 16 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim b/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim index a6a9129090..c597c576e2 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim @@ -40,7 +40,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables @@ -50,7 +50,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 16 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim b/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim index 7bb37c5ebb..49e1dba067 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $sleepTimer = 3000 @@ -143,7 +143,7 @@ endi print ============== step5: create the middle table 5 and insert data sql create table tb5 using $stb tags( 5 ) -sleep 3000 +sleep 2000 $tsStart = 1420041620000 $i = 5 @@ -212,7 +212,7 @@ endi print ============== step8: create the first table 0 and insert data sql create table tb0 using $stb tags( 0 ) -sleep 3000 +sleep 2000 $tsStart = 1420041640000 $i = 0 @@ -277,7 +277,7 @@ endi print ============== step11: create the last table 9 and insert data sql create table tb9 using $stb tags( 9 ) -sleep 3000 +sleep 2000 $tsStart = 1420041660000 $i = 0 diff --git a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim index e11dd69598..2af7cf56b7 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim @@ -49,7 +49,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data @@ -59,7 +59,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $rowNum = 10 $tblNum = 16 diff --git a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim b/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim index 318a89f96b..96fde9061a 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -53,7 +53,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 5000 +sleep 3000 $sleepTimer = 3000 @@ -225,7 +225,7 @@ if $data00 != $totalRows then endi print ============== step5: stop dnode2, and remove its vnode -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s stop -x SIGINT sleep $sleepTimer diff --git a/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim b/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim index 9fc19d588a..da76cc467b 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $sleepTimer = 3000 @@ -359,13 +359,13 @@ endi print ============== step7: stop dnode3/dnode2, and cluster unable to provide services system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 3000 +sleep 2000 sql select count(*) from $stb -x s71 s71: print ============== step8: restart dnode2, and cluster Still unable to provide services system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 sql select count(*) from $stb -x s81 s81: diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim b/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim index 986df81bf6..c924fee1ae 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim @@ -70,7 +70,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster, then create database replica 2, create table , and insert data @@ -78,7 +78,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 $rowNum = 100 $tblNum = 16 @@ -139,7 +139,7 @@ if $data00 != $totalRows then return -1 endi -#sleep 3000 +#sleep 2000 #sql show dnodes #print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 #print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 @@ -175,7 +175,7 @@ endi sql show dnodes if $rows != 3 then - sleep 3000 + sleep 2000 goto wait_drop endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 @@ -218,7 +218,7 @@ system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 16 system sh/exec.sh -n dnode3 -s start sql create dnode $hostname3 -sleep 3000 +sleep 2000 $loopCnt = 0 wait_dnode3_ready: @@ -230,7 +230,7 @@ endi sql show dnodes print rows: $rows if $rows != 4 then - sleep 3000 + sleep 2000 goto wait_dnode3_ready endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 @@ -271,7 +271,7 @@ sql drop database $db sleep 1000 system sh/exec.sh -n dnode5 -s start sql create dnode $hostname5 -sleep 3000 +sleep 2000 $loopCnt = 0 wait_dnode5: $loopCnt = $loopCnt + 1 @@ -281,7 +281,7 @@ endi sql show dnodes if $rows != 5 then - sleep 3000 + sleep 2000 goto wait_dnode5 endi print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 @@ -352,7 +352,7 @@ endw print info: select count(*) from $stb sleep 2000 sql reset query cache -sleep 3000 +sleep 2000 sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim b/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim index 387ae4625f..b9008e4c42 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_replica_change.sim @@ -321,7 +321,7 @@ step9: endi sql show dnodes -if $rows != 2 then +if $rows != 3 then goto step9 endi diff --git a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim b/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim index 08d2db207b..73702835f4 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 10000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim b/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim index 438e4af34f..27b308411a 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim @@ -50,7 +50,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data @@ -60,7 +60,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $rowNum = 10 $tblNum = 16 @@ -152,7 +152,7 @@ endi print ============== step4: restart dnode4, but there are not dnode4 in cluster system sh/exec.sh -n dnode4 -s start -sleep 3000 +sleep 2000 sql show dnodes if $rows != 3 then return -1 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim index 4f80c2389e..6d81effab6 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim index 3b208e6f1a..d22aca07cb 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 #sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim index fb0650b78a..884a43bce1 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data to can fall disc @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 #sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 4 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim index f50081ea70..3c74de4916 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 #sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim index df41e4df36..d0399222f1 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim index d814398d06..19b29bf342 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 #sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim b/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim index 8f2cd9169b..8e15c4f527 100644 --- a/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim +++ b/tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim @@ -50,7 +50,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -60,7 +60,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $sleepTimer = 3000 @@ -170,7 +170,7 @@ s31: print ============== step4: restart dnode2, then create database with replica 2, and create table, insert data system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim b/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim index 7906718b08..d90853d2e4 100644 --- a/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim +++ b/tests/script/unique/arbitrator/dn3_mn2_killDnode.sim @@ -39,7 +39,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 3, and create table to max tables @@ -47,10 +47,10 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start #system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 -sleep 3000 +sleep 2000 sql create dnode $hostname3 #sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 4 $sleepTimer = 3000 @@ -92,7 +92,7 @@ endi print ============== step3: stop dnode2 system sh/exec.sh -n dnode2 -s stop -sleep 3000 +sleep 2000 sql show mnodes print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 diff --git a/tests/script/unique/arbitrator/insert_duplicationTs.sim b/tests/script/unique/arbitrator/insert_duplicationTs.sim index d58f903dcf..4af47ca336 100644 --- a/tests/script/unique/arbitrator/insert_duplicationTs.sim +++ b/tests/script/unique/arbitrator/insert_duplicationTs.sim @@ -49,7 +49,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -57,7 +57,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 $totalTableNum = 1 $sleepTimer = 3000 @@ -181,7 +181,7 @@ $totalRows = $totalRows + 2 print ============== step6: restart dnode2, waiting sync end system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 $loopCnt = 0 wait_dnode2_ready: $loopCnt = $loopCnt + 1 @@ -213,7 +213,7 @@ endi sleep $sleepTimer # check using select -sleep 5000 +sleep 3000 sql select count(*) from $stb print data00 $data00 if $data00 != $totalRows then diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim index 9527d230e4..0adb6b4759 100644 --- a/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim b/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim index 1da8d749d5..a0877ad89c 100644 --- a/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim index 791ba76a8d..376484a066 100644 --- a/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_createTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim b/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim index 0d5abb2b91..9f21193400 100644 --- a/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim b/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim index 0c59ee8525..cb3bbb3a73 100644 --- a/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim index ce7151f78e..8a9995f891 100644 --- a/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim b/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim index e29f8267c3..6eed563bbc 100644 --- a/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim index 8f8b996c09..2633d822c9 100644 --- a/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_createTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim b/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim index f3779cf20a..3abfc40161 100644 --- a/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim b/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim index f70ef1fc8c..f2acb8b90a 100644 --- a/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim +++ b/tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim index 8d1a508ef0..9d0e967f4e 100644 --- a/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim +++ b/tests/script/unique/arbitrator/replica_changeWithArbitrator.sim @@ -60,7 +60,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: replica is 1, and start 1 dnode, then create tables and insert data system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect $totalTableNum = 12 @@ -105,7 +105,7 @@ endi print ============== step2: add 1 new dnode, expect balanced system sh/exec.sh -n dnode2 -s start sql create dnode $hostname2 -sleep 3000 +sleep 2000 # expect after balanced, 2 vondes in dnode1, 1 vonde in dnode2 $cnt = 0 @@ -137,7 +137,7 @@ endi print ============== step3: stop dnode1/dnode2, modify cfg numOfMnodes to 2, and restart dnode1/dnode2 system sh/exec.sh -n dnode1 -s stop system sh/exec.sh -n dnode2 -s stop -sleep 3000 +sleep 2000 system sh/cfg.sh -n dnode1 -c numOfMnodes -v 2 system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 @@ -150,7 +150,7 @@ system sh/cfg.sh -n dnode2 -c role -v 0 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 print ============= step4: wait dnode ready @@ -193,9 +193,9 @@ if $data00 != $totalRows then endi print ============== step5: stop dnode1 -sleep 5000 -system sh/exec.sh -n dnode1 -s stop sleep 3000 +system sh/exec.sh -n dnode1 -s stop +sleep 2000 $cnt = 0 wait_dnode2_master: diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim b/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim index 12db84cbb3..a8c0e83cc1 100644 --- a/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim +++ b/tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim b/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim index 06d67a1cc9..951d26635b 100644 --- a/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim +++ b/tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica2_dropDb.sim b/tests/script/unique/arbitrator/sync_replica2_dropDb.sim index b388bc73a6..e4e7f95188 100644 --- a/tests/script/unique/arbitrator/sync_replica2_dropDb.sim +++ b/tests/script/unique/arbitrator/sync_replica2_dropDb.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica2_dropTable.sim b/tests/script/unique/arbitrator/sync_replica2_dropTable.sim index 2e20d7b5d4..0049dc6fba 100644 --- a/tests/script/unique/arbitrator/sync_replica2_dropTable.sim +++ b/tests/script/unique/arbitrator/sync_replica2_dropTable.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 #sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim b/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim index 69cdb9f942..4990899601 100644 --- a/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim +++ b/tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim b/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim index 491b858500..10bd4fc8bd 100644 --- a/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim +++ b/tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_createTable.sim b/tests/script/unique/arbitrator/sync_replica3_createTable.sim index d593577bee..a0b391dd76 100644 --- a/tests/script/unique/arbitrator/sync_replica3_createTable.sim +++ b/tests/script/unique/arbitrator/sync_replica3_createTable.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 20 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim b/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim index 1ef499534f..68c6ecbd6e 100644 --- a/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim +++ b/tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 20 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_dropDb.sim b/tests/script/unique/arbitrator/sync_replica3_dropDb.sim index 7a5966f60c..83e53eaeeb 100644 --- a/tests/script/unique/arbitrator/sync_replica3_dropDb.sim +++ b/tests/script/unique/arbitrator/sync_replica3_dropDb.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/arbitrator/sync_replica3_dropTable.sim b/tests/script/unique/arbitrator/sync_replica3_dropTable.sim index abd2d8a788..7496541b76 100644 --- a/tests/script/unique/arbitrator/sync_replica3_dropTable.sim +++ b/tests/script/unique/arbitrator/sync_replica3_dropTable.sim @@ -45,7 +45,7 @@ system sh/exec_tarbitrator.sh -s start print ============== step1: start dnode1, only deploy mnode system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data @@ -55,7 +55,7 @@ system sh/exec.sh -n dnode4 -s start sql create dnode $hostname2 sql create dnode $hostname3 sql create dnode $hostname4 -sleep 3000 +sleep 2000 $totalTableNum = 10 $sleepTimer = 3000 diff --git a/tests/script/unique/big/maxvnodes.sim b/tests/script/unique/big/maxvnodes.sim index eb17929ff4..10dbc8bbff 100644 --- a/tests/script/unique/big/maxvnodes.sim +++ b/tests/script/unique/big/maxvnodes.sim @@ -17,7 +17,7 @@ system sh/cfg.sh -n dnode2 -c balanceInterval -v 1 print ========== prepare data system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database db blocks 3 cache 1 sql use db @@ -51,7 +51,7 @@ system sh/exec.sh -n dnode2 -s start $x = 0 show3: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 1000 then return -1 endi diff --git a/tests/script/unique/big/restartSpeed.sim b/tests/script/unique/big/restartSpeed.sim index ea4edefda8..bdc4a8678b 100644 --- a/tests/script/unique/big/restartSpeed.sim +++ b/tests/script/unique/big/restartSpeed.sim @@ -14,7 +14,7 @@ system sh/cfg.sh -n dnode2 -c walLevel -v 2 print ========== prepare data system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database db blocks 3 cache 1 sql use db diff --git a/tests/script/unique/cluster/alter.sim b/tests/script/unique/cluster/alter.sim index 7e56707a69..77e040c6cd 100644 --- a/tests/script/unique/cluster/alter.sim +++ b/tests/script/unique/cluster/alter.sim @@ -28,11 +28,11 @@ system sh/cfg.sh -n dnode4 -c balance -v 0 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 print ========== step2 sql create database d1 diff --git a/tests/script/unique/cluster/balance2.sim b/tests/script/unique/cluster/balance2.sim index ffd13445ed..026678af7c 100644 --- a/tests/script/unique/cluster/balance2.sim +++ b/tests/script/unique/cluster/balance2.sim @@ -335,8 +335,8 @@ print dnode5 ==> $dnode5Role print ============================== step6 system sh/exec.sh -n dnode1 -s stop -x SIGINT -print stop dnode1 and sleep 10000 -sleep 5000 +print stop dnode1 and sleep 3000 +sleep 3000 sql drop dnode $hostname1 print drop dnode1 and sleep 9000 diff --git a/tests/script/unique/cluster/cache.sim b/tests/script/unique/cluster/cache.sim index e23b407828..7a5afae79d 100644 --- a/tests/script/unique/cluster/cache.sim +++ b/tests/script/unique/cluster/cache.sim @@ -17,7 +17,7 @@ system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/cfg.sh -n dnode2 -c monitorInterval -v 1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create database testdb @@ -33,7 +33,7 @@ while $x < 30 $x = $x + 1 endw -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode2 -s start sql create dnode $hostname2 diff --git a/tests/script/unique/cluster/cluster_main.sim b/tests/script/unique/cluster/cluster_main.sim index f0a9b1a214..d3750be6b4 100644 --- a/tests/script/unique/cluster/cluster_main.sim +++ b/tests/script/unique/cluster/cluster_main.sim @@ -48,11 +48,11 @@ print ============== step1: start dnode1/dnode2/dnode3 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 print ============== step2: create db1 with replica 3 $db = db1 @@ -84,7 +84,7 @@ sql select count(tbname) from $stb print select count(tbname) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_complete_create_tables endi @@ -93,12 +93,12 @@ print select count(*) from $stb sql select count(*) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_data endi print wait for a while to let clients start insert data -sleep 5000 +sleep 3000 print ============== step4-1: add dnode4/dnode5 into cluster sql create dnode $hostname4 @@ -116,7 +116,7 @@ print ============== step6: stop dnode1 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 10000 #sql drop dnode $hostname1 -#sleep 5000 +#sleep 3000 #system rm -rf ../../../sim/dnode1/data #sleep 20000 @@ -152,7 +152,7 @@ print $data0_9 $data1_9 $data2_9 $data3_9 $data4_9 print ============== step7: stop dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql show mnodes print show mnodes diff --git a/tests/script/unique/cluster/cluster_main0.sim b/tests/script/unique/cluster/cluster_main0.sim index 9f775c0cef..48403d011b 100644 --- a/tests/script/unique/cluster/cluster_main0.sim +++ b/tests/script/unique/cluster/cluster_main0.sim @@ -48,11 +48,11 @@ print ============== step1: start dnode1/dnode2/dnode3 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 print ============== step2: create db1 with replica 3 $db = db1 @@ -85,7 +85,7 @@ sql select count(tbname) from $stb print select count(tbname) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_complete_create_tables endi @@ -94,12 +94,12 @@ print select count(*) from $stb sql select count(*) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_data endi print wait for a while to let clients start insert data -sleep 5000 +sleep 3000 $loop_cnt = 0 loop_cluster_do: @@ -110,14 +110,14 @@ system sh/exec.sh -n dnode5 -s start sql create dnode $hostname4 sql create dnode $hostname5 -sleep 5000 +sleep 3000 print ============== step6: stop dnode1 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 10000 #sql drop dnode $hostname1 -#sleep 5000 +#sleep 3000 #system rm -rf ../../../sim/dnode1/data #sleep 20000 print ============== step6-1: restart dnode1 @@ -139,7 +139,7 @@ print $data0_9 $data1_9 $data2_9 $data3_9 $data4_9 print ============== step7: stop dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql show mnodes print show mnodes @@ -235,7 +235,7 @@ endi print ============== step14: stop and drop dnode4/dnode5, then remove data dir of dnode4/dnode5 system sh/exec.sh -n dnode4 -s stop -x SIGINT system sh/exec.sh -n dnode5 -s stop -x SIGINT -sleep 3000 +sleep 2000 sql drop dnode $hostname4 sql drop dnode $hostname5 system rm -rf ../../../sim/dnode4/data diff --git a/tests/script/unique/cluster/cluster_main1.sim b/tests/script/unique/cluster/cluster_main1.sim index 7796f1ea00..a2426dc574 100644 --- a/tests/script/unique/cluster/cluster_main1.sim +++ b/tests/script/unique/cluster/cluster_main1.sim @@ -48,11 +48,11 @@ print ============== step1: start dnode1/dnode2/dnode3 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 print ============== step2: create db1 with replica 3 $replica = 3 @@ -92,17 +92,17 @@ print select count(*) from $stb sql select count(*) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_data endi print wait for a while to let clients start insert data -sleep 5000 +sleep 3000 print ============== step4-1: add dnode4/dnode5 into cluster sql create dnode $hostname4 sql create dnode $hostname5 -sleep 5000 +sleep 3000 $loop_cnt = 0 loop_cluster_do: @@ -116,7 +116,7 @@ print ============== step6: stop dnode1 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 10000 #sql drop dnode $hostname1 -#sleep 5000 +#sleep 3000 #system rm -rf ../../../sim/dnode1/data #sleep 20000 print ============== step6-1: restart dnode1 @@ -138,7 +138,7 @@ print $data0_9 $data1_9 $data2_9 $data3_9 $data4_9 print ============== step7: stop dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql show mnodes print show mnodes diff --git a/tests/script/unique/cluster/cluster_main2.sim b/tests/script/unique/cluster/cluster_main2.sim index 4866154681..e050ab3acf 100644 --- a/tests/script/unique/cluster/cluster_main2.sim +++ b/tests/script/unique/cluster/cluster_main2.sim @@ -48,11 +48,11 @@ print ============== step1: start dnode1/dnode2/dnode3 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 print ============== step2: create db1 with replica 3 $replica = 3 @@ -87,7 +87,7 @@ sql select count(tbname) from $stb print select count(tbname) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_complete_create_tables endi @@ -96,17 +96,17 @@ print select count(*) from $stb sql select count(*) from $stb print data00 $data00 if $data00 < 1000 then - sleep 3000 + sleep 2000 goto wait_subsim_insert_data endi print wait for a while to let clients start insert data -sleep 5000 +sleep 3000 print ============== step4-1: add dnode4/dnode5 into cluster sql create dnode $hostname4 sql create dnode $hostname5 -sleep 5000 +sleep 3000 $loop_cnt = 0 @@ -120,7 +120,7 @@ print ============== step6: stop dnode1 system sh/exec.sh -n dnode1 -s stop -x SIGINT sleep 10000 #sql drop dnode $hostname1 -#sleep 5000 +#sleep 3000 #system rm -rf ../../../sim/dnode1/data #sleep 20000 print ============== step6-1: restart dnode1 @@ -142,7 +142,7 @@ print $data0_9 $data1_9 $data2_9 $data3_9 $data4_9 print ============== step7: stop dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql show mnodes print show mnodes diff --git a/tests/script/unique/cluster/flowctrl.sim b/tests/script/unique/cluster/flowctrl.sim index 6dc60d9fba..700fa0a3f1 100644 --- a/tests/script/unique/cluster/flowctrl.sim +++ b/tests/script/unique/cluster/flowctrl.sim @@ -79,14 +79,14 @@ while $x < 100 endw print =============== step3 -sleep 3000 +sleep 2000 system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec.sh -n dnode3 -s stop -x SIGINT print =============== step4 -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start @@ -101,7 +101,7 @@ endw print =============== step6 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 3000 +sleep 2000 while $x < 300 $ms = $x . s sql insert into tb values (now + $ms , $x ) diff --git a/tests/script/unique/clusterSimCase/cluster_main.sim b/tests/script/unique/clusterSimCase/cluster_main.sim index 39607c2915..274ce85974 100644 --- a/tests/script/unique/clusterSimCase/cluster_main.sim +++ b/tests/script/unique/clusterSimCase/cluster_main.sim @@ -88,8 +88,8 @@ sql connect print ============== step1: add dnode2/dnode3 into cluster sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 -sleep 3000 +sleep 2000 +sleep 2000 print ============== step3: start back client-01.sim #run_back unique/clusterSimCase/client-01.sim #run_back unique/clusterSimCase/client-02.sim @@ -142,7 +142,7 @@ if $vg2Dnode2Status != master then endi -sleep 3000 +sleep 2000 print ============== step3: restart dnode3 system sh/exec.sh -n dnode3 -s start @@ -174,7 +174,7 @@ if $vg2Dnode2Status != master then goto wait_vgroup_chang_1 endi -sleep 3000 +sleep 2000 print ============== step4: stop dnode2 system sh/exec.sh -n dnode2 -s stop -x SIGINT @@ -207,7 +207,7 @@ if $vg2Dnode2Status != offline then endi -sleep 3000 +sleep 2000 print ============== step5: restart dnode2 system sh/exec.sh -n dnode2 -s start @@ -239,7 +239,7 @@ if $vg2Dnode3Status != master then goto wait_vgroup_chang_3 endi -sleep 3000 +sleep 2000 print **** **** **** (loop_cnt: $loop_cnt ) end, continue...... **** **** **** **** $loop_cnt = $loop_cnt + 1 if $loop_cnt == 50 then diff --git a/tests/script/unique/db/commit.sim b/tests/script/unique/db/commit.sim index caff3c6a78..661dd4505f 100644 --- a/tests/script/unique/db/commit.sim +++ b/tests/script/unique/db/commit.sim @@ -16,12 +16,12 @@ system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4 print ========= start dnode1 as master system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ========= start other dnodes sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 print ======== step1 create db sql create database commitdb replica 1 days 7 keep 30 @@ -48,9 +48,9 @@ endi print ======== step2 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 sql select * from tb order by ts desc print ===> rows $rows @@ -99,9 +99,9 @@ endi print ======== step5 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 sql select * from tb print ===> rows $rows diff --git a/tests/script/unique/db/delete.sim b/tests/script/unique/db/delete.sim index f84339be79..c876f23de3 100644 --- a/tests/script/unique/db/delete.sim +++ b/tests/script/unique/db/delete.sim @@ -23,7 +23,7 @@ sql create dnode $hostname2 sql create dnode $hostname3 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 print ======== step1 sql create database db replica 3 blocks 3 @@ -49,7 +49,7 @@ if $rows != 0 then return -1 endi -sleep 3000 +sleep 2000 sql show dnodes print dnode1 openVnodes $data2_1 print dnode2 openVnodes $data2_2 diff --git a/tests/script/unique/db/replica_reduce32.sim b/tests/script/unique/db/replica_reduce32.sim index a5eb78dacb..ead265d5d5 100644 --- a/tests/script/unique/db/replica_reduce32.sim +++ b/tests/script/unique/db/replica_reduce32.sim @@ -169,7 +169,7 @@ sleep 200 print ========= step4 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql insert into d1.t1 values(now, 3) -x s41 s41: diff --git a/tests/script/unique/dnode/alternativeRole.sim b/tests/script/unique/dnode/alternativeRole.sim index af627490ba..955b757f06 100644 --- a/tests/script/unique/dnode/alternativeRole.sim +++ b/tests/script/unique/dnode/alternativeRole.sim @@ -23,14 +23,14 @@ system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start sql create dnode $hostname3 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 sql show dnodes print dnode1 $data5_1 diff --git a/tests/script/unique/dnode/balance2.sim b/tests/script/unique/dnode/balance2.sim index 7b07eb3f37..4c67e20c3e 100644 --- a/tests/script/unique/dnode/balance2.sim +++ b/tests/script/unique/dnode/balance2.sim @@ -120,7 +120,7 @@ system sh/exec.sh -n dnode4 -s start $x = 0 show3: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi diff --git a/tests/script/unique/dnode/balancex.sim b/tests/script/unique/dnode/balancex.sim index da8197e22d..d2c738ee97 100644 --- a/tests/script/unique/dnode/balancex.sim +++ b/tests/script/unique/dnode/balancex.sim @@ -23,7 +23,7 @@ system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 sql create database d1 sql create table d1.t1 (t timestamp, i int) @@ -102,7 +102,7 @@ system sh/exec.sh -n dnode3 -s start $x = 0 show4: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi @@ -145,7 +145,7 @@ if $data2_3 != 3 then endi system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql reset query cache sleep 1000 diff --git a/tests/script/unique/dnode/data1.sim b/tests/script/unique/dnode/data1.sim index 61a991148b..75a484abb6 100644 --- a/tests/script/unique/dnode/data1.sim +++ b/tests/script/unique/dnode/data1.sim @@ -23,7 +23,7 @@ system sh/cfg.sh -n dnode4 -c wallevel -v 2 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ========== step2 sql create dnode $hostname2 @@ -36,7 +36,7 @@ system sh/exec.sh -n dnode4 -s start $x = 0 show2: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 10 then return -1 endi @@ -71,7 +71,7 @@ sql insert into d1.t1 values(now+5s, 31) $x = 0 show3: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 10 then return -1 endi diff --git a/tests/script/unique/dnode/datatrans_1node.sim b/tests/script/unique/dnode/datatrans_1node.sim index bc38bfaf2d..a156c32672 100644 --- a/tests/script/unique/dnode/datatrans_1node.sim +++ b/tests/script/unique/dnode/datatrans_1node.sim @@ -5,7 +5,7 @@ system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print =============== step1 @@ -40,7 +40,7 @@ system sh/exec.sh -n dnode2 -s start print =============== step 4 -sleep 3000 +sleep 2000 sql connect sql select * from db.m1 diff --git a/tests/script/unique/dnode/datatrans_3node.sim b/tests/script/unique/dnode/datatrans_3node.sim index 7c3708c111..7948eb6d3a 100644 --- a/tests/script/unique/dnode/datatrans_3node.sim +++ b/tests/script/unique/dnode/datatrans_3node.sim @@ -31,7 +31,7 @@ system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 print ============== step1: start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -39,7 +39,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 # create table sql drop database -x step1 @@ -76,7 +76,7 @@ system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start print =============== step 4 -sleep 3000 +sleep 2000 sql connect sql select * from db.m1 diff --git a/tests/script/unique/dnode/datatrans_3node_2.sim b/tests/script/unique/dnode/datatrans_3node_2.sim index 4fb3b4535f..844afc5b02 100644 --- a/tests/script/unique/dnode/datatrans_3node_2.sim +++ b/tests/script/unique/dnode/datatrans_3node_2.sim @@ -31,7 +31,7 @@ system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 print ============== step1: start dnode1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data @@ -39,7 +39,7 @@ system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start sql create dnode $hostname2 sql create dnode $hostname3 -sleep 3000 +sleep 2000 # create table sql drop database -x step1 @@ -76,7 +76,7 @@ system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode4 -s start print =============== step 4 -sleep 3000 +sleep 2000 sql connect sql select * from db.m1 diff --git a/tests/script/unique/dnode/monitor.sim b/tests/script/unique/dnode/monitor.sim index 1e5b0f6f56..b9b5e41889 100644 --- a/tests/script/unique/dnode/monitor.sim +++ b/tests/script/unique/dnode/monitor.sim @@ -23,7 +23,7 @@ system sh/cfg.sh -n dnode2 -c monitor -v 1 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 5000 +sleep 3000 sql show dnodes print dnode1 openVnodes $data3_1 @@ -65,7 +65,7 @@ sql select * from log.dn1 print $rows $rows1 = $rows -sleep 3000 +sleep 2000 sql select * from log.dn1 print $rows $rows2 = $rows @@ -79,7 +79,7 @@ sql select * from log.dn2 print $rows $rows1 = $rows -sleep 3000 +sleep 2000 sql select * from log.dn2 print $rows $rows2 = $rows diff --git a/tests/script/unique/dnode/monitor_bug.sim b/tests/script/unique/dnode/monitor_bug.sim index 3169c7cdba..efdf5e94b9 100644 --- a/tests/script/unique/dnode/monitor_bug.sim +++ b/tests/script/unique/dnode/monitor_bug.sim @@ -15,7 +15,7 @@ system sh/cfg.sh -n dnode2 -c monitor -v 0 print ========== step1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 5000 +sleep 3000 sql show dnodes print dnode1 openVnodes $data2_1 @@ -64,7 +64,7 @@ sql select * from log.dn1 print $rows $rows1 = $rows -sleep 3000 +sleep 2000 sql select * from log.dn1 print $rows $rows2 = $rows diff --git a/tests/script/unique/dnode/offline1.sim b/tests/script/unique/dnode/offline1.sim index beebbfda60..9bbd14cf07 100644 --- a/tests/script/unique/dnode/offline1.sim +++ b/tests/script/unique/dnode/offline1.sim @@ -25,7 +25,7 @@ system sh/exec.sh -n dnode1 -s start sql connect sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 sql show dnodes print dnode1 $data4_1 diff --git a/tests/script/unique/dnode/offline2.sim b/tests/script/unique/dnode/offline2.sim index e8a5460de4..fa5e0b72e4 100644 --- a/tests/script/unique/dnode/offline2.sim +++ b/tests/script/unique/dnode/offline2.sim @@ -32,7 +32,7 @@ system sh/exec.sh -n dnode1 -s start sql connect sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start -sleep 3000 +sleep 2000 sql create database d1 replica 2 sql create table d1.t1(ts timestamp, i int) @@ -84,11 +84,11 @@ system sh/exec.sh -n dnode3 -s start system sh/exec.sh -n dnode2 -s start sql drop dnode $hostname2 -sleep 5000 +sleep 3000 $x = 0 show4: $x = $x + 1 - sleep 5000 + sleep 3000 if $x == 10 then return -1 endi diff --git a/tests/script/unique/dnode/simple.sim b/tests/script/unique/dnode/simple.sim index 014e2dd04f..38d8c08d75 100644 --- a/tests/script/unique/dnode/simple.sim +++ b/tests/script/unique/dnode/simple.sim @@ -13,7 +13,7 @@ sql create dnode $hostname2 system sh/exec.sh -n dnode2 -s start sql create dnode $hostname3 system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql create database d1 replica 2 sql create table d1.t1 (t timestamp, i int) @@ -44,7 +44,7 @@ endi print ========== step2 sql create dnode $hostname4 system sh/exec.sh -n dnode4 -s start -sleep 3000 +sleep 2000 sql show dnodes print dnode1 openVnodes $data2_1 diff --git a/tests/script/unique/http/admin.sim b/tests/script/unique/http/admin.sim index 8833397487..acc28a4e13 100644 --- a/tests/script/unique/http/admin.sim +++ b/tests/script/unique/http/admin.sim @@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 print ============================ dnode1 start @@ -79,7 +79,7 @@ if $system_content != @{"status":"error","code":4389,"desc":"invalid taosd Autho return -1 endi -sleep 3000 +sleep 2000 system_content curl 127.0.0.1:7111/admin/login/root/taosdata print 9 -----> $system_content diff --git a/tests/script/unique/http/opentsdb.sim b/tests/script/unique/http/opentsdb.sim index 5269817165..3d8e5a8c44 100644 --- a/tests/script/unique/http/opentsdb.sim +++ b/tests/script/unique/http/opentsdb.sim @@ -5,7 +5,7 @@ system sh/cfg.sh -n dnode1 -c http -v 1 system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect print ============================ dnode1 start @@ -152,7 +152,7 @@ if $system_content != @{"status":"error","code":4515,"desc":"tag value is null"} return -1 endi -sleep 3000 +sleep 2000 print =============== step2 - insert single data system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:7111/opentsdb/db/put diff --git a/tests/script/unique/import/replica3.sim b/tests/script/unique/import/replica3.sim index 714141c412..5da9e141a5 100644 --- a/tests/script/unique/import/replica3.sim +++ b/tests/script/unique/import/replica3.sim @@ -241,9 +241,9 @@ endi print ================= step13 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 print ================= step14 #1520000000000 diff --git a/tests/script/unique/mnode/mgmt20.sim b/tests/script/unique/mnode/mgmt20.sim index ee9c2b914f..8945cffab2 100644 --- a/tests/script/unique/mnode/mgmt20.sim +++ b/tests/script/unique/mnode/mgmt20.sim @@ -68,7 +68,7 @@ if $data2_2 != slave then goto show4 endi -sleep 3000 +sleep 2000 sql select * from log.dn1 $d1_second = $rows sql select * from log.dn2 diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index 1dc419b17d..399805312b 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -46,7 +46,7 @@ print should not drop master print ============== step4 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 sql_error show mnodes print error of no master diff --git a/tests/script/unique/mnode/mgmt26.sim b/tests/script/unique/mnode/mgmt26.sim index 9b534cca06..2816845052 100644 --- a/tests/script/unique/mnode/mgmt26.sim +++ b/tests/script/unique/mnode/mgmt26.sim @@ -90,7 +90,7 @@ print ============== step5 system sh/exec.sh -n dnode2 -s stop system sh/deploy.sh -n dnode2 -i 2 system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2 -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start sql create dnode $hostname2 sleep 6000 diff --git a/tests/script/unique/mnode/mgmt30.sim b/tests/script/unique/mnode/mgmt30.sim index a948879933..d0858c0d6c 100644 --- a/tests/script/unique/mnode/mgmt30.sim +++ b/tests/script/unique/mnode/mgmt30.sim @@ -32,7 +32,7 @@ endi print ============== step2 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 sql create dnode $hostname2 sql create dnode $hostname3 diff --git a/tests/script/unique/mnode/mgmtr2.sim b/tests/script/unique/mnode/mgmtr2.sim index 0c9f961d25..5afb419058 100644 --- a/tests/script/unique/mnode/mgmtr2.sim +++ b/tests/script/unique/mnode/mgmtr2.sim @@ -9,7 +9,7 @@ system sh/cfg.sh -n dnode3 -c numOfMnodes -v 2 print ============== step1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql show mnodes diff --git a/tests/script/unique/stable/dnode2_stop.sim b/tests/script/unique/stable/dnode2_stop.sim index 19c6de33b3..c10f04338d 100644 --- a/tests/script/unique/stable/dnode2_stop.sim +++ b/tests/script/unique/stable/dnode2_stop.sim @@ -72,7 +72,7 @@ endi sleep 100 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 print =============== step2 sql select count(*) from $mt -x step2 @@ -84,7 +84,7 @@ sql select count(tbcol) from $mt -x step21 step21: system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 print =============== step3 sql select count(tbcol) as c from $mt where ts <= 1519833840000 diff --git a/tests/script/unique/stream/metrics_balance.sim b/tests/script/unique/stream/metrics_balance.sim index 3cb0d73ab8..b78cfc33a1 100644 --- a/tests/script/unique/stream/metrics_balance.sim +++ b/tests/script/unique/stream/metrics_balance.sim @@ -175,7 +175,7 @@ print rows0=>$r0 rows3=>$r3 rows6=>$r6 rows9=>$r9 $x = 0 show1: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi @@ -200,7 +200,7 @@ sleep 8000 $x = 0 show2: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi diff --git a/tests/script/unique/stream/metrics_vnode_stop.sim b/tests/script/unique/stream/metrics_vnode_stop.sim index 1f9cab48e5..f1a0981d70 100644 --- a/tests/script/unique/stream/metrics_vnode_stop.sim +++ b/tests/script/unique/stream/metrics_vnode_stop.sim @@ -112,11 +112,11 @@ connectTbase2: return -1 endi sql connect -x connectTbase2 -sleep 3000 +sleep 2000 sql create dnode $hostname1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 print ======================== dnode start $dbPrefix = db diff --git a/tests/script/unique/stream/table_balance.sim b/tests/script/unique/stream/table_balance.sim index facb7df459..e8dec54e3e 100644 --- a/tests/script/unique/stream/table_balance.sim +++ b/tests/script/unique/stream/table_balance.sim @@ -112,7 +112,7 @@ print rows1=>$r1 rows5=>$r5 rows8=>$r8 $x = 0 show1: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi @@ -137,7 +137,7 @@ sleep 8000 $x = 0 show2: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi diff --git a/tests/script/unique/stream/table_move.sim b/tests/script/unique/stream/table_move.sim index fe19e6f402..964a0c0253 100644 --- a/tests/script/unique/stream/table_move.sim +++ b/tests/script/unique/stream/table_move.sim @@ -63,7 +63,7 @@ print ========= start dnode1 system sh/exec.sh -n dnode1 -s start sql connect -sleep 3000 +sleep 2000 $i = 0 $db = $dbPrefix . $i @@ -170,7 +170,7 @@ sleep 8000 $x = 0 show2: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi @@ -199,7 +199,7 @@ sleep 9000 $x = 0 show6: $x = $x + 1 - sleep 3000 + sleep 2000 if $x == 20 then return -1 endi diff --git a/tests/script/unique/stream/table_vnode_stop.sim b/tests/script/unique/stream/table_vnode_stop.sim index 16350949b1..229d814e42 100644 --- a/tests/script/unique/stream/table_vnode_stop.sim +++ b/tests/script/unique/stream/table_vnode_stop.sim @@ -113,11 +113,11 @@ connectTbase2: return -1 endi sql connect -x connectTbase2 -sleep 3000 +sleep 2000 sql create dnode $hostname1 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 print ======================== dnode start $dbPrefix = db diff --git a/tests/script/unique/vnode/many.sim b/tests/script/unique/vnode/many.sim index 869c7f8295..a9298b1cf2 100644 --- a/tests/script/unique/vnode/many.sim +++ b/tests/script/unique/vnode/many.sim @@ -80,7 +80,7 @@ $lastRows4 = $rows print ======== step2 run_back unique/vnode/back_insert_many.sim -sleep 5000 +sleep 3000 print ======== step3 @@ -89,15 +89,15 @@ loop: print ======== step4 system sh/exec.sh -n dnode3 -s stop -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 print ======== step5 system sh/exec.sh -n dnode2 -s stop -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 print ======== step6 sql select count(*) from db1.tb1 diff --git a/tests/script/unique/vnode/replica2_a_large.sim b/tests/script/unique/vnode/replica2_a_large.sim index 801570dd9c..6f31803845 100644 --- a/tests/script/unique/vnode/replica2_a_large.sim +++ b/tests/script/unique/vnode/replica2_a_large.sim @@ -29,14 +29,14 @@ print ============== step0: start tarbitrator system sh/exec_tarbitrator.sh -s start system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 system sh/exec.sh -n dnode2 -s start -t system sh/exec.sh -n dnode3 -s start -t -sleep 3000 +sleep 2000 print ========= step1 sql create database db replica 2 @@ -56,7 +56,7 @@ $lastRows = $rows print ======== step2 #run_back unique/vnode/back_insert_many.sim run_back unique/vnode/back_insert.sim -sleep 3000 +sleep 2000 print ======== step3 diff --git a/tests/script/unique/vnode/replica2_basic2.sim b/tests/script/unique/vnode/replica2_basic2.sim index 6976353f3e..c081f878dd 100644 --- a/tests/script/unique/vnode/replica2_basic2.sim +++ b/tests/script/unique/vnode/replica2_basic2.sim @@ -22,13 +22,13 @@ system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 4 print ========= start dnodes system sh/exec.sh -n dnode1 -s start -sleep 3000 +sleep 2000 sql connect sql create dnode $hostname2 sql create dnode $hostname3 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 sql reset query cache @@ -126,7 +126,7 @@ endi print ========= step3 system sh/exec.sh -n dnode2 -s stop -x SIGINT -sleep 5000 +sleep 3000 #sql insert into d1.t1 values(now, 3) #sql insert into d2.t2 values(now, 3) @@ -155,9 +155,9 @@ sleep 5000 print ========= step4 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode3 -s stop -x SIGINT -sleep 5000 +sleep 3000 #sql insert into d1.t1 values(now, 4) #sql insert into d2.t2 values(now, 4) @@ -186,7 +186,7 @@ sleep 5000 print ========= step5 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 sql insert into d1.t1 values(now, 5) sql insert into d2.t2 values(now, 5) diff --git a/tests/script/unique/vnode/replica2_repeat.sim b/tests/script/unique/vnode/replica2_repeat.sim index 5dbb24437d..ac68d59164 100644 --- a/tests/script/unique/vnode/replica2_repeat.sim +++ b/tests/script/unique/vnode/replica2_repeat.sim @@ -65,7 +65,7 @@ $lastRows = $rows print ======== step2 run_back unique/vnode/back_insert.sim -sleep 3000 +sleep 2000 print ======== step3 @@ -74,15 +74,15 @@ loop: print ======== step4 system sh/exec.sh -n dnode2 -s stop -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 print ======== step5 system sh/exec.sh -n dnode3 -s stop -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 print ======== step6 sql select count(*) from db.tb diff --git a/tests/script/unique/vnode/replica3_repeat.sim b/tests/script/unique/vnode/replica3_repeat.sim index d866fb05d8..636bc64f89 100644 --- a/tests/script/unique/vnode/replica3_repeat.sim +++ b/tests/script/unique/vnode/replica3_repeat.sim @@ -72,32 +72,32 @@ $lastRows = $rows print ======== step2 run_back unique/vnode/back_insert.sim -sleep 3000 +sleep 2000 print ======== step3 system sh/exec.sh -n dnode2 -s stop -sleep 5000 +sleep 3000 $x = 0 loop: print ======== step4 system sh/exec.sh -n dnode2 -s start -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode3 -s stop -sleep 5000 +sleep 3000 print ======== step5 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode4 -s stop -sleep 5000 +sleep 3000 print ======== step6 system sh/exec.sh -n dnode4 -s start -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode2 -s stop -sleep 5000 +sleep 3000 print ======== step7 sql select count(*) from db.tb diff --git a/tests/script/unique/vnode/replica3_vgroup.sim b/tests/script/unique/vnode/replica3_vgroup.sim index 11295ba0a4..de4c48eca5 100644 --- a/tests/script/unique/vnode/replica3_vgroup.sim +++ b/tests/script/unique/vnode/replica3_vgroup.sim @@ -16,13 +16,13 @@ sql create dnode $hostname2 sql create dnode $hostname3 system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode3 -s start -sleep 3000 +sleep 2000 $N = 10 $table = table_r3 $db = db1 -sleep 3000 +sleep 2000 print =================== step 1 diff --git a/tests/script/windows/alter/metrics.sim b/tests/script/windows/alter/metrics.sim index 7d5dc77949..7dfda05bd0 100644 --- a/tests/script/windows/alter/metrics.sim +++ b/tests/script/windows/alter/metrics.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases @@ -368,9 +368,9 @@ endi print ======== step9 print ======== step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use d2 sql describe tb diff --git a/tests/script/windows/alter/table.sim b/tests/script/windows/alter/table.sim index 03182e613d..52757da20e 100644 --- a/tests/script/windows/alter/table.sim +++ b/tests/script/windows/alter/table.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases @@ -319,9 +319,9 @@ endi print ======== step9 print ======== step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 5000 +sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 5000 +sleep 3000 sql use d1 sql describe tb diff --git a/tests/script/windows/compute/avg.sim b/tests/script/windows/compute/avg.sim index b655abf163..7445808db5 100644 --- a/tests/script/windows/compute/avg.sim +++ b/tests/script/windows/compute/avg.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/compute/bottom.sim b/tests/script/windows/compute/bottom.sim index dc104a8ebd..18f6c0bd09 100644 --- a/tests/script/windows/compute/bottom.sim +++ b/tests/script/windows/compute/bottom.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/compute/count.sim b/tests/script/windows/compute/count.sim index 9c9d8821b0..227b49a8bd 100644 --- a/tests/script/windows/compute/count.sim +++ b/tests/script/windows/compute/count.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/compute/diff.sim b/tests/script/windows/compute/diff.sim index 667fcdbcff..bdc5a0e3d8 100644 --- a/tests/script/windows/compute/diff.sim +++ b/tests/script/windows/compute/diff.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/first.sim b/tests/script/windows/compute/first.sim index d6e1b1deea..a83939c2a6 100644 --- a/tests/script/windows/compute/first.sim +++ b/tests/script/windows/compute/first.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/interval.sim b/tests/script/windows/compute/interval.sim index 4bf548ccf2..feacce1606 100644 --- a/tests/script/windows/compute/interval.sim +++ b/tests/script/windows/compute/interval.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/last.sim b/tests/script/windows/compute/last.sim index 63d4d3ecbd..379a5ae64a 100644 --- a/tests/script/windows/compute/last.sim +++ b/tests/script/windows/compute/last.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/leastsquare.sim b/tests/script/windows/compute/leastsquare.sim index 69c8fb377b..20353a409e 100644 --- a/tests/script/windows/compute/leastsquare.sim +++ b/tests/script/windows/compute/leastsquare.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/max.sim b/tests/script/windows/compute/max.sim index e480736550..641b31fe36 100644 --- a/tests/script/windows/compute/max.sim +++ b/tests/script/windows/compute/max.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/min.sim b/tests/script/windows/compute/min.sim index 1ff637cecd..3528f573ce 100644 --- a/tests/script/windows/compute/min.sim +++ b/tests/script/windows/compute/min.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/percentile.sim b/tests/script/windows/compute/percentile.sim index 5e327055a8..fa6212f013 100644 --- a/tests/script/windows/compute/percentile.sim +++ b/tests/script/windows/compute/percentile.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/stddev.sim b/tests/script/windows/compute/stddev.sim index 2aa481248a..eea6c8aa05 100644 --- a/tests/script/windows/compute/stddev.sim +++ b/tests/script/windows/compute/stddev.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/sum.sim b/tests/script/windows/compute/sum.sim index 30e98a5b25..a429ce99e0 100644 --- a/tests/script/windows/compute/sum.sim +++ b/tests/script/windows/compute/sum.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/compute/top.sim b/tests/script/windows/compute/top.sim index 9590997ef7..65e448b0fa 100644 --- a/tests/script/windows/compute/top.sim +++ b/tests/script/windows/compute/top.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/db/basic.sim b/tests/script/windows/db/basic.sim index fffde94d66..914e456fe1 100644 --- a/tests/script/windows/db/basic.sim +++ b/tests/script/windows/db/basic.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/db/len.sim b/tests/script/windows/db/len.sim index 5afa2496dd..3356165117 100644 --- a/tests/script/windows/db/len.sim +++ b/tests/script/windows/db/len.sim @@ -1,4 +1,4 @@ -sleep 3000 +sleep 2000 sql connect sql show databases diff --git a/tests/script/windows/field/2.sim b/tests/script/windows/field/2.sim index 8ac6fa1a1b..e258fbe80e 100644 --- a/tests/script/windows/field/2.sim +++ b/tests/script/windows/field/2.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/3.sim b/tests/script/windows/field/3.sim index 331e930b31..e3fe0b0b11 100644 --- a/tests/script/windows/field/3.sim +++ b/tests/script/windows/field/3.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/4.sim b/tests/script/windows/field/4.sim index c6224c46ee..aabfe2be2c 100644 --- a/tests/script/windows/field/4.sim +++ b/tests/script/windows/field/4.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/5.sim b/tests/script/windows/field/5.sim index d1f40059d0..874730ff1c 100644 --- a/tests/script/windows/field/5.sim +++ b/tests/script/windows/field/5.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/6.sim b/tests/script/windows/field/6.sim index 98071f87df..77277df35b 100644 --- a/tests/script/windows/field/6.sim +++ b/tests/script/windows/field/6.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/bigint.sim b/tests/script/windows/field/bigint.sim index bef571f445..f912ee968b 100644 --- a/tests/script/windows/field/bigint.sim +++ b/tests/script/windows/field/bigint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/binary.sim b/tests/script/windows/field/binary.sim index 72a356e684..aa641878e4 100644 --- a/tests/script/windows/field/binary.sim +++ b/tests/script/windows/field/binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/bool.sim b/tests/script/windows/field/bool.sim index abc970264d..3ef56a1d95 100644 --- a/tests/script/windows/field/bool.sim +++ b/tests/script/windows/field/bool.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/double.sim b/tests/script/windows/field/double.sim index e805e0373b..ef404d28dc 100644 --- a/tests/script/windows/field/double.sim +++ b/tests/script/windows/field/double.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/float.sim b/tests/script/windows/field/float.sim index 4178ab4e1e..8435f31c1f 100644 --- a/tests/script/windows/field/float.sim +++ b/tests/script/windows/field/float.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/int.sim b/tests/script/windows/field/int.sim index 05dc19094d..781b939484 100644 --- a/tests/script/windows/field/int.sim +++ b/tests/script/windows/field/int.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/single.sim b/tests/script/windows/field/single.sim index 6422b7f697..b6b4402091 100644 --- a/tests/script/windows/field/single.sim +++ b/tests/script/windows/field/single.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/smallint.sim b/tests/script/windows/field/smallint.sim index 8bf41f45a5..5f1839226b 100644 --- a/tests/script/windows/field/smallint.sim +++ b/tests/script/windows/field/smallint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/field/tinyint.sim b/tests/script/windows/field/tinyint.sim index 16c19ba38d..c90ff3f932 100644 --- a/tests/script/windows/field/tinyint.sim +++ b/tests/script/windows/field/tinyint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/import/basic.sim b/tests/script/windows/import/basic.sim index 491b4f8b34..ee19893ae2 100644 --- a/tests/script/windows/import/basic.sim +++ b/tests/script/windows/import/basic.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/basic.sim b/tests/script/windows/insert/basic.sim index 54cbd3f4d9..a516f80e10 100644 --- a/tests/script/windows/insert/basic.sim +++ b/tests/script/windows/insert/basic.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_block1_file.sim b/tests/script/windows/insert/query_block1_file.sim index 388ed061e5..62b74ac19c 100644 --- a/tests/script/windows/insert/query_block1_file.sim +++ b/tests/script/windows/insert/query_block1_file.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_block1_memory.sim b/tests/script/windows/insert/query_block1_memory.sim index 9e4fc68d09..6c3e58d70e 100644 --- a/tests/script/windows/insert/query_block1_memory.sim +++ b/tests/script/windows/insert/query_block1_memory.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_block2_file.sim b/tests/script/windows/insert/query_block2_file.sim index 9fd4434476..164c8a1124 100644 --- a/tests/script/windows/insert/query_block2_file.sim +++ b/tests/script/windows/insert/query_block2_file.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_block2_memory.sim b/tests/script/windows/insert/query_block2_memory.sim index ede7f3efc6..f3ceb503ac 100644 --- a/tests/script/windows/insert/query_block2_memory.sim +++ b/tests/script/windows/insert/query_block2_memory.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_file_memory.sim b/tests/script/windows/insert/query_file_memory.sim index 083beb4ac5..d9752c40c9 100644 --- a/tests/script/windows/insert/query_file_memory.sim +++ b/tests/script/windows/insert/query_file_memory.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/insert/query_multi_file.sim b/tests/script/windows/insert/query_multi_file.sim index 465970f942..ba617ce63c 100644 --- a/tests/script/windows/insert/query_multi_file.sim +++ b/tests/script/windows/insert/query_multi_file.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/binary.sim b/tests/script/windows/table/binary.sim index 64a081c72f..5efa0bc666 100644 --- a/tests/script/windows/table/binary.sim +++ b/tests/script/windows/table/binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/bool.sim b/tests/script/windows/table/bool.sim index 9486c42221..0d185d31e8 100644 --- a/tests/script/windows/table/bool.sim +++ b/tests/script/windows/table/bool.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/column_name.sim b/tests/script/windows/table/column_name.sim index fffb1334e5..6f9f954461 100644 --- a/tests/script/windows/table/column_name.sim +++ b/tests/script/windows/table/column_name.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/column_num.sim b/tests/script/windows/table/column_num.sim index d182696ce0..395ee02cde 100644 --- a/tests/script/windows/table/column_num.sim +++ b/tests/script/windows/table/column_num.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/column_value.sim b/tests/script/windows/table/column_value.sim index c59e7af8ba..8db85f16ad 100644 --- a/tests/script/windows/table/column_value.sim +++ b/tests/script/windows/table/column_value.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/db.table.sim b/tests/script/windows/table/db.table.sim index 97a9e6fbe9..0e207c9982 100644 --- a/tests/script/windows/table/db.table.sim +++ b/tests/script/windows/table/db.table.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/double.sim b/tests/script/windows/table/double.sim index 93bf3bb149..b88ac4a199 100644 --- a/tests/script/windows/table/double.sim +++ b/tests/script/windows/table/double.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/float.sim b/tests/script/windows/table/float.sim index 684f78a386..741525830d 100644 --- a/tests/script/windows/table/float.sim +++ b/tests/script/windows/table/float.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/table/table.sim b/tests/script/windows/table/table.sim index 985620152a..13d1576277 100644 --- a/tests/script/windows/table/table.sim +++ b/tests/script/windows/table/table.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ============================ dnode1 start sql show databases diff --git a/tests/script/windows/table/table_len.sim b/tests/script/windows/table/table_len.sim index 367f1c6895..72ed549466 100644 --- a/tests/script/windows/table/table_len.sim +++ b/tests/script/windows/table/table_len.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/tag/3.sim b/tests/script/windows/tag/3.sim index 63a8766727..5479be158b 100644 --- a/tests/script/windows/tag/3.sim +++ b/tests/script/windows/tag/3.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/4.sim b/tests/script/windows/tag/4.sim index 7e9af7ece7..17552010b0 100644 --- a/tests/script/windows/tag/4.sim +++ b/tests/script/windows/tag/4.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/5.sim b/tests/script/windows/tag/5.sim index 5dc128a0e0..f06d78e7b5 100644 --- a/tests/script/windows/tag/5.sim +++ b/tests/script/windows/tag/5.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/6.sim b/tests/script/windows/tag/6.sim index 12e9c597f0..64cb9df6f0 100644 --- a/tests/script/windows/tag/6.sim +++ b/tests/script/windows/tag/6.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/add.sim b/tests/script/windows/tag/add.sim index 0a1416b68c..02d027ccf4 100644 --- a/tests/script/windows/tag/add.sim +++ b/tests/script/windows/tag/add.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/bigint.sim b/tests/script/windows/tag/bigint.sim index d988ad1fdc..ebb67d452c 100644 --- a/tests/script/windows/tag/bigint.sim +++ b/tests/script/windows/tag/bigint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/binary.sim b/tests/script/windows/tag/binary.sim index 9dc18cfa94..c59039b6a6 100644 --- a/tests/script/windows/tag/binary.sim +++ b/tests/script/windows/tag/binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/binary_binary.sim b/tests/script/windows/tag/binary_binary.sim index ba688aa80e..361a6edb8b 100644 --- a/tests/script/windows/tag/binary_binary.sim +++ b/tests/script/windows/tag/binary_binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/bool.sim b/tests/script/windows/tag/bool.sim index a7e5d909c5..adf12338d0 100644 --- a/tests/script/windows/tag/bool.sim +++ b/tests/script/windows/tag/bool.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/bool_binary.sim b/tests/script/windows/tag/bool_binary.sim index 639f6c5f2f..064677ee40 100644 --- a/tests/script/windows/tag/bool_binary.sim +++ b/tests/script/windows/tag/bool_binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/bool_int.sim b/tests/script/windows/tag/bool_int.sim index 900cc9e8a1..ef5cd27553 100644 --- a/tests/script/windows/tag/bool_int.sim +++ b/tests/script/windows/tag/bool_int.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/change.sim b/tests/script/windows/tag/change.sim index 75a976bbb1..4126ea1181 100644 --- a/tests/script/windows/tag/change.sim +++ b/tests/script/windows/tag/change.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases @@ -175,7 +175,7 @@ sql alter table $mt change tag tgcol3 tgcol9 sql alter table $mt change tag tgcol5 tgcol10 sql alter table $mt change tag tgcol6 tgcol11 -sleep 5000 +sleep 3000 sql reset query cache print =============== step2 diff --git a/tests/script/windows/tag/column.sim b/tests/script/windows/tag/column.sim index 9f5bfce07e..40159bcae3 100644 --- a/tests/script/windows/tag/column.sim +++ b/tests/script/windows/tag/column.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/create.sim b/tests/script/windows/tag/create.sim index 6a76c93d83..62dc8a7a21 100644 --- a/tests/script/windows/tag/create.sim +++ b/tests/script/windows/tag/create.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/delete.sim b/tests/script/windows/tag/delete.sim index 9e8ea9aba0..2b503fdf47 100644 --- a/tests/script/windows/tag/delete.sim +++ b/tests/script/windows/tag/delete.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases @@ -409,7 +409,7 @@ sql alter table $mt drop tag tgcol3 sql alter table $mt drop tag tgcol4 sql alter table $mt drop tag tgcol6 -sleep 5000 +sleep 3000 print =============== step2 $i = 2 diff --git a/tests/script/windows/tag/double.sim b/tests/script/windows/tag/double.sim index 5445b1dbea..4381aa20f9 100644 --- a/tests/script/windows/tag/double.sim +++ b/tests/script/windows/tag/double.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/filter.sim b/tests/script/windows/tag/filter.sim index f704f32cd2..802e9a312f 100644 --- a/tests/script/windows/tag/filter.sim +++ b/tests/script/windows/tag/filter.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/float.sim b/tests/script/windows/tag/float.sim index 64424c1e20..8df44c24a5 100644 --- a/tests/script/windows/tag/float.sim +++ b/tests/script/windows/tag/float.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/int.sim b/tests/script/windows/tag/int.sim index 7d7b5271d1..dbff8c15b6 100644 --- a/tests/script/windows/tag/int.sim +++ b/tests/script/windows/tag/int.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/int_binary.sim b/tests/script/windows/tag/int_binary.sim index 1dd4771605..94aa9eb7f4 100644 --- a/tests/script/windows/tag/int_binary.sim +++ b/tests/script/windows/tag/int_binary.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/int_float.sim b/tests/script/windows/tag/int_float.sim index cdb9032d8c..9789c9ea06 100644 --- a/tests/script/windows/tag/int_float.sim +++ b/tests/script/windows/tag/int_float.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/set.sim b/tests/script/windows/tag/set.sim index 16103c6ce8..54b87c7d0c 100644 --- a/tests/script/windows/tag/set.sim +++ b/tests/script/windows/tag/set.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/smallint.sim b/tests/script/windows/tag/smallint.sim index dbab4f2d43..bc668b164d 100644 --- a/tests/script/windows/tag/smallint.sim +++ b/tests/script/windows/tag/smallint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/tag/tinyint.sim b/tests/script/windows/tag/tinyint.sim index 7a0237c0d9..44fc9ba4dc 100644 --- a/tests/script/windows/tag/tinyint.sim +++ b/tests/script/windows/tag/tinyint.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 print ======================== dnode1 start sql show databases diff --git a/tests/script/windows/vector/metrics_field.sim b/tests/script/windows/vector/metrics_field.sim index e7c926e141..dfaa7e1d99 100644 --- a/tests/script/windows/vector/metrics_field.sim +++ b/tests/script/windows/vector/metrics_field.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/metrics_mix.sim b/tests/script/windows/vector/metrics_mix.sim index 3d94a96385..111fdebb05 100644 --- a/tests/script/windows/vector/metrics_mix.sim +++ b/tests/script/windows/vector/metrics_mix.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/metrics_query.sim b/tests/script/windows/vector/metrics_query.sim index c292c6b306..45e734f468 100644 --- a/tests/script/windows/vector/metrics_query.sim +++ b/tests/script/windows/vector/metrics_query.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/metrics_tag.sim b/tests/script/windows/vector/metrics_tag.sim index f51a449d71..80c204fa10 100644 --- a/tests/script/windows/vector/metrics_tag.sim +++ b/tests/script/windows/vector/metrics_tag.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/metrics_time.sim b/tests/script/windows/vector/metrics_time.sim index 716f49d1e5..c127fe78fc 100644 --- a/tests/script/windows/vector/metrics_time.sim +++ b/tests/script/windows/vector/metrics_time.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/multi.sim b/tests/script/windows/vector/multi.sim index 415384d243..ff63cda9a5 100644 --- a/tests/script/windows/vector/multi.sim +++ b/tests/script/windows/vector/multi.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/single.sim b/tests/script/windows/vector/single.sim index f3f3862e54..fb3a52760b 100644 --- a/tests/script/windows/vector/single.sim +++ b/tests/script/windows/vector/single.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/table_field.sim b/tests/script/windows/vector/table_field.sim index 0c5df695fb..10c5148243 100644 --- a/tests/script/windows/vector/table_field.sim +++ b/tests/script/windows/vector/table_field.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/table_mix.sim b/tests/script/windows/vector/table_mix.sim index 3d660b5611..7418cb453d 100644 --- a/tests/script/windows/vector/table_mix.sim +++ b/tests/script/windows/vector/table_mix.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/table_query.sim b/tests/script/windows/vector/table_query.sim index 27fcd0f654..7654688b26 100644 --- a/tests/script/windows/vector/table_query.sim +++ b/tests/script/windows/vector/table_query.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1 diff --git a/tests/script/windows/vector/table_time.sim b/tests/script/windows/vector/table_time.sim index 8a3804c619..bea9d41d1b 100644 --- a/tests/script/windows/vector/table_time.sim +++ b/tests/script/windows/vector/table_time.sim @@ -1,5 +1,5 @@ sql connect -sleep 3000 +sleep 2000 sql show databases sql drop database $data00 -x e1