Merge branch '3.0' into enh/TS-5111-3.0

This commit is contained in:
kailixu 2024-09-20 11:57:21 +08:00
commit 74242ea74b
26 changed files with 5303 additions and 179 deletions

View File

@ -2822,8 +2822,8 @@ enum {
TOPIC_SUB_TYPE__COLUMN,
};
#define DEFAULT_MAX_POLL_INTERVAL 3000000
#define DEFAULT_SESSION_TIMEOUT 12000
#define DEFAULT_MAX_POLL_INTERVAL 300000
#define DEFAULT_SESSION_TIMEOUT 12000
typedef struct {
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic

View File

@ -31,7 +31,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
if (pBuf->pData == NULL) {
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
if (pBuf->pData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -43,7 +43,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -54,7 +54,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
}
void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -101,7 +101,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -112,7 +112,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
}
void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -655,7 +655,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
if (buf == NULL) {
cleanupBlockOrderSupporter(&sup);
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
@ -686,7 +686,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i};
void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
@ -730,7 +730,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo;
@ -738,7 +738,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
// set data block index overflow, in order to disable the offset comparator
@ -862,7 +862,7 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
void* px = taosArrayPush(pScanInfo->pFileDelData, &delData);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
}
@ -1122,7 +1122,7 @@ int32_t doAdjustValidDataIters(SArray* pLDIterList, int32_t numOfFileObj) {
void* px = taosArrayPush(pLDIterList, &pIter);
if (px == NULL) {
taosMemoryFree(pIter);
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}
} else if (size > numOfFileObj) { // remove unused LDataIter
@ -1149,7 +1149,7 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet)
}
void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
}

View File

@ -691,7 +691,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx);
if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
}
if (n != size) {
@ -734,7 +734,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) {
n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk);
if (taosArrayPush(aSttBlk, &sttBlk) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
}
if (n != size) {
@ -866,7 +866,7 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa
continue;
}
if (taosArrayPush(aDelData, &delData) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
}
@ -908,7 +908,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) {
n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx);
if (taosArrayPush(aDelIdx, &delIdx) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
}

View File

@ -364,7 +364,7 @@ static int32_t tsdbAsyncRetentionImpl(STsdb *tsdb, int64_t now, bool s3Migrate)
SRtnArg *arg = taosMemoryMalloc(sizeof(*arg));
if (arg == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
TAOS_CHECK_GOTO(terrno, &lino, _exit);
}
arg->tsdb = tsdb;

View File

@ -244,7 +244,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
}
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
if (*data == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
TSDB_CHECK_CODE(code, lino, _exit);
}
@ -347,7 +347,7 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
if (data[0] == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
TSDB_CHECK_CODE(code, lino, _exit);
}

View File

@ -123,7 +123,7 @@ int32_t tsdbSttFileReadStatisBlk(SSttFileReader *reader, const TStatisBlkArray *
int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk);
void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size);
if (!data) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@ -157,7 +157,7 @@ int32_t tsdbSttFileReadTombBlk(SSttFileReader *reader, const TTombBlkArray **tom
int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk);
void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size);
if (!data) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@ -191,7 +191,7 @@ int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBl
int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk);
void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size);
if (!data) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;

View File

@ -56,7 +56,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
// read SBlockIdx array
if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
TAOS_CHECK_GOTO(terrno, &lino, _exit);
}
TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit);
@ -236,7 +236,7 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade
SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
if (aSttBlk == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
TAOS_CHECK_GOTO(terrno, &lino, _exit);
}
TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit);
@ -460,7 +460,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey);
if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
TAOS_CHECK_GOTO(terrno, &lino, _exit);
}
for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) {
@ -550,7 +550,7 @@ static int32_t tsdbUpgradeTombFile(STsdb *tsdb, SDelFile *pDelFile, TFileSetArra
SArray *aDelIdx = NULL;
if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
TAOS_CHECK_GOTO(terrno, &lino, _exit);
}
TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit);

