Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-32211
This commit is contained in:
commit
a94e275cf0
|
@ -173,6 +173,7 @@ int32_t nodesNodeToSQL(SNode* pNode, char* buf, int32_t bufSize, int32_t* len);
|
||||||
char* nodesGetNameFromColumnNode(SNode* pNode);
|
char* nodesGetNameFromColumnNode(SNode* pNode);
|
||||||
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
|
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
|
||||||
void nodesSortList(SNodeList** pList, int32_t (*)(SNode* pNode1, SNode* pNode2));
|
void nodesSortList(SNodeList** pList, int32_t (*)(SNode* pNode1, SNode* pNode2));
|
||||||
|
void destroyFuncParam(void* pFuncStruct);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,6 +651,9 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
streamObj.targetDbUid = pDb->uid;
|
streamObj.targetDbUid = pDb->uid;
|
||||||
streamObj.version = 1;
|
streamObj.version = 1;
|
||||||
streamObj.sql = taosStrdup(pCreate->sql);
|
streamObj.sql = taosStrdup(pCreate->sql);
|
||||||
|
if (!streamObj.sql) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
streamObj.smaId = smaObj.uid;
|
streamObj.smaId = smaObj.uid;
|
||||||
streamObj.conf.watermark = pCreate->watermark;
|
streamObj.conf.watermark = pCreate->watermark;
|
||||||
streamObj.deleteMark = pCreate->deleteMark;
|
streamObj.deleteMark = pCreate->deleteMark;
|
||||||
|
@ -658,6 +661,10 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
||||||
streamObj.conf.triggerParam = pCreate->maxDelay;
|
streamObj.conf.triggerParam = pCreate->maxDelay;
|
||||||
streamObj.ast = taosStrdup(smaObj.ast);
|
streamObj.ast = taosStrdup(smaObj.ast);
|
||||||
|
if (!streamObj.ast) {
|
||||||
|
taosMemoryFree(streamObj.sql);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
streamObj.indexForMultiAggBalance = -1;
|
streamObj.indexForMultiAggBalance = -1;
|
||||||
|
|
||||||
// check the maxDelay
|
// check the maxDelay
|
||||||
|
@ -1509,6 +1516,9 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||||
}
|
}
|
||||||
|
if (!pShow->pIter) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows);
|
int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows);
|
||||||
if (read < rows) {
|
if (read < rows) {
|
||||||
read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read);
|
read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read);
|
||||||
|
@ -1555,27 +1565,6 @@ static void initSMAObj(SCreateTSMACxt* pCxt) {
|
||||||
pCxt->pSma->ast = pCxt->pCreateSmaReq->ast;
|
pCxt->pSma->ast = pCxt->pCreateSmaReq->ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initStreamObj(SStreamObj *pStream, const char *streamName, const SMCreateSmaReq *pCreateReq,
|
|
||||||
const SDbObj *pDb, SSmaObj *pSma) {
|
|
||||||
tstrncpy(pStream->name, streamName, TSDB_STREAM_FNAME_LEN);
|
|
||||||
tstrncpy(pStream->sourceDb, pDb->name, TSDB_DB_FNAME_LEN);
|
|
||||||
tstrncpy(pStream->targetDb, pDb->name, TSDB_DB_FNAME_LEN);
|
|
||||||
pStream->createTime = taosGetTimestampMs();
|
|
||||||
pStream->updateTime = pStream->createTime;
|
|
||||||
pStream->uid = mndGenerateUid(streamName, strlen(streamName));
|
|
||||||
pStream->sourceDbUid = pDb->uid;
|
|
||||||
pStream->targetDbUid = pDb->uid;
|
|
||||||
pStream->version = 1;
|
|
||||||
pStream->sql = taosStrdup(pCreateReq->sql);
|
|
||||||
pStream->smaId = pSma->uid;
|
|
||||||
pStream->conf.watermark = 0;
|
|
||||||
pStream->deleteMark = 0;
|
|
||||||
pStream->conf.fillHistory = STREAM_FILL_HISTORY_ON;
|
|
||||||
pStream->conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
|
||||||
pStream->conf.triggerParam = 10000;
|
|
||||||
pStream->ast = taosStrdup(pSma->ast);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
||||||
tstrncpy(pCxt->pCreateStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
tstrncpy(pCxt->pCreateStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||||
tstrncpy(pCxt->pCreateStreamReq->sourceDB, pCxt->pDb->name, TSDB_DB_FNAME_LEN);
|
tstrncpy(pCxt->pCreateStreamReq->sourceDB, pCxt->pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
|
@ -1653,11 +1642,15 @@ static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
static int32_t mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
||||||
tstrncpy(pCxt->pDropStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
tstrncpy(pCxt->pDropStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||||
pCxt->pDropStreamReq->igNotExists = false;
|
pCxt->pDropStreamReq->igNotExists = false;
|
||||||
pCxt->pDropStreamReq->sql = taosStrdup(pCxt->pDropSmaReq->name);
|
pCxt->pDropStreamReq->sql = taosStrdup(pCxt->pDropSmaReq->name);
|
||||||
|
if (!pCxt->pDropStreamReq->sql) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
pCxt->pDropStreamReq->sqlLen = strlen(pCxt->pDropStreamReq->sql);
|
pCxt->pDropStreamReq->sqlLen = strlen(pCxt->pDropStreamReq->sql);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
||||||
|
@ -1815,7 +1808,10 @@ static int32_t mndCreateTSMA(SCreateTSMACxt *pCxt) {
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != (code = mndCreateTSMATxnPrepare(pCxt))) {
|
if (TSDB_CODE_SUCCESS != (code = mndCreateTSMATxnPrepare(pCxt))) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
@ -1985,7 +1981,10 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
||||||
}
|
}
|
||||||
SMDropStreamReq dropStreamReq = {0};
|
SMDropStreamReq dropStreamReq = {0};
|
||||||
pCxt->pDropStreamReq = &dropStreamReq;
|
pCxt->pDropStreamReq = &dropStreamReq;
|
||||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
||||||
if (mndTransCheckConflict(pCxt->pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransCheckConflict(pCxt->pMnode, pTrans) != 0) goto _OVER;
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
|
@ -2141,12 +2140,15 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
||||||
SMnode * pMnode = pReq->info.node;
|
SMnode * pMnode = pReq->info.node;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SColumnInfoData *pColInfo;
|
SColumnInfoData *pColInfo;
|
||||||
if (pShow->db[0]) {
|
|
||||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
|
||||||
}
|
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||||
}
|
}
|
||||||
|
if (!pShow->pIter) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
if (pShow->db[0]) {
|
||||||
|
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||||
|
}
|
||||||
SSmaAndTagIter *pIter = pShow->pIter;
|
SSmaAndTagIter *pIter = pShow->pIter;
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pIter->pSmaIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter->pSmaIter, (void **)&pSma);
|
pIter->pSmaIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter->pSmaIter, (void **)&pSma);
|
||||||
|
@ -2273,7 +2275,7 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
||||||
mndReleaseDb(pMnode, pSrcDb);
|
mndReleaseDb(pMnode, pSrcDb);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
sdbCancelFetch(pMnode->pSdb, pIter->pSmaIter);
|
sdbCancelFetch(pMnode->pSdb, pIter->pSmaIter);
|
||||||
numOfRows = -1;
|
numOfRows = code;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) {
|
||||||
|
|
||||||
SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||||
if (pEntryNew == NULL) {
|
if (pEntryNew == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) {
|
||||||
|
|
||||||
SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||||
if (pEntryNew == NULL) {
|
if (pEntryNew == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
|
||||||
LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
|
LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
|
||||||
if (pRes == NULL) { // remove the item in the linked list
|
if (pRes == NULL) { // remove the item in the linked list
|
||||||
if (taosArrayPush(pInvalidRes, &pNode) == NULL) {
|
if (taosArrayPush(pInvalidRes, &pNode) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void)taosLRUCacheRelease(pCache, pRes, false);
|
(void)taosLRUCacheRelease(pCache, pRes, false);
|
||||||
|
@ -612,7 +612,7 @@ static void freeUidCachePayload(const void* key, size_t keyLen, void* value, voi
|
||||||
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
|
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
|
||||||
STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
|
STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->hitTimes = 0;
|
p->hitTimes = 0;
|
||||||
|
|
|
@ -39,7 +39,7 @@ int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
|
||||||
uDebug("dencode cols:%d", pWrapper->nCols);
|
uDebug("dencode cols:%d", pWrapper->nCols);
|
||||||
pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
|
pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
|
||||||
if (pWrapper->pColCmpr == NULL) {
|
if (pWrapper->pColCmpr == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pWrapper->nCols; i++) {
|
for (int i = 0; i < pWrapper->nCols; i++) {
|
||||||
|
@ -53,7 +53,7 @@ static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder,
|
||||||
SSchemaWrapper *pSchema) {
|
SSchemaWrapper *pSchema) {
|
||||||
pCmpr->nCols = pSchema->nCols;
|
pCmpr->nCols = pSchema->nCols;
|
||||||
if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
|
if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
||||||
|
@ -149,7 +149,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
||||||
} else if (pME->type == TSDB_TSMA_TABLE) {
|
} else if (pME->type == TSDB_TSMA_TABLE) {
|
||||||
pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
|
pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
|
||||||
if (!pME->smaEntry.tsma) {
|
if (!pME->smaEntry.tsma) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
|
TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1460,7 +1460,7 @@ int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList) {
|
||||||
if (!p->pTagVal) {
|
if (!p->pTagVal) {
|
||||||
if (isLock) metaULock(pMeta);
|
if (isLock) metaULock(pMeta);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(p->pTagVal, val, len);
|
memcpy(p->pTagVal, val, len);
|
||||||
tdbFree(val);
|
tdbFree(val);
|
||||||
|
@ -1511,13 +1511,13 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
||||||
if (!info.pTagVal) {
|
if (!info.pTagVal) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
||||||
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // only the specified tables need to be added
|
} else { // only the specified tables need to be added
|
||||||
|
@ -1538,7 +1538,7 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
||||||
if (!pTagInfo->pTagVal) {
|
if (!pTagInfo->pTagVal) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
|
memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int metaSaveSmaToDB(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
||||||
pVal = taosMemoryMalloc(vLen);
|
pVal = taosMemoryMalloc(vLen);
|
||||||
if (pVal == NULL) {
|
if (pVal == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
||||||
|
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static int32_t saveSuperTableInfoForChildTable(SMetaEntry* me, SHashObj* suidInf
|
||||||
STableInfoForChildTable dataTmp = {0};
|
STableInfoForChildTable dataTmp = {0};
|
||||||
dataTmp.tableName = taosStrdup(me->name);
|
dataTmp.tableName = taosStrdup(me->name);
|
||||||
if (dataTmp.tableName == NULL) {
|
if (dataTmp.tableName == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
||||||
|
|
|
@ -151,7 +151,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@ -217,7 +217,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
||||||
|
|
||||||
SIndexMultiTerm *terms = indexMultiTermCreate();
|
SIndexMultiTerm *terms = indexMultiTermCreate();
|
||||||
if (terms == NULL) {
|
if (terms == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t nCols = taosArrayGetSize(pTagVals);
|
int16_t nCols = taosArrayGetSize(pTagVals);
|
||||||
|
@ -235,7 +235,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@ -2760,7 +2760,7 @@ int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_
|
||||||
|
|
||||||
*ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
|
*ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
|
||||||
if (*ppTagIdxKey == NULL) {
|
if (*ppTagIdxKey == NULL) {
|
||||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ppTagIdxKey)->suid = suid;
|
(*ppTagIdxKey)->suid = suid;
|
||||||
|
|
|
@ -53,12 +53,12 @@ int32_t ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char
|
||||||
*ppTtlMgr = NULL;
|
*ppTtlMgr = NULL;
|
||||||
|
|
||||||
STtlManger *pTtlMgr = (STtlManger *)tdbOsCalloc(1, sizeof(*pTtlMgr));
|
STtlManger *pTtlMgr = (STtlManger *)tdbOsCalloc(1, sizeof(*pTtlMgr));
|
||||||
if (pTtlMgr == NULL) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
if (pTtlMgr == NULL) TAOS_RETURN(terrno);
|
||||||
|
|
||||||
char *logBuffer = (char *)tdbOsCalloc(1, strlen(logPrefix) + 1);
|
char *logBuffer = (char *)tdbOsCalloc(1, strlen(logPrefix) + 1);
|
||||||
if (logBuffer == NULL) {
|
if (logBuffer == NULL) {
|
||||||
tdbOsFree(pTtlMgr);
|
tdbOsFree(pTtlMgr);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
(void)strcpy(logBuffer, logPrefix);
|
(void)strcpy(logBuffer, logPrefix);
|
||||||
pTtlMgr->logPrefix = logBuffer;
|
pTtlMgr->logPrefix = logBuffer;
|
||||||
|
|
|
@ -213,11 +213,11 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
||||||
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
||||||
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||||
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||||
}
|
}
|
||||||
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
|
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
|
||||||
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, terrno);
|
||||||
|
|
||||||
// init smaMgmt
|
// init smaMgmt
|
||||||
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
||||||
|
|
|
@ -273,7 +273,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
if (!taosCheckExistFile(taskInfDir)) {
|
if (!taosCheckExistFile(taskInfDir)) {
|
||||||
char *s = taosStrdup(taskInfDir);
|
char *s = taosStrdup(taskInfDir);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
if (taosMulMkDir(s) != 0) {
|
if (taosMulMkDir(s) != 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -294,7 +294,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
pStreamTask->pMeta = pVnode->pTq->pStreamMeta;
|
pStreamTask->pMeta = pVnode->pTq->pStreamMeta;
|
||||||
pStreamTask->exec.qmsg = taosMemoryMalloc(strlen(RSMA_EXEC_TASK_FLAG) + 1);
|
pStreamTask->exec.qmsg = taosMemoryMalloc(strlen(RSMA_EXEC_TASK_FLAG) + 1);
|
||||||
if (!pStreamTask->exec.qmsg) {
|
if (!pStreamTask->exec.qmsg) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
||||||
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
||||||
|
@ -321,7 +321,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pItem->pResList = taosArrayInit(1, POINTER_BYTES))) {
|
if (!(pItem->pResList = taosArrayInit(1, POINTER_BYTES))) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pItem->fetchResultVer < pItem->submitReqVer) {
|
if (pItem->fetchResultVer < pItem->submitReqVer) {
|
||||||
|
@ -504,11 +504,11 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (uid) {
|
if (uid) {
|
||||||
if (!pStore->tbUids) {
|
if (!pStore->tbUids) {
|
||||||
if (!(pStore->tbUids = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
if (!(pStore->tbUids = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(pStore->tbUids, uid)) {
|
if (!taosArrayPush(pStore->tbUids, uid)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -516,7 +516,7 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (!pStore->uidHash) {
|
if (!pStore->uidHash) {
|
||||||
pStore->uidHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
pStore->uidHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if (!pStore->uidHash) {
|
if (!pStore->uidHash) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uid) {
|
if (uid) {
|
||||||
|
@ -524,16 +524,16 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
||||||
if (!taosArrayPush(uidArray, uid)) {
|
if (!taosArrayPush(uidArray, uid)) {
|
||||||
taosArrayDestroy(uidArray);
|
taosArrayDestroy(uidArray);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
||||||
if (!pUidArray) {
|
if (!pUidArray) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(pUidArray, uid)) {
|
if (!taosArrayPush(pUidArray, uid)) {
|
||||||
taosArrayDestroy(pUidArray);
|
taosArrayDestroy(pUidArray);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(taosHashPut(pStore->uidHash, &suid, sizeof(suid), &pUidArray, sizeof(pUidArray)));
|
TAOS_CHECK_RETURN(taosHashPut(pStore->uidHash, &suid, sizeof(suid), &pUidArray, sizeof(pUidArray)));
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ static int32_t tdRSmaProcessDelReq(SSma *pSma, int64_t suid, int8_t level, SBatc
|
||||||
|
|
||||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||||
if (!pBuf) {
|
if (!pBuf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
||||||
SBatchDeleteReq deleteReq = {.suid = suid, .level = pItem->level};
|
SBatchDeleteReq deleteReq = {.suid = suid, .level = pItem->level};
|
||||||
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
||||||
if (!deleteReq.deleteReqs) {
|
if (!deleteReq.deleteReqs) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
code = tqBuildDeleteReq(pSma->pVnode->pTq, NULL, output, &deleteReq, "", true);
|
code = tqBuildDeleteReq(pSma->pVnode->pTq, NULL, output, &deleteReq, "", true);
|
||||||
|
@ -1065,7 +1065,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
||||||
tb_uid_t suid = 0;
|
tb_uid_t suid = 0;
|
||||||
|
|
||||||
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,7 +1085,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
||||||
int64_t nRsmaTables = 0;
|
int64_t nRsmaTables = 0;
|
||||||
metaReaderDoInit(&mr, SMA_META(pSma), META_READER_LOCK);
|
metaReaderDoInit(&mr, SMA_META(pSma), META_READER_LOCK);
|
||||||
if (!(uidStore.tbUids = taosArrayInit(1024, sizeof(tb_uid_t)))) {
|
if (!(uidStore.tbUids = taosArrayInit(1024, sizeof(tb_uid_t)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,7 +1518,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
||||||
version = packData.ver;
|
version = packData.ver;
|
||||||
if (!taosArrayPush(pSubmitArr, &packData)) {
|
if (!taosArrayPush(pSubmitArr, &packData)) {
|
||||||
taosFreeQitem(msg);
|
taosFreeQitem(msg);
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
++nSubmit;
|
++nSubmit;
|
||||||
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||||
|
@ -1608,7 +1608,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
||||||
|
|
||||||
if (!(pSubmitArr =
|
if (!(pSubmitArr =
|
||||||
taosArrayInit(TMIN(RSMA_EXEC_BATCH_SIZE, atomic_load_64(&pRSmaStat->nBufItems)), sizeof(SPackedData)))) {
|
taosArrayInit(TMIN(RSMA_EXEC_BATCH_SIZE, atomic_load_64(&pRSmaStat->nBufItems)), sizeof(SPackedData)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,12 +170,12 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
|
|
||||||
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
||||||
if (pReq->aSubmitTbData == NULL) {
|
if (pReq->aSubmitTbData == NULL) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
if (pTableIndexMap == NULL) {
|
if (pTableIndexMap == NULL) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSubmitTbData req
|
// SSubmitTbData req
|
||||||
|
@ -205,7 +205,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
}
|
}
|
||||||
|
|
||||||
if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) {
|
if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
SEncoder encoder;
|
SEncoder encoder;
|
||||||
len += sizeof(SSubmitReq2Msg);
|
len += sizeof(SSubmitReq2Msg);
|
||||||
if (!(pBuf = rpcMallocCont(len))) {
|
if (!(pBuf = rpcMallocCont(len))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ static int32_t tsmaProcessDelReq(SSma *pSma, int64_t indexUid, SBatchDeleteReq *
|
||||||
|
|
||||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||||
if (!pBuf) {
|
if (!pBuf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||||
|
|
||||||
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
|
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pHandle == NULL) {
|
if (pTq->pHandle == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
|
taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
|
||||||
|
|
||||||
|
@ -82,18 +82,18 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||||
|
|
||||||
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
||||||
if (pTq->pPushMgr == NULL) {
|
if (pTq->pPushMgr == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTq->pCheckInfo = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
pTq->pCheckInfo = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pCheckInfo == NULL) {
|
if (pTq->pCheckInfo == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
|
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
|
||||||
|
|
||||||
pTq->pOffset = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_ENTRY_LOCK);
|
pTq->pOffset = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pOffset == NULL) {
|
if (pTq->pOffset == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pOffset, (FDelete)tDeleteSTqOffset);
|
taosHashSetFreeFp(pTq->pOffset, (FDelete)tDeleteSTqOffset);
|
||||||
|
|
||||||
|
@ -464,7 +464,6 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
|
|
||||||
void* buf = rpcMallocCont(len);
|
void* buf = rpcMallocCont(len);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
|
|
@ -198,7 +198,7 @@ int32_t tqMetaGetOffset(STQ* pTq, const char* subkey, STqOffset** pOffset){
|
||||||
if (taosHashPut(pTq->pOffset, subkey, strlen(subkey), &offset, sizeof(STqOffset)) != 0) {
|
if (taosHashPut(pTq->pOffset, subkey, strlen(subkey), &offset, sizeof(STqOffset)) != 0) {
|
||||||
tDeleteSTqOffset(&offset);
|
tDeleteSTqOffset(&offset);
|
||||||
tdbFree(data);
|
tdbFree(data);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
tdbFree(data);
|
tdbFree(data);
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ int32_t tqMetaCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle) {
|
||||||
handle->execHandle.execDb.pFilterOutTbUid =
|
handle->execHandle.execDb.pFilterOutTbUid =
|
||||||
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if(handle->execHandle.execDb.pFilterOutTbUid == NULL){
|
if(handle->execHandle.execDb.pFilterOutTbUid == NULL){
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}else if(req->subType == TOPIC_SUB_TYPE__TABLE){
|
}else if(req->subType == TOPIC_SUB_TYPE__TABLE){
|
||||||
handle->execHandle.execTb.suid = req->suid;
|
handle->execHandle.execTb.suid = req->suid;
|
||||||
|
|
|
@ -577,7 +577,7 @@ static int32_t buildResSDataBlock(SSDataBlock* pBlock, SSchemaWrapper* pSchema,
|
||||||
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
blockDataFreeRes(pBlock);
|
blockDataFreeRes(pBlock);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,11 +36,11 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, void* pRsp, int32_t numOf
|
||||||
actualLen += sizeof(SRetrieveTableRspForTmq);
|
actualLen += sizeof(SRetrieveTableRspForTmq);
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockDataLen, &actualLen) == NULL){
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockDataLen, &actualLen) == NULL){
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockData, &buf) == NULL) {
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockData, &buf) == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -52,7 +52,7 @@ static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, void* pRsp) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockSchema, &pSW) == NULL) {
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockSchema, &pSW) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -327,12 +327,12 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, STaosxRsp* pRsp, int3
|
||||||
if (pRsp->createTableNum == 0) {
|
if (pRsp->createTableNum == 0) {
|
||||||
pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t));
|
pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t));
|
||||||
if (pRsp->createTableLen == NULL) {
|
if (pRsp->createTableLen == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
pRsp->createTableReq = taosArrayInit(0, sizeof(void*));
|
pRsp->createTableReq = taosArrayInit(0, sizeof(void*));
|
||||||
if (pRsp->createTableReq == NULL) {
|
if (pRsp->createTableReq == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ int32_t initCreateTableMsg(SVCreateTbReq* pCreateTableReq, uint64_t suid, const
|
||||||
pCreateTableReq->ctb.stbName = taosStrdup((char*)tNameGetTableName(&name));
|
pCreateTableReq->ctb.stbName = taosStrdup((char*)tNameGetTableName(&name));
|
||||||
if (pCreateTableReq->ctb.stbName == NULL) { // ignore this error code
|
if (pCreateTableReq->ctb.stbName == NULL) { // ignore this error code
|
||||||
tqError("failed to duplicate the stb name:%s, failed to init create-table msg and create req table", stbFullName);
|
tqError("failed to duplicate the stb name:%s, failed to init create-table msg and create req table", stbFullName);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
|
|
||||||
void* p = taosArrayPush(tagArray, &tagVal);
|
void* p = taosArrayPush(tagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = createDefaultTagColName(&pCreateTbReq->ctb.tagName);
|
code = createDefaultTagColName(&pCreateTbReq->ctb.tagName);
|
||||||
|
@ -317,7 +317,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
}
|
}
|
||||||
void* p = taosArrayPush(tagArray, &tagVal);
|
void* p = taosArrayPush(tagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
|
|
||||||
void* p = taosArrayPush(reqs.pArray, pCreateTbReq);
|
void* p = taosArrayPush(reqs.pArray, pCreateTbReq);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,13 +446,13 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (pNewRow->ts < pOldRow->ts) {
|
if (pNewRow->ts < pOldRow->ts) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
j += 1;
|
j += 1;
|
||||||
} else if (pNewRow->ts > pOldRow->ts) {
|
} else if (pNewRow->ts > pOldRow->ts) {
|
||||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -461,7 +461,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (pNewRow->numOfPKs == 0) {
|
if (pNewRow->numOfPKs == 0) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -478,7 +478,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
j += 1;
|
j += 1;
|
||||||
|
@ -490,7 +490,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
} else {
|
} else {
|
||||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -503,7 +503,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pNew->aRowP, j++);
|
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pNew->aRowP, j++);
|
||||||
void* p = taosArrayPush(pFinal, &pRow);
|
void* p = taosArrayPush(pFinal, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pExisted->aRowP, k++);
|
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pExisted->aRowP, k++);
|
||||||
void* p = taosArrayPush(pFinal, &pRow);
|
void* p = taosArrayPush(pFinal, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ int32_t buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t n
|
||||||
STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
|
STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
|
||||||
void* p = taosArrayPush(pTagArray, &tagVal);
|
void* p = taosArrayPush(pTagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
|
code = tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
|
||||||
|
@ -604,7 +604,7 @@ int32_t buildSubmitMsgImpl(SSubmitReq2* pSubmitReq, int32_t vgId, void** pMsg, i
|
||||||
pBuf = rpcMallocCont(len);
|
pBuf = rpcMallocCont(len);
|
||||||
if (NULL == pBuf) {
|
if (NULL == pBuf) {
|
||||||
tDestroySubmitReq(pSubmitReq, TSDB_MSG_FLG_ENCODE);
|
tDestroySubmitReq(pSubmitReq, TSDB_MSG_FLG_ENCODE);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SSubmitReq2Msg*)pBuf)->header.vgId = vgId;
|
((SSubmitReq2Msg*)pBuf)->header.vgId = vgId;
|
||||||
|
@ -652,7 +652,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
taosArrayDestroy(pTableData->aRowP);
|
taosArrayDestroy(pTableData->aRowP);
|
||||||
pTableData->aRowP = NULL;
|
pTableData->aRowP = NULL;
|
||||||
taosArrayDestroy(pVals);
|
taosArrayDestroy(pVals);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code));
|
tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex);
|
SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex);
|
||||||
|
@ -713,7 +713,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataIndex++;
|
dataIndex++;
|
||||||
|
@ -725,7 +725,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SValue sv = {.type = pCol->type};
|
SValue sv = {.type = pCol->type};
|
||||||
|
@ -733,7 +733,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataIndex++;
|
dataIndex++;
|
||||||
|
@ -752,7 +752,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
|
|
||||||
void* p = taosArrayPush(pTableData->aRowP, &pRow);
|
void* p = taosArrayPush(pTableData->aRowP, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
||||||
|
|
||||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||||
if (submitReq.aSubmitTbData == NULL) {
|
if (submitReq.aSubmitTbData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
||||||
|
|
||||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||||
if (submitReq.aSubmitTbData == NULL) {
|
if (submitReq.aSubmitTbData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||||
taosHashCleanup(pTableIndexMap);
|
taosHashCleanup(pTableIndexMap);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -33,7 +33,7 @@ int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, int8_t type, STqS
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
|
pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
pReader->pTq = pTq;
|
pReader->pTq = pTq;
|
||||||
|
|
|
@ -95,7 +95,7 @@ int32_t streamStateSnapRead(SStreamStateReader* pReader, uint8_t** ppData) {
|
||||||
}
|
}
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + len);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + len);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
// refactor later, avoid mem/free freq
|
// refactor later, avoid mem/free freq
|
||||||
|
|
|
@ -96,7 +96,7 @@ int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration) {
|
||||||
|
|
||||||
SBuildScanWalMsgParam* pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
|
SBuildScanWalMsgParam* pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pParam->pTq = pTq;
|
pParam->pTq = pTq;
|
||||||
|
|
|
@ -46,7 +46,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
pReader->ever = ever;
|
pReader->ever = ever;
|
||||||
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
||||||
if (pReader->tdbTbList == NULL) {
|
if (pReader->tdbTbList == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||||
}
|
}
|
||||||
|
|
||||||
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
||||||
|
@ -159,7 +159,7 @@ NextTbl:
|
||||||
}
|
}
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ int32_t tqInitDataRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
||||||
pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
|
pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
|
||||||
|
|
||||||
if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
|
if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
tOffsetCopy(&pRsp->reqOffset, &pOffset);
|
tOffsetCopy(&pRsp->reqOffset, &pOffset);
|
||||||
|
@ -71,7 +71,7 @@ static int32_t tqInitTaosxRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
||||||
taosArrayDestroy(pRsp->blockSchema);
|
taosArrayDestroy(pRsp->blockSchema);
|
||||||
pRsp->blockSchema = NULL;
|
pRsp->blockSchema = NULL;
|
||||||
}
|
}
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -540,7 +540,7 @@ int32_t tqDoSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const void* pRsp,
|
||||||
int32_t tlen = sizeof(SMqRspHead) + len;
|
int32_t tlen = sizeof(SMqRspHead) + len;
|
||||||
void* buf = rpcMallocCont(tlen);
|
void* buf = rpcMallocCont(tlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMqRspHead* pHead = (SMqRspHead*)buf;
|
SMqRspHead* pHead = (SMqRspHead*)buf;
|
||||||
|
|
|
@ -578,7 +578,7 @@ int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg)
|
||||||
{ // send checkpoint ready rsp
|
{ // send checkpoint ready rsp
|
||||||
SMStreamCheckpointReadyRspMsg* pReadyRsp = rpcMallocCont(sizeof(SMStreamCheckpointReadyRspMsg));
|
SMStreamCheckpointReadyRspMsg* pReadyRsp = rpcMallocCont(sizeof(SMStreamCheckpointReadyRspMsg));
|
||||||
if (pReadyRsp == NULL) {
|
if (pReadyRsp == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReadyRsp->upstreamTaskId = req.upstreamTaskId;
|
pReadyRsp->upstreamTaskId = req.upstreamTaskId;
|
||||||
|
|
|
@ -425,7 +425,7 @@ static int32_t tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size
|
||||||
|
|
||||||
*value = taosMemoryMalloc(*size);
|
*value = taosMemoryMalloc(*size);
|
||||||
if (NULL == *value) {
|
if (NULL == *value) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t offset = tsdbCacheSerializeV0(*value, pLastCol);
|
int32_t offset = tsdbCacheSerializeV0(*value, pLastCol);
|
||||||
|
@ -509,7 +509,7 @@ static int32_t reallocVarDataVal(SValue *pValue) {
|
||||||
if (nData > 0) {
|
if (nData > 0) {
|
||||||
uint8_t *p = taosMemoryMalloc(nData);
|
uint8_t *p = taosMemoryMalloc(nData);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
pValue->pData = p;
|
pValue->pData = p;
|
||||||
(void)memcpy(pValue->pData, pVal, nData);
|
(void)memcpy(pValue->pData, pVal, nData);
|
||||||
|
@ -1115,11 +1115,11 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, *key})) {
|
if (!taosArrayPush(remainCols, &(SIdxKey){i, *key})) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1273,7 +1273,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!COL_VAL_IS_VALUE(pColVal)) {
|
if (!COL_VAL_IS_VALUE(pColVal)) {
|
||||||
|
@ -1284,7 +1284,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
}
|
}
|
||||||
updateCtx.lflag = LFLAG_LAST;
|
updateCtx.lflag = LFLAG_LAST;
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tsdbRowClose(&iter);
|
tsdbRowClose(&iter);
|
||||||
|
@ -1310,7 +1310,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
if (COL_VAL_IS_VALUE(&colVal)) {
|
if (COL_VAL_IS_VALUE(&colVal)) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
(void)tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
(void)tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
||||||
}
|
}
|
||||||
|
@ -1352,7 +1352,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
||||||
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
|
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1388,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tsdbRowClose(&iter);
|
tsdbRowClose(&iter);
|
||||||
|
@ -1423,7 +1423,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
|
|
||||||
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
||||||
if (!taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key})) {
|
if (!taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key})) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,7 +1447,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
int lastrowIndex = 0;
|
int lastrowIndex = 0;
|
||||||
|
|
||||||
if (!slotIds || !lastColIds || !lastSlotIds || !lastrowColIds || !lastrowSlotIds) {
|
if (!slotIds || !lastColIds || !lastSlotIds || !lastrowColIds || !lastrowSlotIds) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < num_keys; ++i) {
|
for (int i = 0; i < num_keys; ++i) {
|
||||||
|
@ -1457,11 +1457,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
if (NULL == lastTmpIndexArray) {
|
if (NULL == lastTmpIndexArray) {
|
||||||
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||||
if (!lastTmpIndexArray) {
|
if (!lastTmpIndexArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(lastTmpIndexArray, &(i))) {
|
if (!taosArrayPush(lastTmpIndexArray, &(i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
lastColIds[lastIndex] = idxKey->key.cid;
|
lastColIds[lastIndex] = idxKey->key.cid;
|
||||||
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
||||||
|
@ -1470,11 +1470,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
if (NULL == lastrowTmpIndexArray) {
|
if (NULL == lastrowTmpIndexArray) {
|
||||||
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||||
if (!lastrowTmpIndexArray) {
|
if (!lastrowTmpIndexArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(lastrowTmpIndexArray, &(i))) {
|
if (!taosArrayPush(lastrowTmpIndexArray, &(i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
||||||
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
||||||
|
@ -1484,7 +1484,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
|
|
||||||
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
||||||
if (!pTmpColArray) {
|
if (!pTmpColArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastTmpIndexArray != NULL) {
|
if (lastTmpIndexArray != NULL) {
|
||||||
|
@ -1492,7 +1492,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
||||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
||||||
taosArrayGet(lastTmpColArray, i))) {
|
taosArrayGet(lastTmpColArray, i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1502,7 +1502,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
||||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
||||||
taosArrayGet(lastrowTmpColArray, i))) {
|
taosArrayGet(lastrowTmpColArray, i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1594,7 +1594,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
||||||
if (!keys_list || !keys_list_sizes || !key_list) {
|
if (!keys_list || !keys_list_sizes || !key_list) {
|
||||||
taosMemoryFree(keys_list);
|
taosMemoryFree(keys_list);
|
||||||
taosMemoryFree(keys_list_sizes);
|
taosMemoryFree(keys_list_sizes);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
char **values_list = NULL;
|
char **values_list = NULL;
|
||||||
size_t *values_list_sizes = NULL;
|
size_t *values_list_sizes = NULL;
|
||||||
|
@ -1631,7 +1631,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
||||||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pTmpLastCol) {
|
if (!pTmpLastCol) {
|
||||||
taosMemoryFreeClear(pToFree);
|
taosMemoryFreeClear(pToFree);
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t charge = 0;
|
size_t charge = 0;
|
||||||
|
@ -1720,7 +1720,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
||||||
TAOS_CHECK_GOTO(tsdbCacheReallocSLastCol(&lastCol, NULL), NULL, _exit);
|
TAOS_CHECK_GOTO(tsdbCacheReallocSLastCol(&lastCol, NULL), NULL, _exit);
|
||||||
|
|
||||||
if (taosArrayPush(pLastArray, &lastCol) == NULL) {
|
if (taosArrayPush(pLastArray, &lastCol) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1729,29 +1729,29 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
||||||
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
||||||
|
|
||||||
if (taosArrayPush(pLastArray, &noneCol) == NULL) {
|
if (taosArrayPush(pLastArray, &noneCol) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
if ((remainCols = taosArrayInit(numKeys, sizeof(SIdxKey))) == NULL) {
|
if ((remainCols = taosArrayInit(numKeys, sizeof(SIdxKey))) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ignoreFromRocks) {
|
if (!ignoreFromRocks) {
|
||||||
if ((ignoreFromRocks = taosArrayInit(numKeys, sizeof(bool))) == NULL) {
|
if ((ignoreFromRocks = taosArrayInit(numKeys, sizeof(bool))) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (taosArrayPush(remainCols, &(SIdxKey){i, key}) == NULL) {
|
if (taosArrayPush(remainCols, &(SIdxKey){i, key}) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
bool ignoreRocks = pLastCol ? (pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) : false;
|
bool ignoreRocks = pLastCol ? (pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) : false;
|
||||||
if (taosArrayPush(ignoreFromRocks, &ignoreRocks) == NULL) {
|
if (taosArrayPush(ignoreFromRocks, &ignoreRocks) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1844,7 +1844,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
||||||
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2032,7 +2032,7 @@ static int32_t getTableDelDataFromTbData(STbData *pTbData, SArray *aDelData) {
|
||||||
|
|
||||||
for (; pDelData; pDelData = pDelData->pNext) {
|
for (; pDelData; pDelData = pDelData->pNext) {
|
||||||
if (!taosArrayPush(aDelData, pDelData)) {
|
if (!taosArrayPush(aDelData, pDelData)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2098,7 +2098,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
uint64_t *uidList = getUidList(pReader);
|
uint64_t *uidList = getUidList(pReader);
|
||||||
|
|
||||||
if (!uidList) {
|
if (!uidList) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, j = 0; i < pTombBlkArray->size && j < numOfTables; ++i) {
|
for (int i = 0, j = 0; i < pTombBlkArray->size && j < numOfTables; ++i) {
|
||||||
|
@ -2176,7 +2176,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
if (pInfo->pTombData == NULL) {
|
if (pInfo->pTombData == NULL) {
|
||||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||||
if (!pInfo->pTombData) {
|
if (!pInfo->pTombData) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
finished = true;
|
finished = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2189,7 +2189,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
|
|
||||||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||||
if (!taosArrayPush(pInfo->pTombData, &delData)) {
|
if (!taosArrayPush(pInfo->pTombData, &delData)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2397,7 +2397,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
||||||
if (!state->pIndexList) {
|
if (!state->pIndexList) {
|
||||||
state->pIndexList = taosArrayInit(1, sizeof(SBrinBlk));
|
state->pIndexList = taosArrayInit(1, sizeof(SBrinBlk));
|
||||||
if (!state->pIndexList) {
|
if (!state->pIndexList) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
taosArrayClear(state->pIndexList);
|
taosArrayClear(state->pIndexList);
|
||||||
|
@ -2410,7 +2410,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
||||||
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
||||||
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
||||||
if (!taosArrayPush(state->pIndexList, pBrinBlk)) {
|
if (!taosArrayPush(state->pIndexList, pBrinBlk)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
||||||
|
@ -2971,7 +2971,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
||||||
|
|
||||||
if (!pIter->pSkyline) {
|
if (!pIter->pSkyline) {
|
||||||
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
|
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
|
||||||
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, terrno);
|
||||||
|
|
||||||
uint64_t uid = pIter->idx.uid;
|
uint64_t uid = pIter->idx.uid;
|
||||||
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
|
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
|
||||||
|
@ -2979,7 +2979,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
||||||
|
|
||||||
if (pInfo->pTombData == NULL) {
|
if (pInfo->pTombData == NULL) {
|
||||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||||
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
|
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
|
||||||
|
@ -3024,7 +3024,7 @@ _err:
|
||||||
static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) {
|
static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) {
|
||||||
SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol));
|
SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol));
|
||||||
if (NULL == pColArray) {
|
if (NULL == pColArray) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < nCols; ++i) {
|
for (int32_t i = 0; i < nCols; ++i) {
|
||||||
|
@ -3032,7 +3032,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray,
|
||||||
SLastCol col = {.rowKey.ts = 0,
|
SLastCol col = {.rowKey.ts = 0,
|
||||||
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
||||||
if (!taosArrayPush(pColArray, &col)) {
|
if (!taosArrayPush(pColArray, &col)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*ppColArray = pColArray;
|
*ppColArray = pColArray;
|
||||||
|
@ -3044,7 +3044,7 @@ static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
||||||
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
||||||
*ppDst = taosMemoryMalloc(len);
|
*ppDst = taosMemoryMalloc(len);
|
||||||
if (NULL == *ppDst) {
|
if (NULL == *ppDst) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(*ppDst, pSrc, len);
|
memcpy(*ppDst, pSrc, len);
|
||||||
|
|
||||||
|
@ -3083,14 +3083,14 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
|
||||||
if (NULL == aColArray) {
|
if (NULL == aColArray) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nCols; ++i) {
|
for (int i = 0; i < nCols; ++i) {
|
||||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3260,14 +3260,14 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
|
||||||
if (NULL == aColArray) {
|
if (NULL == aColArray) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nCols; ++i) {
|
for (int i = 0; i < nCols; ++i) {
|
||||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3496,7 +3496,7 @@ int32_t tsdbCacheSetPageS3(SLRUCache *pCache, STsdbFD *pFD, int64_t pgno, uint8_
|
||||||
_taos_lru_deleter_t deleter = deleteBCache;
|
_taos_lru_deleter_t deleter = deleteBCache;
|
||||||
uint8_t *pPg = taosMemoryMalloc(charge);
|
uint8_t *pPg = taosMemoryMalloc(charge);
|
||||||
if (!pPg) {
|
if (!pPg) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(pPg, pPage, charge);
|
memcpy(pPg, pPage, charge);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
|
|
||||||
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
|
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
|
||||||
if (funcTypeBlockArray == NULL) {
|
if (funcTypeBlockArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
|
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
|
||||||
|
@ -98,7 +98,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
|
|
||||||
void* px = taosArrayInsert(funcTypeBlockArray, dstSlotIds[i], pVal);
|
void* px = taosArrayInsert(funcTypeBlockArray, dstSlotIds[i], pVal);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ int32_t tsdbReuseCacherowsReader(void* reader, void* pTableIdList, int32_t numOf
|
||||||
destroySttBlockReader(pReader->pLDataIterArray, NULL);
|
destroySttBlockReader(pReader->pLDataIterArray, NULL);
|
||||||
pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
|
||||||
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : TSDB_CODE_OUT_OF_MEMORY;
|
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
||||||
|
@ -343,7 +343,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
|
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
|
||||||
if (p->transferBuf[i] == NULL) {
|
if (p->transferBuf[i] == NULL) {
|
||||||
tsdbCacherowsReaderClose(p);
|
tsdbCacherowsReaderClose(p);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
pr->pReadSnap = NULL;
|
pr->pReadSnap = NULL;
|
||||||
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
||||||
if (pRow == NULL) {
|
if (pRow == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) {
|
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) {
|
||||||
SArray* pLastCols = taosArrayInit(pr->numOfCols, sizeof(SLastCol));
|
SArray* pLastCols = taosArrayInit(pr->numOfCols, sizeof(SLastCol));
|
||||||
if (pLastCols == NULL) {
|
if (pLastCols == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
|
SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
|
||||||
void* px = taosArrayPush(pLastCols, &p);
|
void* px = taosArrayPush(pLastCols, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -537,7 +537,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
void* px = taosArrayPush(pLastCols, &p);
|
void* px = taosArrayPush(pLastCols, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
if (TARRAY_SIZE(pTableUidList) == 0) {
|
if (TARRAY_SIZE(pTableUidList) == 0) {
|
||||||
void* px = taosArrayPush(pTableUidList, &uid);
|
void* px = taosArrayPush(pTableUidList, &uid);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -676,7 +676,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
void* px = taosArrayPush(pTableUidList, &uid);
|
void* px = taosArrayPush(pTableUidList, &uid);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
||||||
|
|
||||||
pTsdb->commitInfo->arr = taosArrayInit(0, sizeof(SFileSetCommitInfo *));
|
pTsdb->commitInfo->arr = taosArrayInit(0, sizeof(SFileSetCommitInfo *));
|
||||||
if (pTsdb->commitInfo->arr == NULL) {
|
if (pTsdb->commitInfo->arr == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
@ -457,7 +457,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
||||||
SFileSetCommitInfo *tinfo;
|
SFileSetCommitInfo *tinfo;
|
||||||
|
|
||||||
if ((tinfo = taosMemoryMalloc(sizeof(*tinfo))) == NULL) {
|
if ((tinfo = taosMemoryMalloc(sizeof(*tinfo))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
tinfo->fid = fid;
|
tinfo->fid = fid;
|
||||||
tinfo->fset = NULL;
|
tinfo->fset = NULL;
|
||||||
|
@ -465,7 +465,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
||||||
TAOS_CHECK_GOTO(vHashPut(tsdb->commitInfo->ht, tinfo), &lino, _exit);
|
TAOS_CHECK_GOTO(vHashPut(tsdb->commitInfo->ht, tinfo), &lino, _exit);
|
||||||
|
|
||||||
if ((taosArrayPush(tsdb->commitInfo->arr, &tinfo)) == NULL) {
|
if ((taosArrayPush(tsdb->commitInfo->arr, &tinfo)) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
taosArraySort(tsdb->commitInfo->arr, tFileSetCommitInfoPCompare);
|
taosArraySort(tsdb->commitInfo->arr, tFileSetCommitInfoPCompare);
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **b
|
||||||
if (reader->headFooter->brinBlkPtr->size > 0) {
|
if (reader->headFooter->brinBlkPtr->size > 0) {
|
||||||
data = taosMemoryMalloc(reader->headFooter->brinBlkPtr->size);
|
data = taosMemoryMalloc(reader->headFooter->brinBlkPtr->size);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
@ -557,7 +557,7 @@ int32_t tsdbDataFileReadTombBlk(SDataFileReader *reader, const TTombBlkArray **t
|
||||||
|
|
||||||
if (reader->tombFooter->tombBlkPtr->size > 0) {
|
if (reader->tombFooter->tombBlkPtr->size > 0) {
|
||||||
if ((data = taosMemoryMalloc(reader->tombFooter->tombBlkPtr->size)) == NULL) {
|
if ((data = taosMemoryMalloc(reader->tombFooter->tombBlkPtr->size)) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
|
|
@ -72,13 +72,13 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
||||||
|
|
||||||
int32_t nt = tGetDFileSet(pData + n, &fSet);
|
int32_t nt = tGetDFileSet(pData + n, &fSet);
|
||||||
if (nt < 0) {
|
if (nt < 0) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
n += nt;
|
n += nt;
|
||||||
if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) {
|
if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
|
||||||
int32_t size = tsdbFSToBinary(NULL, pFS) + sizeof(TSCKSUM);
|
int32_t size = tsdbFSToBinary(NULL, pFS) + sizeof(TSCKSUM);
|
||||||
pData = taosMemoryMalloc(size);
|
pData = taosMemoryMalloc(size);
|
||||||
if (pData == NULL) {
|
if (pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
||||||
|
@ -140,7 +140,7 @@ int32_t tsdbFSCreate(STsdbFS *pFS) {
|
||||||
pFS->pDelFile = NULL;
|
pFS->pDelFile = NULL;
|
||||||
pFS->aDFileSet = taosArrayInit(0, sizeof(SDFileSet));
|
pFS->aDFileSet = taosArrayInit(0, sizeof(SDFileSet));
|
||||||
if (pFS->aDFileSet == NULL) {
|
if (pFS->aDFileSet == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ static int32_t load_fs(const char *fname, STsdbFS *pFS) {
|
||||||
|
|
||||||
pData = taosMemoryMalloc(size);
|
pData = taosMemoryMalloc(size);
|
||||||
if (pData == NULL) {
|
if (pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
(void)taosCloseFile(&pFD);
|
(void)taosCloseFile(&pFD);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// head
|
// head
|
||||||
pSetTo->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
pSetTo->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||||
if (pSetTo->pHeadF == NULL) {
|
if (pSetTo->pHeadF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pHeadF = *pSetFrom->pHeadF;
|
*pSetTo->pHeadF = *pSetFrom->pHeadF;
|
||||||
|
@ -395,7 +395,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// data
|
// data
|
||||||
pSetTo->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
pSetTo->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||||
if (pSetTo->pDataF == NULL) {
|
if (pSetTo->pDataF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pDataF = *pSetFrom->pDataF;
|
*pSetTo->pDataF = *pSetFrom->pDataF;
|
||||||
|
@ -404,7 +404,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// sma
|
// sma
|
||||||
pSetTo->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
pSetTo->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||||
if (pSetTo->pSmaF == NULL) {
|
if (pSetTo->pSmaF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pSmaF = *pSetFrom->pSmaF;
|
*pSetTo->pSmaF = *pSetFrom->pSmaF;
|
||||||
|
@ -414,7 +414,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
for (int32_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
for (int32_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
||||||
pSetTo->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetTo->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetTo->aSttF[iStt] == NULL) {
|
if (pSetTo->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pHeadF->commitID != pSetNew->pHeadF->commitID)) {
|
if ((!sameDisk) || (pHeadF->commitID != pSetNew->pHeadF->commitID)) {
|
||||||
pSetOld->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
pSetOld->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||||
if (pSetOld->pHeadF == NULL) {
|
if (pSetOld->pHeadF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pHeadF = *pSetNew->pHeadF;
|
*pSetOld->pHeadF = *pSetNew->pHeadF;
|
||||||
|
@ -465,7 +465,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pDataF->commitID != pSetNew->pDataF->commitID)) {
|
if ((!sameDisk) || (pDataF->commitID != pSetNew->pDataF->commitID)) {
|
||||||
pSetOld->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
pSetOld->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||||
if (pSetOld->pDataF == NULL) {
|
if (pSetOld->pDataF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pDataF = *pSetNew->pDataF;
|
*pSetOld->pDataF = *pSetNew->pDataF;
|
||||||
|
@ -486,7 +486,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pSmaF->commitID != pSetNew->pSmaF->commitID)) {
|
if ((!sameDisk) || (pSmaF->commitID != pSetNew->pSmaF->commitID)) {
|
||||||
pSetOld->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
pSetOld->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||||
if (pSetOld->pSmaF == NULL) {
|
if (pSetOld->pSmaF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pSmaF = *pSetNew->pSmaF;
|
*pSetOld->pSmaF = *pSetNew->pSmaF;
|
||||||
|
@ -507,7 +507,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if (pSetNew->nSttF > pSetOld->nSttF) {
|
if (pSetNew->nSttF > pSetOld->nSttF) {
|
||||||
pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[pSetOld->nSttF] == NULL) {
|
if (pSetOld->aSttF[pSetOld->nSttF] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[pSetOld->nSttF] = *pSetNew->aSttF[pSetOld->nSttF];
|
*pSetOld->aSttF[pSetOld->nSttF] = *pSetNew->aSttF[pSetOld->nSttF];
|
||||||
|
@ -528,7 +528,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
pSetOld->nSttF = 1;
|
pSetOld->nSttF = 1;
|
||||||
pSetOld->aSttF[0] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[0] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[0] == NULL) {
|
if (pSetOld->aSttF[0] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[0] = *pSetNew->aSttF[0];
|
*pSetOld->aSttF[0] = *pSetNew->aSttF[0];
|
||||||
|
@ -546,7 +546,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
|
|
||||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[iStt] == NULL) {
|
if (pSetOld->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt];
|
*pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt];
|
||||||
|
@ -574,7 +574,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
for (int32_t iStt = 0; iStt < pSetNew->nSttF; iStt++) {
|
for (int32_t iStt = 0; iStt < pSetNew->nSttF; iStt++) {
|
||||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[iStt] == NULL) {
|
if (pSetOld->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
if (pDelFile == NULL || (pDelFile->commitID != pFS->pDelFile->commitID)) {
|
if (pDelFile == NULL || (pDelFile->commitID != pFS->pDelFile->commitID)) {
|
||||||
pTsdb->fs.pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile));
|
pTsdb->fs.pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile));
|
||||||
if (pTsdb->fs.pDelFile == NULL) {
|
if (pTsdb->fs.pDelFile == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ static int32_t load_json(const char *fname, cJSON **json) {
|
||||||
|
|
||||||
data = taosMemoryMalloc(size + 1);
|
data = taosMemoryMalloc(size + 1);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(fp, data, size) < 0) {
|
if (taosReadFile(fp, data, size) < 0) {
|
||||||
|
@ -387,7 +387,7 @@ static void tsdbFSDestroyFileObjHash(STFileHash *hash);
|
||||||
|
|
||||||
static int32_t tsdbFSAddEntryToFileObjHash(STFileHash *hash, const char *fname) {
|
static int32_t tsdbFSAddEntryToFileObjHash(STFileHash *hash, const char *fname) {
|
||||||
STFileHashEntry *entry = taosMemoryMalloc(sizeof(*entry));
|
STFileHashEntry *entry = taosMemoryMalloc(sizeof(*entry));
|
||||||
if (entry == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (entry == NULL) return terrno;
|
||||||
|
|
||||||
strncpy(entry->fname, fname, TSDB_FILENAME_LEN);
|
strncpy(entry->fname, fname, TSDB_FILENAME_LEN);
|
||||||
|
|
||||||
|
@ -752,7 +752,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
||||||
STFileSystem *fs = pTsdb->pFS;
|
STFileSystem *fs = pTsdb->pFS;
|
||||||
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
||||||
if (channelArray == NULL) {
|
if (channelArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||||
|
@ -913,7 +913,7 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
||||||
|
|
||||||
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,7 +962,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
||||||
STFileSet *fset1;
|
STFileSet *fset1;
|
||||||
|
|
||||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||||
if (fsetArr[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (fsetArr[0] == NULL) return terrno;
|
||||||
|
|
||||||
TARRAY2_INIT(fsetArr[0]);
|
TARRAY2_INIT(fsetArr[0]);
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pRa
|
||||||
SHashObj *pHash = NULL;
|
SHashObj *pHash = NULL;
|
||||||
|
|
||||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||||
if (fsetArr == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (fsetArr == NULL) return terrno;
|
||||||
TARRAY2_INIT(fsetArr[0]);
|
TARRAY2_INIT(fsetArr[0]);
|
||||||
|
|
||||||
if (pRanges) {
|
if (pRanges) {
|
||||||
|
|
|
@ -388,7 +388,7 @@ int32_t resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFr
|
||||||
if (pIter->blockList == NULL) {
|
if (pIter->blockList == NULL) {
|
||||||
pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||||
if (pIter->blockList == NULL) {
|
if (pIter->blockList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clearDataBlockIterator(pIter, needFree);
|
clearDataBlockIterator(pIter, needFree);
|
||||||
|
@ -691,7 +691,7 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFileReader* pFileRead
|
||||||
|
|
||||||
void* p1 = taosArrayPush(pIndexList, pBrinBlk);
|
void* p1 = taosArrayPush(pIndexList, pBrinBlk);
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -815,7 +815,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||||
if (pScanInfo->pBlockList == NULL) {
|
if (pScanInfo->pBlockList == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,7 +823,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx));
|
pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx));
|
||||||
if (pScanInfo->pBlockIdxList == NULL) {
|
if (pScanInfo->pBlockIdxList == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +836,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo);
|
void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo);
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: refactor to record the fileset skey/ekey
|
// todo: refactor to record the fileset skey/ekey
|
||||||
|
@ -865,7 +865,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
|
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2908,7 +2908,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
|
||||||
} else {
|
} else {
|
||||||
pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY));
|
pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY));
|
||||||
if (pBlockScanInfo->delSkyline == NULL) {
|
if (pBlockScanInfo->delSkyline == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3021,7 +3021,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
|
||||||
size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
|
size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
|
||||||
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk));
|
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk));
|
||||||
if (pIndexList == NULL) {
|
if (pIndexList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -3541,7 +3541,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
|
||||||
SBlockNumber num = {0};
|
SBlockNumber num = {0};
|
||||||
SArray* pTableList = taosArrayInit(40, POINTER_BYTES);
|
SArray* pTableList = taosArrayInit(40, POINTER_BYTES);
|
||||||
if (pTableList == NULL) {
|
if (pTableList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = moveToNextFile(pReader, &num, pTableList);
|
int32_t code = moveToNextFile(pReader, &num, pTableList);
|
||||||
|
@ -4935,7 +4935,7 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) {
|
||||||
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
|
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
|
||||||
pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||||
if (pStatus->pLDataIterArray == NULL) {
|
if (pStatus->pLDataIterArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,7 @@ static SArray* functParamClone(const SArray* pSrc) {
|
||||||
if (NULL == pDst) {
|
if (NULL == pDst) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
int32_t code = 0;
|
||||||
for (int i = 0; i < TARRAY_SIZE(pSrc); ++i) {
|
for (int i = 0; i < TARRAY_SIZE(pSrc); ++i) {
|
||||||
SFunctParam* pFunctParam = taosArrayGet(pSrc, i);
|
SFunctParam* pFunctParam = taosArrayGet(pSrc, i);
|
||||||
SFunctParam* pNewFunctParam = (SFunctParam*)taosArrayPush(pDst, pFunctParam);
|
SFunctParam* pNewFunctParam = (SFunctParam*)taosArrayPush(pDst, pFunctParam);
|
||||||
|
@ -277,8 +278,16 @@ static SArray* functParamClone(const SArray* pSrc) {
|
||||||
}
|
}
|
||||||
pNewFunctParam->type = pFunctParam->type;
|
pNewFunctParam->type = pFunctParam->type;
|
||||||
pNewFunctParam->pCol = taosMemoryCalloc(1, sizeof(SColumn));
|
pNewFunctParam->pCol = taosMemoryCalloc(1, sizeof(SColumn));
|
||||||
|
if (!pNewFunctParam->pCol) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
memcpy(pNewFunctParam->pCol, pFunctParam->pCol, sizeof(SColumn));
|
memcpy(pNewFunctParam->pCol, pFunctParam->pCol, sizeof(SColumn));
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
taosArrayDestroyEx(pDst, destroyFuncParam);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return pDst;
|
return pDst;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3954,6 +3954,7 @@ static int32_t datumToJson(const void* pObj, SJson* pJson) {
|
||||||
case TSDB_DATA_TYPE_NCHAR: {
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
// cJSON only support utf-8 encoding. Convert memory content to hex string.
|
// cJSON only support utf-8 encoding. Convert memory content to hex string.
|
||||||
char* buf = taosMemoryCalloc(varDataLen(pNode->datum.p) * 2 + 1, sizeof(char));
|
char* buf = taosMemoryCalloc(varDataLen(pNode->datum.p) * 2 + 1, sizeof(char));
|
||||||
|
if (!buf) return terrno;
|
||||||
code = taosHexEncode(varDataVal(pNode->datum.p), buf, varDataLen(pNode->datum.p));
|
code = taosHexEncode(varDataVal(pNode->datum.p), buf, varDataLen(pNode->datum.p));
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
|
@ -3971,6 +3972,7 @@ static int32_t datumToJson(const void* pObj, SJson* pJson) {
|
||||||
case TSDB_DATA_TYPE_JSON: {
|
case TSDB_DATA_TYPE_JSON: {
|
||||||
int32_t len = getJsonValueLen(pNode->datum.p);
|
int32_t len = getJsonValueLen(pNode->datum.p);
|
||||||
char* buf = taosMemoryCalloc(len * 2 + 1, sizeof(char));
|
char* buf = taosMemoryCalloc(len * 2 + 1, sizeof(char));
|
||||||
|
if (!buf) return terrno;
|
||||||
code = taosHexEncode(pNode->datum.p, buf, len);
|
code = taosHexEncode(pNode->datum.p, buf, len);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
|
|
|
@ -824,7 +824,7 @@ static void destroyTableCfg(STableCfg* pCfg) {
|
||||||
|
|
||||||
static void destroySmaIndex(void* pIndex) { taosMemoryFree(((STableIndexInfo*)pIndex)->expr); }
|
static void destroySmaIndex(void* pIndex) { taosMemoryFree(((STableIndexInfo*)pIndex)->expr); }
|
||||||
|
|
||||||
static void destroyFuncParam(void* pValue) { taosMemoryFree(((SFunctParam*)pValue)->pCol); }
|
void destroyFuncParam(void* pValue) { taosMemoryFree(((SFunctParam*)pValue)->pCol); }
|
||||||
|
|
||||||
static void destroyHintValue(EHintOption option, void* value) {
|
static void destroyHintValue(EHintOption option, void* value) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct SVgroupDataCxt {
|
||||||
|
|
||||||
int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf);
|
int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf);
|
||||||
int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema);
|
int16_t insFindCol(struct SToken *pColname, int16_t start, int16_t end, SSchema *pSchema);
|
||||||
void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname,
|
int32_t insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname,
|
||||||
SArray *tagName, uint8_t tagNum, int32_t ttl);
|
SArray *tagName, uint8_t tagNum, int32_t ttl);
|
||||||
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo);
|
int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo *pInfo);
|
||||||
void insResetBoundColsInfo(SBoundColInfo *pInfo);
|
void insResetBoundColsInfo(SBoundColInfo *pInfo);
|
||||||
|
|
|
@ -580,6 +580,7 @@ SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral) {
|
||||||
}
|
}
|
||||||
SNodeList* pHintList = NULL;
|
SNodeList* pHintList = NULL;
|
||||||
char* hint = strndup(pLiteral->z + 3, pLiteral->n - 5);
|
char* hint = strndup(pLiteral->z + 3, pLiteral->n - 5);
|
||||||
|
if (!hint) return NULL;
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
bool inParamList = false;
|
bool inParamList = false;
|
||||||
|
@ -2775,6 +2776,7 @@ _err:
|
||||||
static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange) {
|
static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
char* ipCopy = taosStrdup(ipRange);
|
char* ipCopy = taosStrdup(ipRange);
|
||||||
|
if (!ipCopy) return terrno;
|
||||||
char* slash = strchr(ipCopy, '/');
|
char* slash = strchr(ipCopy, '/');
|
||||||
if (slash) {
|
if (slash) {
|
||||||
*slash = '\0';
|
*slash = '\0';
|
||||||
|
|
|
@ -274,6 +274,11 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
||||||
} else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) {
|
} else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) {
|
||||||
pVal->value.nData = kv->length;
|
pVal->value.nData = kv->length;
|
||||||
pVal->value.pData = taosMemoryMalloc(kv->length);
|
pVal->value.pData = taosMemoryMalloc(kv->length);
|
||||||
|
if (!pVal->value.pData) {
|
||||||
|
ret = terrno;
|
||||||
|
uError("SML smlBuildCol malloc failed %s:%d, err: %s", __func__, __LINE__, tstrerror(ret));
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
(void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
(void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
||||||
} else {
|
} else {
|
||||||
(void)memcpy(&pVal->value.val, &(kv->value), kv->length);
|
(void)memcpy(&pVal->value.val, &(kv->value), kv->length);
|
||||||
|
@ -318,8 +323,11 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
ret = terrno;
|
ret = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
insBuildCreateTbReq(pCreateTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, pTableMeta->tableInfo.numOfTags,
|
ret = insBuildCreateTbReq(pCreateTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName,
|
||||||
ttl);
|
pTableMeta->tableInfo.numOfTags, ttl);
|
||||||
|
if (TSDB_CODE_SUCCESS != ret) {
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
pCreateTblReq->ctb.stbName = taosMemoryCalloc(1, sTableNameLen + 1);
|
pCreateTblReq->ctb.stbName = taosMemoryCalloc(1, sTableNameLen + 1);
|
||||||
if (pCreateTblReq->ctb.stbName == NULL){
|
if (pCreateTblReq->ctb.stbName == NULL){
|
||||||
|
|
|
@ -465,6 +465,7 @@ static int32_t parseVarbinary(SToken* pToken, uint8_t** pData, uint32_t* nData,
|
||||||
*nData = size;
|
*nData = size;
|
||||||
} else {
|
} else {
|
||||||
*pData = taosMemoryCalloc(1, pToken->n);
|
*pData = taosMemoryCalloc(1, pToken->n);
|
||||||
|
if (!pData) return terrno;
|
||||||
int32_t len = trimString(pToken->z, pToken->n, *pData, pToken->n);
|
int32_t len = trimString(pToken->z, pToken->n, *pData, pToken->n);
|
||||||
*nData = len;
|
*nData = len;
|
||||||
|
|
||||||
|
@ -639,6 +640,9 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
||||||
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
|
||||||
}
|
}
|
||||||
val->pData = taosStrdup(pToken->z);
|
val->pData = taosStrdup(pToken->z);
|
||||||
|
if (!val->pData) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
val->nData = pToken->n;
|
val->nData = pToken->n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -770,10 +774,9 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p
|
||||||
if (NULL == pStmt->pCreateTblReq) {
|
if (NULL == pStmt->pCreateTblReq) {
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid,
|
return insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid,
|
||||||
pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags,
|
pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags,
|
||||||
TSDB_DEFAULT_TABLE_TTL);
|
TSDB_DEFAULT_TABLE_TTL);
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
|
int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) {
|
||||||
|
@ -1919,7 +1922,7 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod
|
||||||
code = terrno;
|
code = terrno;
|
||||||
}
|
}
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag,
|
code = insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag,
|
||||||
pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames,
|
pStbRowsCxt->pStbMeta->uid, pStbRowsCxt->stbName.tname, pStbRowsCxt->aTagNames,
|
||||||
getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL);
|
getNumOfTags(pStbRowsCxt->pStbMeta), TSDB_DEFAULT_TABLE_TTL);
|
||||||
pStbRowsCxt->pTag = NULL;
|
pStbRowsCxt->pTag = NULL;
|
||||||
|
|
|
@ -237,7 +237,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
||||||
pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL);
|
pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL);
|
||||||
pTag = NULL;
|
pTag = NULL;
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
code = insBuildCreateTbReq(pDataBlock->pData->pCreateTbReq, tName, pTag, suid, sTableName, tagName,
|
||||||
pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL);
|
pDataBlock->pMeta->tableInfo.numOfTags, TSDB_DEFAULT_TABLE_TTL);
|
||||||
pTag = NULL;
|
pTag = NULL;
|
||||||
|
|
||||||
|
|
|
@ -146,19 +146,24 @@ int16_t insFindCol(SToken* pColname, int16_t start, int16_t end, SSchema* pSchem
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname,
|
int32_t insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname,
|
||||||
SArray* tagName, uint8_t tagNum, int32_t ttl) {
|
SArray* tagName, uint8_t tagNum, int32_t ttl) {
|
||||||
pTbReq->type = TD_CHILD_TABLE;
|
pTbReq->type = TD_CHILD_TABLE;
|
||||||
|
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
||||||
pTbReq->name = taosStrdup(tname);
|
pTbReq->name = taosStrdup(tname);
|
||||||
|
if (!pTbReq->name) return terrno;
|
||||||
pTbReq->ctb.suid = suid;
|
pTbReq->ctb.suid = suid;
|
||||||
pTbReq->ctb.tagNum = tagNum;
|
pTbReq->ctb.tagNum = tagNum;
|
||||||
if (sname) pTbReq->ctb.stbName = taosStrdup(sname);
|
if (sname) {
|
||||||
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
pTbReq->ctb.stbName = taosStrdup(sname);
|
||||||
|
if (!pTbReq->ctb.stbName) return terrno;
|
||||||
|
}
|
||||||
pTbReq->ctb.tagName = taosArrayDup(tagName, NULL);
|
pTbReq->ctb.tagName = taosArrayDup(tagName, NULL);
|
||||||
|
if (!pTbReq->ctb.tagName) return terrno;
|
||||||
pTbReq->ttl = ttl;
|
pTbReq->ttl = ttl;
|
||||||
pTbReq->commentLen = -1;
|
pTbReq->commentLen = -1;
|
||||||
|
|
||||||
return;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initBoundCols(int32_t ncols, int16_t* pBoundCols) {
|
static void initBoundCols(int32_t ncols, int16_t* pBoundCols) {
|
||||||
|
|
|
@ -2733,6 +2733,9 @@ static int32_t rewriteServerStatusFunc(STranslateContext* pCxt, SNode** pNode) {
|
||||||
return TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
return TSDB_CODE_RPC_NETWORK_UNAVAIL;
|
||||||
}
|
}
|
||||||
char* pStatus = taosStrdup((void*)"1");
|
char* pStatus = taosStrdup((void*)"1");
|
||||||
|
if (!pStatus) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
int32_t code = rewriteFuncToValue(pCxt, &pStatus, pNode);
|
int32_t code = rewriteFuncToValue(pCxt, &pStatus, pNode);
|
||||||
if (TSDB_CODE_SUCCESS != code) taosMemoryFree(pStatus);
|
if (TSDB_CODE_SUCCESS != code) taosMemoryFree(pStatus);
|
||||||
return code;
|
return code;
|
||||||
|
@ -4122,12 +4125,18 @@ static EDealRes doTranslateTbName(SNode** pNode, void* pContext) {
|
||||||
pVal->literal = taosStrdup(pCxt->pTbName);
|
pVal->literal = taosStrdup(pCxt->pTbName);
|
||||||
if (NULL == pVal->literal) {
|
if (NULL == pVal->literal) {
|
||||||
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
nodesDestroyNode((SNode*)pVal);
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
pVal->translate = true;
|
pVal->translate = true;
|
||||||
pVal->node.resType.type = TSDB_DATA_TYPE_BINARY;
|
pVal->node.resType.type = TSDB_DATA_TYPE_BINARY;
|
||||||
pVal->node.resType.bytes = tbLen + VARSTR_HEADER_SIZE;
|
pVal->node.resType.bytes = tbLen + VARSTR_HEADER_SIZE;
|
||||||
pVal->datum.p = taosMemoryCalloc(1, tbLen + VARSTR_HEADER_SIZE + 1);
|
pVal->datum.p = taosMemoryCalloc(1, tbLen + VARSTR_HEADER_SIZE + 1);
|
||||||
|
if (!pVal->datum.p) {
|
||||||
|
pCxt->errCode = terrno;
|
||||||
|
nodesDestroyNode((SNode*)pVal);
|
||||||
|
return DEAL_RES_ERROR;
|
||||||
|
}
|
||||||
varDataSetLen(pVal->datum.p, tbLen);
|
varDataSetLen(pVal->datum.p, tbLen);
|
||||||
strncpy(varDataVal(pVal->datum.p), pVal->literal, tbLen);
|
strncpy(varDataVal(pVal->datum.p), pVal->literal, tbLen);
|
||||||
strcpy(pVal->node.userAlias, pFunc->node.userAlias);
|
strcpy(pVal->node.userAlias, pFunc->node.userAlias);
|
||||||
|
@ -5832,6 +5841,11 @@ static int32_t createDefaultEveryNode(STranslateContext* pCxt, SNode** pOutput)
|
||||||
pEvery->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
|
pEvery->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
|
||||||
pEvery->flag |= VALUE_FLAG_IS_DURATION;
|
pEvery->flag |= VALUE_FLAG_IS_DURATION;
|
||||||
pEvery->literal = taosStrdup("1s");
|
pEvery->literal = taosStrdup("1s");
|
||||||
|
if (!pEvery->literal) {
|
||||||
|
code = terrno;
|
||||||
|
nodesDestroyNode((SNode*)pEvery);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
*pOutput = (SNode*)pEvery;
|
*pOutput = (SNode*)pEvery;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -6333,6 +6347,10 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
nTbls = taosArrayGetSize(pInfo->aTbnames);
|
nTbls = taosArrayGetSize(pInfo->aTbnames);
|
||||||
|
|
||||||
SVgroupsInfo* vgsInfo = taosMemoryMalloc(sizeof(SVgroupsInfo) + nTbls * sizeof(SVgroupInfo));
|
SVgroupsInfo* vgsInfo = taosMemoryMalloc(sizeof(SVgroupsInfo) + nTbls * sizeof(SVgroupInfo));
|
||||||
|
if (!vgsInfo) {
|
||||||
|
code = terrno;
|
||||||
|
break;
|
||||||
|
}
|
||||||
findVgroupsFromEqualTbname(pCxt, pInfo->aTbnames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
|
findVgroupsFromEqualTbname(pCxt, pInfo->aTbnames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
|
||||||
if (vgsInfo->numOfVgroups != 0) {
|
if (vgsInfo->numOfVgroups != 0) {
|
||||||
taosMemoryFree(pInfo->pRealTable->pVgroupList);
|
taosMemoryFree(pInfo->pRealTable->pVgroupList);
|
||||||
|
@ -6360,6 +6378,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (NULL == taosArrayPush(pTbNames, &pNewTbName)) {
|
if (NULL == taosArrayPush(pTbNames, &pNewTbName)) {
|
||||||
|
taosMemoryFreeClear(pNewTbName);
|
||||||
code = terrno;
|
code = terrno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6374,15 +6393,19 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
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) {
|
||||||
if (NULL == taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo)) {
|
if (NULL == taosArrayPush(pInfo->pRealTable->tsmaTargetTbVgInfo, &vgsInfo)) {
|
||||||
|
taosMemoryFreeClear(vgsInfo);
|
||||||
code = terrno;
|
code = terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
taosMemoryFree(vgsInfo);
|
taosMemoryFreeClear(vgsInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taosArrayDestroyP(pTbNames, taosMemoryFree);
|
taosArrayDestroyP(pTbNames, taosMemoryFree);
|
||||||
if (code) break;
|
if (code) break;
|
||||||
}
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9216,6 +9239,9 @@ static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pSt
|
||||||
createReq.numIpRanges = pStmt->numIpRanges;
|
createReq.numIpRanges = pStmt->numIpRanges;
|
||||||
if (pStmt->numIpRanges > 0) {
|
if (pStmt->numIpRanges > 0) {
|
||||||
createReq.pIpRanges = taosMemoryMalloc(createReq.numIpRanges * sizeof(SIpV4Range));
|
createReq.pIpRanges = taosMemoryMalloc(createReq.numIpRanges * sizeof(SIpV4Range));
|
||||||
|
if (!createReq.pIpRanges) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
memcpy(createReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * createReq.numIpRanges);
|
memcpy(createReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * createReq.numIpRanges);
|
||||||
}
|
}
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_CREATE_USER, (FSerializeFunc)tSerializeSCreateUserReq, &createReq);
|
code = buildCmdMsg(pCxt, TDMT_MND_CREATE_USER, (FSerializeFunc)tSerializeSCreateUserReq, &createReq);
|
||||||
|
@ -9259,6 +9285,9 @@ static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt
|
||||||
alterReq.numIpRanges = pStmt->numIpRanges;
|
alterReq.numIpRanges = pStmt->numIpRanges;
|
||||||
if (pStmt->numIpRanges > 0) {
|
if (pStmt->numIpRanges > 0) {
|
||||||
alterReq.pIpRanges = taosMemoryMalloc(alterReq.numIpRanges * sizeof(SIpV4Range));
|
alterReq.pIpRanges = taosMemoryMalloc(alterReq.numIpRanges * sizeof(SIpV4Range));
|
||||||
|
if (!alterReq.pIpRanges) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
memcpy(alterReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * alterReq.numIpRanges);
|
memcpy(alterReq.pIpRanges, pStmt->pIpRanges, sizeof(SIpV4Range) * alterReq.numIpRanges);
|
||||||
}
|
}
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &alterReq);
|
||||||
|
@ -13282,6 +13311,10 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
||||||
SVCreateTbReq req = {0};
|
SVCreateTbReq req = {0};
|
||||||
req.type = TD_NORMAL_TABLE;
|
req.type = TD_NORMAL_TABLE;
|
||||||
req.name = taosStrdup(pStmt->tableName);
|
req.name = taosStrdup(pStmt->tableName);
|
||||||
|
if (!req.name) {
|
||||||
|
tdDestroySVCreateTbReq(&req);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
req.ttl = pStmt->pOptions->ttl;
|
req.ttl = pStmt->pOptions->ttl;
|
||||||
if (pStmt->pOptions->commentNull == false) {
|
if (pStmt->pOptions->commentNull == false) {
|
||||||
req.comment = taosStrdup(pStmt->pOptions->comment);
|
req.comment = taosStrdup(pStmt->pOptions->comment);
|
||||||
|
@ -14001,6 +14034,7 @@ static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, S
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
SParseFileContext* pParFileCxt = taosMemoryCalloc(1, sizeof(SParseFileContext));
|
SParseFileContext* pParFileCxt = taosMemoryCalloc(1, sizeof(SParseFileContext));
|
||||||
|
if (!pParFileCxt) return terrno;
|
||||||
pParFileCxt->pStbMeta = pSuperTableMeta;
|
pParFileCxt->pStbMeta = pSuperTableMeta;
|
||||||
pParFileCxt->tagNameFilled = false;
|
pParFileCxt->tagNameFilled = false;
|
||||||
pParFileCxt->pTag = NULL;
|
pParFileCxt->pTag = NULL;
|
||||||
|
@ -14265,6 +14299,9 @@ int32_t continueCreateTbFromFile(SParseContext* pParseCxt, SQuery** pQuery) {
|
||||||
|
|
||||||
SMsgBuf tmpBuf = {0};
|
SMsgBuf tmpBuf = {0};
|
||||||
tmpBuf.buf = taosMemoryMalloc(1024);
|
tmpBuf.buf = taosMemoryMalloc(1024);
|
||||||
|
if (!tmpBuf.buf) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
int32_t code = createSubTableFromFile(&tmpBuf, pParseCxt, pModifyStmt);
|
int32_t code = createSubTableFromFile(&tmpBuf, pParseCxt, pModifyStmt);
|
||||||
if (TSDB_CODE_SUCCESS != code) goto _OUT;
|
if (TSDB_CODE_SUCCESS != code) goto _OUT;
|
||||||
|
|
||||||
|
|
|
@ -1294,35 +1294,56 @@ int32_t getTsmaFromCache(SParseMetaCache* pMetaCache, const SName* pTsmaName, ST
|
||||||
|
|
||||||
STableCfg* tableCfgDup(STableCfg* pCfg) {
|
STableCfg* tableCfgDup(STableCfg* pCfg) {
|
||||||
STableCfg* pNew = taosMemoryMalloc(sizeof(*pNew));
|
STableCfg* pNew = taosMemoryMalloc(sizeof(*pNew));
|
||||||
|
if (!pNew) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
memcpy(pNew, pCfg, sizeof(*pNew));
|
memcpy(pNew, pCfg, sizeof(*pNew));
|
||||||
if (NULL != pNew->pComment) {
|
pNew->pComment = NULL;
|
||||||
|
pNew->pFuncs = NULL;
|
||||||
|
pNew->pTags = NULL;
|
||||||
|
pNew->pSchemas = NULL;
|
||||||
|
pNew->pSchemaExt = NULL;
|
||||||
|
if (NULL != pCfg->pComment) {
|
||||||
pNew->pComment = taosMemoryCalloc(pNew->commentLen + 1, 1);
|
pNew->pComment = taosMemoryCalloc(pNew->commentLen + 1, 1);
|
||||||
|
if (!pNew->pComment) goto err;
|
||||||
memcpy(pNew->pComment, pCfg->pComment, pNew->commentLen);
|
memcpy(pNew->pComment, pCfg->pComment, pNew->commentLen);
|
||||||
}
|
}
|
||||||
if (NULL != pNew->pFuncs) {
|
if (NULL != pCfg->pFuncs) {
|
||||||
pNew->pFuncs = taosArrayDup(pNew->pFuncs, NULL);
|
pNew->pFuncs = taosArrayDup(pCfg->pFuncs, NULL);
|
||||||
|
if (!pNew->pFuncs) goto err;
|
||||||
}
|
}
|
||||||
if (NULL != pNew->pTags) {
|
if (NULL != pCfg->pTags) {
|
||||||
pNew->pTags = taosMemoryCalloc(pNew->tagsLen + 1, 1);
|
pNew->pTags = taosMemoryCalloc(pCfg->tagsLen + 1, 1);
|
||||||
|
if (!pNew->pTags) goto err;
|
||||||
memcpy(pNew->pTags, pCfg->pTags, pNew->tagsLen);
|
memcpy(pNew->pTags, pCfg->pTags, pNew->tagsLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t schemaSize = (pCfg->numOfColumns + pCfg->numOfTags) * sizeof(SSchema);
|
int32_t schemaSize = (pCfg->numOfColumns + pCfg->numOfTags) * sizeof(SSchema);
|
||||||
|
|
||||||
SSchema* pSchema = taosMemoryMalloc(schemaSize);
|
SSchema* pSchema = taosMemoryMalloc(schemaSize);
|
||||||
|
if (!pSchema) goto err;
|
||||||
memcpy(pSchema, pCfg->pSchemas, schemaSize);
|
memcpy(pSchema, pCfg->pSchemas, schemaSize);
|
||||||
|
pNew->pSchemas = pSchema;
|
||||||
|
|
||||||
SSchemaExt* pSchemaExt = NULL;
|
SSchemaExt* pSchemaExt = NULL;
|
||||||
if (useCompress(pCfg->tableType) && pCfg->pSchemaExt) {
|
if (useCompress(pCfg->tableType) && pCfg->pSchemaExt) {
|
||||||
int32_t schemaExtSize = pCfg->numOfColumns * sizeof(SSchemaExt);
|
int32_t schemaExtSize = pCfg->numOfColumns * sizeof(SSchemaExt);
|
||||||
pSchemaExt = taosMemoryMalloc(schemaExtSize);
|
pSchemaExt = taosMemoryMalloc(schemaExtSize);
|
||||||
|
if (!pSchemaExt) goto err;
|
||||||
memcpy(pSchemaExt, pCfg->pSchemaExt, schemaExtSize);
|
memcpy(pSchemaExt, pCfg->pSchemaExt, schemaExtSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
pNew->pSchemas = pSchema;
|
|
||||||
pNew->pSchemaExt = pSchemaExt;
|
pNew->pSchemaExt = pSchemaExt;
|
||||||
|
|
||||||
return pNew;
|
return pNew;
|
||||||
|
err:
|
||||||
|
if (pNew->pComment) taosMemoryFreeClear(pNew->pComment);
|
||||||
|
if (pNew->pFuncs) taosArrayDestroy(pNew->pFuncs);
|
||||||
|
if (pNew->pTags) taosMemoryFreeClear(pNew->pTags);
|
||||||
|
if (pNew->pSchemas) taosMemoryFreeClear(pNew->pSchemas);
|
||||||
|
if (pNew->pSchemaExt) taosMemoryFreeClear(pNew->pSchemaExt);
|
||||||
|
taosMemoryFreeClear(pNew);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t getTableCfgFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableCfg** pOutput) {
|
int32_t getTableCfgFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableCfg** pOutput) {
|
||||||
|
|
Loading…
Reference in New Issue