Merge branch '3.0' into feat/TD-30813-2

This commit is contained in:
Minglei Jin 2024-09-04 10:14:37 +08:00
commit 270190b4ee
83 changed files with 2313 additions and 1287 deletions

3
.gitignore vendored
View File

@ -100,6 +100,9 @@ tests/examples/JDBC/JDBCDemo/.project
tests/examples/JDBC/JDBCDemo/.settings/ tests/examples/JDBC/JDBCDemo/.settings/
source/libs/parser/inc/sql.* source/libs/parser/inc/sql.*
tests/script/tmqResult.txt tests/script/tmqResult.txt
tests/system-test/case_to_run.txt
tests/develop-test/case_to_run.txt
tests/scripts/case_to_run.txt
tests/tmqResult.txt tests/tmqResult.txt
tests/script/jenkins/basic.txt tests/script/jenkins/basic.txt

View File

@ -422,6 +422,10 @@ pipeline {
mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID} mkdir -p ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}
echo "''' + env.FILE_CHANGED + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt echo "''' + env.FILE_CHANGED + '''" > ${WKDIR}/tmp/${BRANCH_NAME}_${BUILD_ID}/docs_changed.txt
''' '''
sh '''
cd ${WKC}/tests/parallel_test
./run_check_assert_container.sh -d ${WKDIR}
'''
sh ''' sh '''
date date
rm -rf ${WKC}/debug rm -rf ${WKC}/debug

View File

@ -321,7 +321,7 @@ if (${BUILD_WITH_ROCKSDB})
endif(${TD_DARWIN_ARM64}) endif(${TD_DARWIN_ARM64})
if (${TD_WINDOWS}) if (${TD_WINDOWS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
option(WITH_JNI "" OFF) option(WITH_JNI "" OFF)
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd") if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")
@ -370,7 +370,7 @@ if (${BUILD_WITH_ROCKSDB})
endif(${TD_DARWIN_ARM64}) endif(${TD_DARWIN_ARM64})
if (${TD_WINDOWS}) if (${TD_WINDOWS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4819 /std:c++17")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4819")
option(WITH_JNI "" OFF) option(WITH_JNI "" OFF)
if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd") if(CMAKE_C_FLAGS MATCHES "/MT" OR CMAKE_C_FLAGS MATCHES "/MTd")

View File

@ -121,6 +121,8 @@ void mndGenerateMachineCode();
void mndDumpSdb(); void mndDumpSdb();
void mndDeleteTrans();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -36,6 +36,7 @@ typedef struct SFuncExecEnv {
} SFuncExecEnv; } SFuncExecEnv;
typedef bool (*FExecGetEnv)(struct SFunctionNode *pFunc, SFuncExecEnv *pEnv); typedef bool (*FExecGetEnv)(struct SFunctionNode *pFunc, SFuncExecEnv *pEnv);
typedef void (*FExecCleanUp)(struct SqlFunctionCtx* pCtx);
typedef int32_t (*FExecInit)(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResultCellInfo); typedef int32_t (*FExecInit)(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResultCellInfo);
typedef int32_t (*FExecProcess)(struct SqlFunctionCtx *pCtx); typedef int32_t (*FExecProcess)(struct SqlFunctionCtx *pCtx);
typedef int32_t (*FExecFinalize)(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock); typedef int32_t (*FExecFinalize)(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock);
@ -54,6 +55,7 @@ typedef struct SFuncExecFuncs {
FExecProcess process; FExecProcess process;
FExecFinalize finalize; FExecFinalize finalize;
FExecCombine combine; FExecCombine combine;
FExecCleanUp cleanup;
processFuncByRow processFuncByRow; processFuncByRow processFuncByRow;
} SFuncExecFuncs; } SFuncExecFuncs;

View File

@ -16,10 +16,10 @@
#include "catalog.h" #include "catalog.h"
#include "clientInt.h" #include "clientInt.h"
#include "clientLog.h" #include "clientLog.h"
#include "scheduler.h"
#include "trpc.h"
#include "tglobal.h"
#include "clientMonitor.h" #include "clientMonitor.h"
#include "scheduler.h"
#include "tglobal.h"
#include "trpc.h"
typedef struct { typedef struct {
union { union {
@ -244,11 +244,9 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
goto _return; goto _return;
} }
TSC_ERR_JRET(catalogUpdateDBVgInfo(pCatalog, TSC_ERR_JRET(catalogUpdateDBVgInfo(
(rsp->useDbRsp->db[0] == 'i') ? pCatalog, (rsp->useDbRsp->db[0] == 'i') ? TSDB_PERFORMANCE_SCHEMA_DB : TSDB_INFORMATION_SCHEMA_DB,
TSDB_PERFORMANCE_SCHEMA_DB : rsp->useDbRsp->uid, vgInfo));
TSDB_INFORMATION_SCHEMA_DB,
rsp->useDbRsp->uid, vgInfo));
} }
} }
} }
@ -556,7 +554,6 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
} }
} }
taosHashRelease(pAppHbMgr->activeInfo, pReq); taosHashRelease(pAppHbMgr->activeInfo, pReq);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -609,8 +606,8 @@ static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) {
} }
pInst->monitorParas = pRsp.monitorParas; pInst->monitorParas = pRsp.monitorParas;
tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", tscDebug("[monitor] paras from hb, clusterId:%" PRIx64 " monitorParas threshold:%d scope:%d", pInst->clusterId,
pInst->clusterId, pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope); pRsp.monitorParas.tsSlowLogThreshold, pRsp.monitorParas.tsSlowLogScope);
if (rspNum) { if (rspNum) {
tscDebug("hb got %d rsp, %d empty rsp received before", rspNum, tscDebug("hb got %d rsp, %d empty rsp received before", rspNum,
@ -1108,7 +1105,8 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
if (clientHbMgr.appHbHash) { if (clientHbMgr.appHbHash) {
code = taosHashPut(clientHbMgr.appHbHash, &hbParam->clusterId, sizeof(uint64_t), NULL, 0); code = taosHashPut(clientHbMgr.appHbHash, &hbParam->clusterId, sizeof(uint64_t), NULL, 0);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId, tstrerror(code)); tscWarn("hbQueryHbReqHandle put clusterId failed, clusterId:%" PRIx64 ", error:%s", hbParam->clusterId,
tstrerror(code));
return code; return code;
} }
} }
@ -1261,7 +1259,7 @@ int32_t hbGatherAppInfo(void) {
SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, i); SAppHbMgr *pAppHbMgr = taosArrayGetP(clientHbMgr.appHbMgrs, i);
if (pAppHbMgr == NULL) continue; if (pAppHbMgr == NULL) continue;
int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId; int64_t clusterId = pAppHbMgr->pAppInstInfo->clusterId;
SAppHbReq *pApp = taosHashGet(clientHbMgr.appSummary, &clusterId, sizeof(clusterId)); SAppHbReq *pApp = taosHashGet(clientHbMgr.appSummary, &clusterId, sizeof(clusterId));
if (NULL == pApp) { if (NULL == pApp) {
(void)memcpy(&req.summary, &pAppHbMgr->pAppInstInfo->summary, sizeof(req.summary)); (void)memcpy(&req.summary, &pAppHbMgr->pAppInstInfo->summary, sizeof(req.summary));
@ -1303,8 +1301,7 @@ static void *hbThreadFunc(void *param) {
return NULL; return NULL;
} }
if (sz > 1 && !clientHbMgr.appHbHash) { if (sz > 1 && !clientHbMgr.appHbHash) {
clientHbMgr.appHbHash = clientHbMgr.appHbHash = taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_NO_LOCK);
taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), true, HASH_NO_LOCK);
if (NULL == clientHbMgr.appHbHash) { if (NULL == clientHbMgr.appHbHash) {
tscError("taosHashInit failed"); tscError("taosHashInit failed");
return NULL; return NULL;
@ -1324,13 +1321,13 @@ static void *hbThreadFunc(void *param) {
continue; continue;
} }
SClientHbBatchReq *pReq = NULL; SClientHbBatchReq *pReq = NULL;
int32_t code = hbGatherAllInfo(pAppHbMgr, &pReq); int32_t code = hbGatherAllInfo(pAppHbMgr, &pReq);
if (TSDB_CODE_SUCCESS != code || taosArrayGetP(clientHbMgr.appHbMgrs, i) == NULL) { if (TSDB_CODE_SUCCESS != code || taosArrayGetP(clientHbMgr.appHbMgrs, i) == NULL) {
terrno = code ? code : TSDB_CODE_OUT_OF_RANGE; terrno = code ? code : TSDB_CODE_OUT_OF_RANGE;
tFreeClientHbBatchReq(pReq); tFreeClientHbBatchReq(pReq);
continue; continue;
} }
int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq); int tlen = tSerializeSClientHbBatchReq(NULL, 0, pReq);
if (tlen == -1) { if (tlen == -1) {
tFreeClientHbBatchReq(pReq); tFreeClientHbBatchReq(pReq);
break; break;
@ -1368,9 +1365,8 @@ static void *hbThreadFunc(void *param) {
pInfo->requestObjRefId = 0; pInfo->requestObjRefId = 0;
SAppInstInfo *pAppInstInfo = pAppHbMgr->pAppInstInfo; SAppInstInfo *pAppInstInfo = pAppHbMgr->pAppInstInfo;
int64_t transporterId = 0;
SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp); SEpSet epSet = getEpSet_s(&pAppInstInfo->mgmtEp);
if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, &transporterId, pInfo)) { if (TSDB_CODE_SUCCESS != asyncSendMsgToServer(pAppInstInfo->pTransporter, &epSet, NULL, pInfo)) {
tscWarn("failed to async send msg to server"); tscWarn("failed to async send msg to server");
} }
tFreeClientHbBatchReq(pReq); tFreeClientHbBatchReq(pReq);
@ -1389,7 +1385,7 @@ static void *hbThreadFunc(void *param) {
} }
static int32_t hbCreateThread() { static int32_t hbCreateThread() {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
TdThreadAttr thAttr; TdThreadAttr thAttr;
TSC_ERR_JRET(taosThreadAttrInit(&thAttr)); TSC_ERR_JRET(taosThreadAttrInit(&thAttr));
TSC_ERR_JRET(taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE)); TSC_ERR_JRET(taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE));
@ -1467,9 +1463,9 @@ int32_t appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key, SAppHbMgr **pAppHbMg
TSC_ERR_JRET(taosThreadMutexLock(&clientHbMgr.lock)); TSC_ERR_JRET(taosThreadMutexLock(&clientHbMgr.lock));
if (taosArrayPush(clientHbMgr.appHbMgrs, &(*pAppHbMgr)) == NULL) { if (taosArrayPush(clientHbMgr.appHbMgrs, &(*pAppHbMgr)) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
(void)taosThreadMutexUnlock(&clientHbMgr.lock); (void)taosThreadMutexUnlock(&clientHbMgr.lock);
goto _return; goto _return;
} }
(*pAppHbMgr)->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1; (*pAppHbMgr)->idx = taosArrayGetSize(clientHbMgr.appHbMgrs) - 1;
TSC_ERR_JRET(taosThreadMutexUnlock(&clientHbMgr.lock)); TSC_ERR_JRET(taosThreadMutexUnlock(&clientHbMgr.lock));

View File