View File

@ -116,7 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
if (pArray == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}

View File

@ -679,7 +679,7 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
// create channel object
SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel));
if (channel == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
channel->state = EVA_CHANNEL_STATE_OPEN;
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
@ -727,7 +727,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
};
SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo));
if (cancelArray == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
(void)taosThreadMutexLock(&async->mutex);

View File

@ -21,7 +21,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
pPool = taosMemoryMalloc(sizeof(SVBufPool) + size);
if (pPool == NULL) {
return terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
memset(pPool, 0, sizeof(SVBufPool));
@ -43,7 +43,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock));
if (!pPool->lock) {
taosMemoryFree(pPool);
return terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
if (taosThreadSpinInit(pPool->lock, 0) != 0) {
taosMemoryFree((void *)pPool->lock);

View File

@ -125,7 +125,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
}
SJson *pNodeRetentions = tjsonCreateArray();
if (pNodeRetentions == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
for (int32_t i = 0; i < nRetention; ++i) {
@ -167,7 +167,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
SJson *nodeInfo = tjsonCreateArray();
if (nodeInfo == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo));
vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId,
@ -175,7 +175,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) {
SJson *info = tjsonCreateObject();
if (info == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i];

View File

@ -241,7 +241,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
pData = taosMemoryMalloc(size + 1);
if (pData == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
if (taosReadFile(pFile, pData, size) < 0) {

View File

@ -55,7 +55,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
(*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable));
if (*ht == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
(*ht)->hash = hash;
@ -102,7 +102,7 @@ int32_t vHashPut(SVHashTable* ht, void* obj) {
SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry));
if (entry == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
entry->obj = obj;
entry->next = ht->buckets[bucketIndex];

View File

@ -262,7 +262,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
cfgRsp.tagsLen = pTag->len;
cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
if (NULL == cfgRsp.pTags) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
(void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
@ -288,7 +288,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
(void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
@ -391,7 +391,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
if (NULL == batchRsp.pRsps) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
goto _exit;
}
@ -448,7 +448,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
}
@ -586,7 +586,7 @@ int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list) {
STableKeyInfo info = {uid = id};
if (NULL == taosArrayPush(list, &info)) {
qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
}
@ -616,7 +616,7 @@ int32_t vnodeGetCtbIdList(void *pVnode, int64_t suid, SArray *list) {
if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
}
@ -641,7 +641,7 @@ int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
}
@ -671,7 +671,7 @@ int32_t vnodeGetStbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bo
if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
}
@ -786,7 +786,7 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
SArray *suidList = NULL;
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
return terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
int32_t tbFilterSize = 0;

View File

@ -281,7 +281,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
if (*ppData == NULL) {
(void)taosCloseFile(&pFile);
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
TSDB_CHECK_CODE(code = terrno, lino, _exit);
}
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
((SSnapDataHdr *)(*ppData))->size = size + 1;

View File

@ -180,7 +180,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
{ // find expired uids
tbUids = taosArrayInit(8, sizeof(tb_uid_t));
if (tbUids == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
TSDB_CHECK_CODE(code, lino, _exit);
}
@ -206,7 +206,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
SMsgHead *pContNew = rpcMallocCont(contLenNew);
if (pContNew == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
TSDB_CHECK_CODE(code, lino, _exit);
}
@ -1536,7 +1536,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
pCxt->pTbData->pCreateTbReq = NULL;
pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES);
if (NULL == pCxt->pTbData->aRowP) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
taosArrayDestroy(pCxt->pColValues);
@ -1623,7 +1623,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) {
pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
if (NULL == pReq2->aSubmitTbData) {
return TSDB_CODE_OUT_OF_MEMORY;
return terrno;
}
SSubmitReqConvertCxt cxt = {0};
@ -1651,7 +1651,7 @@ static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pRe
}
}
if (TSDB_CODE_SUCCESS == code) {
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS);
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? terrno : TSDB_CODE_SUCCESS);
}
if (TSDB_CODE_SUCCESS == code) {
taosMemoryFreeClear(cxt.pTbData);
@ -1670,7 +1670,7 @@ static int32_t vnodeRebuildSubmitReqMsg(SSubmitReq2 *pSubmitReq, void **ppMsg) {
if (TSDB_CODE_SUCCESS == code) {
pMsg = taosMemoryMalloc(msglen);
if (NULL == pMsg) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
}
}
if (TSDB_CODE_SUCCESS == code) {
@ -1847,7 +1847,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
if (pSubmitRsp->aCreateTbRsp == NULL &&
(pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) ==
NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
@ -1859,7 +1859,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
if (newTbUids == NULL &&
(newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _exit;
}
@ -2238,7 +2238,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t));
if (pRes->uidList == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
goto _err;
}

View File

@ -32,7 +32,7 @@ char* tsAuditBatchUri = "/audit-batch";
int32_t auditInit(const SAuditCfg *pCfg) {
tsAudit.cfg = *pCfg;
tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *));
if(tsAudit.records == NULL) return TSDB_CODE_OUT_OF_MEMORY;
if(tsAudit.records == NULL) return terrno;
return taosThreadMutexInit(&tsAudit.lock, NULL);
}

