diff --git a/.travis.yml b/.travis.yml index 2c3fd31911..fcb2e8f22f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,13 @@ # # Build Matrix # +branches: + only: + - master + - develop + - coverity_scan + - /^.*ci-.*$/ + matrix: - os: linux dist: bionic diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 3fedc9e7ad..3c54176d0a 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -42,11 +42,13 @@ static void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRo int doAsyncParseSql(SSqlObj* pSql) { SSqlCmd* pCmd = &pSql->cmd; SSqlRes* pRes = &pSql->res; + int32_t code = tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE); if (code != TSDB_CODE_SUCCESS) { tscError("failed to malloc payload"); + pSql->res.code = code; + tscQueueAsyncRes(pSql); -// tscQueueAsyncRes(pSql->fp, pSql->param, TSDB_CODE_TSC_OUT_OF_MEMORY); return code; } diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index d821271857..4b6178eb61 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1354,7 +1354,7 @@ int tsParseSql(SSqlObj *pSql, bool initialParse) { if (TSDB_CODE_SUCCESS != ret) { return ret; } - + SSqlInfo SQLInfo = qSQLParse(pSql->sqlstr); ret = tscToSQLCmd(pSql, &SQLInfo); SQLInfoDestroy(&SQLInfo); diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 6164c005b9..2566e171f4 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1482,7 +1482,8 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr const char* msg5 = "parameter is out of range [0, 100]"; const char* msg6 = "function applied to tags not allowed"; const char* msg7 = "normal table can not apply this function"; - + const char* msg8 = "multi-columns selection does not support alias column name"; + switch (optr) { case TK_COUNT: { if (pItem->pNode->pParam != NULL && pItem->pNode->pParam->nExpr != 1) { @@ -1689,6 +1690,10 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr return invalidSqlErrMsg(pQueryInfo->msg, msg3); } + if (pItem->pNode->pParam->nExpr > 1 && strlen(pItem->aliasName) > 0) { + return invalidSqlErrMsg(pQueryInfo->msg, msg8); + } + /* in first/last function, multiple columns can be add to resultset */ for (int32_t i = 0; i < pItem->pNode->pParam->nExpr; ++i) { tSQLExprItem* pParamElem = &(pItem->pNode->pParam->a[i]); @@ -1755,6 +1760,11 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIndex, tSQLExpr } else { // select * from xxx int32_t numOfFields = 0; + // multicolumn selection does not support alias name + if (strlen(pItem->aliasName) != 0) { + return invalidSqlErrMsg(pQueryInfo->msg, msg8); + } + for (int32_t j = 0; j < pQueryInfo->numOfTables; ++j) { pTableMetaInfo = tscGetMetaInfo(pQueryInfo, j); SSchema* pSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta); diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index a3e655a971..aaa5ab291f 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1896,7 +1896,8 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) { tscTrace("%p submit data to %d vnode(s)", pSql, pDataBlocks->nSize); SSubqueryState *pState = calloc(1, sizeof(SSubqueryState)); pState->numOfTotal = pSql->numOfSubs; - + pState->numOfRemain = pState->numOfTotal; + pRes->code = TSDB_CODE_SUCCESS; int32_t i = 0; @@ -1917,8 +1918,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) { */ pNew->fetchFp = pNew->fp; pSql->pSubs[i] = pNew; - pNew->fetchFp = pNew->fp; - + tscTrace("%p sub:%p create subObj success. orderOfSub:%d", pSql, pNew, i); } diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index cbf1aa12be..110a435e57 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1581,24 +1581,6 @@ void tscClearSubqueryInfo(SSqlCmd* pCmd) { } } -void doRemoveTableMetaInfo(SQueryInfo* pQueryInfo, int32_t index, bool removeFromCache) { - if (index < 0 || index >= pQueryInfo->numOfTables) { - return; - } - - STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index); - - tscClearTableMetaInfo(pTableMetaInfo, removeFromCache); - free(pTableMetaInfo); - - int32_t after = pQueryInfo->numOfTables - index - 1; - if (after > 0) { - memmove(&pQueryInfo->pTableMetaInfo[index], &pQueryInfo->pTableMetaInfo[index + 1], after * POINTER_BYTES); - } - - pQueryInfo->numOfTables -= 1; -} - void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool removeFromCache) { tscTrace("%p deref the table meta in cache, numOfTables:%d", address, pQueryInfo->numOfTables); diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 7fa7ffa3a9..ccef783709 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -425,6 +425,7 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo) { int taosDumpOut(SDumpArguments *arguments) { TAOS_ROW row; + TAOS_RES* result = NULL; char *temp = NULL; FILE *fp = NULL; int count = 0; @@ -464,7 +465,7 @@ int taosDumpOut(SDumpArguments *arguments) { taosDumpCharset(fp); sprintf(command, "show databases"); - TAOS_RES* result = taos_query(taos, command); + result = taos_query(taos, command); int32_t code = taos_errno(result); if (code != 0) { fprintf(stderr, "failed to run command: %s, reason: %s\n", command, taos_errstr(result)); @@ -571,7 +572,7 @@ int taosDumpOut(SDumpArguments *arguments) { fclose(fp); taos_close(taos); taos_free_result(result); - free(temp); + tfree(temp); taosFreeDbInfos(); return 0; @@ -579,7 +580,7 @@ _exit_failure: fclose(fp); taos_close(taos); taos_free_result(result); - free(temp); + tfree(temp); taosFreeDbInfos(); return -1; } diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index e3ea08aece..0f2bbb8235 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -365,8 +365,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { mnodeUpdateVgroupStatus(pVgroup, pDnode, pVload); pAccess->vgId = htonl(pVload->vgId); pAccess->accessState = pVgroup->accessState; + pAccess++; mnodeDecVgroupRef(pVgroup); } + } if (pDnode->status == TAOS_DN_STATUS_OFFLINE) { diff --git a/src/plugins/mqtt/src/mqttSystem.c b/src/plugins/mqtt/src/mqttSystem.c index e9af733d07..f123d153d1 100644 --- a/src/plugins/mqtt/src/mqttSystem.c +++ b/src/plugins/mqtt/src/mqttSystem.c @@ -122,12 +122,11 @@ void mqttCleanUpSystem() { } void mqtt_PublishCallback(void** unused, struct mqtt_response_publish* published) { - mqttPrint("mqtt_PublishCallback"); /* note that published->topic_name is NOT null-terminated (here we'll change it to a c-string) */ char* topic_name = (char*)malloc(published->topic_name_size + 1); memcpy(topic_name, published->topic_name, published->topic_name_size); topic_name[published->topic_name_size] = '\0'; - mqttPrint("Received publish('%s'): %s", topic_name, (const char*)published->application_message); + mqttPrint("received publish('%s'): %s", topic_name, (const char*)published->application_message); char _token[128] = {0}; char _dbname[128] = {0}; char _tablename[128] = {0}; @@ -166,12 +165,12 @@ void* mqttClientRefresher(void* client) { mqtt_sync((struct mqtt_client*)client); taosMsleep(100); } - mqttPrint("Exit mqttClientRefresher"); + mqttTrace("quit refresher"); return NULL; } void mqttCleanup(int status, int sockfd, pthread_t* client_daemon) { - mqttPrint("mqttCleanup"); + mqttPrint("clean up mqtt module"); if (sockfd != -1) close(sockfd); if (client_daemon != NULL) pthread_cancel(*client_daemon); } @@ -197,7 +196,7 @@ void mqttQueryInsertCallback(void* param, TAOS_RES* result, int32_t code) { } void mqttReconnectClient(struct mqtt_client* client, void** reconnect_state_vptr) { - mqttPrint("mqttReconnectClient"); + mqttPrint("reconnect client"); struct reconnect_state_t* reconnect_state = *((struct reconnect_state_t**)reconnect_state_vptr); /* Close the clients socket if this isn't the initial reconnect call */ @@ -213,7 +212,7 @@ void mqttReconnectClient(struct mqtt_client* client, void** reconnect_state_vptr /* Open a new socket. */ int sockfd = open_nb_socket(reconnect_state->hostname, reconnect_state->port); if (sockfd == -1) { - mqttError("Failed to open socket: "); + mqttError("failed to open socket: "); mqttCleanup(EXIT_FAILURE, sockfd, NULL); } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 69db734588..007a511adf 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -577,15 +577,24 @@ static void rpcReleaseConn(SRpcConn *pConn) { size_t size = snprintf(hashstr, sizeof(hashstr), "%x:%x:%x:%d", pConn->peerIp, pConn->linkUid, pConn->peerId, pConn->connType); taosHashRemove(pRpc->hash, hashstr, size); rpcFreeMsg(pConn->pRspMsg); // it may have a response msg saved, but not request msg - } + pConn->pRspMsg = NULL; - // lockedBy can not be reset, since it maybe hold by a thread - int sid = pConn->sid; - int64_t lockedBy = pConn->lockedBy; - memset(pConn, 0, sizeof(SRpcConn)); - pConn->lockedBy = lockedBy; - taosFreeId(pRpc->idPool, sid); + if (pConn->pReqMsg) rpcFreeCont(pConn->pReqMsg); + } + // memset could not be used, since lockeBy can not be reset + pConn->inType = 0; + pConn->outType = 0; + pConn->inTranId = 0; + pConn->outTranId = 0; + pConn->secured = 0; + pConn->peerIp = 0; + pConn->peerPort = 0; + pConn->pReqMsg = NULL; + pConn->reqMsgLen = 0; + pConn->pContext = NULL; + + taosFreeId(pRpc->idPool, pConn->sid); tTrace("%s, rpc connection is released", pConn->info); } @@ -644,7 +653,6 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) { terrno = TSDB_CODE_RPC_MAX_SESSIONS; } else { pConn = pRpc->connList + sid; - memset(pConn, 0, sizeof(SRpcConn)); memcpy(pConn->user, pHead->user, tListLen(pConn->user)); pConn->pRpc = pRpc; pConn->sid = sid; @@ -885,6 +893,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) { static void rpcReportBrokenLinkToServer(SRpcConn *pConn) { SRpcInfo *pRpc = pConn->pRpc; + if (pConn->pReqMsg == NULL) return; // if there are pending request, notify the app rpcAddRef(pRpc); @@ -897,6 +906,8 @@ static void rpcReportBrokenLinkToServer(SRpcConn *pConn) { rpcMsg.handle = pConn; rpcMsg.msgType = pConn->inType; rpcMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + pConn->pReqMsg = NULL; + pConn->reqMsgLen = 0; if (pRpc->cfp) (*(pRpc->cfp))(&rpcMsg, NULL); } diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c index f9d306e625..889d38ff20 100644 --- a/src/util/src/tcompare.c +++ b/src/util/src/tcompare.c @@ -191,9 +191,7 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c break; } - str++; - - int32_t ret = WCSPatternMatch(&patterStr[i], str, wcslen(str), pInfo); + int32_t ret = WCSPatternMatch(&patterStr[i], ++str, size - n - 1, pInfo); if (ret != TSDB_PATTERN_NOMATCH) { return ret; } @@ -241,9 +239,11 @@ static int32_t compareFindStrInArray(const void* pLeft, const void* pRight) { static int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) { SPatternCompareInfo pInfo = {'%', '_'}; - + wchar_t pattern[128] = {0}; - memcpy(pattern, varDataVal(pRight), varDataLen(pRight)/TSDB_NCHAR_SIZE); + assert(TSDB_PATTERN_STRING_MAX_LEN < 128); + + memcpy(pattern, varDataVal(pRight), varDataLen(pRight)); assert(varDataLen(pRight) < 128); int32_t ret = WCSPatternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft)/TSDB_NCHAR_SIZE, &pInfo); diff --git a/src/util/src/tutil.c b/src/util/src/tutil.c index 4469ad79b1..150767643f 100644 --- a/src/util/src/tutil.c +++ b/src/util/src/tutil.c @@ -36,6 +36,7 @@ uint32_t taosRand(void) #else uint32_t taosRand(void) { +/* int fd; int seed; @@ -51,6 +52,8 @@ uint32_t taosRand(void) } return (uint32_t)seed; +*/ + return rand(); } #endif diff --git a/tests/pytest/query/queryJoin.py b/tests/pytest/query/queryJoin.py new file mode 100644 index 0000000000..b1a0aaed6b --- /dev/null +++ b/tests/pytest/query/queryJoin.py @@ -0,0 +1,128 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + print("======= Step 1 prepare data=========") + tdSql.execute( + "create table stb1 (ts timestamp, c1 int, c2 float) tags(t1 int, t2 binary(10), t3 nchar(10))") + tdSql.execute( + '''insert into tb1 using stb1 tags(1,'tb1', '表1') values ('2020-04-18 15:00:00.000', 1, 0.1) + ('2020-04-18 15:00:01.000', 1,0.1) ('2020-04-18 15:00:03.000', 3, 0.3) ('2020-04-18 15:00:04.000', 4,0.4)''') + tdSql.execute( + '''insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:00.000', 21, 2.1) + ('2020-04-18 15:00:01.000', 22,2.2) ('2020-04-18 15:00:02.000', 22, 2.1) ('2020-04-18 15:00:03.000', 23,2.2)''') + + tdSql.execute( + "create table stb_t (ts timestamp, temperature int, humidity float) tags(id int, name binary(10), dscrption nchar(10))") + tdSql.execute( + '''insert into tb_t1 using stb_t tags(1,'tb_t1', '温度表1') values ('2020-04-18 15:00:00.000', 25, 0.5) + ('2020-04-18 15:00:01.000', 25, 0.5) ('2020-04-18 15:00:02.000', 26, 0.7) ('2020-04-18 15:00:03.000', 27, 0.8)''') + tdSql.execute( + '''insert into tb_t2 using stb_t tags(2,'tb_t2', '温度表2') values ('2020-04-18 15:00:00.000', 33, 0.9) + ('2020-04-18 15:00:01.000', 35, 1.1) ('2020-04-18 15:00:03.000', 36, 1.3) ('2020-04-18 15:00:04.000', 37, 1.4)''') + + tdSql.execute( + "create table stb_p (ts timestamp, pressure float) tags(id int, name binary(10), dscrption nchar(10), location binary(20))") + tdSql.execute( + '''insert into tb_p1 using stb_p tags(1,'tb_p1', '压力计1', 'beijing') values ('2020-04-18 15:00:00.000', 76.6) + ('2020-04-18 15:00:01.000', 76.5) ('2020-04-18 15:00:01.500', 77.1) ('2020-04-18 15:00:02.000', 75.3) + ('2020-04-18 15:00:03.000', 75.1) ('2020-04-18 15:00:04.500', 77.3)''') + tdSql.execute( + '''insert into tb_p2 using stb_p tags(2,'tb_p2', '压力计2', 'shenzhen') values ('2020-04-18 14:59:59.000', 74.6) + ('2020-04-18 15:00:01.000', 74.5) ('2020-04-18 15:00:01.500', 73.6) ('2020-04-18 15:00:02.000', 74.5) + ('2020-04-18 15:00:02.500', 73.9) ('2020-04-18 15:00:03.000', 73.5)''') + + tdSql.execute( + "create table stb_v (ts timestamp, velocity float) tags(id int, name binary(10), dscrption nchar(10), location binary(20))") + tdSql.execute( + '''insert into tb_v1 using stb_v tags(1,'tb_v1', '速度计1', 'beijing ') values ('2020-04-18 15:00:00.000', 176.6) + ('2020-04-18 15:00:01.000', 176.5)''') + tdSql.execute( + '''insert into tb_v2 using stb_v tags(2,'tb_v2', '速度计2', 'shenzhen') values ('2020-04-18 15:00:00.000', 171.6) + ('2020-04-18 15:00:01.000', 171.5)''') + + # explicit join should not work + tdSql.error("select * from stb_p join stb_t on (stb_p.id = stb_t.id)") + tdSql.error("select * from tb1 join tb2 on (tb1.ts=tb2.ts)") + tdSql.error( + "select * from stb_p join stb_t on (stb_p.ts=stb_t.ts and stb_p.id = stb_t.id)") + + # alias should not work + tdSql.error("select * from stb_p p join stb_t t on (p.id = t.id)") + + # join queries + tdSql.query( + "select * from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + tdSql.checkRows(6) + + tdSql.query( + "select * from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id order by ts desc") + tdSql.checkColumnSorted(0, "desc") + + tdSql.error( + "select ts, pressure, temperature, id, dscrption from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + + tdSql.query("select stb_p.ts, pressure, stb_t.temperature, stb_p.id, stb_p.dscrption from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + tdSql.checkRows(6) + + tdSql.query("select stb_t.ts, stb_p.pressure, stb_t.temperature,stb_p.id,stb_p.dscrption from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + tdSql.checkRows(6) + + tdSql.error( + "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id group by name") + tdSql.error( + "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id group by stb_t.name") + tdSql.error( + "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id group by stb_t.id") + tdSql.error( + "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.name;") + tdSql.error( + "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.location = stb_t.name") + + tdSql.execute("alter table stb_t add tag pid int") + tdSql.execute("alter table tb_t1 set tag pid=2") + tdSql.execute("alter table tb_t2 set tag pid=1") + + tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.pid") + tdSql.checkRows(3) + + tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + tdSql.checkRows(6) + + tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id") + tdSql.checkRows(6) + + tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.pid, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id") + tdSql.checkRows(2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/script/general/parser/stream_on_sys.sim b/tests/script/general/parser/stream_on_sys.sim index 5170ddb036..5405e09256 100644 --- a/tests/script/general/parser/stream_on_sys.sim +++ b/tests/script/general/parser/stream_on_sys.sim @@ -22,12 +22,12 @@ $i = 0 sql use $db -sql create table cpustrm as select count(*), avg(cpu_taosd), max(cpu_taosd), min(cpu_taosd), avg(cpu_system), max(cpu_cores), min(cpu_cores), last(cpu_cores) from log.dn_192_168_0_1 interval(4s) sliding(2s) -sql create table memstrm as select count(*), avg(mem_taosd), max(mem_taosd), min(mem_taosd), avg(mem_system), first(mem_total), last(mem_total) from log.dn_192_168_0_1 interval(4s) sliding(2s) -sql create table diskstrm as select count(*), avg(disk_used), last(disk_used), avg(disk_total), first(disk_total) from log.dn_192_168_0_1 interval(4s) sliding(2s) -sql create table bandstrm as select count(*), avg(band_speed), last(band_speed) from log.dn_192_168_0_1 interval(4s) sliding(2s) -sql create table reqstrm as select count(*), avg(req_http), last(req_http), avg(req_select), last(req_select), avg(req_insert), last(req_insert) from log.dn_192_168_0_1 interval(4s) sliding(2s) -sql create table iostrm as select count(*), avg(io_read), last(io_read), avg(io_write), last(io_write) from log.dn_192_168_0_1 interval(4s) sliding(2s) +sql create table cpustrm as select count(*), avg(cpu_taosd), max(cpu_taosd), min(cpu_taosd), avg(cpu_system), max(cpu_cores), min(cpu_cores), last(cpu_cores) from log.dn1 interval(4s) sliding(2s) +sql create table memstrm as select count(*), avg(mem_taosd), max(mem_taosd), min(mem_taosd), avg(mem_system), first(mem_total), last(mem_total) from log.dn1 interval(4s) sliding(2s) +sql create table diskstrm as select count(*), avg(disk_used), last(disk_used), avg(disk_total), first(disk_total) from log.dn1 interval(4s) sliding(2s) +sql create table bandstrm as select count(*), avg(band_speed), last(band_speed) from log.dn1 interval(4s) sliding(2s) +sql create table reqstrm as select count(*), avg(req_http), last(req_http), avg(req_select), last(req_select), avg(req_insert), last(req_insert) from log.dn1 interval(4s) sliding(2s) +sql create table iostrm as select count(*), avg(io_read), last(io_read), avg(io_write), last(io_write) from log.dn1 interval(4s) sliding(2s) sleep 20000 sql select * from cpustrm if $rows <= 0 then diff --git a/tests/script/general/stream/new_stream.sim b/tests/script/general/stream/new_stream.sim index abc06faaef..001602079b 100644 --- a/tests/script/general/stream/new_stream.sim +++ b/tests/script/general/stream/new_stream.sim @@ -1,12 +1,11 @@ -#system sh/stop_dnodes.sh +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 0 +system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 +system sh/exec.sh -n dnode1 -s start -#system sh/deploy.sh -n dnode1 -i 1 -#system sh/cfg.sh -n dnode1 -c walLevel -v 0 -#system sh/cfg.sh -n dnode1 -c tableMetaKeepTimer -v 10 -#system sh/exec.sh -n dnode1 -s start - -#sleep 3000 +sleep 3000 sql connect print ======================== dnode1 start