@ -1567,9 +1567,8 @@ int32_t taosConnectImpl(const char* user, const char* auth, const char* db, __ta
return code; return code;
} }
int64_t transporterId = 0; // int64_t transporterId = 0;
code = asyncSendMsgToServer((*pTscObj)->pAppInfo->pTransporter, &(*pTscObj)->pAppInfo->mgmtEp.epSet, &transporterId, code = asyncSendMsgToServer((*pTscObj)->pAppInfo->pTransporter, &(*pTscObj)->pAppInfo->mgmtEp.epSet, NULL, body);
body);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
destroyTscObj(*pTscObj); destroyTscObj(*pTscObj);
tscError("failed to send connect msg to server, code:%s", tstrerror(code)); tscError("failed to send connect msg to server, code:%s", tstrerror(code));

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ static struct {
#endif #endif
bool dumpConfig; bool dumpConfig;
bool dumpSdb; bool dumpSdb;
bool deleteTrans;
bool generateGrant; bool generateGrant;
bool memDbg; bool memDbg;
bool checkS3; bool checkS3;
@ -187,6 +188,8 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
} }
} else if (strcmp(argv[i], "-s") == 0) { } else if (strcmp(argv[i], "-s") == 0) {
global.dumpSdb = true; global.dumpSdb = true;
} else if (strcmp(argv[i], "-dTxn") == 0) {
global.deleteTrans = true;
} else if (strcmp(argv[i], "-E") == 0) { } else if (strcmp(argv[i], "-E") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
if (strlen(argv[++i]) >= PATH_MAX) { if (strlen(argv[++i]) >= PATH_MAX) {
@ -436,6 +439,22 @@ int mainWindows(int argc, char **argv) {
return 0; return 0;
} }
if (global.deleteTrans) {
TdFilePtr pFile;
if ((code = dmCheckRunning(tsDataDir, &pFile)) != 0) {
printf("failed to generate encrypt code since taosd is running, please stop it first, reason:%s",
tstrerror(code));
return code;
}
mndDeleteTrans();
taosCleanupCfg();
taosCloseLog();
taosCleanupArgs();
taosConvDestroy();
return 0;
}
osSetProcPath(argc, (char **)argv); osSetProcPath(argc, (char **)argv);
taosCleanupArgs(); taosCleanupArgs();

View File

@ -630,4 +630,30 @@ void mndDumpSdb() {
mInfo("dump sdb info success"); mInfo("dump sdb info success");
} }
void mndDeleteTrans() {
mInfo("start to dump sdb info to sdb.json");
char path[PATH_MAX * 2] = {0};
(void)snprintf(path, sizeof(path), "%s%smnode", tsDataDir, TD_DIRSEP);
SMsgCb msgCb = {0};
msgCb.reportStartupFp = reportStartup;
msgCb.sendReqFp = sendReq;
msgCb.sendSyncReqFp = sendSyncReq;
msgCb.sendRspFp = sendRsp;
msgCb.mgmt = (SMgmtWrapper *)(&msgCb); // hack
tmsgSetDefault(&msgCb);
(void)walInit(NULL);
(void)syncInit();
SMnodeOpt opt = {.msgCb = msgCb};
SMnode *pMnode = mndOpen(path, &opt);
if (pMnode == NULL) return;
(void)sdbWriteFileForDump(pMnode->pSdb);
mInfo("dump sdb info success");
}
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View File

@ -280,6 +280,7 @@ int32_t sdbReadFile(SSdb *pSdb);
*/ */
int32_t sdbWriteFile(SSdb *pSdb, int32_t delta); int32_t sdbWriteFile(SSdb *pSdb, int32_t delta);
int32_t sdbWriteFileForDump(SSdb *pSdb);
/** /**
* @brief Parse and write raw data to sdb, then free the pRaw object * @brief Parse and write raw data to sdb, then free the pRaw object
* *

View File

@ -381,7 +381,7 @@ int32_t sdbReadFile(SSdb *pSdb) {
return code; return code;
} }
static int32_t sdbWriteFileImp(SSdb *pSdb) { static int32_t sdbWriteFileImp(SSdb *pSdb, int32_t skip_type) {
int32_t code = 0; int32_t code = 0;
char tmpfile[PATH_MAX] = {0}; char tmpfile[PATH_MAX] = {0};
@ -409,6 +409,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
} }
for (int32_t i = SDB_MAX - 1; i >= 0; --i) { for (int32_t i = SDB_MAX - 1; i >= 0; --i) {
if (i == skip_type) continue;
SdbEncodeFp encodeFp = pSdb->encodeFps[i]; SdbEncodeFp encodeFp = pSdb->encodeFps[i];
if (encodeFp == NULL) continue; if (encodeFp == NULL) continue;
@ -550,7 +551,7 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
} }
} }
if (code == 0) { if (code == 0) {
code = sdbWriteFileImp(pSdb); code = sdbWriteFileImp(pSdb, -1);
} }
if (code == 0) { if (code == 0) {
if (pSdb->pWal != NULL) { if (pSdb->pWal != NULL) {
@ -566,6 +567,14 @@ int32_t sdbWriteFile(SSdb *pSdb, int32_t delta) {
return code; return code;
} }
int32_t sdbWriteFileForDump(SSdb *pSdb) {
int32_t code = 0;
code = sdbWriteFileImp(pSdb, 0);
return code;
}
int32_t sdbDeploy(SSdb *pSdb) { int32_t sdbDeploy(SSdb *pSdb) {
int32_t code = 0; int32_t code = 0;
code = sdbDeployData(pSdb); code = sdbDeployData(pSdb);

View File

@ -174,10 +174,14 @@ static void tRSmaInfoHashFreeNode(void *data) {
if ((pRSmaInfo = *(SRSmaInfo **)data)) { if ((pRSmaInfo = *(SRSmaInfo **)data)) {
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) { if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) {
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) {
smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__);
}
} }
if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) { if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) {
(void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); if (TSDB_CODE_SUCCESS != taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES)) {
smaError("failed to hash remove %s:%d", __FUNCTION__, __LINE__);
}
} }
(void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo); (void)tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo);
} }

View File

@ -50,10 +50,14 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
} }
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK}; STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
(void)taosArrayPush(pReader->tdbTbList, &pair1); if (NULL == taosArrayPush(pReader->tdbTbList, &pair1)) {
TAOS_CHECK_GOTO(terrno, NULL, _err);
}
STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT}; STablePair pair2 = {.tbl = pTq->pStreamMeta->pCheckpointDb, .type = SNAP_DATA_STREAM_TASK_CHECKPOINT};
(void)taosArrayPush(pReader->tdbTbList, &pair2); if (NULL == taosArrayPush(pReader->tdbTbList, &pair2)) {
TAOS_CHECK_GOTO(terrno, NULL, _err);
}
pReader->pos = 0; pReader->pos = 0;

View File

@ -678,14 +678,14 @@ int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) {
static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList, static int32_t tsdbCacheGetValuesFromRocks(STsdb *pTsdb, size_t numKeys, const char *const *ppKeysList,
size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) { size_t *pKeysListSizes, char ***pppValuesList, size_t **ppValuesListSizes) {
char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *)); char **valuesList = taosMemoryCalloc(numKeys, sizeof(char *));
if(!valuesList) return terrno; if (!valuesList) return terrno;
size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t)); size_t *valuesListSizes = taosMemoryCalloc(numKeys, sizeof(size_t));
if(!valuesListSizes) { if (!valuesListSizes) {
taosMemoryFreeClear(valuesList); taosMemoryFreeClear(valuesList);
return terrno; return terrno;
} }
char **errs = taosMemoryCalloc(numKeys, sizeof(char *)); char **errs = taosMemoryCalloc(numKeys, sizeof(char *));
if (!errs) { if (!errs) {
taosMemoryFreeClear(valuesList); taosMemoryFreeClear(valuesList);
taosMemoryFreeClear(valuesListSizes); taosMemoryFreeClear(valuesListSizes);
@ -1178,7 +1178,7 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
size_t *values_list_sizes = NULL; size_t *values_list_sizes = NULL;
char **errs = NULL; char **errs = NULL;
keys_list = taosMemoryCalloc(num_keys, sizeof(char *)); keys_list = taosMemoryCalloc(num_keys, sizeof(char *));
if(!keys_list) { if (!keys_list) {
(void)taosThreadMutexUnlock(&pTsdb->lruMutex); (void)taosThreadMutexUnlock(&pTsdb->lruMutex);
return terrno; return terrno;
} }
@ -1692,19 +1692,18 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
goto _exit; goto _exit;
} }
SLastCol lastCol = *pLastCol;
TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL));
LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter,
NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState); NULL, TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
if (status != TAOS_LRU_STATUS_OK) { if (status != TAOS_LRU_STATUS_OK) {
code = -1; code = -1;
} }
SLastCol lastCol = *pLastCol;
TAOS_CHECK_EXIT(tsdbCacheReallocSLastCol(&lastCol, NULL));
taosArraySet(pLastArray, idxKey->idx, &lastCol); taosArraySet(pLastArray, idxKey->idx, &lastCol);
taosArrayRemove(remainCols, j); taosArrayRemove(remainCols, j);
taosArrayRemove(ignoreFromRocks, j); taosArrayRemove(ignoreFromRocks, j);
} else { } else {
++j; ++j;
} }

View File

@ -4749,13 +4749,13 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi
if (pCond->suid != 0) { if (pCond->suid != 0) {
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1); pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pReader->info.suid, -1, 1);
if (pReader->info.pSchema == NULL) { if (pReader->info.pSchema == NULL) {
tsdbError("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr); tsdbWarn("failed to get table schema, suid:%" PRIu64 ", ver:-1, %s", pReader->info.suid, pReader->idStr);
} }
} else if (numOfTables > 0) { } else if (numOfTables > 0) {
STableKeyInfo* pKey = pTableList; STableKeyInfo* pKey = pTableList;
pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1); pReader->info.pSchema = metaGetTbTSchema(pReader->pTsdb->pVnode->pMeta, pKey->uid, -1, 1);
if (pReader->info.pSchema == NULL) { if (pReader->info.pSchema == NULL) {
tsdbError("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr); tsdbWarn("failed to get table schema, uid:%" PRIu64 ", ver:-1, %s", pKey->uid, pReader->idStr);
} }
} }

View File

@ -530,8 +530,7 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob* pJob,
pMsgSendInfo->msgInfo.handle = NULL; pMsgSendInfo->msgInfo.handle = NULL;
pMsgSendInfo->msgType = msgType; pMsgSendInfo->msgType = msgType;
int64_t transporterId = 0; code = asyncSendMsgToServer(pConn->pTrans, &pConn->mgmtEps, NULL, pMsgSendInfo);
code = asyncSendMsgToServer(pConn->pTrans, &pConn->mgmtEps, &transporterId, pMsgSendInfo);
pMsgSendInfo = NULL; pMsgSendInfo = NULL;
if (code) { if (code) {
ctgError("asyncSendMsgToSever failed, error: %s", tstrerror(code)); ctgError("asyncSendMsgToSever failed, error: %s", tstrerror(code));

View File

@ -82,7 +82,7 @@ int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pA
SAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAggOperatorInfo)); SAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -326,6 +326,9 @@ int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
} }
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
if (pCtx[k].fpSet.cleanup != NULL) {
pCtx[k].fpSet.cleanup(&pCtx[k]);
}
qError("%s aggregate function error happens, code: %s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code)); qError("%s aggregate function error happens, code: %s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code));
return code; return code;
} }
@ -536,7 +539,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
pAggSup->pResultRowHashTable = tSimpleHashInit(100, taosFastHash); pAggSup->pResultRowHashTable = tSimpleHashInit(100, taosFastHash);
if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) { if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
uint32_t defaultPgsz = 0; uint32_t defaultPgsz = 0;
@ -640,6 +643,9 @@ void applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pC
} }
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
if (pCtx[k].fpSet.cleanup != NULL) {
pCtx[k].fpSet.cleanup(&pCtx[k]);
}
qError("%s apply functions error, code: %s", GET_TASKID(taskInfo), tstrerror(code)); qError("%s apply functions error, code: %s", GET_TASKID(taskInfo), tstrerror(code));
taskInfo->code = code; taskInfo->code = code;
T_LONG_JMP(taskInfo->env, code); T_LONG_JMP(taskInfo->env, code);

View File

@ -107,7 +107,7 @@ int32_t createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandl
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -302,7 +302,7 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
SCountWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SCountWindowOperatorInfo)); SCountWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SCountWindowOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -68,7 +68,7 @@ int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
SEventWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SEventWindowOperatorInfo)); SEventWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SEventWindowOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -408,7 +408,7 @@ int32_t createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode* pExNo
SExchangeInfo* pInfo = taosMemoryCalloc(1, sizeof(SExchangeInfo)); SExchangeInfo* pInfo = taosMemoryCalloc(1, sizeof(SExchangeInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -322,13 +322,13 @@ int32_t prepareDataBlockBuf(SSDataBlock* pDataBlock, SColMatchInfo* pMatchInfo)
if (IS_VAR_DATA_TYPE(pItem->dataType.type)) { if (IS_VAR_DATA_TYPE(pItem->dataType.type)) {
pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes); pBlockInfo->pks[0].pData = taosMemoryCalloc(1, pInfoData->info.bytes);
if (pBlockInfo->pks[0].pData == NULL) { if (pBlockInfo->pks[0].pData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes); pBlockInfo->pks[1].pData = taosMemoryCalloc(1, pInfoData->info.bytes);
if (pBlockInfo->pks[1].pData == NULL) { if (pBlockInfo->pks[1].pData == NULL) {
taosMemoryFreeClear(pBlockInfo->pks[0].pData); taosMemoryFreeClear(pBlockInfo->pks[0].pData);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pBlockInfo->pks[0].nData = pInfoData->info.bytes; pBlockInfo->pks[0].nData = pInfoData->info.bytes;
@ -520,7 +520,6 @@ static EDealRes getColumn(SNode** pNode, void* pContext) {
static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) { static int32_t createResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) {
SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
if (pColumnData == NULL) { if (pColumnData == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
@ -759,7 +758,7 @@ int32_t getColInfoResultForGroupby(void* pVnode, SNodeList* group, STableListInf
keyBuf = taosMemoryCalloc(1, keyLen); keyBuf = taosMemoryCalloc(1, keyLen);
if (keyBuf == NULL) { if (keyBuf == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto end; goto end;
} }
@ -1981,7 +1980,7 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
SqlFunctionCtx* p = NULL; SqlFunctionCtx* p = NULL;
SqlFunctionCtx** pValCtx = taosMemoryCalloc(numOfOutput, POINTER_BYTES); SqlFunctionCtx** pValCtx = taosMemoryCalloc(numOfOutput, POINTER_BYTES);
if (pValCtx == NULL) { if (pValCtx == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); SHashObj* pSelectFuncs = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);

View File

@ -1220,7 +1220,6 @@ int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* s
if (pCond->colList == NULL || pCond->pSlotList == NULL) { if (pCond->colList == NULL || pCond->pSlotList == NULL) {
taosMemoryFreeClear(pCond->colList); taosMemoryFreeClear(pCond->colList);
taosMemoryFreeClear(pCond->pSlotList); taosMemoryFreeClear(pCond->pSlotList);
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }

View File

@ -421,7 +421,7 @@ static int32_t doCreateConstantValColumnSMAInfo(SInputColumnInfoData* pInput, SF
if (pInput->pData[paramIndex] == NULL) { if (pInput->pData[paramIndex] == NULL) {
pInput->pData[paramIndex] = taosMemoryCalloc(1, sizeof(SColumnInfoData)); pInput->pData[paramIndex] = taosMemoryCalloc(1, sizeof(SColumnInfoData));
if (pInput->pData[paramIndex] == NULL) { if (pInput->pData[paramIndex] == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
// Set the correct column info (data type and bytes) // Set the correct column info (data type and bytes)
@ -1092,7 +1092,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: { case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT: {
SInserterParam* pInserterParam = taosMemoryCalloc(1, sizeof(SInserterParam)); SInserterParam* pInserterParam = taosMemoryCalloc(1, sizeof(SInserterParam));
if (NULL == pInserterParam) { if (NULL == pInserterParam) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pInserterParam->readHandle = readHandle; pInserterParam->readHandle = readHandle;
@ -1102,7 +1102,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo*
case QUERY_NODE_PHYSICAL_PLAN_DELETE: { case QUERY_NODE_PHYSICAL_PLAN_DELETE: {
SDeleterParam* pDeleterParam = taosMemoryCalloc(1, sizeof(SDeleterParam)); SDeleterParam* pDeleterParam = taosMemoryCalloc(1, sizeof(SDeleterParam));
if (NULL == pDeleterParam) { if (NULL == pDeleterParam) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SArray* pInfoList = NULL; SArray* pInfoList = NULL;

View File

@ -430,7 +430,7 @@ int32_t createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pPhyFi
SFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SFillOperatorInfo)); SFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SFillOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -1298,7 +1298,7 @@ static int32_t initGroupCacheExecInfo(SOperatorInfo* pOperator) {
SGroupCacheOperatorInfo* pInfo = pOperator->info; SGroupCacheOperatorInfo* pInfo = pOperator->info;
pInfo->execInfo.pDownstreamBlkNum = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(int64_t)); pInfo->execInfo.pDownstreamBlkNum = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(int64_t));
if (NULL == pInfo->execInfo.pDownstreamBlkNum) { if (NULL == pInfo->execInfo.pDownstreamBlkNum) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1342,7 +1342,7 @@ static int32_t initGroupCacheDownstreamCtx(SOperatorInfo* pOperator) {
SGroupCacheOperatorInfo* pInfo = pOperator->info; SGroupCacheOperatorInfo* pInfo = pOperator->info;
pInfo->pDownstreams = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(*pInfo->pDownstreams)); pInfo->pDownstreams = taosMemoryCalloc(pOperator->numOfDownstream, sizeof(*pInfo->pDownstreams));
if (NULL == pInfo->pDownstreams) { if (NULL == pInfo->pDownstreams) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pInfo->downstreamNum = pOperator->numOfDownstream; pInfo->downstreamNum = pOperator->numOfDownstream;
@ -1450,7 +1450,7 @@ int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfD
SGroupCacheOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupCacheOperatorInfo)); SGroupCacheOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupCacheOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pOperator == NULL || pInfo == NULL) { if (pOperator == NULL || pInfo == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -112,7 +112,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
key.isNull = false; key.isNull = false;
key.pData = taosMemoryCalloc(1, pCol->bytes); key.pData = taosMemoryCalloc(1, pCol->bytes);
if (key.pData == NULL) { if (key.pData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
void* tmp = taosArrayPush((*pGroupColVals), &key); void* tmp = taosArrayPush((*pGroupColVals), &key);
@ -126,7 +126,7 @@ static int32_t initGroupOptrInfo(SArray** pGroupColVals, int32_t* keyLen, char**
(*keyBuf) = taosMemoryCalloc(1, (*keyLen)); (*keyBuf) = taosMemoryCalloc(1, (*keyLen));
if ((*keyBuf) == NULL) { if ((*keyBuf) == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -1675,7 +1675,7 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart
SStreamPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamPartitionOperatorInfo)); SStreamPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamPartitionOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -388,7 +388,7 @@ static int32_t hJoinBuildResColsMap(SHJoinOperatorInfo* pInfo, SHashJoinPhysiNod
pInfo->pResColNum = pJoinNode->pTargets->length; pInfo->pResColNum = pJoinNode->pTargets->length;
pInfo->pResColMap = taosMemoryCalloc(pJoinNode->pTargets->length, sizeof(int8_t)); pInfo->pResColMap = taosMemoryCalloc(pJoinNode->pTargets->length, sizeof(int8_t));
if (NULL == pInfo->pResColMap) { if (NULL == pInfo->pResColMap) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SNode* pNode = NULL; SNode* pNode = NULL;
@ -1188,7 +1188,7 @@ int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDow
SHJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SHJoinOperatorInfo)); SHJoinOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SHJoinOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pOperator == NULL || pInfo == NULL) { if (pOperator == NULL || pInfo == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _return; goto _return;
} }

View File

@ -1919,10 +1919,10 @@ _return:
if (pInfo != NULL) { if (pInfo != NULL) {
destroyMergeJoinOperator(pInfo); destroyMergeJoinOperator(pInfo);
} }
destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum);
if (newDownstreams) { if (newDownstreams) {
taosMemoryFree(pDownstream); taosMemoryFree(pDownstream);
} }
destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum);
pTaskInfo->code = code; pTaskInfo->code = code;
return code; return code;

View File

@ -565,7 +565,7 @@ int32_t createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size_t numS
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
SDataBlockDescNode* pDescNode = pPhyNode->pOutputDataBlockDesc; SDataBlockDescNode* pDescNode = pPhyNode->pOutputDataBlockDesc;
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -63,7 +63,7 @@ int32_t optrDummyOpenFn(SOperatorInfo* pOperator) {
int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num) { int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num) {
p->pDownstream = taosMemoryCalloc(1, num * POINTER_BYTES); p->pDownstream = taosMemoryCalloc(1, num * POINTER_BYTES);
if (p->pDownstream == NULL) { if (p->pDownstream == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
memcpy(p->pDownstream, pDownstream, num * POINTER_BYTES); memcpy(p->pDownstream, pDownstream, num * POINTER_BYTES);
@ -824,7 +824,7 @@ int32_t setOperatorParams(struct SOperatorInfo* pOperator, SOperatorParam* pInpu
if (NULL == *pppDownstramParam) { if (NULL == *pppDownstramParam) {
*pppDownstramParam = taosMemoryCalloc(pOperator->numOfDownstream, POINTER_BYTES); *pppDownstramParam = taosMemoryCalloc(pOperator->numOfDownstream, POINTER_BYTES);
if (NULL == *pppDownstramParam) { if (NULL == *pppDownstramParam) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }

View File

@ -99,7 +99,7 @@ int32_t createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhysiNode*
SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo)); SProjectOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SProjectOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -450,7 +450,7 @@ int32_t createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo)); SIndefOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIndefOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -1057,6 +1057,9 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
code = pfCtx->fpSet.process(pfCtx); code = pfCtx->fpSet.process(pfCtx);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
if (pCtx[k].fpSet.cleanup != NULL) {
pCtx[k].fpSet.cleanup(&pCtx[k]);
}
goto _exit; goto _exit;
} }

View File

@ -43,7 +43,7 @@ int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC
SExecTaskInfo* p = taosMemoryCalloc(1, sizeof(SExecTaskInfo)); SExecTaskInfo* p = taosMemoryCalloc(1, sizeof(SExecTaskInfo));
if (p == NULL) { if (p == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
setTaskStatus(p, TASK_NOT_COMPLETED); setTaskStatus(p, TASK_NOT_COMPLETED);
@ -217,6 +217,7 @@ SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema)); pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
if (pqSw->pSchema == NULL) { if (pqSw->pSchema == NULL) {
taosMemoryFree(pqSw);
return NULL; return NULL;
} }

View File

@ -1450,7 +1450,7 @@ int32_t createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SReadHa
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo)); STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -1549,7 +1549,7 @@ int32_t createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pTaskIn
STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo)); STableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _end; goto _end;
} }
@ -3120,7 +3120,7 @@ int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff, int32_t*
len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup);
*pBuff = taosMemoryCalloc(1, len); *pBuff = taosMemoryCalloc(1, len);
if (!(*pBuff)) { if (!(*pBuff)) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
void* buf = *pBuff; void* buf = *pBuff;
@ -3840,7 +3840,7 @@ int32_t createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pTaskInfo
SStreamRawScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamRawScanInfo)); SStreamRawScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamRawScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
lino = __LINE__; lino = __LINE__;
goto _end; goto _end;
} }
@ -3923,7 +3923,7 @@ void streamScanReleaseState(SOperatorInfo* pOperator) {
pBuff = taosMemoryCalloc(1, len); pBuff = taosMemoryCalloc(1, len);
if (!pBuff) { if (!pBuff) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -3959,7 +3959,7 @@ void streamScanReloadState(SOperatorInfo* pOperator) {
SUpdateInfo* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); SUpdateInfo* pUpInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
if (!pUpInfo) { if (!pUpInfo) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -4036,7 +4036,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
const char* idstr = pTaskInfo->id.str; const char* idstr = pTaskInfo->id.str;
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -4339,7 +4339,6 @@ static void tagScanFreeUidTag(void* p) {
static int32_t tagScanCreateResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) { static int32_t tagScanCreateResultData(SDataType* pType, int32_t numOfRows, SScalarParam* pParam) {
SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); SColumnInfoData* pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
if (pColumnData == NULL) { if (pColumnData == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
@ -4748,7 +4747,7 @@ int32_t createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysiNode* p
STagScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STagScanInfo)); STagScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STagScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -5028,7 +5027,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
} }
STmsSubTablesMergeInfo* pSubTblsInfo = taosMemoryCalloc(1, sizeof(STmsSubTablesMergeInfo)); STmsSubTablesMergeInfo* pSubTblsInfo = taosMemoryCalloc(1, sizeof(STmsSubTablesMergeInfo));
if (pSubTblsInfo == NULL) { if (pSubTblsInfo == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
pSubTblsInfo->pTsOrderInfo = taosArrayGet(pInfo->pSortInfo, 0); pSubTblsInfo->pTsOrderInfo = taosArrayGet(pInfo->pSortInfo, 0);
if (!pSubTblsInfo->pTsOrderInfo) { if (!pSubTblsInfo->pTsOrderInfo) {
@ -5048,7 +5047,7 @@ static int32_t initSubTablesMergeInfo(STableMergeScanInfo* pInfo) {
pSubTblsInfo->aInputs = taosMemoryCalloc(pSubTblsInfo->numSubTables, sizeof(STmsSubTableInput)); pSubTblsInfo->aInputs = taosMemoryCalloc(pSubTblsInfo->numSubTables, sizeof(STmsSubTableInput));
if (pSubTblsInfo->aInputs == NULL) { if (pSubTblsInfo->aInputs == NULL) {
taosMemoryFree(pSubTblsInfo); taosMemoryFree(pSubTblsInfo);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t bufPageSize = pInfo->bufPageSize; int32_t bufPageSize = pInfo->bufPageSize;
int32_t inMemSize = (pSubTblsInfo->numSubTables - pSubTblsInfo->numTableBlocksInMem) * bufPageSize; int32_t inMemSize = (pSubTblsInfo->numSubTables - pSubTblsInfo->numTableBlocksInMem) * bufPageSize;
@ -5973,7 +5972,7 @@ int32_t createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SR
STableMergeScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableMergeScanInfo)); STableMergeScanInfo* pInfo = taosMemoryCalloc(1, sizeof(STableMergeScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -6216,7 +6215,7 @@ int32_t createTableCountScanOperatorInfo(SReadHandle* readHandle, STableCountSca
STableCountScanOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STableCountScanOperatorInfo)); STableCountScanOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(STableCountScanOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (!pInfo || !pOperator) { if (!pInfo || !pOperator) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -63,7 +63,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN
SSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortOperatorInfo)); SSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -108,7 +108,7 @@ int32_t createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pSortN
int32_t keyLen; int32_t keyLen;
SSortOpGroupIdCalc* pGroupIdCalc = pInfo->pGroupIdCalc = taosMemoryCalloc(1, sizeof(SSortOpGroupIdCalc)); SSortOpGroupIdCalc* pGroupIdCalc = pInfo->pGroupIdCalc = taosMemoryCalloc(1, sizeof(SSortOpGroupIdCalc));
if (!pGroupIdCalc) { if (!pGroupIdCalc) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
SNodeList* pSortColsNodeArr = makeColsNodeArrFromSortKeys(pSortNode->pSortKeys); SNodeList* pSortColsNodeArr = makeColsNodeArrFromSortKeys(pSortNode->pSortKeys);
@ -784,7 +784,7 @@ int32_t createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNo
SGroupSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupSortOperatorInfo)); SGroupSortOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SGroupSortOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -484,7 +484,7 @@ void doStreamCountSaveCheckpoint(SOperatorInfo* pOperator) {
int32_t len = doStreamCountEncodeOpState(NULL, 0, pOperator, true); int32_t len = doStreamCountEncodeOpState(NULL, 0, pOperator, true);
pBuf = taosMemoryCalloc(1, len); pBuf = taosMemoryCalloc(1, len);
if (!pBuf) { if (!pBuf) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
void* pTmpBuf = pBuf; void* pTmpBuf = pBuf;
@ -816,7 +816,7 @@ int32_t createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo)); SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }

View File

@ -867,7 +867,7 @@ int32_t createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
SStreamEventAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamEventAggOperatorInfo)); SStreamEventAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamEventAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -1189,7 +1189,7 @@ static SStreamFillSupporter* initStreamFillSup(SStreamFillPhysiNode* pPhyFillNod
int32_t lino = 0; int32_t lino = 0;
SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter)); SStreamFillSupporter* pFillSup = taosMemoryCalloc(1, sizeof(SStreamFillSupporter));
if (!pFillSup) { if (!pFillSup) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
pFillSup->numOfFillCols = numOfFillCols; pFillSup->numOfFillCols = numOfFillCols;
@ -1242,7 +1242,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
int32_t lino = 0; int32_t lino = 0;
SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo)); SStreamFillInfo* pFillInfo = taosMemoryCalloc(1, sizeof(SStreamFillInfo));
if (!pFillInfo) { if (!pFillInfo) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -1253,7 +1253,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
pFillInfo->needFill = false; pFillInfo->needFill = false;
pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo)); pFillInfo->pLinearInfo = taosMemoryCalloc(1, sizeof(SStreamFillLinearInfo));
if (!pFillInfo) { if (!pFillInfo) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -1279,7 +1279,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
SPoint value = {0}; SPoint value = {0};
value.val = taosMemoryCalloc(1, pColData->info.bytes); value.val = taosMemoryCalloc(1, pColData->info.bytes);
if (!value.val) { if (!value.val) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -1291,7 +1291,7 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
value.val = taosMemoryCalloc(1, pColData->info.bytes); value.val = taosMemoryCalloc(1, pColData->info.bytes);
if (!value.val) { if (!value.val) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -1309,14 +1309,14 @@ SStreamFillInfo* initStreamFillInfo(SStreamFillSupporter* pFillSup, SSDataBlock*
pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) { pFillSup->type == TSDB_FILL_NULL || pFillSup->type == TSDB_FILL_NULL_F) {
pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData)); pFillInfo->pResRow = taosMemoryCalloc(1, sizeof(SResultRowData));
if (!pFillInfo->pResRow) { if (!pFillInfo->pResRow) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
pFillInfo->pResRow->key = INT64_MIN; pFillInfo->pResRow->key = INT64_MIN;
pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize); pFillInfo->pResRow->pRowVal = taosMemoryCalloc(1, pFillSup->rowSize);
if (!pFillInfo->pResRow->pRowVal) { if (!pFillInfo->pResRow->pRowVal) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _end); QUERY_CHECK_CODE(code, lino, _end);
} }
@ -1356,7 +1356,7 @@ int32_t createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFillPhysi
SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo)); SStreamFillOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamFillOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }

View File

@ -1884,7 +1884,7 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN
SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo)); SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
@ -3753,7 +3753,7 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode
SStreamSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamSessionAggOperatorInfo)); SStreamSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamSessionAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -4931,7 +4931,7 @@ int32_t createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
SStreamStateAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamStateAggOperatorInfo)); SStreamStateAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamStateAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }
@ -5247,7 +5247,7 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo)); SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
QUERY_CHECK_CODE(code, lino, _error); QUERY_CHECK_CODE(code, lino, _error);
} }

View File

@ -2236,7 +2236,7 @@ int32_t createSysTableScanOperatorInfo(void* readHandle, SSystemTableScanPhysiNo
SSysTableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SSysTableScanInfo)); SSysTableScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SSysTableScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
lino = __LINE__; lino = __LINE__;
goto _error; goto _error;
} }
@ -2832,7 +2832,6 @@ static int32_t initTableblockDistQueryCond(uint64_t uid, SQueryTableDataCond* pC
pCond->colList = taosMemoryCalloc(1, sizeof(SColumnInfo)); pCond->colList = taosMemoryCalloc(1, sizeof(SColumnInfo));
pCond->pSlotList = taosMemoryMalloc(sizeof(int32_t)); pCond->pSlotList = taosMemoryMalloc(sizeof(int32_t));
if (pCond->colList == NULL || pCond->pSlotList == NULL) { if (pCond->colList == NULL || pCond->pSlotList == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
@ -2862,7 +2861,7 @@ int32_t createDataBlockInfoScanOperator(SReadHandle* readHandle, SBlockDistScanP
SBlockDistInfo* pInfo = taosMemoryCalloc(1, sizeof(SBlockDistInfo)); SBlockDistInfo* pInfo = taosMemoryCalloc(1, sizeof(SBlockDistInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
pTaskInfo->code = code = TSDB_CODE_OUT_OF_MEMORY; pTaskInfo->code = code = terrno;
goto _error; goto _error;
} }

View File

@ -652,7 +652,7 @@ static int32_t initGroupKeyKeeper(STimeSliceOperatorInfo* pInfo, SExprSupp* pExp
pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys)); pInfo->pPrevGroupKey = taosMemoryCalloc(1, sizeof(SGroupKeys));
if (pInfo->pPrevGroupKey == NULL) { if (pInfo->pPrevGroupKey == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) { for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) {
@ -1112,7 +1112,7 @@ int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyN
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pOperator == NULL || pInfo == NULL) { if (pOperator == NULL || pInfo == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -1327,7 +1327,7 @@ int32_t createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode
SIntervalAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIntervalAggOperatorInfo)); SIntervalAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SIntervalAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -1623,7 +1623,7 @@ int32_t createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWinodwPhy
SStateWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStateWindowOperatorInfo)); SStateWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStateWindowOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -1734,7 +1734,7 @@ int32_t createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionWinodwPh
SSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSessionAggOperatorInfo)); SSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SSessionAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) { if (pInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -2034,7 +2034,7 @@ int32_t createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, SMerge
SMergeAlignedIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeAlignedIntervalAggOperatorInfo)); SMergeAlignedIntervalAggOperatorInfo* miaInfo = taosMemoryCalloc(1, sizeof(SMergeAlignedIntervalAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (miaInfo == NULL || pOperator == NULL) { if (miaInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }
@ -2372,7 +2372,7 @@ int32_t createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMergeInterva
SMergeIntervalAggOperatorInfo* pMergeIntervalInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo)); SMergeIntervalAggOperatorInfo* pMergeIntervalInfo = taosMemoryCalloc(1, sizeof(SMergeIntervalAggOperatorInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pMergeIntervalInfo == NULL || pOperator == NULL) { if (pMergeIntervalInfo == NULL || pOperator == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _error; goto _error;
} }

View File

@ -260,7 +260,7 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) {
SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_t numOfTuplePerPage) { SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_t numOfTuplePerPage) {
SLHashObj* pHashObj = taosMemoryCalloc(1, sizeof(SLHashObj)); SLHashObj* pHashObj = taosMemoryCalloc(1, sizeof(SLHashObj));
if (pHashObj == NULL) { if (pHashObj == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = terrno;
return NULL; return NULL;
} }

View File

@ -1357,7 +1357,7 @@ static int32_t createSortMemFile(SSortHandle* pHandle) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SSortMemFile* pMemFile = taosMemoryCalloc(1, sizeof(SSortMemFile)); SSortMemFile* pMemFile = taosMemoryCalloc(1, sizeof(SSortMemFile));
if (pMemFile == NULL) { if (pMemFile == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
} }
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath); taosGetTmpfilePath(tsTempDir, "sort-ext-mem", pMemFile->memFilePath);

View File

@ -40,6 +40,7 @@ typedef struct SBuiltinFuncDefinition {
FExecProcess processFunc; FExecProcess processFunc;
FScalarExecProcess sprocessFunc; FScalarExecProcess sprocessFunc;
FExecFinalize finalizeFunc; FExecFinalize finalizeFunc;
FExecCleanUp cleanupFunc;
#ifdef BUILD_NO_CALL #ifdef BUILD_NO_CALL
FExecProcess invertFunc; FExecProcess invertFunc;
#endif #endif

View File

@ -239,6 +239,7 @@ bool getModeFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo); int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo);
int32_t modeFunction(SqlFunctionCtx* pCtx); int32_t modeFunction(SqlFunctionCtx* pCtx);
int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
void modeFunctionCleanupExt(SqlFunctionCtx* pCtx);
bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv); bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
int32_t twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo); int32_t twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo);

View File

@ -3658,6 +3658,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.processFunc = modeFunction, .processFunc = modeFunction,
.sprocessFunc = modeScalarFunction, .sprocessFunc = modeScalarFunction,
.finalizeFunc = modeFinalize, .finalizeFunc = modeFinalize,
.cleanupFunc = modeFunctionCleanupExt
}, },
{ {
.name = "abs", .name = "abs",

View File

@ -6019,6 +6019,12 @@ static void modeFunctionCleanup(SModeInfo * pInfo) {
taosMemoryFreeClear(pInfo->buf); taosMemoryFreeClear(pInfo->buf);
} }
void modeFunctionCleanupExt(SqlFunctionCtx* pCtx) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SModeInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo);
modeFunctionCleanup(pInfo);
}
static int32_t saveModeTupleData(SqlFunctionCtx* pCtx, char* data, SModeInfo *pInfo, STuplePos* pPos) { static int32_t saveModeTupleData(SqlFunctionCtx* pCtx, char* data, SModeInfo *pInfo, STuplePos* pPos) {
if (IS_VAR_DATA_TYPE(pInfo->colType)) { if (IS_VAR_DATA_TYPE(pInfo->colType)) {
(void)memcpy(pInfo->buf, data, varDataTLen(data)); (void)memcpy(pInfo->buf, data, varDataTLen(data));

View File

@ -142,6 +142,7 @@ int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet) {
pFpSet->finalize = funcMgtBuiltins[funcId].finalizeFunc; pFpSet->finalize = funcMgtBuiltins[funcId].finalizeFunc;
pFpSet->combine = funcMgtBuiltins[funcId].combineFunc; pFpSet->combine = funcMgtBuiltins[funcId].combineFunc;
pFpSet->processFuncByRow = funcMgtBuiltins[funcId].processFuncByRow; pFpSet->processFuncByRow = funcMgtBuiltins[funcId].processFuncByRow;
pFpSet->cleanup = funcMgtBuiltins[funcId].cleanupFunc;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -409,16 +409,19 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
if (pCxt->currLevel == currTotalLevel) { if (pCxt->currLevel == currTotalLevel) {
(void)taosArrayPush(pTables, &pTable); if (NULL == taosArrayPush(pTables, &pTable)) {
taosArrayDestroy(pTables);
return terrno;
}
if (hasSameTableAlias(pTables)) { if (hasSameTableAlias(pTables)) {
(void)taosArrayDestroy(pTables); taosArrayDestroy(pTables);
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS, return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
"Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias); "Not unique table/alias: '%s'", ((STableNode*)pTable)->tableAlias);
} }
} }
if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) { if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
(void)taosArrayDestroy(pTables); taosArrayDestroy(pTables);
break; break;
} }
++currTotalLevel; ++currTotalLevel;
@ -820,7 +823,7 @@ static int32_t resetHighLevelTranslateNamespace(STranslateContext* pCxt) {
} }
for (int32_t i = size - 1; i >= pCxt->currLevel; --i) { for (int32_t i = size - 1; i >= pCxt->currLevel; --i) {
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
} }
taosArrayPopTailBatch(pCxt->pNsLevel, levelNum); taosArrayPopTailBatch(pCxt->pNsLevel, levelNum);
@ -837,9 +840,9 @@ static int32_t resetTranslateNamespace(STranslateContext* pCxt) {
if (NULL != pCxt->pNsLevel) { if (NULL != pCxt->pNsLevel) {
size_t size = taosArrayGetSize(pCxt->pNsLevel); size_t size = taosArrayGetSize(pCxt->pNsLevel);
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
} }
(void)taosArrayDestroy(pCxt->pNsLevel); taosArrayDestroy(pCxt->pNsLevel);
} }
pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES); pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
if (NULL == pCxt->pNsLevel) { if (NULL == pCxt->pNsLevel) {
@ -852,9 +855,9 @@ static void destroyTranslateContext(STranslateContext* pCxt) {
if (NULL != pCxt->pNsLevel) { if (NULL != pCxt->pNsLevel) {
size_t size = taosArrayGetSize(pCxt->pNsLevel); size_t size = taosArrayGetSize(pCxt->pNsLevel);
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
(void)taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i));
} }
(void)taosArrayDestroy(pCxt->pNsLevel); taosArrayDestroy(pCxt->pNsLevel);
} }
if (NULL != pCxt->pCmdMsg) { if (NULL != pCxt->pCmdMsg) {
@ -1208,7 +1211,9 @@ static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SCo
SAssociationNode assNode; SAssociationNode assNode;
assNode.pPlace = (SNode**)pColRef; assNode.pPlace = (SNode**)pColRef;
assNode.pAssociationNode = (SNode*)*pColRef; assNode.pAssociationNode = (SNode*)*pColRef;
(void)taosArrayPush(pExpr->pAssociation, &assNode); if (NULL == taosArrayPush(pExpr->pAssociation, &assNode)) {
return terrno;
}
strcpy(pCol->tableAlias, pTable->table.tableAlias); strcpy(pCol->tableAlias, pTable->table.tableAlias);
pCol->isPrimTs = isPrimaryKeyImpl((SNode*)pExpr); pCol->isPrimTs = isPrimaryKeyImpl((SNode*)pExpr);
@ -3882,7 +3887,7 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = toVgroupsInfo(pVgs, &pRealTable->pVgroupList); code = toVgroupsInfo(pVgs, &pRealTable->pVgroupList);
} }
(void)taosArrayDestroy(pVgs); taosArrayDestroy(pVgs);
return code; return code;
} }
@ -3893,7 +3898,7 @@ static int32_t setDnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList); code = dnodeToVgroupsInfo(pDnodes, &pRealTable->pVgroupList);
} }
(void)taosArrayDestroy(pDnodes); taosArrayDestroy(pDnodes);
return code; return code;
} }
@ -3913,7 +3918,7 @@ static int32_t setSuperTableVgroupList(STranslateContext* pCxt, SName* pName, SR
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList); code = toVgroupsInfo(vgroupList, &pRealTable->pVgroupList);
} }
(void)taosArrayDestroy(vgroupList); taosArrayDestroy(vgroupList);
return code; return code;
} }
@ -4033,7 +4038,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
} }
pVgpsInfo->numOfVgroups = 1; pVgpsInfo->numOfVgroups = 1;
pVgpsInfo->vgroups[0] = vgInfo; pVgpsInfo->vgroups[0] = vgInfo;
(void)taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo); if (NULL == taosArrayPush(pRealTable->tsmaTargetTbVgInfo, &pVgpsInfo)) {
code = terrno;
break;
}
} else { } else {
break; break;
} }
@ -4062,7 +4070,10 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
// ignore table not exists error // ignore table not exists error
code = TSDB_CODE_SUCCESS; code = TSDB_CODE_SUCCESS;
} }
(void)taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo); if (NULL == taosArrayPush(pRealTable->tsmaTargetTbInfo, &ctbInfo)) {
code = terrno;
break;
}
} }
} }
} }
@ -5991,20 +6002,28 @@ static int32_t isOperatorEqTbnameCond(STranslateContext* pCxt, SOperatorNode* pO
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
char* pTableAlias = NULL;
if (LIST_LENGTH(pTbnameFunc->pParameterList) == 0) { if (LIST_LENGTH(pTbnameFunc->pParameterList) == 0) {
*ppTableAlias = NULL;
} else if (LIST_LENGTH(pTbnameFunc->pParameterList) == 1) { } else if (LIST_LENGTH(pTbnameFunc->pParameterList) == 1) {
SNode* pQualNode = nodesListGetNode(pTbnameFunc->pParameterList, 0); SNode* pQualNode = nodesListGetNode(pTbnameFunc->pParameterList, 0);
if (nodeType(pQualNode) != QUERY_NODE_VALUE) return false; if (nodeType(pQualNode) != QUERY_NODE_VALUE) return false;
SValueNode* pQualValNode = (SValueNode*)pQualNode; SValueNode* pQualValNode = (SValueNode*)pQualNode;
*ppTableAlias = pQualValNode->literal; pTableAlias = pQualValNode->literal;
} else { } else {
*pRet = false; *pRet = false;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
*ppTabNames = taosArrayInit(1, sizeof(void*)); SArray* pTabNames = NULL;
if (!*ppTabNames) return TSDB_CODE_OUT_OF_MEMORY; pTabNames = taosArrayInit(1, sizeof(void*));
(void)taosArrayPush(*ppTabNames, &(pValueNode->literal)); if (!pTabNames) {
return terrno;
}
if (NULL == taosArrayPush(pTabNames, &(pValueNode->literal))) {
taosArrayDestroy(pTabNames);
return terrno;
}
*ppTableAlias = pTableAlias;
*ppTabNames = pTabNames;
*pRet = true; *pRet = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -6042,7 +6061,11 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO
*pRet = false; *pRet = false;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
(void)taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal); if (NULL == taosArrayPush(*ppTbNames, &((SValueNode*)pValNode)->literal)) {
taosArrayDestroy(*ppTbNames);
*ppTbNames = NULL;
return terrno;
}
} }
*pRet = true; *pRet = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -6070,7 +6093,7 @@ static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pW
*pRet = true; *pRet = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
(void)taosArrayDestroy(pInfo->aTbnames); taosArrayDestroy(pInfo->aTbnames);
pInfo->aTbnames = NULL; pInfo->aTbnames = NULL;
} }
*pRet = false; *pRet = false;
@ -6104,7 +6127,7 @@ static int32_t findEqualCondTbnameInLogicCondAnd(STranslateContext* pCxt, SNode*
break; break;
} }
} else { } else {
(void)taosArrayDestroy(info.aTbnames); taosArrayDestroy(info.aTbnames);
} }
} }
} }
@ -6123,7 +6146,7 @@ static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTb
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
break; break;
} }
(void)taosArrayDestroy(pInfo->aTbnames); taosArrayDestroy(pInfo->aTbnames);
pInfo->aTbnames = NULL; pInfo->aTbnames = NULL;
bFoundTable = true; bFoundTable = true;
break; break;
@ -6163,7 +6186,7 @@ static int32_t findEqualCondTbnameInLogicCondOr(STranslateContext* pCxt, SNode*
if (TSDB_CODE_SUCCESS == code && !bAllTbName) { if (TSDB_CODE_SUCCESS == code && !bAllTbName) {
for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) { for (int i = 0; i < taosArrayGetSize(aTableTbnames); ++i) {
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTableTbnames, i); SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTableTbnames, i);
(void)taosArrayDestroy(pInfo->aTbnames); taosArrayDestroy(pInfo->aTbnames);
pInfo->aTbnames = NULL; pInfo->aTbnames = NULL;
} }
taosArrayClear(aTableTbnames); taosArrayClear(aTableTbnames);
@ -6326,7 +6349,10 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
break; break;
} }
(void)taosArrayPush(pTbNames, &pNewTbName); if (NULL == taosArrayPush(pTbNames, &pNewTbName)) {
code = terrno;
break;
}
sprintf(pNewTbName, "%s.%s_%s", pTsma->dbFName, pTsma->name, pTbName); sprintf(pNewTbName, "%s.%s_%s", pTsma->dbFName, pTsma->name, pTbName);
int32_t len = taosCreateMD5Hash(pNewTbName, strlen(pNewTbName)); int32_t len = taosCreateMD5Hash(pNewTbName, strlen(pNewTbName));
} }
@ -6337,7 +6363,9 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo); findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
if (vgsInfo->numOfVgroups != 0) { if (vgsInfo->numOfVgroups != 0) {
(void)taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo); if (NULL == taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo)) {
code = terrno;
}
} else { } else {
taosMemoryFree(vgsInfo); taosMemoryFree(vgsInfo);
} }
@ -6366,9 +6394,9 @@ static int32_t setTableVgroupsFromEqualTbnameCond(STranslateContext* pCxt, SSele
} }
for (int i = 0; i < taosArrayGetSize(aTables); ++i) { for (int i = 0; i < taosArrayGetSize(aTables); ++i) {
SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i); SEqCondTbNameTableInfo* pInfo = taosArrayGet(aTables, i);
(void)taosArrayDestroy(pInfo->aTbnames); taosArrayDestroy(pInfo->aTbnames);
} }
(void)taosArrayDestroy(aTables); taosArrayDestroy(aTables);
return code; return code;
} }
@ -7968,7 +7996,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
} }
} }
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(*pArray); taosArrayDestroy(*pArray);
*pArray = NULL; *pArray = NULL;
} }
return code; return code;
@ -7992,7 +8020,11 @@ static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calByte
if (pCol->sma) { if (pCol->sma) {
field.flags |= COL_SMA_ON; field.flags |= COL_SMA_ON;
} }
(void)taosArrayPush(*pArray, &field); if (NULL == taosArrayPush(*pArray, &field)) {
taosArrayDestroy(*pArray);
*pArray = NULL;
return terrno;
}
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -8734,7 +8766,13 @@ static int32_t buildRollupFuncs(SNodeList* pFuncs, SArray** pArray) {
*pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN); *pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN);
if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY; if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY;
SNode* pNode; SNode* pNode;
FOREACH(pNode, pFuncs) { (void)taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName); } FOREACH(pNode, pFuncs) {
if (NULL == taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName)) {
taosArrayDestroy(*pArray);
*pArray = NULL;
return terrno;
}
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -8899,7 +8937,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
break; break;
} }
case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: { case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION: {
(void)taosArrayDestroy(pAlterReq->pFields); taosArrayDestroy(pAlterReq->pFields);
pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions)); pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions));
if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY; if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY;
@ -10593,7 +10631,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
(void)taosArrayDestroy(pProjColPos); taosArrayDestroy(pProjColPos);
nodesDestroyList(*pProjections); nodesDestroyList(*pProjections);
nodesDestroyList(*ppCols); nodesDestroyList(*ppCols);
*pProjections = pNewProjections; *pProjections = pNewProjections;
@ -10705,7 +10743,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
(void)taosArrayDestroy(pTagPos); taosArrayDestroy(pTagPos);
nodesDestroyList(*pTagExprs); nodesDestroyList(*pTagExprs);
*pTagExprs = pNewTagExprs; *pTagExprs = pNewTagExprs;
} else { } else {
@ -13331,7 +13369,7 @@ static void destroyCreateTbReqBatch(void* data) {
tdDestroySVCreateTbReq(pTableReq); tdDestroySVCreateTbReq(pTableReq);
} }
(void)taosArrayDestroy(pTbBatch->req.pArray); taosArrayDestroy(pTbBatch->req.pArray);
} }
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) { int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) {
@ -13354,7 +13392,7 @@ static void destroyCreateTbReqArray(SArray* pArray) {
taosMemoryFreeClear(pVg->pData); taosMemoryFreeClear(pVg->pData);
taosMemoryFreeClear(pVg); taosMemoryFreeClear(pVg);
} }
(void)taosArrayDestroy(pArray); taosArrayDestroy(pArray);
} }
static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo, static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt* pStmt, const SVgroupInfo* pInfo,
@ -13443,12 +13481,12 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db
if (!tBatch.req.pArray) { if (!tBatch.req.pArray) {
code = terrno; code = terrno;
} else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) { } else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) {
(void)taosArrayDestroy(tBatch.req.pArray); taosArrayDestroy(tBatch.req.pArray);
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
} else { } else {
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch)); code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(tBatch.req.pArray); taosArrayDestroy(tBatch.req.pArray);
} }
} }
} else { // add to the correct vgroup } else { // add to the correct vgroup
@ -13545,7 +13583,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
taosMemoryFreeClear(p->pData); taosMemoryFreeClear(p->pData);
} }
} }
(void)taosArrayDestroy(pTagArray); taosArrayDestroy(pTagArray);
return code; return code;
} }
@ -13608,7 +13646,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
taosMemoryFreeClear(p->pData); taosMemoryFreeClear(p->pData);
} }
} }
(void)taosArrayDestroy(pTagArray); taosArrayDestroy(pTagArray);
return code; return code;
} }
@ -13659,7 +13697,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
taosMemoryFree(pTag); taosMemoryFree(pTag);
} }
(void)taosArrayDestroy(tagName); taosArrayDestroy(tagName);
taosMemoryFreeClear(pSuperTableMeta); taosMemoryFreeClear(pSuperTableMeta);
return code; return code;
} }
@ -14066,10 +14104,9 @@ _ERR:
return code; return code;
} }
static int32_t resetParseFileContext(SParseFileContext* pParFileCxt) { static void resetParseFileContext(SParseFileContext* pParFileCxt) {
taosArrayClear(pParFileCxt->aCreateTbData); taosArrayClear(pParFileCxt->aCreateTbData);
taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp); taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp);
return TSDB_CODE_SUCCESS;
} }
static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) { static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) {
@ -14104,7 +14141,7 @@ static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt
} }
} }
(void)resetParseFileContext(pModifyStmt->pParFileCxt); resetParseFileContext(pModifyStmt->pParFileCxt);
return code; return code;
} }
@ -14132,7 +14169,7 @@ int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut
} while (true); } while (true);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(pBufArray); taosArrayDestroy(pBufArray);
} else { } else {
*pOut = pBufArray; *pOut = pBufArray;
} }
@ -14258,14 +14295,14 @@ static int32_t addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SVgroupInfo* pVg
tBatch.info = *pVgInfo; tBatch.info = *pVgInfo;
tBatch.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq)); tBatch.req.pArray = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVDropTbReq));
if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) { if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) {
(void)taosArrayDestroy(tBatch.req.pArray); taosArrayDestroy(tBatch.req.pArray);
tBatch.req.pArray = NULL; tBatch.req.pArray = NULL;
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch)); code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(tBatch.req.pArray); taosArrayDestroy(tBatch.req.pArray);
tBatch.req.pArray = NULL; tBatch.req.pArray = NULL;
return code; return code;
} }
@ -14312,7 +14349,7 @@ over:
static void destroyDropTbReqBatch(void* data) { static void destroyDropTbReqBatch(void* data) {
SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data; SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data;
(void)taosArrayDestroy(pTbBatch->req.pArray); taosArrayDestroy(pTbBatch->req.pArray);
} }
static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SArray* pBufArray) { static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SArray* pBufArray) {
@ -14374,7 +14411,7 @@ int32_t serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap, SArray** pOut)
code = serializeVgroupDropTableBatch(pTbBatch, pBufArray); code = serializeVgroupDropTableBatch(pTbBatch, pBufArray);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
taosHashCancelIterate(pVgroupHashmap, pTbBatch); taosHashCancelIterate(pVgroupHashmap, pTbBatch);
(void)taosArrayDestroy(pBufArray); taosArrayDestroy(pBufArray);
break; break;
} }
} while (true); } while (true);
@ -14452,7 +14489,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = buildCmdMsg(pCxt, TDMT_MND_DROP_TB_WITH_TSMA, (FSerializeFunc)tSerializeSMDropTbsReq, &req); code = buildCmdMsg(pCxt, TDMT_MND_DROP_TB_WITH_TSMA, (FSerializeFunc)tSerializeSMDropTbsReq, &req);
} }
(void)taosArrayDestroy(req.pVgReqs); taosArrayDestroy(req.pVgReqs);
} }
taosHashCleanup(pVgroupHashmap); taosHashCleanup(pVgroupHashmap);
return code; return code;
@ -14817,7 +14854,7 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
*pArray = pTmpArray; *pArray = pTmpArray;
} else { } else {
(void)taosArrayDestroy(pTmpArray); taosArrayDestroy(pTmpArray);
} }
return code; return code;
@ -14835,7 +14872,7 @@ static void destoryAlterTbReq(SVAlterTbReq* pReq) {
taosMemoryFreeClear(p->pData); taosMemoryFreeClear(p->pData);
} }
} }
(void)taosArrayDestroy(pReq->pTagArray); taosArrayDestroy(pReq->pTagArray);
if (pReq->tagFree) tTagFree((STag*)pReq->pTagVal); if (pReq->tagFree) tTagFree((STag*)pReq->pTagVal);
} }
@ -14920,7 +14957,7 @@ static int32_t serializeFlushDb(SArray* pVgs, SArray** pOutput) {
for (int32_t i = 0; i < numOfVgs; ++i) { for (int32_t i = 0; i < numOfVgs; ++i) {
int32_t code = serializeFlushVgroup((SVgroupInfo*)taosArrayGet(pVgs, i), pBufArray); int32_t code = serializeFlushVgroup((SVgroupInfo*)taosArrayGet(pVgs, i), pBufArray);
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(pBufArray); taosArrayDestroy(pBufArray);
return code; return code;
} }
} }
@ -14942,9 +14979,9 @@ static int32_t rewriteFlushDatabase(STranslateContext* pCxt, SQuery* pQuery) {
code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray); code = rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
} }
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
(void)taosArrayDestroy(pBufArray); taosArrayDestroy(pBufArray);
} }
(void)taosArrayDestroy(pVgs); taosArrayDestroy(pVgs);
return code; return code;
} }
@ -15577,7 +15614,7 @@ static int32_t toMsgType(ENodeType type) {
static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) { static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
if (NULL != pCxt->pDbs) { if (NULL != pCxt->pDbs) {
(void)taosArrayDestroy(pQuery->pDbList); taosArrayDestroy(pQuery->pDbList);
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN); pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
if (NULL == pQuery->pDbList) { if (NULL == pQuery->pDbList) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
@ -15593,7 +15630,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
} }
if (NULL != pCxt->pTables) { if (NULL != pCxt->pTables) {
(void)taosArrayDestroy(pQuery->pTableList); taosArrayDestroy(pQuery->pTableList);
pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName)); pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName));
if (NULL == pQuery->pTableList) { if (NULL == pQuery->pTableList) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
@ -15609,7 +15646,7 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
} }
if (NULL != pCxt->pTargetTables) { if (NULL != pCxt->pTargetTables) {
(void)taosArrayDestroy(pQuery->pTargetTableList); taosArrayDestroy(pQuery->pTargetTableList);
pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName)); pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName));
if (NULL == pQuery->pTargetTableList) { if (NULL == pQuery->pTargetTableList) {
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;

View File

@ -586,7 +586,7 @@ int32_t cloneDbVgInfo(SDBVgInfo* pSrc, SDBVgInfo** pDst) {
} }
memcpy(*pDst, pSrc, sizeof(*pSrc)); memcpy(*pDst, pSrc, sizeof(*pSrc));
(*pDst)->vgArray = NULL; (*pDst)->vgArray = NULL;
if (pSrc->vgHash) { if (pSrc->vgHash) {
(*pDst)->vgHash = taosHashInit(taosHashGetSize(pSrc->vgHash), taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, (*pDst)->vgHash = taosHashInit(taosHashGetSize(pSrc->vgHash), taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true,
HASH_ENTRY_LOCK); HASH_ENTRY_LOCK);

View File

@ -1706,7 +1706,9 @@ EDealRes fltTreeToGroup(SNode *pNode, void *pContext) {
cell = cell->pNext; cell = cell->pNext;
} }
(void)taosArrayAddAll(ctx->group, preGroup); if (NULL == taosArrayAddAll(ctx->group, preGroup)) {
FLT_ERR_JRET(terrno);
}
taosArrayDestroy(preGroup); taosArrayDestroy(preGroup);

View File

@ -982,6 +982,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery
SCH_ERR_JRET(code); SCH_ERR_JRET(code);
} }
trans->pHandle = (void *)refId; trans->pHandle = (void *)refId;
pMsgSendInfo->msgInfo.handle =trans->pHandle;
} }
if (pJob && pTask) { if (pJob && pTask) {
@ -996,8 +997,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery
pTask->lastMsgType = msgType; pTask->lastMsgType = msgType;
} }
int64_t transporterId = 0; code = asyncSendMsgToServerExt(trans->pTrans, epSet, NULL, pMsgSendInfo, persistHandle, ctx);
code = asyncSendMsgToServerExt(trans->pTrans, epSet, &transporterId, pMsgSendInfo, persistHandle, ctx);
pMsgSendInfo = NULL; pMsgSendInfo = NULL;
if (code) { if (code) {
SCH_ERR_JRET(code); SCH_ERR_JRET(code);

View File

@ -1496,9 +1496,10 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
} }
} else { } else {
SFailFastItem item = {.count = 1, .timestamp = cTimestamp}; SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
int32_t code = taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem)); int32_t code =
taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem));
if (code != 0) { if (code != 0) {
tError("failed to put fail-fast item to cache, reason:%s", tstrerror(code)); tError("failed to put fail-fast item to cache, reason:%s", tstrerror(code));
} }
} }
} }
@ -2980,7 +2981,9 @@ int32_t transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, S
QUEUE_PUSH(&exh->q, &pCliMsg->seqq); QUEUE_PUSH(&exh->q, &pCliMsg->seqq);
taosWUnLockLatch(&exh->latch); taosWUnLockLatch(&exh->latch);
tDebug("msg refId: %" PRId64 "", handle); tDebug("msg refId: %" PRId64 "", handle);
(void)transReleaseExHandle(transGetRefMgt(), handle);
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); (void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
return 0; return 0;
} else { } else {

View File

@ -64,7 +64,7 @@ class TAdapter:
"enable" : True "enable" : True
}, },
"node_exporter" : { "node_exporter" : {
"enable" : True "enable" : False
}, },
"prometheus" : { "prometheus" : {
"enable" : True "enable" : True

View File

@ -22,6 +22,9 @@ class TDTestCase(TBase):
self.child_table_num = 1 self.child_table_num = 1
self.insert_round_num = 300 self.insert_round_num = 300
self.row_num_per_round = 15 self.row_num_per_round = 15
self.row_num_per_round_varbia_json = 8
self.rows_all1 = self.insert_round_num * self.row_num_per_round
self.rows_all2 = self.insert_round_num * self.row_num_per_round_varbia_json
self.start_ts = 1704082431000 self.start_ts = 1704082431000
def prepare_data(self): def prepare_data(self):
@ -47,8 +50,8 @@ class TDTestCase(TBase):
# check the data # check the data
for i in range(self.child_table_num): for i in range(self.child_table_num):
tdSql.query(f"select * from ct_binary{i+1};") tdSql.query(f"select * from ct_binary{i+1};")
tdSql.checkRows(4500) tdSql.checkRows(self.rows_all1)
row_num = random.randint(0, 3999) row_num = random.randint(0, self.rows_all1-1)
tdSql.checkData(row_num, 1, 'a' * self.max_column_length) tdSql.checkData(row_num, 1, 'a' * self.max_column_length)
tdSql.query(f"show tags from ct_binary{i+1};") tdSql.query(f"show tags from ct_binary{i+1};")
tdSql.checkData(0, 5, tag) tdSql.checkData(0, 5, tag)
@ -71,8 +74,8 @@ class TDTestCase(TBase):
# check the data # check the data
for i in range(self.child_table_num): for i in range(self.child_table_num):
tdSql.query(f"select * from ct_varchar{i+1};") tdSql.query(f"select * from ct_varchar{i+1};")
tdSql.checkRows(4500) tdSql.checkRows(self.rows_all1)
row_num = random.randint(0, 3999) row_num = random.randint(0, self.rows_all1-1)
tdSql.checkData(row_num, 1, 'b' * self.max_column_length) tdSql.checkData(row_num, 1, 'b' * self.max_column_length)
tdSql.query(f"show tags from ct_varchar{i+1};") tdSql.query(f"show tags from ct_varchar{i+1};")
tdSql.checkData(0, 5, tag) tdSql.checkData(0, 5, tag)
@ -106,14 +109,14 @@ class TDTestCase(TBase):
# check the data # check the data
for i in range(self.child_table_num): for i in range(self.child_table_num):
tdSql.query(f"select * from ct_nchar{i+1};") tdSql.query(f"select * from ct_nchar{i+1};")
tdSql.checkRows(4500) tdSql.checkRows(self.rows_all1)
row_num = random.randint(0, 3999) row_num = random.randint(0, self.rows_all1-1)
tdSql.checkData(row_num, 1, column) tdSql.checkData(row_num, 1, column)
tdSql.query(f"show tags from ct_nchar{i+1};") tdSql.query(f"show tags from ct_nchar{i+1};")
tdSql.checkData(0, 5, tag) tdSql.checkData(0, 5, tag)
def test_varbinary_boundary(self): def test_varbinary_boundary(self):
row_num_per_round = 8
# create tables # create tables
tdSql.execute(f"create table st_varbinary (ts timestamp, c1 varbinary({self.max_column_length})) tags (t1 varbinary({self.max_tag_length}));") tdSql.execute(f"create table st_varbinary (ts timestamp, c1 varbinary({self.max_column_length})) tags (t1 varbinary({self.max_tag_length}));")
for i in range(self.child_table_num): for i in range(self.child_table_num):
@ -124,22 +127,21 @@ class TDTestCase(TBase):
# insert data # insert data
for j in range(self.insert_round_num): for j in range(self.insert_round_num):
sql = "insert into ct_varbinary%s values" % (i+1) sql = "insert into ct_varbinary%s values" % (i+1)
for k in range(row_num_per_round): for k in range(self.row_num_per_round_varbia_json):
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column) sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
tdSql.execute(sql) tdSql.execute(sql)
tdLog.info(f"Insert {row_num_per_round} rows data into ct_varbinary{i+1} {j+1} times successfully") tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_varbinary{i+1} {j+1} times successfully")
tdSql.execute("flush database db;") tdSql.execute("flush database db;")
# check the data # check the data
for i in range(self.child_table_num): for i in range(self.child_table_num):
tdSql.query(f"select * from ct_varbinary{i+1};") tdSql.query(f"select * from ct_varbinary{i+1};")
tdSql.checkRows(2400) tdSql.checkRows(self.rows_all2)
row_num = random.randint(0, 2399) row_num = random.randint(0, self.rows_all2-1)
tdSql.checkData(row_num, 1, bytes.fromhex(column)) tdSql.checkData(row_num, 1, bytes.fromhex(column))
tdSql.query(f"show tags from ct_varbinary{i+1};") tdSql.query(f"show tags from ct_varbinary{i+1};")
tdSql.checkData(0, 5, '\\x' + tag.upper()) tdSql.checkData(0, 5, '\\x' + tag.upper())
def test_json_tag_boundary(self): def test_json_tag_boundary(self):
row_num_per_round = 8
max_json_tag_length = 4095 max_json_tag_length = 4095
max_json_tag_key_length = 256 max_json_tag_key_length = 256
# create tables # create tables
@ -153,16 +155,16 @@ class TDTestCase(TBase):
# insert data # insert data
for j in range(self.insert_round_num): for j in range(self.insert_round_num):
sql = "insert into ct_json_tag%s values" % (i+1) sql = "insert into ct_json_tag%s values" % (i+1)
for k in range(row_num_per_round): for k in range(self.row_num_per_round_varbia_json):
sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column) sql += "(%s, '%s')," % (str(self.start_ts + (j * self.insert_round_num + k * self.row_num_per_round + 1)), '\\x' + column)
tdSql.execute(sql) tdSql.execute(sql)
tdLog.info(f"Insert {row_num_per_round} rows data into ct_json_tag{i+1} {j+1} times successfully") tdLog.info(f"Insert {self.row_num_per_round_varbia_json} rows data into ct_json_tag{i+1} {j+1} times successfully")
tdSql.execute("flush database db;") tdSql.execute("flush database db;")
# check the data # check the data
for i in range(self.child_table_num): for i in range(self.child_table_num):
tdSql.query(f"select * from ct_json_tag{i+1} where t1->'{tag_key}' = '{tag_value}';") tdSql.query(f"select * from ct_json_tag{i+1} where t1->'{tag_key}' = '{tag_value}';")
tdSql.checkRows(2400) tdSql.checkRows(self.rows_all2)
row_num = random.randint(0, 2399) row_num = random.randint(0, self.rows_all2-1)
tdSql.checkData(row_num, 1, bytes.fromhex(column)) tdSql.checkData(row_num, 1, bytes.fromhex(column))
def run(self): def run(self):

29
tests/army/win-test-file Normal file
View File

@ -0,0 +1,29 @@
python3 ./test.py -f multi-level/mlevel_basic.py -N 3 -L 3 -D 2
python3 ./test.py -f db-encrypt/basic.py
python3 ./test.py -f s3/s3Basic.py -N 3
python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2
python3 ./test.py -f query/function/test_func_elapsed.py
python3 ./test.py -f query/function/concat.py
python3 ./test.py -f query/function/cast.py
python3 ./test.py -f query/test_join.py
python3 ./test.py -f query/test_compare.py
python3 ./test.py -f insert/test_column_tag_boundary.py
python3 ./test.py -f query/fill/fill_desc.py -N 3 -L 3 -D 2
python3 ./test.py -f query/fill/fill_null.py
python3 ./test.py -f cluster/incSnapshot.py -N 3
python3 ./test.py -f query/query_basic.py -N 3
python3 ./test.py -f query/accuracy/test_query_accuracy.py
python3 ./test.py -f insert/insert_basic.py -N 3
python3 ./test.py -f cluster/splitVgroupByLearner.py -N 3
python3 ./test.py -f authorith/authBasic.py -N 3
python3 ./test.py -f cmdline/fullopt.py
python3 ./test.py -f query/show.py -N 3
python3 ./test.py -f alter/alterConfig.py -N 3
python3 ./test.py -f query/subquery/subqueryBugs.py -N 3
python3 ./test.py -f storage/oneStageComp.py -N 3 -L 3 -D 1
python3 ./test.py -f storage/compressBasic.py -N 3
python3 ./test.py -f grant/grantBugs.py -N 3
python3 ./test.py -f query/queryBugs.py -N 3
python3 ./test.py -f tmq/tmqBugs.py -N 3
python3 ./test.py -f query/fill/fill_compare_asc_desc.py
python3 ./test.py -f query/last/test_last.py

View File

@ -1,23 +1,47 @@
import os import os
import re import re
from loguru import logger
# List of source directories to search # List of source directories to search
self_path = os.path.dirname(os.path.realpath(__file__))
# Check if "community" or "tests" is in self_path
index_community = self_path.find("community")
if index_community != -1:
TD_project_path = self_path[:index_community]
index_TDinternal = TD_project_path.find("TDinternal")
# Check if index_TDinternal is valid and set work_path accordingly
if index_TDinternal != -1:
work_path = TD_project_path[:index_TDinternal]
else:
index_tests = self_path.find("tests")
if index_tests != -1:
TD_project_path = self_path[:index_tests]
# Check if index_TDengine is valid and set work_path accordingly
index_TDengine = TD_project_path.find("TDengine")
if index_TDengine != -1:
work_path = TD_project_path[:index_TDengine]
TD_project_path = TD_project_path.rstrip('/')
print(TD_project_path)
source_dirs = [ source_dirs = [
"community/source", f"{TD_project_path}/community/source",
"community/include", f"{TD_project_path}/community/include",
"enterprise/src/plugins/" f"{TD_project_path}/enterprise/src/plugins/"
] ]
# List of directories to exclude # List of directories to exclude
exclude_dirs = [ exclude_dirs = [
"community/source/client/jni" f"{TD_project_path}/community/source/client/jni",
f"{TD_project_path}/enterprise/src/plugins/taosx",
f"{TD_project_path}/enterprise/src/plugins/explorer",
] ]
# List of files to exclude # List of files to exclude
exclude_source_files = [ exclude_source_files = [
"community/source/libs/parser/src/sql.c", f"{TD_project_path}/community/source/libs/parser/src/sql.c",
"community/source/util/src/tlog.c", f"{TD_project_path}/community/source/util/src/tlog.c",
"community/include/util/tlog.h" f"{TD_project_path}/community/include/util/tlog.h"
] ]
def grep_asserts_in_file(file_path, summary_list, detaild_list): def grep_asserts_in_file(file_path, summary_list, detaild_list):
@ -26,10 +50,10 @@ def grep_asserts_in_file(file_path, summary_list, detaild_list):
with open(file_path, 'r') as file: with open(file_path, 'r') as file:
for line_number, line in enumerate(file, start=1): for line_number, line in enumerate(file, start=1):
if re.search(r'\bassert\(.*\)|\bASSERT\(.*\)|\bASSERTS\(.*\)|\bASSERT_CORE\(.*\)', line): if re.search(r'\bassert\(.*\)|\bASSERT\(.*\)|\bASSERTS\(.*\)|\bASSERT_CORE\(.*\)', line):
detaild_list.append(f"{file_path}:{line_number}: {line.strip()}") detaild_list.append(f"{file_path}:{line.strip()}:{line_number}")
match_count += 1 match_count += 1
if match_count > 0: if match_count > 0:
summary_list.append(f"Total matches in {file_path}: {match_count}") summary_list.append(f"Total matches in {file_path}:{match_count}")
def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files): def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files):
"""Traverse directories and grep for assert, ASSERTS, or ASSERT function calls in .h and .c files.""" """Traverse directories and grep for assert, ASSERTS, or ASSERT function calls in .h and .c files."""
@ -47,7 +71,52 @@ def traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files):
grep_asserts_in_file(file_path, summary_list, detaild_list) grep_asserts_in_file(file_path, summary_list, detaild_list)
return summary_list, detaild_list return summary_list, detaild_list
def check_list_result(result_list,detaild_list):
logger.debug("check assert in source code")
error_message = "ERROR: do not add `assert` statements in new code."
error_message2 = "ERROR: Please check the detailed information below: assert statement with file name and line number"
remove_detail_items = [
f"{TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:ASSERT_CORE(tsdb->imem == NULL, \"imem should be null to commit mem\");",
f"{TD_project_path}/community/include/util/types.h:assert(sizeof(float) == sizeof(uint32_t));",
f"{TD_project_path}/community/include/util/types.h:assert(sizeof(double) == sizeof(uint64_t));"
]
expected_strings = [
f"Total matches in {TD_project_path}/community/source/dnode/vnode/src/tsdb/tsdbCommit2.c:1",
f"Total matches in {TD_project_path}/community/include/util/types.h:2"
]
# logger.debug(len(result_list))
if len(result_list) != 2:
logger.error(f"{error_message}")
for item in expected_strings:
if item in result_list:
result_list.remove(item)
logger.error("\n" + "\n".join(result_list))
logger.error(f"{error_message2}")
for item in remove_detail_items:
if item in detaild_list:
detaild_list.remove(item)
logger.error("\n" + "\n".join(detaild_list))
exit(1)
else:
# check if all expected strings are in the result list
if all(item in result_list for item in expected_strings):
# logger.debug(result_list)
# logger.debug(detaild_list)
if all(any(remove_detail_item in detaild for remove_detail_item in remove_detail_items) for detaild in detaild_list):
logger.info("Validation successful.")
else:
logger.error(f"{error_message}")
for item in expected_strings:
if item in result_list:
result_list.remove(item)
logger.error("\n" + "\n".join(result_list))
logger.error(f"{error_message2}")
for item in remove_detail_items:
if item in detaild_list:
detaild_list.remove(item)
logger.error("\n" + "\n".join(detaild_list))
exit(1)
if __name__ == "__main__": if __name__ == "__main__":
summary_list, detaild_list = traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files) summary_list, detaild_list = traverse_and_grep(source_dirs, exclude_dirs, exclude_source_files)
print("\n".join(summary_list)) check_list_result(summary_list,detaild_list)
# print("\n".join(detaild_list))

View File

@ -0,0 +1,54 @@
#!/bin/bash
function usage() {
echo "$0"
echo -e "\t -d work dir"
echo -e "\t -h help"
}
while getopts "d:h" opt; do
case $opt in
d)
WORKDIR=$OPTARG
;;
h)
usage
exit 0
;;
\?)
echo "Invalid option: -$OPTARG"
usage
exit 0
;;
esac
done
if [ -z "$WORKDIR" ]; then
usage
exit 1
fi
# enterprise edition
INTERNAL_REPDIR=$WORKDIR/TDinternal
REPDIR_DEBUG=$WORKDIR/debugNoSan/
REP_MOUNT_PARAM="$INTERNAL_REPDIR:/home/TDinternal"
CONTAINER_TESTDIR=/home/TDinternal/community
check_assert_scripts="$CONTAINER_TESTDIR/tests/ci/count_assert.py"
ulimit -c unlimited
cat << EOF
docker run \
-v $REP_MOUNT_PARAM \
--rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts
EOF
docker run \
-v $REP_MOUNT_PARAM \
--rm --ulimit core=-1 taos_test:v1.0 python3 $check_assert_scripts
ret=$?
exit $ret

View File

@ -5,20 +5,35 @@ parm_path=$(pwd ${parm_path})
echo "execute path:${parm_path}" echo "execute path:${parm_path}"
cd ${parm_path} cd ${parm_path}
cp cases.task ${case_file} cp cases.task ${case_file}
# comment udf and stream case in windows # comment udf and stream and sma case in windows
sed -i '/udf/d' ${case_file} sed -i '/udf/d' ${case_file}
sed -i '/Udf/d' ${case_file} sed -i '/Udf/d' ${case_file}
sed -i '/stream/d' ${case_file} sed -i '/stream/d' ${case_file}
sed -i '/^$/d' ${case_file} sed -i '/^$/d' ${case_file}
sed -i '$a\%%FINISHED%%' ${case_file} sed -i '$a\%%FINISHED%%' ${case_file}
#unsupported case:sma
sed -i '/tsim\/sync\/vnodesnapshot-rsma-test.sim/d' ${case_file}
sed -i '/tsim\/sma/d' ${case_file}
sed -i '/tsim\/tagindex\/sma_and_tag_index.sim/d' ${case_file}
#unsupported case:to_char
sed -i '/tsim\/query\/sort-pre-cols.sim/d' ${case_file}
sed -i '/2-query\/nestedQueryInterval.py/d' ${case_file}
#unsupported case:stream
sed -i '/database_pre_suf/d' ${case_file}
sed -i '/tsma/d' ${case_file}
utest="unit-test" utest="unit-test"
tsimtest="script" tsimtest="script"
systest="system-test" systest="system-test"
devtest="develop-test" devtest="develop-test"
doctest="docs-examples-test" doctest="docs-examples-test"
rm -rf win-${utest}.log win-${tsimtest}.log win-${systest}.log win-${devtest}.log win-${doctest}.log armytest="army"
rm -rf ${parm_path}/../${utest}/win-test-file ${parm_path}/../${tsimtest}/win-test-file ${parm_path}/../${systest}/win-test-file ${parm_path}/../${devtest}/win-test-file
rm -rf win-${utest}.log win-${tsimtest}.log win-${systest}.log win-${devtest}.log win-${doctest}.log win-${armytest}.log
rm -rf ${parm_path}/../${utest}/win-test-file ${parm_path}/../${tsimtest}/win-test-file ${parm_path}/../${systest}/win-test-file ${parm_path}/../${devtest}/win-test-file ${parm_path}/../${doctest}/win-test-file ${parm_path}/../${armytest}/win-test-file
while read -r line while read -r line
do do
echo "$line"|grep -q "^#" echo "$line"|grep -q "^#"
@ -44,6 +59,15 @@ do
fi fi
continue continue
fi fi
if [[ "${exec_dir}" == "${armytest}" ]]; then
if [[ "${case_cmd}" =~ "pytest.sh" ]]; then
case_cmd=$(echo "$case_cmd"|cut -d ' ' -f 2-)
echo "${case_cmd}" >> win-${armytest}.log
else
echo "${case_cmd}" >> win-${armytest}.log
fi
continue
fi
if [[ "${exec_dir}" == "${devtest}" ]]; then if [[ "${exec_dir}" == "${devtest}" ]]; then
echo ${case_cmd} >> win-${devtest}.log echo ${case_cmd} >> win-${devtest}.log
continue continue
@ -57,6 +81,7 @@ mv win-${utest}.log ${parm_path}/../${utest}/win-test-file
mv win-${tsimtest}.log ${parm_path}/../${tsimtest}/win-test-file mv win-${tsimtest}.log ${parm_path}/../${tsimtest}/win-test-file
mv win-${systest}.log ${parm_path}/../${systest}/win-test-file mv win-${systest}.log ${parm_path}/../${systest}/win-test-file
mv win-${devtest}.log ${parm_path}/../${devtest}/win-test-file mv win-${devtest}.log ${parm_path}/../${devtest}/win-test-file
mv win-${armytest}.log ${parm_path}/../${armytest}/win-test-file
mv win-${doctest}.log ${parm_path}/../${armytest}/win-test-file
rm -rf ${case_file} rm -rf ${case_file}

View File

@ -979,6 +979,155 @@ class TDCom:
for stream_name in stream_name_list: for stream_name in stream_name_list:
tdSql.execute(f'drop stream if exists {stream_name};') tdSql.execute(f'drop stream if exists {stream_name};')
def check_stream_wal_info(self, wal_info):
# This method is defined for the 'info' column of the 'information_schema.ins_stream_tasks'.
# Define the regular expression pattern to match the required format
# This pattern looks for a number followed by an optional space and then a pair of square brackets
# containing two numbers separated by a comma.
pattern = r'(\d+)\s*\[(\d+),\s*(\d+)\]'
# Use the search function from the re module to find a match in the string
match = re.search(pattern, wal_info)
# Check if a match was found
if match:
# Extract the numbers from the matching groups
first_number = int(match.group(1)) # The number before the brackets
second_number = int(match.group(3)) # The second number inside the brackets
# Compare the extracted numbers and return the result
if second_number >=5 :
if first_number >= second_number-5 and first_number <= second_number:
return True
elif second_number < 5:
if first_number >= second_number-1 and first_number <= second_number:
return True
# If no match was found, or the pattern does not match the expected format, return False
return False
def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None):
"""check stream status
Args:
stream_name (str): stream_name
vgroups (int): vgroups
Returns:
str: status
"""
timeout = self.stream_timeout if stream_timeout is None else stream_timeout
#check stream task rows
sql_task_all = f"select `task_id`,node_id,stream_name,status,info,history_task_id from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
sql_task_status = f"select distinct(status) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
sql_task_history = f"select distinct(history_task_id) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
tdSql.query(sql_task_all)
tdSql.checkRows(vgroups)
#check stream task status
checktimes = 1
check_stream_success = 0
vgroup_num = 0
while checktimes <= timeout:
tdLog.notice(f"checktimes:{checktimes}")
try:
result_task_alll = tdSql.query(sql_task_all,row_tag=True)
result_task_alll_rows = tdSql.query(sql_task_all)
result_task_status = tdSql.query(sql_task_status,row_tag=True)
result_task_status_rows = tdSql.query(sql_task_status)
result_task_history = tdSql.query(sql_task_history,row_tag=True)
result_task_history_rows = tdSql.query(sql_task_history)
tdLog.notice(f"Try to check stream status, check times: {checktimes} and stream task list[{check_stream_success}]")
print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}")
if result_task_status_rows == 1 and result_task_status ==[('ready',)] :
if result_task_history_rows == 1 and result_task_history == [(None,)] :
for vgroup_num in range(vgroups):
if self.check_stream_wal_info(result_task_alll[vgroup_num][4]) :
check_stream_success += 1
tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :")
else:
check_stream_success = 0
break
if check_stream_success == vgroups:
break
time.sleep(1)
checktimes += 1
vgroup_num = vgroup_num
except Exception as e:
tdLog.notice(f"Try to check stream status again, check times: {checktimes}")
checktimes += 1
tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all)
else:
checktimes_end = checktimes - 1
tdLog.notice(f"it has spend {checktimes_end} for checking stream task status but it failed")
if checktimes_end == timeout:
tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all)
# def check_stream_task_status(self, stream_name, vgroups, stream_timeout=None):
# """check stream status
# Args:
# stream_name (str): stream_name
# vgroups (int): vgroups
# Returns:
# str: status
# """
# timeout = self.stream_timeout if stream_timeout is None else stream_timeout
# #check stream task rows
# sql_task_all = f"select `task_id`,node_id,stream_name,status,info,history_task_id from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
# sql_task_status = f"select distinct(status) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
# sql_task_history = f"select distinct(history_task_id) from information_schema.ins_stream_tasks where stream_name='{stream_name}' and `level`='source';"
# tdSql.query(sql_task_all)
# tdSql.checkRows(vgroups)
# #check stream task status
# checktimes = 1
# check_stream_success = 0
# vgroup_num = 0
# while checktimes <= timeout:
# print(f"checktimes:{checktimes}")
# try:
# result_task_alll = tdSql.query(sql_task_all,row_tag=True)
# result_task_alll_rows = tdSql.query(sql_task_all)
# result_task_status = tdSql.query(sql_task_status,row_tag=True)
# result_task_status_rows = tdSql.query(sql_task_status)
# result_task_history = tdSql.query(sql_task_history,row_tag=True)
# result_task_history_rows = tdSql.query(sql_task_history)
# tdLog.notice(f"Try to check stream status, check times: {checktimes} and stream task list[{check_stream_success}]")
# print(f"result_task_status:{result_task_status},result_task_history:{result_task_history},result_task_alll:{result_task_alll}")
# for vgroup_num in range(vgroups):
# if result_task_alll[vgroup_num][3] == "ready" and self.check_stream_wal_info(result_task_alll[vgroup_num][4]) and result_task_alll[vgroup_num][5] == None:
# check_stream_success += 1
# tdLog.info(f"check stream task list[{check_stream_success}] sucessfully :")
# else:
# check_stream_success = 0
# break
# if check_stream_success == vgroups:
# break
# time.sleep(1)
# checktimes += 1
# vgroup_num = vgroup_num
# except Exception as e:
# tdLog.notice(f"Try to check stream status again, check times: {checktimes}")
# checktimes += 1
# tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all)
# else:
# checktimes_end = checktimes - 1
# tdLog.notice(f"it has spend {checktimes_end} for checking stream task status but it failed")
# if checktimes_end == timeout:
# tdSql.print_error_frame_info(result_task_alll[vgroup_num],"status is ready,info is finished and history_task_id is NULL",sql_task_all)
def drop_db(self, dbname="test"): def drop_db(self, dbname="test"):
"""drop a db """drop a db

View File

@ -61,6 +61,13 @@ class TDSql:
def close(self): def close(self):
self.cursor.close() self.cursor.close()
def print_error_frame_info(self, elm, expect_elm, sql=None):
caller = inspect.getframeinfo(inspect.stack()[1][0])
print_sql = self.sql if sql is None else sql
args = (caller.filename, caller.lineno, print_sql, elm, expect_elm)
# tdLog.info("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
raise Exception("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
def prepare(self, dbname="db", drop=True, **kwargs): def prepare(self, dbname="db", drop=True, **kwargs):
tdLog.info(f"prepare database:{dbname}") tdLog.info(f"prepare database:{dbname}")
s = 'reset query cache' s = 'reset query cache'
@ -331,13 +338,14 @@ class TDSql:
return self.queryRows return self.queryRows
def checkRows(self, expectedRows): def checkRows(self, expectedRows):
if self.queryRows == expectedRows: return self.checkEqual(self.queryRows, expectedRows)
tdLog.info("sql:%s, queryRows:%d == expect:%d" % (self.sql, self.queryRows, expectedRows)) # if self.queryRows == expectedRows:
return True # tdLog.info("sql:%s, queryRows:%d == expect:%d" % (self.sql, self.queryRows, expectedRows))
else: # return True
caller = inspect.getframeinfo(inspect.stack()[1][0]) # else:
args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectedRows) # caller = inspect.getframeinfo(inspect.stack()[1][0])
tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) # args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectedRows)
# tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args)
def checkRows_not_exited(self, expectedRows): def checkRows_not_exited(self, expectedRows):
""" """
@ -636,16 +644,12 @@ class TDSql:
def checkEqual(self, elm, expect_elm): def checkEqual(self, elm, expect_elm):
if elm == expect_elm: if elm == expect_elm:
tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm)) tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm))
return return True
if self.__check_equal(elm, expect_elm): if self.__check_equal(elm, expect_elm):
tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm)) tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm))
return return True
self.print_error_frame_info(elm, expect_elm)
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, elm, expect_elm)
# tdLog.info("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
raise Exception("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
def checkNotEqual(self, elm, expect_elm): def checkNotEqual(self, elm, expect_elm):
if elm != expect_elm: if elm != expect_elm:
tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm)) tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm))

View File

@ -97,6 +97,6 @@ else
if [ $python_error -ne 0 ] || [ $python_taos_error -ne 0 ] ; then if [ $python_error -ne 0 ] || [ $python_taos_error -ne 0 ] ; then
cat ${LOG_DIR}/*.info |grep "#" | grep -w "TDinternal" cat ${LOG_DIR}/*.info |grep "#" | grep -w "TDinternal"
fi fi
cat ${LOG_DIR}/*.asan cat ${LOG_DIR}/*.asan |grep "#" | grep -w "TDinternal"
exit 1 exit 1
fi fi

View File

@ -4,5 +4,5 @@ rem echo taskkill /F /IM taosd.exe
wmic process where "name='taosd.exe'" call terminate > NUL 2>&1 wmic process where "name='taosd.exe'" call terminate > NUL 2>&1
taskkill /F /IM taosd.exe > NUL 2>&1 taskkill /F /IM taosd.exe > NUL 2>&1
sleep 2
rem echo taskkill /F /IM taosd.exe finished rem echo taskkill /F /IM taosd.exe finished

View File

@ -15,42 +15,42 @@ fi
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do while [ -n "$PID" ]; do
echo kill -15 $PID echo kill -9 $PID
#pkill -15 taosd #pkill -9 taosd
kill -15 $PID kill -9 $PID
echo "Killing taosd processes" echo "Killing taosd processes"
if [ "$OS_TYPE" != "Darwin" ]; then if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030 fuser -k -n tcp 6030
else else
lsof -nti:6030 | xargs kill -15 lsof -nti:6030 | xargs kill -9
fi fi
PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'`
done done
PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do while [ -n "$PID" ]; do
echo kill -15 $PID echo kill -9 $PID
#pkill -9 taos #pkill -9 taos
kill -15 $PID kill -9 $PID
echo "Killing taos processes" echo "Killing taos processes"
if [ "$OS_TYPE" != "Darwin" ]; then if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030 fuser -k -n tcp 6030
else else
lsof -nti:6030 | xargs kill -15 lsof -nti:6030 | xargs kill -9
fi fi
PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w taos | grep -v grep | awk '{print $2}'`
done done
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
while [ -n "$PID" ]; do while [ -n "$PID" ]; do
echo kill -15 $PID echo kill -9 $PID
#pkill -15 tmq_sim #pkill -9 tmq_sim
kill -15 $PID kill -9 $PID
echo "Killing tmq_sim processes" echo "Killing tmq_sim processes"
if [ "$OS_TYPE" != "Darwin" ]; then if [ "$OS_TYPE" != "Darwin" ]; then
fuser -k -n tcp 6030 fuser -k -n tcp 6030
else else
lsof -nti:6030 | xargs kill -15 lsof -nti:6030 | xargs kill -9
fi fi
PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'` PID=`ps -ef|grep -w tmq_sim | grep -v grep | awk '{print $2}'`
done done

View File

@ -308,4 +308,4 @@ if $rows != 2 then
return -1 return -1
endi endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -200,7 +200,6 @@
./test.sh -f tsim/query/unionall_as_table.sim ./test.sh -f tsim/query/unionall_as_table.sim
./test.sh -f tsim/query/multi_order_by.sim ./test.sh -f tsim/query/multi_order_by.sim
./test.sh -f tsim/query/sys_tbname.sim ./test.sh -f tsim/query/sys_tbname.sim
./test.sh -f tsim/query/sort-pre-cols.sim
./test.sh -f tsim/query/groupby.sim ./test.sh -f tsim/query/groupby.sim
./test.sh -f tsim/query/groupby_distinct.sim ./test.sh -f tsim/query/groupby_distinct.sim
./test.sh -f tsim/query/event.sim ./test.sh -f tsim/query/event.sim
@ -289,12 +288,6 @@
./test.sh -f tsim/stable/tag_rename.sim ./test.sh -f tsim/stable/tag_rename.sim
./test.sh -f tsim/stable/values.sim ./test.sh -f tsim/stable/values.sim
./test.sh -f tsim/stable/vnode3.sim ./test.sh -f tsim/stable/vnode3.sim
./test.sh -f tsim/sma/drop_sma.sim
./test.sh -f tsim/sma/sma_leak.sim
./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQueryDelete.sim
./test.sh -f tsim/sync/vnodesnapshot-rsma-test.sim
./test.sh -f tsim/valgrind/checkError1.sim ./test.sh -f tsim/valgrind/checkError1.sim
./test.sh -f tsim/valgrind/checkError2.sim ./test.sh -f tsim/valgrind/checkError2.sim
./test.sh -f tsim/valgrind/checkError3.sim ./test.sh -f tsim/valgrind/checkError3.sim
@ -406,7 +399,6 @@
./test.sh -f tsim/tag/tbNameIn.sim ./test.sh -f tsim/tag/tbNameIn.sim
./test.sh -f tmp/monitor.sim ./test.sh -f tmp/monitor.sim
./test.sh -f tsim/tagindex/add_index.sim ./test.sh -f tsim/tagindex/add_index.sim
./test.sh -f tsim/tagindex/sma_and_tag_index.sim
./test.sh -f tsim/tagindex/indexOverflow.sim ./test.sh -f tsim/tagindex/indexOverflow.sim
./test.sh -f tsim/view/view.sim ./test.sh -f tsim/view/view.sim
./test.sh -f tsim/query/cache_last.sim ./test.sh -f tsim/query/cache_last.sim

View File

@ -42,19 +42,19 @@ class TDTestCase:
type = 'stable' type = 'stable'
tdSql.execute(f'create topic if not exists {name} as {type} {name}') tdSql.execute(f'create topic if not exists {name} as {type} {name}')
tdSql.query('show topics') tdSql.query('show topics')
tdSql.checkEqual(tdSql.queryResult[0][0],name) tdSql.checkData(0, 0, name)
tdSql.execute(f'drop topic {name}') tdSql.execute(f'drop topic {name}')
tdSql.execute(f'create topic if not exists `{name}` as {type} {name}') tdSql.execute(f'create topic if not exists `{name}` as {type} {name}')
tdSql.query('show topics') tdSql.query('show topics')
tdSql.checkEqual(tdSql.queryResult[0][0],name) tdSql.checkData(0, 0, name)
tdSql.execute(f'drop topic {name}') tdSql.execute(f'drop topic {name}')
tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`')
tdSql.query('show topics') tdSql.query('show topics')
tdSql.checkEqual(tdSql.queryResult[0][0],name) tdSql.checkData(0, 0, name)
tdSql.execute(f'drop topic {name}') tdSql.execute(f'drop topic {name}')
tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`') tdSql.execute(f'create topic if not exists `{name}` as {type} `{name}`')
tdSql.query('show topics') tdSql.query('show topics')
tdSql.checkEqual(tdSql.queryResult[0][0],name) tdSql.checkData(0, 0, name)
tdSql.execute(f'drop topic `{name}`') tdSql.execute(f'drop topic `{name}`')
def db_name_check(self): def db_name_check(self):
@ -70,14 +70,14 @@ class TDTestCase:
time.sleep(15) time.sleep(15)
tdSql.query('show streams') tdSql.query('show streams')
tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) tdSql.checkData(0, 0, self.streamname)
tdSql.execute(f'drop stream {self.streamname}') tdSql.execute(f'drop stream {self.streamname}')
tdSql.execute(f'drop stable {self.streamtb}') tdSql.execute(f'drop stable {self.streamtb}')
tdSql.execute(f'create stream {self.streamname} into `{self.streamtb}` as select count(*) from {self.stbname} interval(10s);') tdSql.execute(f'create stream {self.streamname} into `{self.streamtb}` as select count(*) from {self.stbname} interval(10s);')
time.sleep(10) time.sleep(10)
tdSql.query('show streams') tdSql.query('show streams')
tdSql.checkEqual(tdSql.queryResult[0][0],self.streamname) tdSql.checkData(0, 0, self.streamname)
tdSql.execute(f'drop stream `{self.streamname}`') tdSql.execute(f'drop stream `{self.streamname}`')
tdSql.execute(f'drop database {self.dbname}') tdSql.execute(f'drop database {self.dbname}')
@ -89,17 +89,17 @@ class TDTestCase:
tdSql.execute(f'insert into {self.ntbname1} values(now(),1,1)') tdSql.execute(f'insert into {self.ntbname1} values(now(),1,1)')
tdSql.execute(f'insert into {self.ntbname2} values(now(),2,2)') tdSql.execute(f'insert into {self.ntbname2} values(now(),2,2)')
tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.ntbname1}`') tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.ntbname1}`')
tdSql.checkEqual(tdSql.queryResult[0][0], 1) tdSql.checkData(0, 0, 1)
tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.dbname}`.`{self.ntbname1}`') tdSql.query(f'select `{self.ntbname1}`.`c0`, `{self.ntbname1}`.`c1` from `{self.dbname}`.`{self.ntbname1}`')
tdSql.checkEqual(tdSql.queryResult[0][0], 1) tdSql.checkData(0, 0, 1)
tdSql.query(f'select `{self.ntbname1}`.`c0` from `{self.ntbname2}` `{self.ntbname1}`') tdSql.query(f'select `{self.ntbname1}`.`c0` from `{self.ntbname2}` `{self.ntbname1}`')
tdSql.checkEqual(tdSql.queryResult[0][0], 2) tdSql.checkData(0, 0, 2)
tdSql.query(f'select `{self.ntbname1}`.`c0` from (select * from `{self.ntbname2}`) `{self.ntbname1}`') tdSql.query(f'select `{self.ntbname1}`.`c0` from (select * from `{self.ntbname2}`) `{self.ntbname1}`')
tdSql.checkEqual(tdSql.queryResult[0][0], 2) tdSql.checkData(0, 0, 2)
# select `t1`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from t2) `t1`; # select `t1`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from t2) `t1`;
tdSql.query(f'select `{self.ntbname1}`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from {self.ntbname2}) `{self.ntbname1}`') tdSql.query(f'select `{self.ntbname1}`.`col1`, `col2`, `col3` from (select ts `col1`, 123 `col2`, c0 + c1 as `col3` from {self.ntbname2}) `{self.ntbname1}`')
tdSql.checkEqual(tdSql.queryResult[0][1], 123) tdSql.checkData(0, 1, 123)
tdSql.checkEqual(tdSql.queryResult[0][2], 4) tdSql.checkData(0, 2, 4)
# tdSql.execute(f'drop database {self.dbname}') # tdSql.execute(f'drop database {self.dbname}')
@ -117,15 +117,15 @@ class TDTestCase:
tdSql.query(f'select `t1`.`ts`, `t1`.`c0` + `t2`.`c0` as `c0`, `t1`.`c1` * `t2`.`c1` as `c1` from `{self.ntbname1}` `t1` join `{self.ntbname2}` `t2` on timetruncate(`t1`.`ts`, 1s) = timetruncate(`t2`.`ts`, 1s);') tdSql.query(f'select `t1`.`ts`, `t1`.`c0` + `t2`.`c0` as `c0`, `t1`.`c1` * `t2`.`c1` as `c1` from `{self.ntbname1}` `t1` join `{self.ntbname2}` `t2` on timetruncate(`t1`.`ts`, 1s) = timetruncate(`t2`.`ts`, 1s);')
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkEqual(tdSql.queryResult[0][1], 3) tdSql.checkData(0, 1, 3)
tdSql.query(f'select `t1`.`ts`, `t1`.`c1`, `t1`.`c2` from (select `ts`, `c0` + 1 as `c1`, `c1` + 2 as `c2` from `{self.ntbname1}`) `t1`;') tdSql.query(f'select `t1`.`ts`, `t1`.`c1`, `t1`.`c2` from (select `ts`, `c0` + 1 as `c1`, `c1` + 2 as `c2` from `{self.ntbname1}`) `t1`;')
tdSql.checkEqual(tdSql.queryResult[0][1], 2) tdSql.checkData(0, 1, 2)
tdSql.checkEqual(tdSql.queryResult[0][2], 3) tdSql.checkData(0, 2, 3)
tdSql.query(f'select `t`.`ts`, cast(`t`.`v1` as int) + `t`.`c0` as `v` from (select `ts`, "12" as `v1`, `c0`, `c1` from `ntb1`) `t`;') tdSql.query(f'select `t`.`ts`, cast(`t`.`v1` as int) + `t`.`c0` as `v` from (select `ts`, "12" as `v1`, `c0`, `c1` from `ntb1`) `t`;')
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkEqual(tdSql.queryResult[0][1], 13) tdSql.checkData(0, 1, 13)
tdSql.query(f'select count(`t1`.`ts`) from (select `t`.`ts` from `{self.ntbname1}` `t`) `t1`;') tdSql.query(f'select count(`t1`.`ts`) from (select `t`.`ts` from `{self.ntbname1}` `t`) `t1`;')
tdSql.checkRows(1) tdSql.checkRows(1)
@ -133,7 +133,8 @@ class TDTestCase:
def run(self): def run(self):
self.topic_name_check() self.topic_name_check()
self.db_name_check() self.db_name_check()
self.stream_name_check() if platform.system().lower() == 'windows':
self.stream_name_check()
self.table_name_check() self.table_name_check()
self.view_name_check() self.view_name_check()
self.query_check() self.query_check()

View File

@ -16,7 +16,7 @@ import random
import time import time
import copy import copy
import string import string
import platform
import taos import taos
from util.log import * from util.log import *
from util.cases import * from util.cases import *
@ -380,14 +380,15 @@ class TDTestCase:
# forbid # forbid
def checkForbid(self): def checkForbid(self):
# stream # stream
tdLog.info("check forbid split having stream...") if platform.system().lower() != 'windows':
tdSql.execute("create database streamdb;") tdLog.info("check forbid split having stream...")
tdSql.execute("use streamdb;") tdSql.execute("create database streamdb;")
tdSql.execute("create table ta(ts timestamp, age int);") tdSql.execute("use streamdb;")
tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") tdSql.execute("create table ta(ts timestamp, age int);")
self.expectSplitError("streamdb") tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);")
tdSql.execute("drop stream ma;") self.expectSplitError("streamdb")
self.expectSplitOk("streamdb") tdSql.execute("drop stream ma;")
self.expectSplitOk("streamdb")
# topic # topic
tdLog.info("check forbid split having topic...") tdLog.info("check forbid split having topic...")

View File

@ -16,7 +16,7 @@ import random
import time import time
import copy import copy
import string import string
import platform
import taos import taos
from util.log import * from util.log import *
from util.cases import * from util.cases import *
@ -380,14 +380,15 @@ class TDTestCase:
# forbid # forbid
def checkForbid(self): def checkForbid(self):
# stream # stream
tdLog.info("check forbid split having stream...") if platform.system().lower() != 'windows':
tdSql.execute("create database streamdb;") tdLog.info("check forbid split having stream...")
tdSql.execute("use streamdb;") tdSql.execute("create database streamdb;")
tdSql.execute("create table ta(ts timestamp, age int);") tdSql.execute("use streamdb;")
tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);") tdSql.execute("create table ta(ts timestamp, age int);")
self.expectSplitError("streamdb") tdSql.execute("create stream ma into sta as select count(*) from ta interval(1s);")
tdSql.execute("drop stream ma;") self.expectSplitError("streamdb")
self.expectSplitOk("streamdb") tdSql.execute("drop stream ma;")
self.expectSplitOk("streamdb")
# topic # topic
tdLog.info("check forbid split having topic...") tdLog.info("check forbid split having topic...")

View File

@ -154,7 +154,10 @@ class TDTestCase:
tdSql.query("use source_db") tdSql.query("use source_db")
tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);") tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);")
tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);") tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);")
tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);") if platform.system().lower() == 'windows':
pass
else:
tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS startts, min(k), max(k), sum(k) from source_db.stb interval(10m);")
#TD-19944 -Q=3 #TD-19944 -Q=3

View File

@ -17,7 +17,10 @@ class TDTestCase:
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), logSql)
self.buffer_boundary = [3, 4097, 8193, 12289, 16384] if platform.system().lower() == 'windows':
self.buffer_boundary = [3, 4097]
else:
self.buffer_boundary = [3, 4097, 8193, 12289, 16384]
# remove the value > free_memory, 70% is the weight to calculate the max value # remove the value > free_memory, 70% is the weight to calculate the max value
# if platform.system() == "Linux" and platform.machine() == "aarch64": # if platform.system() == "Linux" and platform.machine() == "aarch64":
# mem = psutil.virtual_memory() # mem = psutil.virtual_memory()

View File

@ -22,6 +22,7 @@ from util.cases import tdCases
from util.sql import tdSql from util.sql import tdSql
from util.dnodes import tdDnodes from util.dnodes import tdDnodes
from util.dnodes import * from util.dnodes import *
from util.common import *
class TDTestCase: class TDTestCase:
updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 135} updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 135}
@ -158,7 +159,8 @@ class TDTestCase:
fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1))) fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
# create stream # create stream
tdSql.execute('''create stream current_stream trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''') stream_name="current_stream"
tdSql.execute(f'''create stream {stream_name} trigger at_once IGNORE EXPIRED 0 into stream_max_stable_1 as select _wstart as startts, _wend as wend, max(q_int) as max_int, min(q_bigint) as min_int from stable_1 where ts is not null interval (5s);''')
# insert data positive # insert data positive
for i in range(num_random*n): for i in range(num_random*n):
@ -287,8 +289,8 @@ class TDTestCase:
tdSql.query("select count(*) from hn_table_1_r;") tdSql.query("select count(*) from hn_table_1_r;")
tdSql.checkData(0,0,num_random*n) tdSql.checkData(0,0,num_random*n)
sleep(5)
# stream data check # stream data check
tdCom.check_stream_task_status(stream_name,vgroups,90)
tdSql.query("select startts,wend,max_int from stream_max_stable_1 ;") tdSql.query("select startts,wend,max_int from stream_max_stable_1 ;")
tdSql.checkRows(20) tdSql.checkRows(20)
tdSql.query("select sum(max_int) from stream_max_stable_1 ;") tdSql.query("select sum(max_int) from stream_max_stable_1 ;")

View File

@ -162,7 +162,8 @@ class TDTestCase:
self.drop_ntb_check() self.drop_ntb_check()
self.drop_stb_ctb_check() self.drop_stb_ctb_check()
self.drop_topic_check() self.drop_topic_check()
self.drop_stream_check() if platform.system().lower() == 'windows':
self.drop_stream_check()
pass pass
def stop(self): def stop(self):
tdSql.close() tdSql.close()

View File

@ -14,7 +14,7 @@
import sys import sys
import random import random
import time import time
import platform
import taos import taos
from util.log import * from util.log import *
from util.cases import * from util.cases import *
@ -149,9 +149,10 @@ class TDTestCase:
tdSql.execute(sql) tdSql.execute(sql)
# create stream # create stream
sql = "create stream ma into sta as select count(ts) from st interval(100b)" if platform.system().lower() != 'windows':
tdLog.info(sql) sql = "create stream ma into sta as select count(ts) from st interval(100b)"
tdSql.execute(sql) tdLog.info(sql)
tdSql.execute(sql)
# insert data # insert data
self.insertData() self.insertData()
@ -315,7 +316,8 @@ class TDTestCase:
self.checkWhere() self.checkWhere()
# check stream # check stream
self.checkStream() if platform.system().lower() != 'windows':
self.checkStream()
# stop # stop
def stop(self): def stop(self):

View File

@ -14,7 +14,7 @@
import sys import sys
import random import random
import time import time
import platform
import taos import taos
from util.log import * from util.log import *
from util.cases import * from util.cases import *
@ -149,9 +149,10 @@ class TDTestCase:
tdSql.execute(sql) tdSql.execute(sql)
# create stream # create stream
sql = "create stream ma into sta as select count(ts) from st interval(100u)" if platform.system().lower() != 'windows':
tdLog.info(sql) sql = "create stream ma into sta as select count(ts) from st interval(100u)"
tdSql.execute(sql) tdLog.info(sql)
tdSql.execute(sql)
# insert data # insert data
self.insertData() self.insertData()
@ -289,7 +290,8 @@ class TDTestCase:
self.checkWhere() self.checkWhere()
# check stream # check stream
self.checkStream() if platform.system().lower() != 'windows':
self.checkStream()
# stop # stop
def stop(self): def stop(self):

View File

@ -25,7 +25,9 @@ class TDTestCase:
self.tag2 = f'using {self.stable0}(groupId) tags(2)' self.tag2 = f'using {self.stable0}(groupId) tags(2)'
self.file1 = f"{self.testcasePath}/b.csv" self.file1 = f"{self.testcasePath}/b.csv"
self.file2 = f"{self.testcasePath}/c.csv" self.file2 = f"{self.testcasePath}/c.csv"
if platform.system().lower() == 'windows':
self.file1 = self.file1.replace("\\","\\\\")
self.file2 = self.file2.replace("\\","\\\\")
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), logSql)

View File

@ -56,26 +56,33 @@ class TDTestCase(TDTestCase):
def check_sql_result_include(self, sql,include_result): def check_sql_result_include(self, sql,include_result):
result = os.popen("taos -s 'reset query cache; %s'" %sql) result = os.popen(f"taos -s \"reset query cache; {sql}\"" )
res = result.read() res = result.read()
#tdLog.info(res) if res is None or res == '':
if (include_result in res):
tdLog.info(f"check_sql_result_include : checkEqual success")
else :
tdLog.info(res)
tdLog.info(sql) tdLog.info(sql)
tdLog.exit(f"check_sql_result_include : checkEqual error") tdLog.exit(f"check_sql_result_include : taos -s return null")
else:
if (include_result in res):
tdLog.info(f"check_sql_result_include : checkEqual success")
else :
tdLog.info(res)
tdLog.info(sql)
tdLog.exit(f"check_sql_result_include : checkEqual error")
def check_sql_result_not_include(self, sql,not_include_result): def check_sql_result_not_include(self, sql,not_include_result):
result = os.popen("taos -s 'reset query cache; %s'" %sql) result = os.popen(f"taos -s \"reset query cache; {sql}\"" )
res = result.read() res = result.read()
#tdLog.info(res) #tdLog.info(res)
if (not_include_result in res): if res is None or res == '':
tdLog.info(res)
tdLog.info(sql) tdLog.info(sql)
tdLog.exit(f"check_sql_result_not_include : checkEqual error") tdLog.exit(f"check_sql_result_not_include : taos -s return null")
else : else:
tdLog.info(f"check_sql_result_not_include : checkEqual success") if (not_include_result in res):
tdLog.info(res)
tdLog.info(sql)
tdLog.exit(f"check_sql_result_not_include : checkEqual error")
else :
tdLog.info(f"check_sql_result_not_include : checkEqual success")
def cachemodel_none(self, dbname="nested"): def cachemodel_none(self, dbname="nested"):
@ -325,6 +332,7 @@ class TDTestCase(TDTestCase):
for i in range(2): for i in range(2):
self.cachemodel_none() self.cachemodel_none()
tdLog.info("last_row")
tdSql.query("alter database nested cachemodel 'last_row' ") tdSql.query("alter database nested cachemodel 'last_row' ")
tdSql.query("reset query cache;") tdSql.query("reset query cache;")
self.cachemodel_last_row() self.cachemodel_last_row()

View File

@ -65,9 +65,12 @@ class TDTestCase:
while count < self.mnodeCheckCnt: while count < self.mnodeCheckCnt:
time.sleep(1) time.sleep(1)
tdSql.query("select * from information_schema.ins_mnodes;") tdSql.query("select * from information_schema.ins_mnodes;")
rst = tdSql.checkRows(self.mnodes)
print(f"rst: {rst}")
if tdSql.checkRows(self.mnodes) : if tdSql.checkRows(self.mnodes) :
tdLog.debug("mnode is three nodes") tdLog.debug("mnode is three nodes")
else: else:
tdSql.print_error_frame_info(tdSql.queryRows,3)
tdLog.exit("mnode number is correct") tdLog.exit("mnode number is correct")
roleOfMnode0 = tdSql.queryResult[0][self.roleIndex] roleOfMnode0 = tdSql.queryResult[0][self.roleIndex]

View File

@ -1,2 +1,19 @@
#python3 ./test.py -f 2-query/last.py -Q 3 python3 ./test.py -f 2-query/match.py
#./test.sh -f tsim/mnode/basic4.sim python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1
python3 ./test.py -f 2-query/tsma.py
python3 ./test.py -f 2-query/tsma2.py
python3 ./test.py -f 1-insert/database_pre_suf.py
python3 ./test.py -f 0-others/splitVGroup.py -N 3 -n 1
python3 ./test.py -f 0-others/splitVGroupWal.py -N 3 -n 1
python3 ./test.py -f 0-others/delete_check.py
python3 ./test.py -f 1-insert/alter_database.py
python3 ./test.py -f 1-insert/db_tb_name_check.py
python3 ./test.py -f 1-insert/precisionUS.py
python3 ./test.py -f 1-insert/precisionNS.py
python3 ./test.py -f 1-insert/ts-4272.py
python3 ./test.py -f 2-query/last+last_row.py
python3 ./test.py -f 2-query/normal.py
python3 ./test.py -f 2-query/To_iso8601.py
python3 ./test.py -f 2-query/normal.py
python3 ./test.py -f 5-taos-tools/taosbenchmark/insertMix.py -N 3
python3 ./test.py -f 7-tmq/tmq_taosx.py

View File

@ -44,7 +44,7 @@ def checkRunTimeError():
time.sleep(1) time.sleep(1)
timeCount = timeCount + 1 timeCount = timeCount + 1
print("checkRunTimeError",timeCount) print("checkRunTimeError",timeCount)
if (timeCount>600): if (timeCount>1200):
print("stop the test.") print("stop the test.")
os.system("TASKKILL /F /IM taosd.exe") os.system("TASKKILL /F /IM taosd.exe")
os.system("TASKKILL /F /IM taos.exe") os.system("TASKKILL /F /IM taos.exe")

View File

@ -104,7 +104,6 @@ python3 ./test.py -f 2-query/insert_null_none.py -R
python3 ./test.py -f 2-query/insert_null_none.py -Q 2 python3 ./test.py -f 2-query/insert_null_none.py -Q 2
python3 ./test.py -f 2-query/insert_null_none.py -Q 3 python3 ./test.py -f 2-query/insert_null_none.py -Q 3
python3 ./test.py -f 2-query/insert_null_none.py -Q 4 python3 ./test.py -f 2-query/insert_null_none.py -Q 4
python3 ./test.py -f 1-insert/database_pre_suf.py
python3 ./test.py -f 2-query/concat.py -Q 3 python3 ./test.py -f 2-query/concat.py -Q 3
python3 ./test.py -f 2-query/out_of_order.py -Q 2 python3 ./test.py -f 2-query/out_of_order.py -Q 2
python3 ./test.py -f 2-query/out_of_order.py -Q 4 python3 ./test.py -f 2-query/out_of_order.py -Q 4
@ -572,7 +571,6 @@ python3 ./test.py -f 2-query/join2.py
python3 ./test.py -f 2-query/union1.py python3 ./test.py -f 2-query/union1.py
python3 ./test.py -f 2-query/concat2.py python3 ./test.py -f 2-query/concat2.py
python3 ./test.py -f 2-query/json_tag.py python3 ./test.py -f 2-query/json_tag.py
python3 ./test.py -f 2-query/nestedQueryInterval.py
python3 ./test.py -f 2-query/systable_func.py python3 ./test.py -f 2-query/systable_func.py
python3 ./test.py -f 2-query/test_ts4382.py python3 ./test.py -f 2-query/test_ts4382.py
python3 ./test.py -f 2-query/test_ts4403.py python3 ./test.py -f 2-query/test_ts4403.py
@ -687,7 +685,6 @@ python3 ./test.py -f 2-query/arctan.py -Q 2
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2
python3 ./test.py -f 2-query/interp.py -Q 2 python3 ./test.py -f 2-query/interp.py -Q 2
python3 ./test.py -f 2-query/fill.py -Q 2 python3 ./test.py -f 2-query/fill.py -Q 2
python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2
python3 ./test.py -f 2-query/stablity.py -Q 2 python3 ./test.py -f 2-query/stablity.py -Q 2
python3 ./test.py -f 2-query/stablity_1.py -Q 2 python3 ./test.py -f 2-query/stablity_1.py -Q 2
python3 ./test.py -f 2-query/avg.py -Q 2 python3 ./test.py -f 2-query/avg.py -Q 2
@ -783,7 +780,6 @@ python3 ./test.py -f 2-query/arcsin.py -Q 3
python3 ./test.py -f 2-query/arccos.py -Q 3 python3 ./test.py -f 2-query/arccos.py -Q 3
python3 ./test.py -f 2-query/arctan.py -Q 3 python3 ./test.py -f 2-query/arctan.py -Q 3
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3
python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 3
python3 ./test.py -f 2-query/stablity.py -Q 3 python3 ./test.py -f 2-query/stablity.py -Q 3
python3 ./test.py -f 2-query/stablity_1.py -Q 3 python3 ./test.py -f 2-query/stablity_1.py -Q 3
python3 ./test.py -f 2-query/avg.py -Q 3 python3 ./test.py -f 2-query/avg.py -Q 3
@ -881,7 +877,6 @@ python3 ./test.py -f 2-query/arcsin.py -Q 4
python3 ./test.py -f 2-query/arccos.py -Q 4 python3 ./test.py -f 2-query/arccos.py -Q 4
python3 ./test.py -f 2-query/arctan.py -Q 4 python3 ./test.py -f 2-query/arctan.py -Q 4
python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4
python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 4
python3 ./test.py -f 2-query/stablity.py -Q 4 python3 ./test.py -f 2-query/stablity.py -Q 4
python3 ./test.py -f 2-query/stablity_1.py -Q 4 python3 ./test.py -f 2-query/stablity_1.py -Q 4
python3 ./test.py -f 2-query/avg.py -Q 4 python3 ./test.py -f 2-query/avg.py -Q 4
@ -914,7 +909,6 @@ python3 ./test.py -f 2-query/last_row.py -Q 4
python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
python3 ./test.py -f 2-query/sml.py -Q 4 python3 ./test.py -f 2-query/sml.py -Q 4
python3 ./test.py -f 2-query/interp.py -Q 4 python3 ./test.py -f 2-query/interp.py -Q 4
python3 ./test.py -f 2-query/fill.py -Q 4
python3 ./test.py -f 2-query/case_when.py -Q 4 python3 ./test.py -f 2-query/case_when.py -Q 4
python3 ./test.py -f 2-query/insert_select.py python3 ./test.py -f 2-query/insert_select.py
python3 ./test.py -f 2-query/insert_select.py -R python3 ./test.py -f 2-query/insert_select.py -R