View File

@ -443,7 +443,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
if (tTagIsJson(pTag)) {
pTagVals = taosArrayInit(1, sizeof(STagVal));
if (NULL == pTagVals) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
char* pJson = NULL;
@ -460,7 +460,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
taosMemoryFree(pJson);
taosArrayDestroy(pTagVals);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
} else {
CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals));
@ -938,14 +938,14 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) {
false, HASH_ENTRY_LOCK);
if (NULL == clusterCtg->dbCache) {
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum,
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
if (NULL == clusterCtg->userCache) {
qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES);
@ -1592,7 +1592,7 @@ int32_t catalogGetExpiredViews(SCatalog* pCtg, SViewVersion** views, uint32_t* n
*dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion));
if (NULL == *dynViewVersion) {
CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY);
CTG_API_LEAVE(terrno);
}
(*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs);

View File

@ -61,7 +61,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
@ -69,7 +69,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -97,12 +97,12 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum,
(int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
@ -130,7 +130,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -158,7 +158,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -186,7 +186,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -212,7 +212,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
@ -220,7 +220,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx,
@ -248,12 +248,12 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum,
(int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
@ -272,7 +272,7 @@ int32_t ctgInitGetQnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -290,7 +290,7 @@ int32_t ctgInitGetDnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -317,7 +317,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx,
@ -345,7 +345,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx,
@ -373,7 +373,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx,
@ -391,7 +391,7 @@ int32_t ctgInitGetSvrVerTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -416,14 +416,14 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -449,14 +449,14 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -482,14 +482,14 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -517,12 +517,12 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum,
(int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx,
@ -549,12 +549,12 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum,
(int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
return TSDB_CODE_SUCCESS;
@ -577,12 +577,12 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum,
(int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
return TSDB_CODE_SUCCESS;
@ -643,7 +643,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con
if (NULL == pDb || NULL == pTb) {
taosHashCleanup(pDb);
taosHashCleanup(pTb);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
@ -896,14 +896,14 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (NULL == pJob->pBatchs) {
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
#endif
pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask));
if (NULL == pJob->pTasks) {
ctgError("taosArrayInit %d tasks failed", taskNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
if (pReq->forceUpdate && taskNum) {
@ -1069,7 +1069,7 @@ int32_t ctgDumpTbMetaRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pTableMeta) {
pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pTableMeta) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1114,7 +1114,7 @@ int32_t ctgDumpDbVgRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbVgroup) {
pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbVgroup) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1135,7 +1135,7 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pTableHash) {
pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pTableHash) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1243,7 +1243,7 @@ int32_t ctgDumpIndexRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pIndex) {
pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pIndex) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1264,7 +1264,7 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pQnodeList) {
pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pQnodeList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1285,7 +1285,7 @@ int32_t ctgDumpDnodeRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDnodeList) {
pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDnodeList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1306,7 +1306,7 @@ int32_t ctgDumpDbCfgRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbCfg) {
pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbCfg) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1327,7 +1327,7 @@ int32_t ctgDumpDbInfoRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbInfo) {
pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbInfo) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1348,7 +1348,7 @@ int32_t ctgDumpUdfRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pUdfList) {
pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pUdfList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -1369,7 +1369,7 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pUser) {
pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pUser) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -2152,7 +2152,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
if (NULL == pTask->res) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName,
@ -2331,7 +2331,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
if (tTagIsJson(pTag)) {
pTagVals = taosArrayInit(1, sizeof(STagVal));
if (NULL == pTagVals) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
char* pJson = NULL;
@ -2348,7 +2348,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
taosMemoryFree(pJson);
taosArrayDestroy(pTagVals);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
} else {
CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals));
@ -3093,7 +3093,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -3196,7 +3196,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
if (NULL != dbCache) {
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
if (NULL == pTask->res) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName,
(SVgroupInfo*)pTask->res));
@ -3264,7 +3264,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
for (int32_t j = 0; j < inc; ++j) {
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
}
@ -3281,7 +3281,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -3750,7 +3750,7 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -3843,7 +3843,7 @@ int32_t ctgLaunchGetTbTSMATask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {

View File

@ -600,7 +600,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
metaSize = CTG_META_SIZE(stbMeta);
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
if (NULL == *pTableMeta) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
@ -814,7 +814,7 @@ int32_t ctgGetCachedStbNameFromSuid(SCatalog* pCtg, char* dbFName, uint64_t suid
*stbName = taosStrdup(stb);
if (NULL == *stbName) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
}
taosHashRelease(dbCache->stbCache, stb);
@ -956,7 +956,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId)
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
char *p = strchr(dbFName, '.');
@ -1032,7 +1032,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1067,7 +1067,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1102,7 +1102,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
taosMemoryFree(op);
freeVgInfo(dbInfo);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
char *p = strchr(dbFName, '.');
@ -1152,7 +1152,7 @@ int32_t ctgUpdateDbCfgEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg));
taosMemoryFree(op);
freeDbCfgInfo(cfgInfo);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
char *p = strchr(dbFName, '.');
@ -1193,7 +1193,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool sy
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
char *p = strchr(output->dbFName, '.');
@ -1235,7 +1235,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEp
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1269,7 +1269,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
msg->pCtg = pCtg;
@ -1303,7 +1303,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncO
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
msg->pCtg = pCtg;
@ -1339,7 +1339,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) {
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1374,7 +1374,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1406,7 +1406,7 @@ int32_t ctgUpdateViewMetaEnqueue(SCatalog *pCtg, SViewMetaRsp *pRsp, bool syncOp
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
char *p = strchr(pRsp->dbFName, '.');
@ -1450,7 +1450,7 @@ int32_t ctgDropViewMetaEnqueue(SCatalog *pCtg, const char *dbFName, uint64_t dbI
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg));
taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
msg->pCtg = pCtg;
@ -1485,7 +1485,7 @@ int32_t ctgUpdateTbTSMAEnqueue(SCatalog *pCtg, STSMACache **pTsma, int32_t tsmaV
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
msg->pCtg = pCtg;
@ -1644,7 +1644,7 @@ int32_t ctgUpdateDbTsmaVersionEnqueue(SCatalog* pCtg, int32_t tsmaVersion, const
if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
msg->pCtg = pCtg;
@ -1675,28 +1675,28 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.tbCache) {
ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.stbCache) {
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.viewCache) {
ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
true, HASH_ENTRY_LOCK);
if (!newDBCache.tsmaCache) {
ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache));
@ -1707,7 +1707,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
}
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_CACHE_NUM_INC(CTG_CI_DB, 1);
@ -1845,7 +1845,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) {
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
taosMemoryFree(meta);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta));
@ -1879,7 +1879,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1);
@ -1911,7 +1911,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa
ctgFreeSTableIndex(*index);
taosMemoryFreeClear(*index);
ctgError("taosHashPut new tbCache failed, tbName:%s", tbName);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex));
@ -1971,7 +1971,7 @@ int32_t ctgWriteViewMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFN
if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) {
ctgError("taosHashPut new tbCache failed, viewName:%s", viewName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta));
@ -2101,16 +2101,16 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
SCtgTSMACache cache = {0};
cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
if (NULL == cache.pTsmas) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) {
ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache));
@ -2155,13 +2155,13 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
if (!pCache->pTsmas) {
CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
// push the new cache
if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) {
code = TSDB_CODE_OUT_OF_MEMORY;
code = terrno;
} else {
*ppTsmaCache = NULL;
@ -2437,7 +2437,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
if (NULL == ctbMeta) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
@ -2590,7 +2590,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosMemoryFreeClear(msg);
@ -3423,7 +3423,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
@ -3442,7 +3442,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_META_NHIT_INC();
@ -3459,7 +3459,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_META_NHIT_INC();
@ -3508,7 +3508,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
continue;
@ -3533,7 +3533,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
continue;
@ -3559,7 +3559,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosMemoryFreeClear(pTableMeta);
@ -3574,7 +3574,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosMemoryFreeClear(pTableMeta);
@ -3593,7 +3593,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosMemoryFreeClear(pTableMeta);
@ -3612,7 +3612,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosMemoryFreeClear(pTableMeta);
@ -3629,7 +3629,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize);
if (NULL == pTableMeta) {
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta));
@ -3646,7 +3646,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
lastSuid = pTableMeta->suid;
@ -3792,7 +3792,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -3811,7 +3811,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
@ -3825,7 +3825,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
@ -3857,7 +3857,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgReleaseViewMetaToCache(pCtg, dbCache, pCache);
ctgFreeSViewMeta(pViewMeta);
taosMemoryFree(pViewMeta);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
@ -3868,7 +3868,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
res.pRes = pViewMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
@ -3908,7 +3908,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
@ -3928,7 +3928,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
continue;
@ -3941,7 +3941,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
taosHashRelease(dbCache->tbCache, pTbCache);
@ -3966,7 +3966,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
continue;
@ -3978,7 +3978,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) {
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
continue;
@ -3993,7 +3993,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1);
@ -4012,7 +4012,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
if (!pRsp->pTsmas) {
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
taosMemoryFreeClear(pRsp);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
SMetaRes res = {0};
@ -4031,14 +4031,14 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
tFreeTableTSMAInfoRsp(pRsp);
taosMemoryFreeClear(pRsp);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_RET(terrno);
}
}
res.pRes = pRsp;
CTG_UNLOCK(CTG_READ, &pCache->tsmaLock);
taosHashRelease(dbCache->tsmaCache, pCache);
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
@ -4108,16 +4108,16 @@ int32_t ctgGetTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, SName* pTsmaNam
pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES);
if (!pRsp->pTsmas) {
tFreeAndClearTableTSMAInfo(pTsmaOut);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) {
tFreeAndClearTableTSMAInfo(pTsmaOut);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}

