Merge branch 'develop' into hotfix/sangshuduo/TD-3147-insert-rate-more-than-1s
This commit is contained in:
commit
08b272c69f
|
@ -27,7 +27,6 @@ tests/hdfs/
|
||||||
nmake/
|
nmake/
|
||||||
sln/
|
sln/
|
||||||
hdfs/
|
hdfs/
|
||||||
c/
|
|
||||||
taoshebei/
|
taoshebei/
|
||||||
taosdalipu/
|
taosdalipu/
|
||||||
Target/
|
Target/
|
||||||
|
|
|
@ -227,6 +227,8 @@ pipeline {
|
||||||
./test-all.sh p4
|
./test-all.sh p4
|
||||||
cd ${WKC}/tests
|
cd ${WKC}/tests
|
||||||
./test-all.sh full jdbc
|
./test-all.sh full jdbc
|
||||||
|
cd ${WKC}/tests
|
||||||
|
./test-all.sh full unit
|
||||||
date'''
|
date'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,20 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
|
||||||
* [创建超级表](/model#create-stable):为同一类型的数据采集点创建一个超级表
|
* [创建超级表](/model#create-stable):为同一类型的数据采集点创建一个超级表
|
||||||
* [创建表](/model#create-table):使用超级表做模板,为每一个具体的数据采集点单独建表
|
* [创建表](/model#create-table):使用超级表做模板,为每一个具体的数据采集点单独建表
|
||||||
|
|
||||||
|
## [TAOS SQL](/taos-sql)
|
||||||
|
|
||||||
|
* [支持的数据类型](/taos-sql#data-type):支持时间戳、整型、浮点型、布尔型、字符型等多种数据类型
|
||||||
|
* [数据库管理](/taos-sql#management):添加、删除、查看数据库
|
||||||
|
* [表管理](/taos-sql#table):添加、删除、查看、修改表
|
||||||
|
* [超级表管理](/taos-sql#super-table):添加、删除、查看、修改超级表
|
||||||
|
* [标签管理](/taos-sql#tags):增加、删除、修改标签
|
||||||
|
* [数据写入](/taos-sql#insert):支持单表单条、多条、多表多条写入,支持历史数据写入
|
||||||
|
* [数据查询](/taos-sql#select):支持时间段、值过滤、排序、查询结果手动分页等
|
||||||
|
* [SQL函数](/taos-sql#functions):支持各种聚合函数、选择函数、计算函数,如avg, min, diff等
|
||||||
|
* [时间维度聚合](/taos-sql#aggregation):将表中数据按照时间段进行切割后聚合,降维处理
|
||||||
|
* [边界限制](/taos-sql#limitation):库、表、SQL等边界限制条件
|
||||||
|
* [错误码](/taos-sql/error-code):TDengine 2.0 错误码以及对应的十进制码
|
||||||
|
|
||||||
## [高效写入数据](/insert)
|
## [高效写入数据](/insert)
|
||||||
|
|
||||||
* [SQL写入](/insert#sql):使用SQL insert命令向一张或多张表写入单条或多条记录
|
* [SQL写入](/insert#sql):使用SQL insert命令向一张或多张表写入单条或多条记录
|
||||||
|
@ -94,20 +108,6 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
|
||||||
* [文件目录结构](/administrator#directories):TDengine数据文件、配置文件等所在目录
|
* [文件目录结构](/administrator#directories):TDengine数据文件、配置文件等所在目录
|
||||||
* [参数限制与保留关键字](/administrator#keywords):TDengine的参数限制与保留关键字列表
|
* [参数限制与保留关键字](/administrator#keywords):TDengine的参数限制与保留关键字列表
|
||||||
|
|
||||||
## [TAOS SQL](/taos-sql)
|
|
||||||
|
|
||||||
* [支持的数据类型](/taos-sql#data-type):支持时间戳、整型、浮点型、布尔型、字符型等多种数据类型
|
|
||||||
* [数据库管理](/taos-sql#management):添加、删除、查看数据库
|
|
||||||
* [表管理](/taos-sql#table):添加、删除、查看、修改表
|
|
||||||
* [超级表管理](/taos-sql#super-table):添加、删除、查看、修改超级表
|
|
||||||
* [标签管理](/taos-sql#tags):增加、删除、修改标签
|
|
||||||
* [数据写入](/taos-sql#insert):支持单表单条、多条、多表多条写入,支持历史数据写入
|
|
||||||
* [数据查询](/taos-sql#select):支持时间段、值过滤、排序、查询结果手动分页等
|
|
||||||
* [SQL函数](/taos-sql#functions):支持各种聚合函数、选择函数、计算函数,如avg, min, diff等
|
|
||||||
* [时间维度聚合](/taos-sql#aggregation):将表中数据按照时间段进行切割后聚合,降维处理
|
|
||||||
* [边界限制](/taos-sql#limitation):库、表、SQL等边界限制条件
|
|
||||||
* [错误码](/taos-sql/error-code):TDengine 2.0 错误码以及对应的十进制码
|
|
||||||
|
|
||||||
## TDengine的技术设计
|
## TDengine的技术设计
|
||||||
|
|
||||||
* [系统模块](/architecture/taosd):taosd的功能和模块划分
|
* [系统模块](/architecture/taosd):taosd的功能和模块划分
|
||||||
|
|
|
@ -13,9 +13,8 @@ WORKDIR /root/${dirName}/
|
||||||
RUN /bin/bash install.sh -e no
|
RUN /bin/bash install.sh -e no
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
ENV LANGUAGE=en_US:en
|
ENV LC_ALL=C.UTF-8
|
||||||
ENV LC_ALL=en_US.UTF-8
|
|
||||||
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
|
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
|
||||||
CMD ["taosd"]
|
CMD ["taosd"]
|
||||||
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
|
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
|
||||||
|
|
|
@ -270,7 +270,7 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex);
|
||||||
bool hasMoreVnodesToTry(SSqlObj *pSql);
|
bool hasMoreVnodesToTry(SSqlObj *pSql);
|
||||||
bool hasMoreClauseToTry(SSqlObj* pSql);
|
bool hasMoreClauseToTry(SSqlObj* pSql);
|
||||||
|
|
||||||
void tscFreeQueryInfo(SSqlCmd* pCmd);
|
void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta);
|
||||||
|
|
||||||
void tscTryQueryNextVnode(SSqlObj *pSql, __async_cb_func_t fp);
|
void tscTryQueryNextVnode(SSqlObj *pSql, __async_cb_func_t fp);
|
||||||
void tscAsyncQuerySingleRowForNextVnode(void *param, TAOS_RES *tres, int numOfRows);
|
void tscAsyncQuerySingleRowForNextVnode(void *param, TAOS_RES *tres, int numOfRows);
|
||||||
|
|
|
@ -442,6 +442,8 @@ void tscCloseTscObj(void *pObj);
|
||||||
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
|
||||||
void *param, TAOS **taos);
|
void *param, TAOS **taos);
|
||||||
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res);
|
TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, int64_t* res);
|
||||||
|
TAOS_RES * taos_query_ra(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param);
|
||||||
|
|
||||||
void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
|
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 doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen);
|
||||||
|
|
|
@ -74,12 +74,16 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
|
||||||
|
|
||||||
// TODO return the correct error code to client in tscQueueAsyncError
|
// TODO return the correct error code to client in tscQueueAsyncError
|
||||||
void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
||||||
|
taos_query_ra(taos, sqlstr, fp, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_RES * taos_query_ra(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *param) {
|
||||||
STscObj *pObj = (STscObj *)taos;
|
STscObj *pObj = (STscObj *)taos;
|
||||||
if (pObj == NULL || pObj->signature != pObj) {
|
if (pObj == NULL || pObj->signature != pObj) {
|
||||||
tscError("bug!!! pObj:%p", pObj);
|
tscError("bug!!! pObj:%p", pObj);
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_DISCONNECTED);
|
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_DISCONNECTED);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t sqlLen = (int32_t)strlen(sqlstr);
|
int32_t sqlLen = (int32_t)strlen(sqlstr);
|
||||||
|
@ -87,7 +91,7 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
|
||||||
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
|
tscError("sql string exceeds max length:%d", tsMaxSQLStringLen);
|
||||||
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
|
||||||
tscQueueAsyncError(fp, param, terrno);
|
tscQueueAsyncError(fp, param, terrno);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nPrintTsc("%s", sqlstr);
|
nPrintTsc("%s", sqlstr);
|
||||||
|
@ -96,12 +100,15 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
|
||||||
if (pSql == NULL) {
|
if (pSql == NULL) {
|
||||||
tscError("failed to malloc sqlObj");
|
tscError("failed to malloc sqlObj");
|
||||||
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY);
|
tscQueueAsyncError(fp, param, TSDB_CODE_TSC_OUT_OF_MEMORY);
|
||||||
return;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
doAsyncQuery(pObj, pSql, fp, param, sqlstr, sqlLen);
|
doAsyncQuery(pObj, pSql, fp, param, sqlstr, sqlLen);
|
||||||
|
|
||||||
|
return pSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows) {
|
static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows) {
|
||||||
if (tres == NULL) {
|
if (tres == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2802,7 +2802,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
|
||||||
numOfFailed += 1;
|
numOfFailed += 1;
|
||||||
|
|
||||||
// clean up tableMeta in cache
|
// clean up tableMeta in cache
|
||||||
tscFreeQueryInfo(&pSql->cmd);
|
tscFreeQueryInfo(&pSql->cmd, false);
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(&pSql->cmd, 0);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetailSafely(&pSql->cmd, 0);
|
||||||
STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pParentObj->cmd, pSql->cmd.clauseIndex, 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);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "ttokendef.h"
|
#include "ttokendef.h"
|
||||||
|
|
||||||
static void freeQueryInfoImpl(SQueryInfo* pQueryInfo);
|
static void freeQueryInfoImpl(SQueryInfo* pQueryInfo);
|
||||||
static void clearAllTableMetaInfo(SQueryInfo* pQueryInfo);
|
static void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta);
|
||||||
|
|
||||||
static void tscStrToLower(char *str, int32_t n) {
|
static void tscStrToLower(char *str, int32_t n) {
|
||||||
if (str == NULL || n <= 0) { return;}
|
if (str == NULL || n <= 0) { return;}
|
||||||
|
@ -367,7 +367,7 @@ static void tscDestroyResPointerInfo(SSqlRes* pRes) {
|
||||||
pRes->data = NULL; // pRes->data points to the buffer of pRsp, no need to free
|
pRes->data = NULL; // pRes->data points to the buffer of pRsp, no need to free
|
||||||
}
|
}
|
||||||
|
|
||||||
void tscFreeQueryInfo(SSqlCmd* pCmd) {
|
void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeMeta) {
|
||||||
if (pCmd == NULL || pCmd->numOfClause == 0) {
|
if (pCmd == NULL || pCmd->numOfClause == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd) {
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, i);
|
||||||
|
|
||||||
freeQueryInfoImpl(pQueryInfo);
|
freeQueryInfoImpl(pQueryInfo);
|
||||||
clearAllTableMetaInfo(pQueryInfo);
|
clearAllTableMetaInfo(pQueryInfo, removeMeta);
|
||||||
tfree(pQueryInfo);
|
tfree(pQueryInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void tscResetSqlCmd(SSqlCmd* pCmd, bool removeMeta) {
|
||||||
|
|
||||||
pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList, removeMeta);
|
pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList, removeMeta);
|
||||||
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
|
||||||
tscFreeQueryInfo(pCmd);
|
tscFreeQueryInfo(pCmd, removeMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tscFreeSqlResult(SSqlObj* pSql) {
|
void tscFreeSqlResult(SSqlObj* pSql) {
|
||||||
|
@ -1847,10 +1847,17 @@ SArray* tscVgroupTableInfoDup(SArray* pVgroupTables) {
|
||||||
return pa;
|
return pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAllTableMetaInfo(SQueryInfo* pQueryInfo) {
|
void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, bool removeMeta) {
|
||||||
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
|
||||||
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
|
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
|
||||||
|
|
||||||
|
if (removeMeta) {
|
||||||
|
char name[TSDB_TABLE_FNAME_LEN] = {0};
|
||||||
|
tNameExtractFullName(&pTableMetaInfo->name, name);
|
||||||
|
|
||||||
|
taosHashRemove(tscTableMetaInfo, name, strnlen(name, TSDB_TABLE_FNAME_LEN));
|
||||||
|
}
|
||||||
|
|
||||||
tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables);
|
tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables);
|
||||||
tscClearTableMetaInfo(pTableMetaInfo);
|
tscClearTableMetaInfo(pTableMetaInfo);
|
||||||
free(pTableMetaInfo);
|
free(pTableMetaInfo);
|
||||||
|
@ -2714,7 +2721,11 @@ STableMeta* createSuperTableMeta(STableMetaMsg* pChild) {
|
||||||
uint32_t tscGetTableMetaSize(STableMeta* pTableMeta) {
|
uint32_t tscGetTableMetaSize(STableMeta* pTableMeta) {
|
||||||
assert(pTableMeta != NULL);
|
assert(pTableMeta != NULL);
|
||||||
|
|
||||||
int32_t totalCols = pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags;
|
int32_t totalCols = 0;
|
||||||
|
if (pTableMeta->tableInfo.numOfColumns >= 0 && pTableMeta->tableInfo.numOfTags >= 0) {
|
||||||
|
totalCols = pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags;
|
||||||
|
}
|
||||||
|
|
||||||
return sizeof(STableMeta) + totalCols * sizeof(SSchema);
|
return sizeof(STableMeta) + totalCols * sizeof(SSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ do { \
|
||||||
#define TSDB_MAX_COMP_LEVEL 2
|
#define TSDB_MAX_COMP_LEVEL 2
|
||||||
#define TSDB_DEFAULT_COMP_LEVEL 2
|
#define TSDB_DEFAULT_COMP_LEVEL 2
|
||||||
|
|
||||||
#define TSDB_MIN_WAL_LEVEL 1
|
#define TSDB_MIN_WAL_LEVEL 0
|
||||||
#define TSDB_MAX_WAL_LEVEL 2
|
#define TSDB_MAX_WAL_LEVEL 2
|
||||||
#define TSDB_DEFAULT_WAL_LEVEL 1
|
#define TSDB_DEFAULT_WAL_LEVEL 1
|
||||||
|
|
||||||
|
|
|
@ -832,12 +832,13 @@ static int32_t mnodeProcessBatchCreateTableMsg(SMnodeMsg *pMsg) {
|
||||||
return code;
|
return code;
|
||||||
} else if (code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
} else if (code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
++pMsg->pBatchMasterMsg->received;
|
++pMsg->pBatchMasterMsg->received;
|
||||||
|
pMsg->pBatchMasterMsg->code = code;
|
||||||
mnodeDestroySubMsg(pMsg);
|
mnodeDestroySubMsg(pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
||||||
>= pMsg->pBatchMasterMsg->expected) {
|
>= pMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, TSDB_CODE_SUCCESS);
|
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, pMsg->pBatchMasterMsg->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
@ -1908,7 +1909,8 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
|
||||||
sdbDeleteRow(&desc);
|
sdbDeleteRow(&desc);
|
||||||
|
|
||||||
if (pMsg->pBatchMasterMsg) {
|
if (pMsg->pBatchMasterMsg) {
|
||||||
++pMsg->pBatchMasterMsg->successed;
|
++pMsg->pBatchMasterMsg->received;
|
||||||
|
pMsg->pBatchMasterMsg->code = code;
|
||||||
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
||||||
>= pMsg->pBatchMasterMsg->expected) {
|
>= pMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code);
|
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code);
|
||||||
|
@ -2690,6 +2692,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
|
||||||
|
|
||||||
if (pMsg->pBatchMasterMsg) {
|
if (pMsg->pBatchMasterMsg) {
|
||||||
++pMsg->pBatchMasterMsg->received;
|
++pMsg->pBatchMasterMsg->received;
|
||||||
|
pMsg->pBatchMasterMsg->code = code;
|
||||||
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
||||||
>= pMsg->pBatchMasterMsg->expected) {
|
>= pMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code);
|
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, code);
|
||||||
|
@ -2728,6 +2731,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
|
||||||
|
|
||||||
if (pMsg->pBatchMasterMsg) {
|
if (pMsg->pBatchMasterMsg) {
|
||||||
++pMsg->pBatchMasterMsg->received;
|
++pMsg->pBatchMasterMsg->received;
|
||||||
|
pMsg->pBatchMasterMsg->code = rpcMsg->code;
|
||||||
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
||||||
>= pMsg->pBatchMasterMsg->expected) {
|
>= pMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, rpcMsg->code);
|
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, rpcMsg->code);
|
||||||
|
|
|
@ -537,6 +537,7 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
|
||||||
|
|
||||||
if (pMsg->pBatchMasterMsg) {
|
if (pMsg->pBatchMasterMsg) {
|
||||||
++pMsg->pBatchMasterMsg->received;
|
++pMsg->pBatchMasterMsg->received;
|
||||||
|
pMsg->pBatchMasterMsg->code = pMsg->code;
|
||||||
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
if (pMsg->pBatchMasterMsg->successed + pMsg->pBatchMasterMsg->received
|
||||||
>= pMsg->pBatchMasterMsg->expected) {
|
>= pMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, pMsg->code);
|
dnodeSendRpcMWriteRsp(pMsg->pBatchMasterMsg, pMsg->code);
|
||||||
|
@ -1002,6 +1003,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
|
||||||
|
|
||||||
if (mnodeMsg->pBatchMasterMsg) {
|
if (mnodeMsg->pBatchMasterMsg) {
|
||||||
++mnodeMsg->pBatchMasterMsg->received;
|
++mnodeMsg->pBatchMasterMsg->received;
|
||||||
|
mnodeMsg->pBatchMasterMsg->code = code;
|
||||||
if (mnodeMsg->pBatchMasterMsg->successed + mnodeMsg->pBatchMasterMsg->received
|
if (mnodeMsg->pBatchMasterMsg->successed + mnodeMsg->pBatchMasterMsg->received
|
||||||
>= mnodeMsg->pBatchMasterMsg->expected) {
|
>= mnodeMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(mnodeMsg->pBatchMasterMsg, code);
|
dnodeSendRpcMWriteRsp(mnodeMsg->pBatchMasterMsg, code);
|
||||||
|
@ -1024,6 +1026,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
|
||||||
|
|
||||||
if (mnodeMsg->pBatchMasterMsg) {
|
if (mnodeMsg->pBatchMasterMsg) {
|
||||||
++mnodeMsg->pBatchMasterMsg->received;
|
++mnodeMsg->pBatchMasterMsg->received;
|
||||||
|
mnodeMsg->pBatchMasterMsg->code = mnodeMsg->code;
|
||||||
if (mnodeMsg->pBatchMasterMsg->successed + mnodeMsg->pBatchMasterMsg->received
|
if (mnodeMsg->pBatchMasterMsg->successed + mnodeMsg->pBatchMasterMsg->received
|
||||||
>= mnodeMsg->pBatchMasterMsg->expected) {
|
>= mnodeMsg->pBatchMasterMsg->expected) {
|
||||||
dnodeSendRpcMWriteRsp(mnodeMsg->pBatchMasterMsg, mnodeMsg->code);
|
dnodeSendRpcMWriteRsp(mnodeMsg->pBatchMasterMsg, mnodeMsg->code);
|
||||||
|
|
|
@ -83,6 +83,20 @@ extern "C" {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||||
|
do { \
|
||||||
|
if (isnan(x) && isnan(y)) { return 0; } \
|
||||||
|
if (isnan(x)) { return -1; } \
|
||||||
|
if (isnan(y)) { return 1; } \
|
||||||
|
if ((x) == (y)) { \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
return (x) < (y) ? -1 : 1; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define DEFAULT_FLOAT_COMP(x, y) DEFAULT_DOUBLE_COMP(x, y)
|
||||||
|
|
||||||
#define ALIGN_NUM(n, align) (((n) + ((align)-1)) & (~((align)-1)))
|
#define ALIGN_NUM(n, align) (((n) + ((align)-1)) & (~((align)-1)))
|
||||||
|
|
||||||
// align to 8bytes
|
// align to 8bytes
|
||||||
|
|
|
@ -362,20 +362,10 @@ static FORCE_INLINE int32_t columnValueAscendingComparator(char *f1, char *f2, i
|
||||||
return (first < second) ? -1 : 1;
|
return (first < second) ? -1 : 1;
|
||||||
};
|
};
|
||||||
case TSDB_DATA_TYPE_DOUBLE: {
|
case TSDB_DATA_TYPE_DOUBLE: {
|
||||||
double first = GET_DOUBLE_VAL(f1);
|
DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2));
|
||||||
double second = GET_DOUBLE_VAL(f2);
|
|
||||||
if (first == second) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (first < second) ? -1 : 1;
|
|
||||||
};
|
};
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
float first = GET_FLOAT_VAL(f1);
|
DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2));
|
||||||
float second = GET_FLOAT_VAL(f2);
|
|
||||||
if (first == second) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return (first < second) ? -1 : 1;
|
|
||||||
};
|
};
|
||||||
case TSDB_DATA_TYPE_BIGINT: {
|
case TSDB_DATA_TYPE_BIGINT: {
|
||||||
int64_t first = *(int64_t *)f1;
|
int64_t first = *(int64_t *)f1;
|
||||||
|
|
|
@ -58,6 +58,15 @@ SSqlInfo qSQLParse(const char *pStr) {
|
||||||
sqlInfo.valid = false;
|
sqlInfo.valid = false;
|
||||||
goto abort_parse;
|
goto abort_parse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TK_HEX:
|
||||||
|
case TK_OCT:
|
||||||
|
case TK_BIN:{
|
||||||
|
snprintf(sqlInfo.msg, tListLen(sqlInfo.msg), "unsupported token: \"%s\"", t0.z);
|
||||||
|
sqlInfo.valid = false;
|
||||||
|
goto abort_parse;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Parse(pParser, t0.type, t0, &sqlInfo);
|
Parse(pParser, t0.type, t0, &sqlInfo);
|
||||||
if (sqlInfo.valid == false) {
|
if (sqlInfo.valid == false) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ tMemBucket *createUnsignedDataBucket(int32_t start, int32_t end, int32_t type) {
|
||||||
uint64_t k = i;
|
uint64_t k = i;
|
||||||
int32_t ret = tMemBucketPut(pBucket, &k, 1);
|
int32_t ret = tMemBucketPut(pBucket, &k, 1);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("value out of range:%f", k);
|
printf("value out of range:%" PRId64, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ void unsignedDataTest() {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(testCase, percentileTest) {
|
TEST(testCase, percentileTest) {
|
||||||
// qsortTest();
|
// qsortTest();
|
||||||
intDataTest();
|
intDataTest();
|
||||||
bigintDataTest();
|
bigintDataTest();
|
||||||
doubleDataTest();
|
doubleDataTest();
|
||||||
|
|
|
@ -227,10 +227,10 @@ TEST(testCase, db_table_name) {
|
||||||
EXPECT_EQ(testValidateName(t60_1), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t60_1), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t61[] = "' ABC '";
|
char t61[] = "' ABC '";
|
||||||
EXPECT_EQ(testValidateName(t61), TSDB_CODE_SUCCESS);
|
EXPECT_EQ(testValidateName(t61), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t61_1[] = "' ABC '";
|
char t61_1[] = "' ABC '";
|
||||||
EXPECT_EQ(testValidateName(t61_1), TSDB_CODE_SUCCESS);
|
EXPECT_EQ(testValidateName(t61_1), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t62[] = " ABC . def ";
|
char t62[] = " ABC . def ";
|
||||||
EXPECT_EQ(testValidateName(t62), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t62), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
@ -249,13 +249,13 @@ TEST(testCase, db_table_name) {
|
||||||
EXPECT_EQ(testValidateName(t65), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t65), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t66[] = "' ABC '.' DEF '";
|
char t66[] = "' ABC '.' DEF '";
|
||||||
EXPECT_EQ(testValidateName(t66), TSDB_CODE_SUCCESS);
|
EXPECT_EQ(testValidateName(t66), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t67[] = "abc . ' DEF '";
|
char t67[] = "abc . ' DEF '";
|
||||||
EXPECT_EQ(testValidateName(t67), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t67), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t68[] = "' abc '.' DEF '";
|
char t68[] = "' abc '.' DEF '";
|
||||||
EXPECT_EQ(testValidateName(t68), TSDB_CODE_SUCCESS);
|
EXPECT_EQ(testValidateName(t68), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
// do not use key words
|
// do not use key words
|
||||||
char t69[] = "table.'DEF'";
|
char t69[] = "table.'DEF'";
|
||||||
|
@ -265,7 +265,7 @@ TEST(testCase, db_table_name) {
|
||||||
EXPECT_EQ(testValidateName(t70), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t70), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t71[] = "'_abXYZ1234 '.' deFF '";
|
char t71[] = "'_abXYZ1234 '.' deFF '";
|
||||||
EXPECT_EQ(testValidateName(t71), TSDB_CODE_SUCCESS);
|
EXPECT_EQ(testValidateName(t71), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
||||||
char t72[] = "'_abDEF&^%1234'.' DIef'";
|
char t72[] = "'_abDEF&^%1234'.' DIef'";
|
||||||
EXPECT_EQ(testValidateName(t72), TSDB_CODE_TSC_INVALID_SQL);
|
EXPECT_EQ(testValidateName(t72), TSDB_CODE_TSC_INVALID_SQL);
|
||||||
|
|
|
@ -285,17 +285,24 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
|
||||||
assert(info.lastKey <= pQueryHandle->window.skey);
|
assert(info.lastKey <= pQueryHandle->window.skey);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayPush(pTable, &pKeyInfo->pTable);
|
|
||||||
|
|
||||||
taosArrayPush(pTableCheckInfo, &info);
|
taosArrayPush(pTableCheckInfo, &info);
|
||||||
tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %p", pQueryHandle, info.tableId.uid,
|
tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %p", pQueryHandle, info.tableId.uid,
|
||||||
info.tableId.tid, info.lastKey, pQueryHandle->qinfo);
|
info.tableId.tid, info.lastKey, pQueryHandle->qinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*psTable = pTable;
|
|
||||||
|
|
||||||
taosArraySort(pTableCheckInfo, tsdbCheckInfoCompar);
|
taosArraySort(pTableCheckInfo, tsdbCheckInfoCompar);
|
||||||
|
|
||||||
|
size_t gsize = taosArrayGetSize(pTableCheckInfo);
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < gsize; ++i) {
|
||||||
|
STableCheckInfo* pInfo = (STableCheckInfo*) taosArrayGet(pTableCheckInfo, i);
|
||||||
|
|
||||||
|
taosArrayPush(pTable, &pInfo->pTableObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
*psTable = pTable;
|
||||||
|
|
||||||
return pTableCheckInfo;
|
return pTableCheckInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,8 +392,8 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) {
|
||||||
int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
|
int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_INT: DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2));
|
case TSDB_DATA_TYPE_INT: DEFAULT_COMP(GET_INT32_VAL(f1), GET_INT32_VAL(f2));
|
||||||
case TSDB_DATA_TYPE_DOUBLE: DEFAULT_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2));
|
case TSDB_DATA_TYPE_DOUBLE: DEFAULT_DOUBLE_COMP(GET_DOUBLE_VAL(f1), GET_DOUBLE_VAL(f2));
|
||||||
case TSDB_DATA_TYPE_FLOAT: DEFAULT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2));
|
case TSDB_DATA_TYPE_FLOAT: DEFAULT_FLOAT_COMP(GET_FLOAT_VAL(f1), GET_FLOAT_VAL(f2));
|
||||||
case TSDB_DATA_TYPE_BIGINT: DEFAULT_COMP(GET_INT64_VAL(f1), GET_INT64_VAL(f2));
|
case TSDB_DATA_TYPE_BIGINT: DEFAULT_COMP(GET_INT64_VAL(f1), GET_INT64_VAL(f2));
|
||||||
case TSDB_DATA_TYPE_SMALLINT: DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2));
|
case TSDB_DATA_TYPE_SMALLINT: DEFAULT_COMP(GET_INT16_VAL(f1), GET_INT16_VAL(f2));
|
||||||
case TSDB_DATA_TYPE_TINYINT:
|
case TSDB_DATA_TYPE_TINYINT:
|
||||||
|
|
|
@ -55,9 +55,15 @@ pipeline {
|
||||||
sh '''
|
sh '''
|
||||||
cd ${WKC}/tests
|
cd ${WKC}/tests
|
||||||
./test-all.sh b1
|
./test-all.sh b1
|
||||||
|
date'''
|
||||||
|
sh '''
|
||||||
cd ${WKC}/tests
|
cd ${WKC}/tests
|
||||||
./test-all.sh full jdbc
|
./test-all.sh full jdbc
|
||||||
date'''
|
date'''
|
||||||
|
sh '''
|
||||||
|
cd ${WKC}/tests
|
||||||
|
./test-all.sh full unit
|
||||||
|
date'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,15 +92,14 @@ void Test(TAOS *taos, char *qstr, int index) {
|
||||||
// printf("insert row: %i, reason:%s\n", i, taos_errstr(taos));
|
// printf("insert row: %i, reason:%s\n", i, taos_errstr(taos));
|
||||||
// }
|
// }
|
||||||
TAOS_RES *result1 = taos_query(taos, qstr);
|
TAOS_RES *result1 = taos_query(taos, qstr);
|
||||||
if (result1) {
|
if (result1 == NULL || taos_errno(result1) != 0) {
|
||||||
printf("insert row: %i\n", i);
|
printf("failed to insert row, reason:%s\n", taos_errstr(result1));
|
||||||
} else {
|
|
||||||
printf("failed to insert row: %i, reason:%s\n", i, "null result"/*taos_errstr(result)*/);
|
|
||||||
taos_free_result(result1);
|
taos_free_result(result1);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
} else {
|
||||||
|
printf("insert row: %i\n", i);
|
||||||
}
|
}
|
||||||
taos_free_result(result1);
|
taos_free_result(result1);
|
||||||
|
|
||||||
}
|
}
|
||||||
printf("success to insert rows, total %d rows\n", i);
|
printf("success to insert rows, total %d rows\n", i);
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,9 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
sys.path.insert(0, os.getcwd())
|
|
||||||
from fabric import Connection
|
from fabric import Connection
|
||||||
from util.sql import *
|
|
||||||
from util.log import *
|
|
||||||
import taos
|
|
||||||
import random
|
import random
|
||||||
import threading
|
import time
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
class Node:
|
class Node:
|
||||||
|
@ -76,6 +70,19 @@ class Node:
|
||||||
print("remove taosd error for node %d " % self.index)
|
print("remove taosd error for node %d " % self.index)
|
||||||
logging.exception(e)
|
logging.exception(e)
|
||||||
|
|
||||||
|
def forceStopOneTaosd(self):
|
||||||
|
try:
|
||||||
|
self.conn.run("kill -9 $(ps -ax|grep taosd|awk '{print $1}')")
|
||||||
|
except Exception as e:
|
||||||
|
print("kill taosd error on node%d " % self.index)
|
||||||
|
|
||||||
|
def startOneTaosd(self):
|
||||||
|
try:
|
||||||
|
self.conn.run("nohup taosd -c /etc/taos/ > /dev/null 2>&1 &")
|
||||||
|
except Exception as e:
|
||||||
|
print("start taosd error on node%d " % self.index)
|
||||||
|
logging.exception(e)
|
||||||
|
|
||||||
def installTaosd(self, packagePath):
|
def installTaosd(self, packagePath):
|
||||||
self.conn.put(packagePath, self.homeDir)
|
self.conn.put(packagePath, self.homeDir)
|
||||||
self.conn.cd(self.homeDir)
|
self.conn.cd(self.homeDir)
|
||||||
|
@ -122,100 +129,51 @@ class Node:
|
||||||
|
|
||||||
class Nodes:
|
class Nodes:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.node1 = Node(1, 'root', '52.151.60.239', 'node1', 'r', '/root/')
|
self.tdnodes = []
|
||||||
self.node2 = Node(2, 'root', '52.183.32.246', 'node1', 'r', '/root/')
|
self.tdnodes.append(Node(0, 'root', '52.143.103.7', 'node1', 'a', '/root/'))
|
||||||
self.node3 = Node(3, 'root', '51.143.46.79', 'node1', 'r', '/root/')
|
self.tdnodes.append(Node(1, 'root', '52.250.48.222', 'node2', 'a', '/root/'))
|
||||||
self.node4 = Node(4, 'root', '52.183.2.76', 'node1', 'r', '/root/')
|
self.tdnodes.append(Node(2, 'root', '51.141.167.23', 'node3', 'a', '/root/'))
|
||||||
self.node5 = Node(5, 'root', '13.66.225.87', 'node1', 'r', '/root/')
|
self.tdnodes.append(Node(3, 'root', '52.247.207.173', 'node4', 'a', '/root/'))
|
||||||
|
self.tdnodes.append(Node(4, 'root', '51.141.166.100', 'node5', 'a', '/root/'))
|
||||||
|
|
||||||
|
def stopOneNode(self, index):
|
||||||
|
self.tdnodes[index].forceStopOneTaosd()
|
||||||
|
|
||||||
|
def startOneNode(self, index):
|
||||||
|
self.tdnodes[index].startOneTaosd()
|
||||||
|
|
||||||
def stopAllTaosd(self):
|
def stopAllTaosd(self):
|
||||||
self.node1.stopTaosd()
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.stopTaosd()
|
self.tdnodes[i].stopTaosd()
|
||||||
self.node3.stopTaosd()
|
|
||||||
|
|
||||||
def startAllTaosd(self):
|
def startAllTaosd(self):
|
||||||
self.node1.startTaosd()
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.startTaosd()
|
self.tdnodes[i].startTaosd()
|
||||||
self.node3.startTaosd()
|
|
||||||
|
|
||||||
def restartAllTaosd(self):
|
def restartAllTaosd(self):
|
||||||
self.node1.restartTaosd()
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.restartTaosd()
|
self.tdnodes[i].restartTaosd()
|
||||||
self.node3.restartTaosd()
|
|
||||||
|
|
||||||
def addConfigs(self, configKey, configValue):
|
def addConfigs(self, configKey, configValue):
|
||||||
self.node1.configTaosd(configKey, configValue)
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.configTaosd(configKey, configValue)
|
self.tdnodes[i].configTaosd(configKey, configValue)
|
||||||
self.node3.configTaosd(configKey, configValue)
|
|
||||||
|
|
||||||
def removeConfigs(self, configKey, configValue):
|
def removeConfigs(self, configKey, configValue):
|
||||||
self.node1.removeTaosConfig(configKey, configValue)
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.removeTaosConfig(configKey, configValue)
|
self.tdnodes[i].removeTaosConfig(configKey, configValue)
|
||||||
self.node3.removeTaosConfig(configKey, configValue)
|
|
||||||
|
|
||||||
def removeAllDataFiles(self):
|
def removeAllDataFiles(self):
|
||||||
self.node1.removeData()
|
for i in range(len(self.tdnodes)):
|
||||||
self.node2.removeData()
|
self.tdnodes[i].removeData()
|
||||||
self.node3.removeData()
|
|
||||||
|
|
||||||
class ClusterTest:
|
# kill taosd randomly every 10 mins
|
||||||
def __init__(self, hostName):
|
nodes = Nodes()
|
||||||
self.host = hostName
|
loop = 0
|
||||||
self.user = "root"
|
while True:
|
||||||
self.password = "taosdata"
|
loop = loop + 1
|
||||||
self.config = "/etc/taos"
|
index = random.randint(0, 4)
|
||||||
self.dbName = "mytest"
|
print("loop: %d, kill taosd on node%d" %(loop, index))
|
||||||
self.stbName = "meters"
|
nodes.stopOneNode(index)
|
||||||
self.numberOfThreads = 20
|
time.sleep(60)
|
||||||
self.numberOfTables = 10000
|
nodes.startOneNode(index)
|
||||||
self.numberOfRecords = 1000
|
time.sleep(600)
|
||||||
self.tbPrefix = "t"
|
|
||||||
self.ts = 1538548685000
|
|
||||||
self.repeat = 1
|
|
||||||
|
|
||||||
def connectDB(self):
|
|
||||||
self.conn = taos.connect(
|
|
||||||
host=self.host,
|
|
||||||
user=self.user,
|
|
||||||
password=self.password,
|
|
||||||
config=self.config)
|
|
||||||
|
|
||||||
def createSTable(self, replica):
|
|
||||||
cursor = self.conn.cursor()
|
|
||||||
tdLog.info("drop database if exists %s" % self.dbName)
|
|
||||||
cursor.execute("drop database if exists %s" % self.dbName)
|
|
||||||
tdLog.info("create database %s replica %d" % (self.dbName, replica))
|
|
||||||
cursor.execute("create database %s replica %d" % (self.dbName, replica))
|
|
||||||
tdLog.info("use %s" % self.dbName)
|
|
||||||
cursor.execute("use %s" % self.dbName)
|
|
||||||
tdLog.info("drop table if exists %s" % self.stbName)
|
|
||||||
cursor.execute("drop table if exists %s" % self.stbName)
|
|
||||||
tdLog.info("create table %s(ts timestamp, current float, voltage int, phase int) tags(id int)" % self.stbName)
|
|
||||||
cursor.execute("create table %s(ts timestamp, current float, voltage int, phase int) tags(id int)" % self.stbName)
|
|
||||||
cursor.close()
|
|
||||||
|
|
||||||
def insertData(self, threadID):
|
|
||||||
print("Thread %d: starting" % threadID)
|
|
||||||
cursor = self.conn.cursor()
|
|
||||||
tablesPerThread = int(self.numberOfTables / self.numberOfThreads)
|
|
||||||
baseTableID = tablesPerThread * threadID
|
|
||||||
for i in range (tablesPerThread):
|
|
||||||
cursor.execute("create table %s%d using %s tags(%d)" % (self.tbPrefix, baseTableID + i, self.stbName, baseTableID + i))
|
|
||||||
query = "insert into %s%d values" % (self.tbPrefix, baseTableID + i)
|
|
||||||
base = self.numberOfRecords * i
|
|
||||||
for j in range(self.numberOfRecords):
|
|
||||||
query += "(%d, %f, %d, %d)" % (self.ts + base + j, random.random(), random.randint(210, 230), random.randint(0, 10))
|
|
||||||
cursor.execute(query)
|
|
||||||
cursor.close()
|
|
||||||
print("Thread %d: finishing" % threadID)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
threads = []
|
|
||||||
tdLog.info("Inserting data")
|
|
||||||
for i in range(self.numberOfThreads):
|
|
||||||
thread = threading.Thread(target=self.insertData, args=(i,))
|
|
||||||
threads.append(thread)
|
|
||||||
thread.start()
|
|
||||||
|
|
||||||
for i in range(self.numberOfThreads):
|
|
||||||
threads[i].join()
|
|
|
@ -54,10 +54,11 @@ class TDTestCase:
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
|
||||||
tdSql.execute("insert into tb values(%d, 1, 2)" % (self.ts + 1))
|
tdSql.execute("insert into tb values(%d, 1, 2)" % (self.ts + 1))
|
||||||
|
tdSql.execute("insert into tb(ts, col1, col2) values(%d, 1, 2)" % (self.ts + 2))
|
||||||
|
|
||||||
print("==============step2")
|
print("==============step2")
|
||||||
tdSql.query("select * from tb")
|
tdSql.query("select * from tb")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -209,7 +209,7 @@ sql alter database db wal 1
|
||||||
sql alter database db wal 2
|
sql alter database db wal 2
|
||||||
sql alter database db wal 1
|
sql alter database db wal 1
|
||||||
sql alter database db wal 2
|
sql alter database db wal 2
|
||||||
sql_error alter database db wal 0
|
sql alter database db wal 0
|
||||||
sql_error alter database db wal 3
|
sql_error alter database db wal 3
|
||||||
sql_error alter database db wal 4
|
sql_error alter database db wal 4
|
||||||
sql_error alter database db wal -1
|
sql_error alter database db wal -1
|
||||||
|
|
|
@ -169,8 +169,8 @@ sql_error create database $db cache 0
|
||||||
sql_error create database $db ctime 29
|
sql_error create database $db ctime 29
|
||||||
sql_error create database $db ctime 40961
|
sql_error create database $db ctime 40961
|
||||||
|
|
||||||
# wal {1, 2}
|
# wal {0, 2}
|
||||||
sql_error create database $db wal 0
|
#sql_error create database $db wal 0
|
||||||
sql_error create database $db wal -1
|
sql_error create database $db wal -1
|
||||||
sql_error create database $db wal 3
|
sql_error create database $db wal 3
|
||||||
|
|
||||||
|
|
|
@ -160,9 +160,10 @@ function runPyCaseOneByOnefq {
|
||||||
totalFailed=0
|
totalFailed=0
|
||||||
totalPyFailed=0
|
totalPyFailed=0
|
||||||
totalJDBCFailed=0
|
totalJDBCFailed=0
|
||||||
|
totalUnitFailed=0
|
||||||
|
|
||||||
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
|
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
|
||||||
if [ "$2" != "jdbc" ] && [ "$2" != "python" ]; then
|
if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ]; then
|
||||||
echo "### run TSIM test case ###"
|
echo "### run TSIM test case ###"
|
||||||
cd $tests_dir/script
|
cd $tests_dir/script
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ if [ "$2" != "jdbc" ] && [ "$2" != "python" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] ; then
|
if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ]; then
|
||||||
echo "### run Python test case ###"
|
echo "### run Python test case ###"
|
||||||
|
|
||||||
cd $tests_dir
|
cd $tests_dir
|
||||||
|
@ -300,8 +301,8 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$1" == "full" ]; then
|
if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$1" == "full" ]; then
|
||||||
echo "### run JDBC test case ###"
|
echo "### run JDBC test cases ###"
|
||||||
|
|
||||||
cd $tests_dir
|
cd $tests_dir
|
||||||
|
|
||||||
|
@ -318,7 +319,7 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$1" == "full" ]; then
|
||||||
nohup build/bin/taosd -c /etc/taos/ > /dev/null 2>&1 &
|
nohup build/bin/taosd -c /etc/taos/ > /dev/null 2>&1 &
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
cd $tests_dir/../src/connector/jdbc
|
cd $tests_dir/../src/connector/jdbc
|
||||||
|
|
||||||
mvn test > jdbc-out.log 2>&1
|
mvn test > jdbc-out.log 2>&1
|
||||||
tail -n 20 jdbc-out.log
|
tail -n 20 jdbc-out.log
|
||||||
|
@ -343,4 +344,40 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$1" == "full" ]; then
|
||||||
dohavecore 1
|
dohavecore 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $(($totalFailed + $totalPyFailed + $totalJDBCFailed))
|
if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$1" == "full" ]; then
|
||||||
|
echo "### run Unit tests ###"
|
||||||
|
|
||||||
|
stopTaosd
|
||||||
|
cd $tests_dir
|
||||||
|
|
||||||
|
if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then
|
||||||
|
cd ../../
|
||||||
|
else
|
||||||
|
cd ../
|
||||||
|
fi
|
||||||
|
|
||||||
|
pwd
|
||||||
|
cd debug/build/bin
|
||||||
|
nohup ./taosd -c /etc/taos/ > /dev/null 2>&1 &
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
pwd
|
||||||
|
./queryTest > unittest-out.log 2>&1
|
||||||
|
tail -n 20 unittest-out.log
|
||||||
|
|
||||||
|
totalUnitTests=`grep "Running" unittest-out.log | awk '{print $3}'`
|
||||||
|
totalUnitSuccess=`grep 'PASSED' unittest-out.log | awk '{print $4}'`
|
||||||
|
totalUnitFailed=`expr $totalUnitTests - $totalUnitSuccess`
|
||||||
|
|
||||||
|
if [ "$totalUnitSuccess" -gt "0" ]; then
|
||||||
|
echo -e "\n${GREEN} ### Total $totalUnitSuccess Unit test succeed! ### ${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$totalUnitFailed" -ne "0" ]; then
|
||||||
|
echo -e "\n${RED} ### Total $totalUnitFailed Unit test failed! ### ${NC}"
|
||||||
|
fi
|
||||||
|
dohavecore 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
exit $(($totalFailed + $totalPyFailed + $totalJDBCFailed + $totalUnitFailed))
|
||||||
|
|
Loading…
Reference in New Issue