[td-225] merge develop
This commit is contained in:
commit
6c5ff84d2c
|
@ -18,6 +18,7 @@ SET(TD_COVER FALSE)
|
||||||
SET(TD_MEM_CHECK FALSE)
|
SET(TD_MEM_CHECK FALSE)
|
||||||
|
|
||||||
SET(TD_PAGMODE_LITE FALSE)
|
SET(TD_PAGMODE_LITE FALSE)
|
||||||
|
SET(TD_SOMODE_STATIC FALSE)
|
||||||
SET(TD_GODLL FALSE)
|
SET(TD_GODLL FALSE)
|
||||||
|
|
||||||
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
|
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
||||||
[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
|
[](https://coveralls.io/github/taosdata/TDengine?branch=develop)
|
||||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||||
|

|
||||||
|
|
||||||
[](https://www.taosdata.com)
|
[](https://www.taosdata.com)
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ IF (TD_WINDOWS)
|
||||||
ADD_DEFINITIONS(-D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
ADD_DEFINITIONS(-D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
SET(CMAKE_GENERATOR "NMake Makefiles" CACHE INTERNAL "" FORCE)
|
SET(CMAKE_GENERATOR "NMake Makefiles" CACHE INTERNAL "" FORCE)
|
||||||
IF (NOT TD_GODLL)
|
IF (NOT TD_GODLL)
|
||||||
SET(COMMON_FLAGS "/nologo /WX /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
|
SET(COMMON_FLAGS "/nologo /WX /wd4018 /wd2220 /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
|
||||||
SET(DEBUG_FLAGS "/Zi /W3 /GL")
|
SET(DEBUG_FLAGS "/Zi /W3 /GL")
|
||||||
SET(RELEASE_FLAGS "/W0 /GL")
|
SET(RELEASE_FLAGS "/W0 /GL")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -22,6 +22,11 @@ IF (${PAGMODE} MATCHES "lite")
|
||||||
MESSAGE(STATUS "Build with pagmode lite")
|
MESSAGE(STATUS "Build with pagmode lite")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (${SOMODE} MATCHES "static")
|
||||||
|
SET(TD_SOMODE_STATIC TRUE)
|
||||||
|
MESSAGE(STATUS "Link so using static mode")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (${DLLTYPE} MATCHES "go")
|
IF (${DLLTYPE} MATCHES "go")
|
||||||
SET(TD_GODLL TRUE)
|
SET(TD_GODLL TRUE)
|
||||||
MESSAGE(STATUS "input dll type: " ${DLLTYPE})
|
MESSAGE(STATUS "input dll type: " ${DLLTYPE})
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
/* Generate the OS-and-debug-mode-specific library name */
|
/* Generate the OS-and-debug-mode-specific library name */
|
||||||
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
|
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
|
||||||
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
|
//#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
|
||||||
#pragma comment(lib, _MSVCLIBX_LIB)
|
//#pragma comment(lib, _MSVCLIBX_LIB)
|
||||||
|
|
||||||
/* Library-specific routine used internally by many standard routines */
|
/* Library-specific routine used internally by many standard routines */
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
|
@ -1,16 +1,46 @@
|
||||||
#TDengine 集群安装、管理
|
# TDengine 集群安装、管理
|
||||||
|
|
||||||
多个taosd的运行实例可以组成一个集群,以保证TDengine的高可靠运行,并提供水平扩展能力。要了解TDengine 2.0的集群管理,需要对集群的基本概念有所了解,请看TDengine 2.0整体架构一章。
|
多个taosd的运行实例可以组成一个集群,以保证TDengine的高可靠运行,并提供水平扩展能力。要了解TDengine 2.0的集群管理,需要对集群的基本概念有所了解,请看TDengine 2.0整体架构一章。而且在安装集群之前,请按照[《立即开始》](https://www.taosdata.com/cn/getting-started20/)一章安装并体验过单节点功能。
|
||||||
|
|
||||||
集群的每个节点是由End Point来唯一标识的,End Point是由FQDN(Fully Qualified Domain Name)外加Port组成,比如 h1.taosdata.com:6030。一般FQDN就是服务器的hostname,可通过Linux命令“hostname"获取。端口是这个节点对外服务的端口号,缺省是6030,但可以通过taos.cfg里配置参数serverPort进行修改。
|
集群的每个节点是由End Point来唯一标识的,End Point是由FQDN(Fully Qualified Domain Name)外加Port组成,比如 h1.taosdata.com:6030。一般FQDN就是服务器的hostname,可通过Linux命令“hostname"获取。端口是这个节点对外服务的端口号,缺省是6030,但可以通过taos.cfg里配置参数serverPort进行修改。一个节点可能配置了多个hostname, TDengine会自动获取第一个,但也可以通过taos.cfg里配置参数fqdn进行指定。
|
||||||
|
|
||||||
TDengine的集群管理极其简单,除添加和删除节点需要人工干预之外,其他全部是自动完成,最大程度的降低了运维的工作量。本章对集群管理的操作做详细的描述。
|
TDengine的集群管理极其简单,除添加和删除节点需要人工干预之外,其他全部是自动完成,最大程度的降低了运维的工作量。本章对集群管理的操作做详细的描述。
|
||||||
|
|
||||||
##安装、创建第一个节点
|
## 准备工作
|
||||||
|
|
||||||
集群是由一个一个dnode组成的,是从一个dnode的创建开始的。创建第一个节点很简单,就按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法进行安装、启动即可。
|
**第一步**:如果搭建集群的节点中,存有之前的测试数据、装过1.X的版本,或者装过其他版本的TDengine,请先将其删除,并清空所有数据,具体步骤请参考博客[《TDengine多种安装包的安装和卸载》](https://www.taosdata.com/blog/2019/08/09/566.html )
|
||||||
|
|
||||||
启动后,请执行taos, 启动taos shell,从shell里执行命令"show dnodes;",如下所示:
|
**第二步**:建议关闭防火墙,至少保证端口:6030 - 6041的TCP和UDP端口都是开放的。**强烈建议**先关闭防火墙,集群搭建完毕之后,再来配置端口;
|
||||||
|
|
||||||
|
**第三步**:在所有节点安装TDengine,且版本必须是一致的,**但不要启动taosd**;
|
||||||
|
|
||||||
|
**第四步**:检查、配置所有节点的FQDN:
|
||||||
|
|
||||||
|
1. 每个节点上执行命令`hostname`,查看和确认所有节点的hostname是不相同的;
|
||||||
|
2. 每个节点上执行`ping host`, 其中host是其他节点的hostname, 看能否ping通其它节点; 如果不能ping通,需要检查网络设置, 或/etc/hosts文件,或DNS的配置。如果无法ping通,是无法组成集群的。
|
||||||
|
3. 每个节点的FQDN就是输出的hostname外加端口号,比如h1.taosdata.com:6030
|
||||||
|
|
||||||
|
**第五步**:修改TDengine的配置文件(所有节点的文件/etc/taos/taos.cfg都需要修改)。假设准备启动的第一个节点End Point为 h1.taosdata.com:6030, 那么以下几个参数与集群相关:
|
||||||
|
|
||||||
|
```
|
||||||
|
// firstEp 是每个节点启动后连接的第一个节点
|
||||||
|
firstEp h1.taosdata.com:6030
|
||||||
|
|
||||||
|
// 配置本节点的FQDN,如果本机只有一个hostname, 无需配置
|
||||||
|
fqdn h1.taosdata.com
|
||||||
|
|
||||||
|
// 配置本节点的端口号,缺省是6030
|
||||||
|
serverPort 6030
|
||||||
|
|
||||||
|
// 副本数为偶数的时候,需要配置,请参考《Arbitrator的使用》的部分
|
||||||
|
arbitrator ha.taosdata.com:6030
|
||||||
|
```
|
||||||
|
|
||||||
|
一定要修改的参数是firstEp, 其他参数可不做任何修改,除非你很清楚为什么要修改。
|
||||||
|
|
||||||
|
## 启动第一个节点
|
||||||
|
|
||||||
|
按照[《立即开始》](https://www.taosdata.com/cn/getting-started20/)里的指示,启动第一个节点h1.taosdata.com,然后执行taos, 启动taos shell,从shell里执行命令"show dnodes;",如下所示:
|
||||||
```
|
```
|
||||||
Welcome to the TDengine shell from Linux, Client Version:2.0.0.0
|
Welcome to the TDengine shell from Linux, Client Version:2.0.0.0
|
||||||
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
|
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
|
||||||
|
@ -25,71 +55,64 @@ taos>
|
||||||
```
|
```
|
||||||
上述命令里,可以看到这个刚启动的这个节点的End Point是:h1.taos.com:6030
|
上述命令里,可以看到这个刚启动的这个节点的End Point是:h1.taos.com:6030
|
||||||
|
|
||||||
## 安装、创建后续节点
|
## 启动后续节点
|
||||||
|
|
||||||
将新的节点添加到现有集群,具体有以下几步:
|
将后续的节点添加到现有集群,具体有以下几步:
|
||||||
|
|
||||||
1. 按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法进行安装,**但不要启动taosd**
|
1. 按照["立即开始“](https://www.taosdata.com/cn/getting-started/)一章的方法在每个节点启动taosd。
|
||||||
|
|
||||||
2. 如果是使用涛思数据的官方安装包进行安装,在安装结束时,会询问集群的End Port, 输入第一个节点的End Point即可。如果是源码安装,请编辑配置文件taos.cfg(缺省是在/etc/taos/目录),增加一行:
|
2. 在第一个节点,使用CLI程序taos, 登录进TDengine系统, 执行命令:
|
||||||
|
|
||||||
```
|
|
||||||
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";
|
CREATE DNODE "h2.taos.com:6030";
|
||||||
```
|
```
|
||||||
|
|
||||||
将新节点的End Point添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。请注意将示例的“h2.taos.com:6030" 替换为你自己第一个节点的End Point
|
将新节点的End Point (准备工作中第四步获知的) 添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。请注意将示例的“h2.taos.com:6030" 替换为这个新节点的End Point。
|
||||||
|
|
||||||
6. 使用命令
|
3. 然后执行命令
|
||||||
|
|
||||||
```
|
```
|
||||||
SHOW DNODES;
|
SHOW DNODES;
|
||||||
```
|
```
|
||||||
|
|
||||||
查看新节点是否被成功加入。
|
查看新节点是否被成功加入。如果该被加入的节点处于离线状态,请做两个检查
|
||||||
|
|
||||||
|
- 查看该节点的taosd是否正常工作,如果没有正常运行,需要先检查为什么
|
||||||
|
- 查看该节点taosd日志文件taosdlog.0里前面几行日志(一般在/var/log/taos目录),看日志里输出的该节点fqdn以及端口号是否为刚添加的End Point。如果不一致,需要将正确的End Point添加进去。
|
||||||
|
|
||||||
按照上述步骤可以源源不断的将新的节点加入到集群。
|
按照上述步骤可以源源不断的将新的节点加入到集群。
|
||||||
|
|
||||||
**提示:**
|
**提示:**
|
||||||
|
|
||||||
- firstEp, secondEp这两个参数仅仅在该节点第一次加入集群时有作用,加入集群后,该节点会保存最新的mnode的End Point列表,不再依赖这两个参数。
|
- firstEp这个参数仅仅在该节点第一次加入集群时有作用,加入集群后,该节点会保存最新的mnode的End Point列表,不再依赖这两个参数。
|
||||||
- 两个没有配置firstEp, secondEp参数的dnode启动后,会独立运行起来。这个时候,无法将其中一个节点加入到另外一个节点,形成集群。**无法将两个独立的集群合并成为新的集群**。
|
- 两个没有配置firstEp参数的dnode启动后,会独立运行起来。这个时候,无法将其中一个节点加入到另外一个节点,形成集群。**无法将两个独立的集群合并成为新的集群**。
|
||||||
|
|
||||||
##节点管理
|
## 节点管理
|
||||||
|
|
||||||
###添加节点
|
### 添加节点
|
||||||
执行CLI程序taos, 使用root账号登录进系统, 执行:
|
执行CLI程序taos, 使用root账号登录进系统, 执行:
|
||||||
```
|
```
|
||||||
CREATE DNODE "fqdn:port";
|
CREATE DNODE "fqdn:port";
|
||||||
```
|
```
|
||||||
将新节点的End Point添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。一个节点对外服务的fqdn和port可以通过配置文件taos.cfg进行配置,缺省是自动获取。
|
将新节点的End Point添加进集群的EP列表。**"fqdn:port"需要用双引号引起来**,否则出错。一个节点对外服务的fqdn和port可以通过配置文件taos.cfg进行配置,缺省是自动获取。
|
||||||
|
|
||||||
###删除节点
|
### 删除节点
|
||||||
执行CLI程序taos, 使用root账号登录进TDengine系统,执行:
|
执行CLI程序taos, 使用root账号登录进TDengine系统,执行:
|
||||||
|
|
||||||
```
|
```
|
||||||
DROP DNODE "fqdn:port";
|
DROP DNODE "fqdn:port";
|
||||||
```
|
```
|
||||||
其中fqdn是被删除的节点的FQDN,port是其对外服务器的端口号
|
其中fqdn是被删除的节点的FQDN,port是其对外服务器的端口号
|
||||||
|
|
||||||
###查看节点
|
### 查看节点
|
||||||
执行CLI程序taos,使用root账号登录进TDengine系统,执行:
|
执行CLI程序taos,使用root账号登录进TDengine系统,执行:
|
||||||
|
|
||||||
```
|
```
|
||||||
SHOW DNODES;
|
SHOW DNODES;
|
||||||
```
|
```
|
||||||
它将列出集群中所有的dnode,每个dnode的fqdn:port, 状态(ready, offline等),vnode数目,还未使用的vnode数目等信息。在添加或删除一个节点后,可以使用该命令查看。
|
它将列出集群中所有的dnode,每个dnode的fqdn:port, 状态(ready, offline等),vnode数目,还未使用的vnode数目等信息。在添加或删除一个节点后,可以使用该命令查看。
|
||||||
|
|
||||||
###查看虚拟节点组
|
### 查看虚拟节点组
|
||||||
|
|
||||||
为充分利用多核技术,并提供scalability,数据需要分片处理。因此TDengine会将一个DB的数据切分成多份,存放在多个vnode里。这些vnode可能分布在多个dnode里,这样就实现了水平扩展。一个vnode仅仅属于一个DB,但一个DB可以有多个vnode。vnode的是mnode根据当前系统资源的情况,自动进行分配的,无需任何人工干预。
|
为充分利用多核技术,并提供scalability,数据需要分片处理。因此TDengine会将一个DB的数据切分成多份,存放在多个vnode里。这些vnode可能分布在多个dnode里,这样就实现了水平扩展。一个vnode仅仅属于一个DB,但一个DB可以有多个vnode。vnode的是mnode根据当前系统资源的情况,自动进行分配的,无需任何人工干预。
|
||||||
|
|
||||||
|
@ -97,7 +120,7 @@ SHOW DNODES;
|
||||||
```
|
```
|
||||||
SHOW VGROUPS;
|
SHOW VGROUPS;
|
||||||
```
|
```
|
||||||
##vnode的高可用性
|
## vnode的高可用性
|
||||||
TDengine通过多副本的机制来提供系统的高可用性,包括vnode和mnode的高可用性。
|
TDengine通过多副本的机制来提供系统的高可用性,包括vnode和mnode的高可用性。
|
||||||
|
|
||||||
vnode的副本数是与DB关联的,一个集群里可以有多个DB,根据运营的需求,每个DB可以配置不同的副本数。创建数据库时,通过参数replica 指定副本数(缺省为1)。如果副本数为1,系统的可靠性无法保证,只要数据所在的节点宕机,就将无法提供服务。集群的节点数必须大于等于副本数,否则创建表时将返回错误“more dnodes are needed"。比如下面的命令将创建副本数为3的数据库demo:
|
vnode的副本数是与DB关联的,一个集群里可以有多个DB,根据运营的需求,每个DB可以配置不同的副本数。创建数据库时,通过参数replica 指定副本数(缺省为1)。如果副本数为1,系统的可靠性无法保证,只要数据所在的节点宕机,就将无法提供服务。集群的节点数必须大于等于副本数,否则创建表时将返回错误“more dnodes are needed"。比如下面的命令将创建副本数为3的数据库demo:
|
||||||
|
@ -111,7 +134,7 @@ CREATE DATABASE demo replica 3;
|
||||||
|
|
||||||
因为vnode的引入,无法简单的给出结论:“集群中过半dnode工作,集群就应该工作”。但是对于简单的情形,很好下结论。比如副本数为3,只有三个dnode,那如果仅有一个节点不工作,整个集群还是可以正常工作的,但如果有两个节点不工作,那整个集群就无法正常工作了。
|
因为vnode的引入,无法简单的给出结论:“集群中过半dnode工作,集群就应该工作”。但是对于简单的情形,很好下结论。比如副本数为3,只有三个dnode,那如果仅有一个节点不工作,整个集群还是可以正常工作的,但如果有两个节点不工作,那整个集群就无法正常工作了。
|
||||||
|
|
||||||
##Mnode的高可用性
|
## Mnode的高可用性
|
||||||
TDengine集群是由mnode (taosd的一个模块,逻辑节点) 负责管理的,为保证mnode的高可用,可以配置多个mnode副本,副本数由系统配置参数numOfMnodes决定,有效范围为1-3。为保证元数据的强一致性,mnode副本之间是通过同步的方式进行数据复制的。
|
TDengine集群是由mnode (taosd的一个模块,逻辑节点) 负责管理的,为保证mnode的高可用,可以配置多个mnode副本,副本数由系统配置参数numOfMnodes决定,有效范围为1-3。为保证元数据的强一致性,mnode副本之间是通过同步的方式进行数据复制的。
|
||||||
|
|
||||||
一个集群有多个dnode, 但一个dnode至多运行一个mnode实例。多个dnode情况下,哪个dnode可以作为mnode呢?这是完全由系统根据整个系统资源情况,自动指定的。用户可通过CLI程序taos,在TDengine的console里,执行如下命令:
|
一个集群有多个dnode, 但一个dnode至多运行一个mnode实例。多个dnode情况下,哪个dnode可以作为mnode呢?这是完全由系统根据整个系统资源情况,自动指定的。用户可通过CLI程序taos,在TDengine的console里,执行如下命令:
|
||||||
|
@ -125,7 +148,7 @@ SHOW MNODES;
|
||||||
|
|
||||||
**注意:**一个TDengine高可用系统,无论是vnode还是mnode, 都必须配置多个副本。
|
**注意:**一个TDengine高可用系统,无论是vnode还是mnode, 都必须配置多个副本。
|
||||||
|
|
||||||
##负载均衡
|
## 负载均衡
|
||||||
|
|
||||||
有三种情况,将触发负载均衡,而且都无需人工干预。
|
有三种情况,将触发负载均衡,而且都无需人工干预。
|
||||||
|
|
||||||
|
@ -142,8 +165,9 @@ SHOW MNODES;
|
||||||
|
|
||||||
**注意:**如果一个虚拟节点组(包括mnode组)里每个节点都处于离线或unsynced状态,必须等该虚拟节点组里的所有节点都上线、都能交换状态信息后,才能选出Master,该虚拟节点组才能对外提供服务。比如整个集群有3个节点,副本数为3,如果3个节点都宕机,然后2个节点重启,是无法工作的,只有等3个节点都重启成功,才能对外服务。
|
**注意:**如果一个虚拟节点组(包括mnode组)里每个节点都处于离线或unsynced状态,必须等该虚拟节点组里的所有节点都上线、都能交换状态信息后,才能选出Master,该虚拟节点组才能对外提供服务。比如整个集群有3个节点,副本数为3,如果3个节点都宕机,然后2个节点重启,是无法工作的,只有等3个节点都重启成功,才能对外服务。
|
||||||
|
|
||||||
##Arbitrator的使用
|
## 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服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6030。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的arbitrator。
|
TDengine安装包里带有一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6030。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的arbitrator。
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ set -e
|
||||||
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
|
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
|
||||||
# -V [stable | beta]
|
# -V [stable | beta]
|
||||||
# -l [full | lite]
|
# -l [full | lite]
|
||||||
|
# -s [static | dynamic]
|
||||||
# -n [2.0.0.3]
|
# -n [2.0.0.3]
|
||||||
|
|
||||||
# set parameters by default value
|
# set parameters by default value
|
||||||
|
@ -18,9 +19,10 @@ verType=stable # [stable, beta]
|
||||||
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
|
||||||
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
|
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
|
||||||
pagMode=full # [full | lite]
|
pagMode=full # [full | lite]
|
||||||
|
soMode=dynamic # [static | dynamic]
|
||||||
verNumber=""
|
verNumber=""
|
||||||
|
|
||||||
while getopts "hv:V:c:o:l:n:" arg
|
while getopts "hv:V:c:o:l:s:n:" arg
|
||||||
do
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
v)
|
v)
|
||||||
|
@ -39,6 +41,10 @@ do
|
||||||
#echo "pagMode=$OPTARG"
|
#echo "pagMode=$OPTARG"
|
||||||
pagMode=$(echo $OPTARG)
|
pagMode=$(echo $OPTARG)
|
||||||
;;
|
;;
|
||||||
|
s)
|
||||||
|
#echo "soMode=$OPTARG"
|
||||||
|
soMode=$(echo $OPTARG)
|
||||||
|
;;
|
||||||
n)
|
n)
|
||||||
#echo "verNumber=$OPTARG"
|
#echo "verNumber=$OPTARG"
|
||||||
verNumber=$(echo $OPTARG)
|
verNumber=$(echo $OPTARG)
|
||||||
|
@ -53,6 +59,7 @@ do
|
||||||
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...] "
|
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...] "
|
||||||
echo " -V [stable | beta] "
|
echo " -V [stable | beta] "
|
||||||
echo " -l [full | lite] "
|
echo " -l [full | lite] "
|
||||||
|
echo " -s [static | dynamic] "
|
||||||
echo " -n [version number] "
|
echo " -n [version number] "
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
@ -63,7 +70,7 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} verNumber=${verNumber}"
|
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} verNumber=${verNumber}"
|
||||||
|
|
||||||
curr_dir=$(pwd)
|
curr_dir=$(pwd)
|
||||||
|
|
||||||
|
@ -223,9 +230,9 @@ cd ${compile_dir}
|
||||||
# check support cpu type
|
# check support cpu type
|
||||||
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
|
if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]] ; then
|
||||||
if [ "$verMode" != "cluster" ]; then
|
if [ "$verMode" != "cluster" ]; then
|
||||||
cmake ../ -DCPUTYPE=${cpuType} -DPAGMODE=${pagMode}
|
cmake ../ -DCPUTYPE=${cpuType} -DPAGMODE=${pagMode} -DSOMODE=${soMode}
|
||||||
else
|
else
|
||||||
cmake ../../ -DCPUTYPE=${cpuType}
|
cmake ../../ -DCPUTYPE=${cpuType} -DSOMODE=${soMode}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "input cpuType=${cpuType} error!!!"
|
echo "input cpuType=${cpuType} error!!!"
|
||||||
|
|
|
@ -45,7 +45,7 @@ if [ "$osType" != "Darwin" ]; then
|
||||||
strip ${build_dir}/bin/taos
|
strip ${build_dir}/bin/taos
|
||||||
bin_files="${build_dir}/bin/taos ${script_dir}/remove_client.sh"
|
bin_files="${build_dir}/bin/taos ${script_dir}/remove_client.sh"
|
||||||
else
|
else
|
||||||
bin_files="${build_dir}/bin/taos ${build_dir}/bin/taosdump ${script_dir}/remove_client.sh ${script_dir}/set_core.sh"
|
bin_files="${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${script_dir}/remove_client.sh ${script_dir}/set_core.sh"
|
||||||
fi
|
fi
|
||||||
lib_files="${build_dir}/lib/libtaos.so.${version}"
|
lib_files="${build_dir}/lib/libtaos.so.${version}"
|
||||||
else
|
else
|
||||||
|
|
|
@ -885,7 +885,7 @@ static void genFinalResWithoutFill(SSqlRes* pRes, SLocalReducer *pLocalReducer,
|
||||||
savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pLocalReducer->pFillInfo);
|
savePrevRecordAndSetupFillInfo(pLocalReducer, pQueryInfo, pLocalReducer->pFillInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pRes->data, pBeforeFillData->data, pRes->numOfRows * pLocalReducer->finalRowSize);
|
memcpy(pRes->data, pBeforeFillData->data, (size_t)(pRes->numOfRows * pLocalReducer->finalRowSize));
|
||||||
|
|
||||||
pRes->numOfClauseTotal += pRes->numOfRows;
|
pRes->numOfClauseTotal += pRes->numOfRows;
|
||||||
pBeforeFillData->num = 0;
|
pBeforeFillData->num = 0;
|
||||||
|
@ -922,7 +922,7 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
|
||||||
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) {
|
||||||
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i);
|
||||||
memmove(pResPages[i]->data, pResPages[i]->data + pField->bytes * pQueryInfo->limit.offset,
|
memmove(pResPages[i]->data, pResPages[i]->data + pField->bytes * pQueryInfo->limit.offset,
|
||||||
newRows * pField->bytes);
|
(size_t)(newRows * pField->bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1223,7 +1223,7 @@ bool genFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool noMoreCur
|
||||||
printf("final result before interpo:\n");
|
printf("final result before interpo:\n");
|
||||||
// tColModelDisplay(pLocalReducer->resColModel, pLocalReducer->pBufForInterpo, pResBuf->num, pResBuf->num);
|
// tColModelDisplay(pLocalReducer->resColModel, pLocalReducer->pBufForInterpo, pResBuf->num, pResBuf->num);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// no interval query, no fill operation
|
// no interval query, no fill operation
|
||||||
if (pQueryInfo->intervalTime == 0 || pQueryInfo->fillType == TSDB_FILL_NONE) {
|
if (pQueryInfo->intervalTime == 0 || pQueryInfo->fillType == TSDB_FILL_NONE) {
|
||||||
genFinalResWithoutFill(pRes, pLocalReducer, pQueryInfo);
|
genFinalResWithoutFill(pRes, pLocalReducer, pQueryInfo);
|
||||||
|
|
|
@ -43,6 +43,14 @@ void tscUpdateSubscriptionProgress(void* sub, int64_t uid, TSKEY ts);
|
||||||
void tscSaveSubscriptionProgress(void* sub);
|
void tscSaveSubscriptionProgress(void* sub);
|
||||||
|
|
||||||
static int32_t minMsgSize() { return tsRpcHeadSize + 100; }
|
static int32_t minMsgSize() { return tsRpcHeadSize + 100; }
|
||||||
|
static int32_t getWaitingTimeInterval(int32_t count) {
|
||||||
|
int32_t initial = 100; // 100 ms by default
|
||||||
|
if (count <= 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return initial * (2<<(count - 2));
|
||||||
|
}
|
||||||
|
|
||||||
static void tscSetDnodeEpSet(SSqlObj* pSql, SCMVgroupInfo* pVgroupInfo) {
|
static void tscSetDnodeEpSet(SSqlObj* pSql, SCMVgroupInfo* pVgroupInfo) {
|
||||||
assert(pSql != NULL && pVgroupInfo != NULL && pVgroupInfo->numOfEps > 0);
|
assert(pSql != NULL && pVgroupInfo != NULL && pVgroupInfo->numOfEps > 0);
|
||||||
|
@ -275,6 +283,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
(rpcMsg->code == TSDB_CODE_TDB_INVALID_TABLE_ID ||
|
(rpcMsg->code == TSDB_CODE_TDB_INVALID_TABLE_ID ||
|
||||||
rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID ||
|
rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID ||
|
||||||
rpcMsg->code == TSDB_CODE_RPC_NETWORK_UNAVAIL ||
|
rpcMsg->code == TSDB_CODE_RPC_NETWORK_UNAVAIL ||
|
||||||
|
rpcMsg->code == TSDB_CODE_APP_NOT_READY ||
|
||||||
rpcMsg->code == TSDB_CODE_TDB_TABLE_RECONFIGURE)) {
|
rpcMsg->code == TSDB_CODE_TDB_TABLE_RECONFIGURE)) {
|
||||||
tscWarn("%p it shall renew table meta, code:%s, retry:%d", pSql, tstrerror(rpcMsg->code), ++pSql->retry);
|
tscWarn("%p it shall renew table meta, code:%s, retry:%d", pSql, tstrerror(rpcMsg->code), ++pSql->retry);
|
||||||
|
|
||||||
|
@ -287,6 +296,12 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
if (pSql->retry > pSql->maxRetry) {
|
if (pSql->retry > pSql->maxRetry) {
|
||||||
tscError("%p max retry %d reached, give up", pSql, pSql->maxRetry);
|
tscError("%p max retry %d reached, give up", pSql, pSql->maxRetry);
|
||||||
} else {
|
} else {
|
||||||
|
// wait for a little bit moment and then retry
|
||||||
|
if (rpcMsg->code == TSDB_CODE_APP_NOT_READY || rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
|
||||||
|
int32_t duration = getWaitingTimeInterval(pSql->retry);
|
||||||
|
taosMsleep(duration);
|
||||||
|
}
|
||||||
|
|
||||||
rpcMsg->code = tscRenewTableMeta(pSql, pTableMetaInfo->name);
|
rpcMsg->code = tscRenewTableMeta(pSql, pTableMetaInfo->name);
|
||||||
|
|
||||||
// if there is an error occurring, proceed to the following error handling procedure.
|
// if there is an error occurring, proceed to the following error handling procedure.
|
||||||
|
@ -708,7 +723,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
if (pColFilter->filterstr) {
|
if (pColFilter->filterstr) {
|
||||||
pFilterMsg->len = htobe64(pColFilter->len);
|
pFilterMsg->len = htobe64(pColFilter->len);
|
||||||
memcpy(pMsg, (void *)pColFilter->pz, pColFilter->len + 1);
|
memcpy(pMsg, (void *)pColFilter->pz, (size_t)(pColFilter->len + 1));
|
||||||
pMsg += (pColFilter->len + 1); // append the additional filter binary info
|
pMsg += (pColFilter->len + 1); // append the additional filter binary info
|
||||||
} else {
|
} else {
|
||||||
pFilterMsg->lowerBndi = htobe64(pColFilter->lowerBndi);
|
pFilterMsg->lowerBndi = htobe64(pColFilter->lowerBndi);
|
||||||
|
|
|
@ -624,7 +624,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
||||||
|
|
||||||
// keep the results in memory
|
// keep the results in memory
|
||||||
if (numOfRows > 0) {
|
if (numOfRows > 0) {
|
||||||
size_t validLen = pSupporter->tagSize * pRes->numOfRows;
|
size_t validLen = (size_t)(pSupporter->tagSize * pRes->numOfRows);
|
||||||
size_t length = pSupporter->totalLen + validLen;
|
size_t length = pSupporter->totalLen + validLen;
|
||||||
|
|
||||||
// todo handle memory error
|
// todo handle memory error
|
||||||
|
@ -750,7 +750,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numOfRows > 0) { // write the compressed timestamp to disk file
|
if (numOfRows > 0) { // write the compressed timestamp to disk file
|
||||||
fwrite(pRes->data, pRes->numOfRows, 1, pSupporter->f);
|
fwrite(pRes->data, (size_t)pRes->numOfRows, 1, pSupporter->f);
|
||||||
fclose(pSupporter->f);
|
fclose(pSupporter->f);
|
||||||
pSupporter->f = NULL;
|
pSupporter->f = NULL;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SRC)
|
||||||
|
|
||||||
IF (TD_LINUX)
|
IF (TD_LINUX)
|
||||||
ADD_LIBRARY(tcq ${SRC})
|
ADD_LIBRARY(tcq ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(tcq tutil common taos)
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(tcq tutil common taos_static)
|
||||||
|
ELSE ()
|
||||||
|
TARGET_LINK_LIBRARIES(tcq tutil common taos)
|
||||||
|
ENDIF ()
|
||||||
ADD_SUBDIRECTORY(test)
|
ADD_SUBDIRECTORY(test)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -11,7 +11,11 @@ AUX_SOURCE_DIRECTORY(src SRC)
|
||||||
|
|
||||||
IF (TD_LINUX)
|
IF (TD_LINUX)
|
||||||
ADD_EXECUTABLE(taosd ${SRC})
|
ADD_EXECUTABLE(taosd ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(taosd mnode taos monitor http mqtt tsdb twal vnode cJson lz4 balance sync)
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(taosd mnode taos_static monitor http mqtt tsdb twal vnode cJson lz4 balance sync)
|
||||||
|
ELSE ()
|
||||||
|
TARGET_LINK_LIBRARIES(taosd mnode taos monitor http mqtt tsdb twal vnode cJson lz4 balance sync)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_ACCOUNT)
|
IF (TD_ACCOUNT)
|
||||||
TARGET_LINK_LIBRARIES(taosd account)
|
TARGET_LINK_LIBRARIES(taosd account)
|
||||||
|
@ -35,4 +39,4 @@ IF (TD_LINUX)
|
||||||
COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
COMMAND ${CMAKE_COMMAND} -E echo charset UTF-8 >> ${TD_TESTS_OUTPUT_DIR}/cfg/taos.cfg
|
||||||
COMMENT "prepare taosd environment")
|
COMMENT "prepare taosd environment")
|
||||||
ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD})
|
ADD_CUSTOM_TARGET(${PREPARE_ENV_TARGET} ALL WORKING_DIRECTORY ${TD_EXECUTABLE_OUTPUT_PATH} DEPENDS ${PREPARE_ENV_CMD})
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -165,6 +165,13 @@ int32_t dnodeInitMgmtTimer() {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dnodeSendStatusMsgToMnode() {
|
||||||
|
if (tsDnodeTmr != NULL && tsStatusTimer != NULL) {
|
||||||
|
dInfo("force send status msg to mnode");
|
||||||
|
taosTmrReset(dnodeSendStatusMsg, 3, NULL, tsDnodeTmr, &tsStatusTimer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void dnodeCleanupMgmtTimer() {
|
void dnodeCleanupMgmtTimer() {
|
||||||
if (tsStatusTimer != NULL) {
|
if (tsStatusTimer != NULL) {
|
||||||
taosTmrStopA(&tsStatusTimer);
|
taosTmrStopA(&tsStatusTimer);
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
|
||||||
if (pMsg->pCont == NULL) return;
|
if (pMsg->pCont == NULL) return;
|
||||||
|
|
||||||
if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) {
|
if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) {
|
||||||
rspMsg.code = TSDB_CODE_RPC_NOT_READY;
|
rspMsg.code = TSDB_CODE_APP_NOT_READY;
|
||||||
rpcSendResponse(&rspMsg);
|
rpcSendResponse(&rspMsg);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
dDebug("RPC %p, msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
dDebug("RPC %p, msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||||
|
|
|
@ -119,7 +119,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
|
||||||
|
|
||||||
if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) {
|
if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) {
|
||||||
dError("RPC %p, shell msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
dError("RPC %p, shell msg:%s is ignored since dnode not running", pMsg->handle, taosMsg[pMsg->msgType]);
|
||||||
rpcMsg.code = TSDB_CODE_RPC_NOT_READY;
|
rpcMsg.code = TSDB_CODE_APP_NOT_READY;
|
||||||
rpcSendResponse(&rpcMsg);
|
rpcSendResponse(&rpcMsg);
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
return;
|
return;
|
||||||
|
@ -144,7 +144,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
|
||||||
|
|
||||||
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
|
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
|
||||||
int code = mnodeRetriveAuth(user, spi, encrypt, secret, ckey);
|
int code = mnodeRetriveAuth(user, spi, encrypt, secret, ckey);
|
||||||
if (code != TSDB_CODE_RPC_NOT_READY) return code;
|
if (code != TSDB_CODE_APP_NOT_READY) return code;
|
||||||
|
|
||||||
SDMAuthMsg *pMsg = rpcMallocCont(sizeof(SDMAuthMsg));
|
SDMAuthMsg *pMsg = rpcMallocCont(sizeof(SDMAuthMsg));
|
||||||
tstrncpy(pMsg->user, user, sizeof(pMsg->user));
|
tstrncpy(pMsg->user, user, sizeof(pMsg->user));
|
||||||
|
|
|
@ -65,6 +65,8 @@ void dnodeSendRpcMnodeWriteRsp(void *pMsg, int32_t code);
|
||||||
void dnodeReprocessMnodeWriteMsg(void *pMsg);
|
void dnodeReprocessMnodeWriteMsg(void *pMsg);
|
||||||
void dnodeDelayReprocessMnodeWriteMsg(void *pMsg);
|
void dnodeDelayReprocessMnodeWriteMsg(void *pMsg);
|
||||||
|
|
||||||
|
void dnodeSendStatusMsgToMnode();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,6 +65,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_SESSION_ID, 0, 0x0010, "Invalid se
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_MSG_TYPE, 0, 0x0011, "Invalid message type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_MSG_TYPE, 0, 0x0011, "Invalid message type")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_RESPONSE_TYPE, 0, 0x0012, "Invalid response type")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_RESPONSE_TYPE, 0, 0x0012, "Invalid response type")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TIME_STAMP, 0, 0x0013, "Invalid timestamp")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TIME_STAMP, 0, 0x0013, "Invalid timestamp")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_APP_NOT_READY, 0, 0x0014, "Database not ready")
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_COM_OPS_NOT_SUPPORT, 0, 0x0100, "Operation not supported")
|
TAOS_DEFINE_ERROR(TSDB_CODE_COM_OPS_NOT_SUPPORT, 0, 0x0100, "Operation not supported")
|
||||||
|
@ -184,7 +185,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "No write p
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "Missing data file")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "Missing data file")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "Out of memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "Out of memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "Unexpected generic error in vnode")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "Unexpected generic error in vnode")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_STATUS, 0, 0x0510, "Database not ready")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_SYNCED, 0, 0x0511, "Database suspended")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_SYNCED, 0, 0x0511, "Database suspended")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, 0, 0x0512, "Write operation denied")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, 0, 0x0512, "Write operation denied")
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ IF (TD_LINUX)
|
||||||
LIST(REMOVE_ITEM SRC ./src/shellDarwin.c)
|
LIST(REMOVE_ITEM SRC ./src/shellDarwin.c)
|
||||||
ADD_EXECUTABLE(shell ${SRC})
|
ADD_EXECUTABLE(shell ${SRC})
|
||||||
|
|
||||||
# IF (TD_PAGMODE_LITE)
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(shell taos_static)
|
||||||
|
ELSE ()
|
||||||
TARGET_LINK_LIBRARIES(shell taos)
|
TARGET_LINK_LIBRARIES(shell taos)
|
||||||
# ELSE ()
|
ENDIF ()
|
||||||
# TARGET_LINK_LIBRARIES(shell taos_static)
|
|
||||||
# ENDIF ()
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos)
|
SET_TARGET_PROPERTIES(shell PROPERTIES OUTPUT_NAME taos)
|
||||||
ELSEIF (TD_WINDOWS)
|
ELSEIF (TD_WINDOWS)
|
||||||
|
|
|
@ -8,11 +8,11 @@ IF (TD_LINUX)
|
||||||
AUX_SOURCE_DIRECTORY(. SRC)
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
ADD_EXECUTABLE(taosdemo ${SRC})
|
ADD_EXECUTABLE(taosdemo ${SRC})
|
||||||
|
|
||||||
# IF (TD_PAGMODE_LITE)
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(taosdemo taos_static)
|
||||||
|
ELSE ()
|
||||||
TARGET_LINK_LIBRARIES(taosdemo taos)
|
TARGET_LINK_LIBRARIES(taosdemo taos)
|
||||||
# ELSE ()
|
ENDIF ()
|
||||||
# TARGET_LINK_LIBRARIES(taosdemo taos_static)
|
|
||||||
# ENDIF ()
|
|
||||||
ELSEIF (TD_WINDOWS)
|
ELSEIF (TD_WINDOWS)
|
||||||
AUX_SOURCE_DIRECTORY(. SRC)
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
ADD_EXECUTABLE(taosdemo ${SRC})
|
ADD_EXECUTABLE(taosdemo ${SRC})
|
||||||
|
|
|
@ -581,8 +581,8 @@ void mnodeDropAllUsers(SAcctObj *pAcct) {
|
||||||
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
|
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
|
||||||
if (!sdbIsMaster()) {
|
if (!sdbIsMaster()) {
|
||||||
*secret = 0;
|
*secret = 0;
|
||||||
mDebug("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_RPC_NOT_READY));
|
mDebug("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_APP_NOT_READY));
|
||||||
return TSDB_CODE_RPC_NOT_READY;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pUser = mnodeGetUser(user);
|
SUserObj *pUser = mnodeGetUser(user);
|
||||||
|
|
|
@ -230,8 +230,12 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
|
#define atomic_exchange_16(ptr, val) _InterlockedExchange16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
|
#define atomic_exchange_32(ptr, val) _InterlockedExchange((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_exchange_64(ptr, val) _InterlockedExchange64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
#ifdef _WIN64
|
||||||
|
#define atomic_exchange_ptr(ptr, val) _InterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
||||||
|
#else
|
||||||
|
#define atomic_exchange_ptr(ptr, val) _InlineInterlockedExchangePointer((void* volatile*)(ptr), (void*)(val))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
|
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
|
||||||
#else
|
#else
|
||||||
|
@ -247,162 +251,104 @@ void wordfree(wordexp_t *pwordexp);
|
||||||
long interlocked_add_fetch_32(long volatile *ptr, long val);
|
long interlocked_add_fetch_32(long volatile *ptr, long val);
|
||||||
__int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
__int64 interlocked_add_fetch_64(__int64 volatile *ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_and_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_and_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_and_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_or_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_or_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_or_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
char interlocked_xor_fetch_8(char volatile* ptr, char val);
|
||||||
|
short interlocked_xor_fetch_16(short volatile* ptr, short val);
|
||||||
|
long interlocked_xor_fetch_32(long volatile* ptr, long val);
|
||||||
|
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
|
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val);
|
||||||
|
|
||||||
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
|
#define atomic_add_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
|
#define atomic_add_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_add_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_add_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_add_fetch_ptr atomic_add_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_add_fetch_ptr atomic_add_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
#define atomic_fetch_add_8 __sync_fetch_and_ad
|
#define atomic_fetch_add_8 __sync_fetch_and_ad
|
||||||
#define atomic_fetch_add_16 __sync_fetch_and_add
|
#define atomic_fetch_add_16 __sync_fetch_and_add
|
||||||
#else
|
#else
|
||||||
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
||||||
#endif
|
#endif
|
||||||
|
#define atomic_fetch_add_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), (char)(val))
|
||||||
|
#define atomic_fetch_add_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_add_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_fetch_add_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_add_ptr atomic_fetch_add_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_add_ptr atomic_fetch_add_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
|
#define atomic_sub_fetch_8(ptr, val) interlocked_add_fetch_8((char volatile*)(ptr), -(char)(val))
|
||||||
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
|
#define atomic_sub_fetch_16(ptr, val) interlocked_add_fetch_16((short volatile*)(ptr), -(short)(val))
|
||||||
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
|
#define atomic_sub_fetch_32(ptr, val) interlocked_add_fetch_32((long volatile*)(ptr), -(long)(val))
|
||||||
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
|
#define atomic_sub_fetch_64(ptr, val) interlocked_add_fetch_64((__int64 volatile*)(ptr), -(__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
|
#define atomic_fetch_sub_8(ptr, val) _InterlockedExchangeAdd8((char volatile*)(ptr), -(char)(val))
|
||||||
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
|
#define atomic_fetch_sub_16(ptr, val) _InterlockedExchangeAdd16((short volatile*)(ptr), -(short)(val))
|
||||||
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
|
#define atomic_fetch_sub_32(ptr, val) _InterlockedExchangeAdd((long volatile*)(ptr), -(long)(val))
|
||||||
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
|
#define atomic_fetch_sub_64(ptr, val) _InterlockedExchangeAdd64((__int64 volatile*)(ptr), -(__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
char interlocked_and_fetch_8(char volatile* ptr, char val);
|
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
short interlocked_and_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_and_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_and_fetch_8(ptr, val) interlocked_and_fetch_8((char volatile*)(ptr), (char)(val))
|
|
||||||
#define atomic_and_fetch_16(ptr, val) interlocked_and_fetch_16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_and_fetch_32(ptr, val) interlocked_and_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_and_fetch_64(ptr, val) interlocked_and_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_and_fetch_ptr atomic_and_fetch_64
|
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
|
||||||
#else
|
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_and_fetch_ptr atomic_and_fetch_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_fetch_and_8(ptr, val) _InterlockedAnd8((char volatile*)(ptr), (char)(val))
|
|
||||||
#define atomic_fetch_and_16(ptr, val) _InterlockedAnd16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_and_32(ptr, val) _InterlockedAnd((long volatile*)(ptr), (long)(val))
|
||||||
|
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val);
|
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_fetch_and_64(ptr, val) interlocked_fetch_and_64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_and_64(ptr, val) _InterlockedAnd64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_and_ptr atomic_fetch_and_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_and_ptr atomic_fetch_and_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_or_fetch_8(char volatile* ptr, char val);
|
|
||||||
short interlocked_or_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_or_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_or_fetch_8(ptr, val) interlocked_or_fetch_8((char volatile*)(ptr), (char)(val))
|
|
||||||
#define atomic_or_fetch_16(ptr, val) interlocked_or_fetch_16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_or_fetch_32(ptr, val) interlocked_or_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_or_fetch_64(ptr, val) interlocked_or_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_or_fetch_ptr atomic_or_fetch_64
|
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
|
||||||
#else
|
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_or_fetch_ptr atomic_or_fetch_32
|
|
||||||
#endif
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_fetch_or_8(ptr, val) _InterlockedOr8((char volatile*)(ptr), (char)(val))
|
|
||||||
#define atomic_fetch_or_16(ptr, val) _InterlockedOr16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_or_32(ptr, val) _InterlockedOr((long volatile*)(ptr), (long)(val))
|
||||||
|
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
|
||||||
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val);
|
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_fetch_or_64(ptr, val) interlocked_fetch_or_64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_or_64(ptr, val) _InterlockedOr64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_fetch_or_ptr atomic_fetch_or_64
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_or_ptr atomic_fetch_or_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_xor_fetch_8(char volatile* ptr, char val);
|
|
||||||
short interlocked_xor_fetch_16(short volatile* ptr, short val);
|
|
||||||
#endif
|
|
||||||
long interlocked_xor_fetch_32(long volatile* ptr, long val);
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
#define atomic_xor_fetch_8(ptr, val) interlocked_xor_fetch_8((char volatile*)(ptr), (char)(val))
|
|
||||||
#define atomic_xor_fetch_16(ptr, val) interlocked_xor_fetch_16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
|
#define atomic_xor_fetch_32(ptr, val) interlocked_xor_fetch_32((long volatile*)(ptr), (long)(val))
|
||||||
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
#define atomic_xor_fetch_64(ptr, val) interlocked_xor_fetch_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _WIN64
|
|
||||||
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
|
|
||||||
#else
|
|
||||||
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _TD_GO_DLL_
|
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
|
||||||
#define atomic_fetch_xor_8(ptr, val) _InterlockedXor8((char volatile*)(ptr), (char)(val))
|
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
|
||||||
#define atomic_fetch_xor_16(ptr, val) _InterlockedXor16((short volatile*)(ptr), (short)(val))
|
|
||||||
#endif
|
|
||||||
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
|
#define atomic_fetch_xor_32(ptr, val) _InterlockedXor((long volatile*)(ptr), (long)(val))
|
||||||
|
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
|
||||||
#ifdef _M_IX86
|
|
||||||
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val);
|
|
||||||
#define atomic_fetch_xor_64(ptr, val) interlocked_fetch_xor_64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#else
|
|
||||||
#define atomic_fetch_xor_64(ptr, val) _InterlockedXor64((__int64 volatile*)(ptr), (__int64)(val))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
|
#define atomic_add_fetch_ptr atomic_add_fetch_64
|
||||||
|
#define atomic_fetch_add_ptr atomic_fetch_add_64
|
||||||
|
#define atomic_sub_fetch_ptr atomic_sub_fetch_64
|
||||||
|
#define atomic_fetch_sub_ptr atomic_fetch_sub_64
|
||||||
|
#define atomic_and_fetch_ptr atomic_and_fetch_64
|
||||||
|
#define atomic_fetch_and_ptr atomic_fetch_and_64
|
||||||
|
#define atomic_or_fetch_ptr atomic_or_fetch_64
|
||||||
|
#define atomic_fetch_or_ptr atomic_fetch_or_64
|
||||||
|
#define atomic_xor_fetch_ptr atomic_xor_fetch_64
|
||||||
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
|
#define atomic_fetch_xor_ptr atomic_fetch_xor_64
|
||||||
#else
|
#else
|
||||||
|
#define atomic_add_fetch_ptr atomic_add_fetch_32
|
||||||
|
#define atomic_fetch_add_ptr atomic_fetch_add_32
|
||||||
|
#define atomic_sub_fetch_ptr atomic_sub_fetch_32
|
||||||
|
#define atomic_fetch_sub_ptr atomic_fetch_sub_32
|
||||||
|
#define atomic_and_fetch_ptr atomic_and_fetch_32
|
||||||
|
#define atomic_fetch_and_ptr atomic_fetch_and_32
|
||||||
|
#define atomic_or_fetch_ptr atomic_or_fetch_32
|
||||||
|
#define atomic_fetch_or_ptr atomic_fetch_or_32
|
||||||
|
#define atomic_xor_fetch_ptr atomic_xor_fetch_32
|
||||||
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
|
#define atomic_fetch_xor_ptr atomic_fetch_xor_32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
|
|
||||||
// add
|
// add
|
||||||
char interlocked_add_fetch_8(char volatile* ptr, char val) {
|
char interlocked_add_fetch_8(char volatile* ptr, char val) {
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
return __sync_fetch_and_add(ptr, val) + val;
|
return __sync_fetch_and_add(ptr, val) + val;
|
||||||
#else
|
#else
|
||||||
return _InterlockedExchangeAdd8(ptr, val) + val;
|
return _InterlockedExchangeAdd8(ptr, val) + val;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
short interlocked_add_fetch_16(short volatile* ptr, short val) {
|
short interlocked_add_fetch_16(short volatile* ptr, short val) {
|
||||||
#ifdef _TD_GO_DLL_
|
#ifdef _TD_GO_DLL_
|
||||||
return __sync_fetch_and_add(ptr, val) + val;
|
return __sync_fetch_and_add(ptr, val) + val;
|
||||||
#else
|
#else
|
||||||
return _InterlockedExchangeAdd16(ptr, val) + val;
|
return _InterlockedExchangeAdd16(ptr, val) + val;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
long interlocked_add_fetch_32(long volatile* ptr, long val) {
|
long interlocked_add_fetch_32(long volatile* ptr, long val) {
|
||||||
|
@ -43,15 +43,13 @@ long interlocked_add_fetch_32(long volatile* ptr, long val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
#ifdef _WIN64
|
//#ifdef _WIN64
|
||||||
return _InterlockedExchangeAdd64(ptr, val) + val;
|
return _InterlockedExchangeAdd64(ptr, val) + val;
|
||||||
#else
|
//#else
|
||||||
return _InterlockedExchangeAdd(ptr, val) + val;
|
// return _InterlockedExchangeAdd(ptr, val) + val;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// and
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedAnd8(ptr, val) & val;
|
return _InterlockedAnd8(ptr, val) & val;
|
||||||
}
|
}
|
||||||
|
@ -59,41 +57,37 @@ char interlocked_and_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
short interlocked_and_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedAnd16(ptr, val) & val;
|
return _InterlockedAnd16(ptr, val) & val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
long interlocked_and_fetch_32(long volatile* ptr, long val) {
|
long interlocked_and_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedAnd(ptr, val) & val;
|
return _InterlockedAnd(ptr, val) & val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
#ifndef _M_IX86
|
#ifndef _M_IX86
|
||||||
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedAnd64(ptr, val) & val;
|
return _InterlockedAnd64(ptr, val) & val;
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__int64 interlocked_and_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old & val;
|
res = old & val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old & val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old & val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedAnd64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// or
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedOr8(ptr, val) | val;
|
return _InterlockedOr8(ptr, val) | val;
|
||||||
}
|
}
|
||||||
|
@ -101,40 +95,36 @@ char interlocked_or_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
short interlocked_or_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedOr16(ptr, val) | val;
|
return _InterlockedOr16(ptr, val) | val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
long interlocked_or_fetch_32(long volatile* ptr, long val) {
|
long interlocked_or_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedOr(ptr, val) | val;
|
return _InterlockedOr(ptr, val) | val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _M_IX86
|
|
||||||
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedOr64(ptr, val) & val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_or_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old | val;
|
res = old | val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return _InterlockedOr64(ptr, val) & val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, old | val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedOr64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// xor
|
|
||||||
#ifndef _TD_GO_DLL_
|
|
||||||
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||||
return _InterlockedXor8(ptr, val) ^ val;
|
return _InterlockedXor8(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
|
@ -142,35 +132,33 @@ char interlocked_xor_fetch_8(char volatile* ptr, char val) {
|
||||||
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
|
||||||
return _InterlockedXor16(ptr, val) ^ val;
|
return _InterlockedXor16(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
|
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
|
||||||
return _InterlockedXor(ptr, val) ^ val;
|
return _InterlockedXor(ptr, val) ^ val;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _M_IX86
|
|
||||||
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
|
||||||
return _InterlockedXor64(ptr, val) ^ val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_xor_fetch_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old, res;
|
__int64 old, res;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
res = old ^ val;
|
res = old ^ val;
|
||||||
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
} while(_InterlockedCompareExchange64(ptr, res, old) != old);
|
||||||
return res;
|
return res;
|
||||||
|
#else
|
||||||
|
return _InterlockedXor64(ptr, val) ^ val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val) {
|
__int64 interlocked_fetch_xor_64(__int64 volatile* ptr, __int64 val) {
|
||||||
|
#ifdef _M_IX86
|
||||||
__int64 old;
|
__int64 old;
|
||||||
do {
|
do {
|
||||||
old = *ptr;
|
old = *ptr;
|
||||||
} while(_InterlockedCompareExchange64(ptr, old ^ val, old) != old);
|
} while (_InterlockedCompareExchange64(ptr, old ^ val, old) != old);
|
||||||
return old;
|
return old;
|
||||||
|
#else
|
||||||
|
return _InterlockedXor64((__int64 volatile*)(ptr), (__int64)(val));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -154,13 +154,15 @@ bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage) {
|
||||||
|
|
||||||
bool taosGetProcMemory(float *memoryUsedMB) {
|
bool taosGetProcMemory(float *memoryUsedMB) {
|
||||||
unsigned bytes_used = 0;
|
unsigned bytes_used = 0;
|
||||||
|
#if 0
|
||||||
#if defined(_WIN32) && defined(_MSC_VER)
|
#if defined(_WIN32) && defined(_MSC_VER)
|
||||||
PROCESS_MEMORY_COUNTERS pmc;
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
HANDLE cur_proc = GetCurrentProcess();
|
HANDLE cur_proc = GetCurrentProcess();
|
||||||
|
|
||||||
if (GetProcessMemoryInfo(cur_proc, &pmc, sizeof(pmc))) {
|
if (GetProcessMemoryInfo(cur_proc, &pmc, sizeof(pmc))) {
|
||||||
bytes_used = (unsigned)(pmc.WorkingSetSize + pmc.PagefileUsage);
|
bytes_used = (unsigned)(pmc.WorkingSetSize + pmc.PagefileUsage);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*memoryUsedMB = (float)bytes_used / 1024 / 1024;
|
*memoryUsedMB = (float)bytes_used / 1024 / 1024;
|
||||||
|
|
|
@ -11,7 +11,12 @@ AUX_SOURCE_DIRECTORY(src SRC)
|
||||||
|
|
||||||
IF (TD_LINUX)
|
IF (TD_LINUX)
|
||||||
ADD_LIBRARY(http ${SRC})
|
ADD_LIBRARY(http ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(http taos z)
|
|
||||||
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(http taos_static z)
|
||||||
|
ELSE ()
|
||||||
|
TARGET_LINK_LIBRARIES(http taos z)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_ADMIN)
|
IF (TD_ADMIN)
|
||||||
TARGET_LINK_LIBRARIES(http admin)
|
TARGET_LINK_LIBRARIES(http admin)
|
||||||
|
|
|
@ -8,5 +8,10 @@ IF (TD_LINUX)
|
||||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc)
|
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc)
|
||||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
|
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
|
||||||
ADD_LIBRARY(monitor ${SRC})
|
ADD_LIBRARY(monitor ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(monitor taos)
|
|
||||||
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(monitor taos_static)
|
||||||
|
ELSE ()
|
||||||
|
TARGET_LINK_LIBRARIES(monitor taos)
|
||||||
|
ENDIF ()
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -10,8 +10,12 @@ IF (TD_LINUX)
|
||||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MQTT-C/include)
|
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MQTT-C/include)
|
||||||
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MQTT-C/examples/templates)
|
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MQTT-C/examples/templates)
|
||||||
ADD_LIBRARY(mqtt ${SRC})
|
ADD_LIBRARY(mqtt ${SRC})
|
||||||
TARGET_LINK_LIBRARIES(mqtt taos cJson mqttc)
|
|
||||||
|
|
||||||
|
IF (TD_SOMODE_STATIC)
|
||||||
|
TARGET_LINK_LIBRARIES(mqtt taos_static cJson mqttc)
|
||||||
|
ELSE ()
|
||||||
|
TARGET_LINK_LIBRARIES(mqtt taos cJson mqttc)
|
||||||
|
ENDIF ()
|
||||||
IF (TD_ADMIN)
|
IF (TD_ADMIN)
|
||||||
TARGET_LINK_LIBRARIES(mqtt admin cJson)
|
TARGET_LINK_LIBRARIES(mqtt admin cJson)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -414,7 +414,7 @@ static SWindowResult *doSetTimeWindowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SWin
|
||||||
newCap = (int64_t)(pWindowResInfo->capacity * 1.5);
|
newCap = (int64_t)(pWindowResInfo->capacity * 1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *t = realloc(pWindowResInfo->pResult, newCap * sizeof(SWindowResult));
|
char *t = realloc(pWindowResInfo->pResult, (size_t)(newCap * sizeof(SWindowResult)));
|
||||||
pRuntimeEnv->summary.internalSupSize += (newCap - pWindowResInfo->capacity) * sizeof(SWindowResult);
|
pRuntimeEnv->summary.internalSupSize += (newCap - pWindowResInfo->capacity) * sizeof(SWindowResult);
|
||||||
pRuntimeEnv->summary.numOfTimeWindows += (newCap - pWindowResInfo->capacity);
|
pRuntimeEnv->summary.numOfTimeWindows += (newCap - pWindowResInfo->capacity);
|
||||||
|
|
||||||
|
@ -2265,7 +2265,7 @@ static void ensureOutputBuffer(SQueryRuntimeEnv* pRuntimeEnv, SDataBlockInfo* pB
|
||||||
if (tmp == NULL) { // todo handle the oom
|
if (tmp == NULL) { // todo handle the oom
|
||||||
assert(0);
|
assert(0);
|
||||||
} else {
|
} else {
|
||||||
memset(tmp + sizeof(tFilePage) + bytes * pRec->rows, 0, (newSize - pRec->rows) * bytes);
|
memset(tmp + sizeof(tFilePage) + bytes * pRec->rows, 0, (size_t)((newSize - pRec->rows) * bytes));
|
||||||
pQuery->sdata[i] = (tFilePage *)tmp;
|
pQuery->sdata[i] = (tFilePage *)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3255,8 +3255,8 @@ void skipResults(SQueryRuntimeEnv *pRuntimeEnv) {
|
||||||
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
|
||||||
int32_t functionId = pQuery->pSelectExpr[i].base.functionId;
|
int32_t functionId = pQuery->pSelectExpr[i].base.functionId;
|
||||||
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
int32_t bytes = pRuntimeEnv->pCtx[i].outputBytes;
|
||||||
|
|
||||||
memmove(pQuery->sdata[i]->data, (char*) pQuery->sdata[i]->data + bytes * numOfSkip, pQuery->rec.rows * bytes);
|
memmove(pQuery->sdata[i]->data, (char*)pQuery->sdata[i]->data + bytes * numOfSkip, (size_t)(pQuery->rec.rows * bytes));
|
||||||
pRuntimeEnv->pCtx[i].aOutputBuf = ((char*) pQuery->sdata[i]->data) + pQuery->rec.rows * bytes;
|
pRuntimeEnv->pCtx[i].aOutputBuf = ((char*) pQuery->sdata[i]->data) + pQuery->rec.rows * bytes;
|
||||||
|
|
||||||
if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
|
if (functionId == TSDB_FUNC_DIFF || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
|
||||||
|
@ -5446,8 +5446,8 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
|
||||||
if (pColFilter->filterstr) {
|
if (pColFilter->filterstr) {
|
||||||
pColFilter->len = htobe64(pFilterMsg->len);
|
pColFilter->len = htobe64(pFilterMsg->len);
|
||||||
|
|
||||||
pColFilter->pz = (int64_t) calloc(1, pColFilter->len + 1 * TSDB_NCHAR_SIZE); // note: null-terminator
|
pColFilter->pz = (int64_t)calloc(1, (size_t)(pColFilter->len + 1 * TSDB_NCHAR_SIZE)); // note: null-terminator
|
||||||
memcpy((void *)pColFilter->pz, pMsg, pColFilter->len);
|
memcpy((void *)pColFilter->pz, pMsg, (size_t)pColFilter->len);
|
||||||
pMsg += (pColFilter->len + 1);
|
pMsg += (pColFilter->len + 1);
|
||||||
} else {
|
} else {
|
||||||
pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi);
|
pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi);
|
||||||
|
@ -5963,7 +5963,7 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
|
||||||
assert(pExprs[col].interBytes >= pExprs[col].bytes);
|
assert(pExprs[col].interBytes >= pExprs[col].bytes);
|
||||||
|
|
||||||
// allocate additional memory for interResults that are usually larger then final results
|
// allocate additional memory for interResults that are usually larger then final results
|
||||||
size_t size = (pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interBytes + sizeof(tFilePage);
|
size_t size = (size_t)((pQuery->rec.capacity + 1) * pExprs[col].bytes + pExprs[col].interBytes + sizeof(tFilePage));
|
||||||
pQuery->sdata[col] = (tFilePage *)calloc(1, size);
|
pQuery->sdata[col] = (tFilePage *)calloc(1, size);
|
||||||
if (pQuery->sdata[col] == NULL) {
|
if (pQuery->sdata[col] == NULL) {
|
||||||
goto _cleanup;
|
goto _cleanup;
|
||||||
|
@ -6236,7 +6236,7 @@ static size_t getResultSize(SQInfo *pQInfo, int64_t *numOfRows) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return pQuery->rowSize * (*numOfRows);
|
return (size_t)(pQuery->rowSize * (*numOfRows));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -990,7 +990,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
|
||||||
SSchemaEx* pSchemaEx = &pModel->pFields[i];
|
SSchemaEx* pSchemaEx = &pModel->pFields[i];
|
||||||
memmove(inputBuffer->data + pSchemaEx->offset * inputBuffer->num,
|
memmove(inputBuffer->data + pSchemaEx->offset * inputBuffer->num,
|
||||||
inputBuffer->data + pSchemaEx->offset * maxElemsCapacity,
|
inputBuffer->data + pSchemaEx->offset * maxElemsCapacity,
|
||||||
pSchemaEx->field.bytes * inputBuffer->num);
|
(size_t)(pSchemaEx->field.bytes * inputBuffer->num));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, tFilePage* pInpu
|
||||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||||
|
|
||||||
char* data = pInput->data + pCol->col.offset * pInput->num;
|
char* data = pInput->data + pCol->col.offset * pInput->num;
|
||||||
memcpy(pFillInfo->pData[i], data, pInput->num * pCol->col.bytes);
|
memcpy(pFillInfo->pData[i], data, (size_t)(pInput->num * pCol->col.bytes));
|
||||||
|
|
||||||
if (pCol->flag == TSDB_COL_TAG) { // copy the tag value to tag value buffer
|
if (pCol->flag == TSDB_COL_TAG) { // copy the tag value to tag value buffer
|
||||||
for (int32_t j = 0; j < pFillInfo->numOfTags; ++j) {
|
for (int32_t j = 0; j < pFillInfo->numOfTags; ++j) {
|
||||||
|
|
|
@ -388,7 +388,7 @@ size_t getNumOfRowsPerPage(const SDiskbasedResultBuf* pResultBuf) { return pResu
|
||||||
|
|
||||||
size_t getNumOfResultBufGroupId(const SDiskbasedResultBuf* pResultBuf) { return taosHashGetSize(pResultBuf->groupSet); }
|
size_t getNumOfResultBufGroupId(const SDiskbasedResultBuf* pResultBuf) { return taosHashGetSize(pResultBuf->groupSet); }
|
||||||
|
|
||||||
size_t getResBufSize(const SDiskbasedResultBuf* pResultBuf) { return pResultBuf->totalBufSize; }
|
size_t getResBufSize(const SDiskbasedResultBuf* pResultBuf) { return (size_t)pResultBuf->totalBufSize; }
|
||||||
|
|
||||||
SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId) {
|
SIDList getDataBufPagesIdList(SDiskbasedResultBuf* pResultBuf, int32_t groupId) {
|
||||||
assert(pResultBuf != NULL);
|
assert(pResultBuf != NULL);
|
||||||
|
|
|
@ -1120,7 +1120,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
|
||||||
pContext->epSet.port[i] = htons(pContext->epSet.port[i]);
|
pContext->epSet.port[i] = htons(pContext->epSet.port[i]);
|
||||||
rpcSendReqToServer(pRpc, pContext);
|
rpcSendReqToServer(pRpc, pContext);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY) {
|
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY) {
|
||||||
pContext->code = pHead->code;
|
pContext->code = pHead->code;
|
||||||
rpcProcessConnError(pContext, NULL);
|
rpcProcessConnError(pContext, NULL);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
|
|
|
@ -908,7 +908,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
|
||||||
|
|
||||||
// Add the sub-block
|
// Add the sub-block
|
||||||
if (pSCompBlock->numOfSubBlocks > 1) {
|
if (pSCompBlock->numOfSubBlocks > 1) {
|
||||||
size_t tsize = pIdx->len - (pSCompBlock->offset + pSCompBlock->len);
|
size_t tsize = (size_t)(pIdx->len - (pSCompBlock->offset + pSCompBlock->len));
|
||||||
if (tsize > 0) {
|
if (tsize > 0) {
|
||||||
memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)),
|
memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)),
|
||||||
(void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize);
|
(void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize);
|
||||||
|
@ -988,7 +988,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
|
||||||
|
|
||||||
// Delete the sub blocks it has
|
// Delete the sub blocks it has
|
||||||
if (pSCompBlock->numOfSubBlocks > 1) {
|
if (pSCompBlock->numOfSubBlocks > 1) {
|
||||||
size_t tsize = pIdx->len - (pSCompBlock->offset + pSCompBlock->len);
|
size_t tsize = (size_t)(pIdx->len - (pSCompBlock->offset + pSCompBlock->len));
|
||||||
if (tsize > 0) {
|
if (tsize > 0) {
|
||||||
memmove(POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset),
|
memmove(POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset),
|
||||||
POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize);
|
POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize);
|
||||||
|
|
|
@ -355,9 +355,9 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
|
|
||||||
buf = taosDecodeVariantU64(buf, &size);
|
buf = taosDecodeVariantU64(buf, &size);
|
||||||
*value = (char *)malloc(size + 1);
|
*value = (char *)malloc((size_t)size + 1);
|
||||||
if (*value == NULL) return NULL;
|
if (*value == NULL) return NULL;
|
||||||
memcpy(*value, buf, size);
|
memcpy(*value, buf, (size_t)size);
|
||||||
|
|
||||||
(*value)[size] = '\0';
|
(*value)[size] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -575,7 +575,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = malloc(maxBufSize);
|
buf = malloc((size_t)maxBufSize);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname);
|
uError("failed to allocate %" PRId64 " bytes in KV store %s", maxBufSize, pStore->fname);
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -598,7 +598,7 @@ static int tdRestoreKVStore(SKVStore *pStore) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosTRead(pStore->fd, buf, pRecord->size) < pRecord->size) {
|
if (taosTRead(pStore->fd, buf, (size_t)pRecord->size) < pRecord->size) {
|
||||||
uError("failed to read %" PRId64 " bytes from file %s since %s, offset %" PRId64, pRecord->size, pStore->fname,
|
uError("failed to read %" PRId64 " bytes from file %s since %s, offset %" PRId64, pRecord->size, pStore->fname,
|
||||||
strerror(errno), pRecord->offset);
|
strerror(errno), pRecord->offset);
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "vnode.h"
|
#include "vnode.h"
|
||||||
#include "vnodeInt.h"
|
#include "vnodeInt.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
|
#include "dnode.h"
|
||||||
|
|
||||||
#define TSDB_VNODE_VERSION_CONTENT_LEN 31
|
#define TSDB_VNODE_VERSION_CONTENT_LEN 31
|
||||||
|
|
||||||
|
@ -361,6 +362,7 @@ void vnodeRelease(void *pVnodeRaw) {
|
||||||
sprintf(rootDir, "%s/vnode%d", tsVnodeDir, vgId);
|
sprintf(rootDir, "%s/vnode%d", tsVnodeDir, vgId);
|
||||||
taosMvDir(tsVnodeBakDir, rootDir);
|
taosMvDir(tsVnodeBakDir, rootDir);
|
||||||
taosRemoveDir(rootDir);
|
taosRemoveDir(rootDir);
|
||||||
|
dnodeSendStatusMsgToMnode();
|
||||||
}
|
}
|
||||||
|
|
||||||
tsem_destroy(&pVnode->sem);
|
tsem_destroy(&pVnode->sem);
|
||||||
|
@ -390,7 +392,7 @@ void *vnodeAcquireRqueue(int32_t vgId) {
|
||||||
if (pVnode == NULL) return NULL;
|
if (pVnode == NULL) return NULL;
|
||||||
|
|
||||||
if (pVnode->status == TAOS_VN_STATUS_RESET) {
|
if (pVnode->status == TAOS_VN_STATUS_RESET) {
|
||||||
terrno = TSDB_CODE_VND_INVALID_STATUS;
|
terrno = TSDB_CODE_APP_NOT_READY;
|
||||||
vInfo("vgId:%d, status is in reset", vgId);
|
vInfo("vgId:%d, status is in reset", vgId);
|
||||||
vnodeRelease(pVnode);
|
vnodeRelease(pVnode);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -404,7 +406,7 @@ void *vnodeAcquireWqueue(int32_t vgId) {
|
||||||
if (pVnode == NULL) return NULL;
|
if (pVnode == NULL) return NULL;
|
||||||
|
|
||||||
if (pVnode->status == TAOS_VN_STATUS_RESET) {
|
if (pVnode->status == TAOS_VN_STATUS_RESET) {
|
||||||
terrno = TSDB_CODE_VND_INVALID_STATUS;
|
terrno = TSDB_CODE_APP_NOT_READY;
|
||||||
vInfo("vgId:%d, status is in reset", vgId);
|
vInfo("vgId:%d, status is in reset", vgId);
|
||||||
vnodeRelease(pVnode);
|
vnodeRelease(pVnode);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -547,6 +549,7 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) {
|
||||||
SVnodeObj *pVnode = ahandle;
|
SVnodeObj *pVnode = ahandle;
|
||||||
vInfo("vgId:%d, sync role changed from %d to %d", pVnode->vgId, pVnode->role, role);
|
vInfo("vgId:%d, sync role changed from %d to %d", pVnode->vgId, pVnode->role, role);
|
||||||
pVnode->role = role;
|
pVnode->role = role;
|
||||||
|
dnodeSendStatusMsgToMnode();
|
||||||
|
|
||||||
if (pVnode->role == TAOS_SYNC_ROLE_MASTER)
|
if (pVnode->role == TAOS_SYNC_ROLE_MASTER)
|
||||||
cqStart(pVnode->cq);
|
cqStart(pVnode->cq);
|
||||||
|
|
|
@ -49,18 +49,18 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) {
|
||||||
|
|
||||||
if (pVnode->status != TAOS_VN_STATUS_READY) {
|
if (pVnode->status != TAOS_VN_STATUS_READY) {
|
||||||
vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[msgType], pVnode->status);
|
vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[msgType], pVnode->status);
|
||||||
return TSDB_CODE_VND_INVALID_STATUS;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tsdb may be in reset state
|
// tsdb may be in reset state
|
||||||
if (pVnode->tsdb == NULL) return TSDB_CODE_RPC_NOT_READY;
|
if (pVnode->tsdb == NULL) return TSDB_CODE_APP_NOT_READY;
|
||||||
if (pVnode->status == TAOS_VN_STATUS_CLOSING)
|
if (pVnode->status == TAOS_VN_STATUS_CLOSING)
|
||||||
return TSDB_CODE_RPC_NOT_READY;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
|
|
||||||
// TODO: Later, let slave to support query
|
// TODO: Later, let slave to support query
|
||||||
if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
||||||
vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[msgType], pVnode->syncCfg.replica, pVnode->role);
|
vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[msgType], pVnode->syncCfg.replica, pVnode->role);
|
||||||
return TSDB_CODE_RPC_NOT_READY;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*vnodeProcessReadMsgFp[msgType])(pVnode, pReadMsg);
|
return (*vnodeProcessReadMsgFp[msgType])(pVnode, pReadMsg);
|
||||||
|
|
|
@ -60,19 +60,19 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// tsdb may be in reset state
|
// tsdb may be in reset state
|
||||||
if (pVnode->tsdb == NULL) return TSDB_CODE_RPC_NOT_READY;
|
if (pVnode->tsdb == NULL) return TSDB_CODE_APP_NOT_READY;
|
||||||
if (pVnode->status == TAOS_VN_STATUS_CLOSING)
|
if (pVnode->status == TAOS_VN_STATUS_CLOSING)
|
||||||
return TSDB_CODE_RPC_NOT_READY;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
|
|
||||||
if (pHead->version == 0) { // from client or CQ
|
if (pHead->version == 0) { // from client or CQ
|
||||||
if (pVnode->status != TAOS_VN_STATUS_READY) {
|
if (pVnode->status != TAOS_VN_STATUS_READY) {
|
||||||
vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->status);
|
vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->status);
|
||||||
return TSDB_CODE_VND_INVALID_STATUS; // it may be in deleting or closing state
|
return TSDB_CODE_APP_NOT_READY; // it may be in deleting or closing state
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
if (pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
||||||
vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->syncCfg.replica, pVnode->role);
|
vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->syncCfg.replica, pVnode->role);
|
||||||
return TSDB_CODE_RPC_NOT_READY;
|
return TSDB_CODE_APP_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign version
|
// assign version
|
||||||
|
|
Loading…
Reference in New Issue