View File

@ -52,13 +52,13 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size)
if (NULL == slot->meta) {
qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
}
if (NULL == taosArrayPush(slot->meta, meta)) {
qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
mgmt->rentCacheSize += size;
@ -181,7 +181,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_
*res = taosMemoryMalloc(msize);
if (NULL == *res) {
qError("malloc %d failed", (int32_t)msize);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
CTG_ERR_JRET(terrno);
}
void *meta = taosArrayGet(slot->meta, 0);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
import taos
import socket
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.caseBase import *
from frame import *
from frame.eos import *
from frame.server.dnodes import *
class TDTestCase(TBase):
"""Add test case to cover having key word
"""
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), logSql)
def prepare_data(self):
# data for TD-32059
tdSql.execute("create database td32059;")
tdSql.execute("use td32059;")
tdSql.execute("create stable stb (ts timestamp, id int, gid int) tags (t1 int);")
tdSql.execute("insert into tb1 using stb (t1) tags (1) values ('2024-09-11 09:53:13.999', 6, 6)('2024-09-11 09:53:15.005', 6, 6)('2024-09-11 09:53:15.402', 6, 6);")
tdSql.execute("insert into tb2 using stb (t1) tags(2) values ('2024-09-11 09:54:59.790', 9, 9)('2024-09-11 09:55:58.978', 11, 11)('2024-09-11 09:56:22.755', 12, 12)('2024-09-11 09:56:23.276', 12, 12)('2024-09-11 09:56:23.783', 12, 12)('2024-09-11 09:56:26.783', 12, 12)('2024-09-11 09:56:29.783', 12, 12);")
def test_td32059(self):
tdSql.execute("use td32059;")
tdSql.query("SELECT _wstart, last_row(id) FROM stb WHERE ts BETWEEN '2024-09-11 09:50:13.999' AND '2024-09-11 09:59:13.999' INTERVAL(30s) FILL(PREV) HAVING(last_row(id) IS NOT NULL);")
tdSql.checkRows(13)
assert ('NULL' not in [item[1] for item in tdSql.res])
def run(self):
self.prepare_data()
self.test_td32059()
def stop(self):
tdSql.execute("drop database td32059;")
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -51,6 +51,22 @@ class TDTestCase(TBase):
sql += f"({start_ts + i * 1000 * 1000 + j * 1000}, {','.join([str(item) for item in data[index[i]]])}),"
sql += ";"
tdSql.execute(sql)
# database for case TD-31880
tdSql.execute("create database db_td31880;")
tdSql.execute("use db_td31880;")
# super table
# tdSql.execute("create table st (ts timestamp, c1 int) tags(t1 int);")
tdSql.execute("create stable if not exists db_td31880.stb (ts timestamp, c1 timestamp, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 int unsigned, c9 bigint unsigned, c10 float, c11 double, c12 varchar(64), c13 varbinary(64), c14 nchar(64), c15 geometry(64), c16 bool) tags (t1 timestamp, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 tinyint unsigned, t7 smallint unsigned, t8 int unsigned, t9 bigint unsigned, t10 float, t11 double, t12 varchar(64), t13 varbinary(64), t14 nchar(64), t15 geometry(64), t16 bool);")
csv_file = os.sep.join([os.path.dirname(__file__), "create_table_by_csv_0627_5.csv"])
tdSql.execute(f"insert into db_td31880.stb (ts,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,tbname) file '{csv_file}';")
# database for case TD-31966
tdSql.execute("create database db_td31966;")
tdSql.execute("use db_td31966;")
tdSql.execute("create table tb1 (ts timestamp, c1 int, c2 int);")
sql = "insert into tb1 values ('2024-09-09 11:41:00', 1, 1)('2024-09-09 11:41:01', 1, 100)('2024-09-09 11:41:02', 2, 1)('2024-09-09 11:41:11', 2, 2)('2024-09-09 11:41:12', 2, 100)"
tdSql.execute(sql)
def test_ts4806(self):
tdSql.execute("use db_ts4806;")
@ -64,9 +80,53 @@ class TDTestCase(TBase):
tdSql.checkData(4, 1, '30000002')
tdSql.checkData(4, 2, 1001)
def test_td31880(self):
tdSql.execute("use db_td31880;")
tdSql.query("select last_row(ts) from stb group by tbname;")
tdSql.checkRows(5000)
def test_td31966(self):
tdSql.execute("use db_td31966;")
tdSql.error("select percentile(c2,20) from tb1 count_window(2);")
tdSql.error("select percentile(c2,20) from tb1 event_window start with f1 = 1 end with f1 > 1;")
# percentile min for time window
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 interval(5s) sliding(3s);")
tdSql.checkRows(4)
tdSql.checkData(0, 2, 1)
tdSql.checkData(1, 2, 1)
tdSql.checkData(2, 2, 2)
tdSql.checkData(3, 2, 100)
# percentile max for time window
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 interval(5s) sliding(3s);")
tdSql.checkRows(4)
tdSql.checkData(0, 2, 100)
tdSql.checkData(1, 2, 100)
tdSql.checkData(2, 2, 100)
tdSql.checkData(3, 2, 100)
# percentile min for state window
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 state_window(1);")
tdSql.checkRows(1)
tdSql.checkData(0, 2, 1)
# percentile max for state window
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 state_window(1);")
tdSql.checkRows(1)
tdSql.checkData(0, 2, 100)
# percentile min for session window
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 session(ts, 3s);")
tdSql.checkRows(2)
tdSql.checkData(0, 2, 1)
tdSql.checkData(1, 2, 2)
# percentile max for session window
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 session(ts, 3s);")
tdSql.checkRows(2)
tdSql.checkData(0, 2, 100)
tdSql.checkData(1, 2, 100)
def run(self):
self.prepare_data()
self.test_ts4806()
self.test_td31880()
self.test_td31966()
def stop(self):
tdSql.execute("drop database db_ts4806;")

View File

@ -48,6 +48,15 @@ class TDTestCase(TBase):
tdSql.execute("insert into ct3 values ('2021-01-01 00:00:01', 'b', NULL);")
tdSql.execute("insert into ct4 values ('2021-01-01 00:00:00', 'c', '3');")
tdSql.execute("insert into ct4 values ('2021-01-01 00:00:01', 'd', NULL);")
# TD-32051
tdSql.execute("drop database if exists db32051;")
tdSql.execute("create database db32051 replica 1 vgroups 1 cachemodel 'none';")
tdSql.execute("use db32051;")
tdSql.execute("create table ntb1(ts timestamp, kval int primary key, ival int);")
tdSql.execute("insert into ntb1 values('2024-09-14 10:08:00.8', 3, 3);")
tdSql.execute("flush database db32051;")
tdSql.execute("insert into ntb1 values('2024-09-14 10:08:00.8', 1, 1);")
def test_last_with_primarykey_int_ct(self):
tdSql.execute("use db_td30816;")
@ -187,6 +196,14 @@ class TDTestCase(TBase):
tdSql.query("select distinct site,zone,tracker,last(reg_firmware_rev) from trackers where ts > now() -1h and site='MI-01' partition by site;")
tdSql.checkRows(1)
def test_td32051(self):
tdSql.execute("use db32051;")
tdSql.execute("alter database db32051 cachemodel 'both';")
time.sleep(5)
tdSql.query("select last(ival) from db32051.ntb1;")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 3)
def run(self):
self.prepare_data()
# regular table
@ -197,6 +214,8 @@ class TDTestCase(TBase):
self.test_last_with_primarykey_str_ct()
# ts-5389
self.test_ts5389()
# TD-32051
self.test_td32051()
def stop(self):
tdSql.execute("drop database db_td30816;")

View File

@ -28,6 +28,7 @@
,,y,army,./pytest.sh python3 ./test.py -f query/query_basic.py -N 3
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_query_accuracy.py
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_ts5400.py
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_having.py
,,y,army,./pytest.sh python3 ./test.py -f insert/insert_basic.py -N 3
,,y,army,./pytest.sh python3 ./test.py -f cluster/splitVgroupByLearner.py -N 3
,,y,army,./pytest.sh python3 ./test.py -f authorith/authBasic.py -N 3