Merge pull request #26811 from taosdata/enh/TD-30987-19
enh: add more check return
This commit is contained in:
commit
52d07c7916
|
@ -2899,7 +2899,6 @@ static FORCE_INLINE SMqRebInfo* tNewSMqRebSubscribe(const char* key) {
|
|||
}
|
||||
pRebInfo->newConsumers = taosArrayInit(0, sizeof(int64_t));
|
||||
if (pRebInfo->newConsumers == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
}
|
||||
return pRebInfo;
|
||||
|
@ -3455,7 +3454,9 @@ static FORCE_INLINE void* taosDecodeSMqTopicInfoMsg(void* buf, SMqTopicInfo* pTo
|
|||
buf = taosDecodeStringTo(buf, pTopicInfo->name);
|
||||
int32_t sz;
|
||||
buf = taosDecodeFixedI32(buf, &sz);
|
||||
pTopicInfo->pVgInfo = taosArrayInit(sz, sizeof(SMqReportVgInfo));
|
||||
if ((pTopicInfo->pVgInfo = taosArrayInit(sz, sizeof(SMqReportVgInfo))) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
SMqReportVgInfo vgInfo;
|
||||
buf = taosDecodeSMqVgInfo(buf, &vgInfo);
|
||||
|
@ -3493,7 +3494,9 @@ static FORCE_INLINE void* taosDecodeSMqReportMsg(void* buf, SMqReportReq* pMsg)
|
|||
buf = taosDecodeFixedI64(buf, &pMsg->consumerId);
|
||||
int32_t sz;
|
||||
buf = taosDecodeFixedI32(buf, &sz);
|
||||
pMsg->pTopics = taosArrayInit(sz, sizeof(SMqTopicInfo));
|
||||
if ((pMsg->pTopics = taosArrayInit(sz, sizeof(SMqTopicInfo))) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (int32_t i = 0; i < sz; i++) {
|
||||
SMqTopicInfo topicInfo;
|
||||
buf = taosDecodeSMqTopicInfoMsg(buf, &topicInfo);
|
||||
|
|
|
@ -459,7 +459,7 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted,
|
|||
SColVal colVal;
|
||||
|
||||
if ((colValArray = taosArrayInit(numOfInfos, sizeof(SColVal))) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t iRow = 0; iRow < numOfRows; iRow++) {
|
||||
|
@ -670,7 +670,7 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart,
|
|||
// merge
|
||||
aColVal = taosArrayInit(pTSchema->numOfCols, sizeof(SColVal));
|
||||
if (aColVal == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1748,7 +1748,7 @@ int32_t tTagToValArray(const STag *pTag, SArray **ppArray) {
|
|||
|
||||
(*ppArray) = taosArrayInit(pTag->nTag + 1, sizeof(STagVal));
|
||||
if (*ppArray == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,9 +1069,12 @@ int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
if (count > TRY_ERROR_LIMIT) break;
|
||||
|
||||
int32_t cmp = (*param->filterFunc)((void *)&p->btime, (void *)&pBtimeKey->btime, param->type);
|
||||
if (cmp == 0)
|
||||
taosArrayPush(pUids, &p->uid);
|
||||
else {
|
||||
if (cmp == 0) {
|
||||
if (taosArrayPush(pUids, &p->uid) == NULL) {
|
||||
ret = terrno;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (param->equal == true) {
|
||||
if (count > TRY_ERROR_LIMIT) break;
|
||||
count++;
|
||||
|
@ -1132,7 +1135,10 @@ int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
cmp = (*param->filterFunc)(pTableKey, pName, pCursor->type);
|
||||
if (cmp == 0) {
|
||||
tb_uid_t tuid = *(tb_uid_t *)pEntryVal;
|
||||
taosArrayPush(pUids, &tuid);
|
||||
if (taosArrayPush(pUids, &tuid) == NULL) {
|
||||
ret = terrno;
|
||||
goto END;
|
||||
}
|
||||
} else {
|
||||
if (param->equal == true) {
|
||||
if (count > TRY_ERROR_LIMIT) break;
|
||||
|
@ -1328,7 +1334,10 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
|
|||
} else {
|
||||
tuid = *(tb_uid_t *)(p->data + tDataTypes[pCursor->type].bytes);
|
||||
}
|
||||
taosArrayPush(pUids, &tuid);
|
||||
if (taosArrayPush(pUids, &tuid) == NULL) {
|
||||
ret = terrno;
|
||||
break;
|
||||
}
|
||||
found = true;
|
||||
} else {
|
||||
if (param->equal == true) {
|
||||
|
@ -1432,7 +1441,11 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
|||
STUidTagInfo info = {.uid = uid, .pTagVal = pCur->pVal};
|
||||
info.pTagVal = taosMemoryMalloc(pCur->vLen);
|
||||
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
||||
taosArrayPush(pUidTagInfo, &info);
|
||||
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
||||
metaCloseCtbCursor(pCur);
|
||||
taosHashCleanup(pSepecifiedUidMap);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
} else { // only the specified tables need to be added
|
||||
while (1) {
|
||||
|
|
|
@ -341,7 +341,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
|||
break;
|
||||
}
|
||||
|
||||
taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid));
|
||||
(void)taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid));
|
||||
}
|
||||
|
||||
tdbTbcClose(pCtbIdxc);
|
||||
|
@ -405,7 +405,7 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
|
|||
break;
|
||||
}
|
||||
|
||||
taosArrayPush(uids, &(((SCtbIdxKey *)pKey)->uid));
|
||||
(void)taosArrayPush(uids, &(((SCtbIdxKey *)pKey)->uid));
|
||||
}
|
||||
|
||||
tdbFree(pKey);
|
||||
|
@ -1033,7 +1033,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
|||
}
|
||||
|
||||
if ((type == TSDB_CHILD_TABLE || type == TSDB_NORMAL_TABLE) && tbUids) {
|
||||
taosArrayPush(tbUids, &uid);
|
||||
(void)taosArrayPush(tbUids, &uid);
|
||||
|
||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||
tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
||||
|
@ -1135,7 +1135,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
|||
tbFName[TSDB_TABLE_FNAME_LEN] = '\0';
|
||||
int32_t ret = vnodeValidateTableHash(pMeta->pVnode, tbFName);
|
||||
if (ret < 0 && terrno == TSDB_CODE_VND_HASH_MISMATCH) {
|
||||
taosArrayPush(uidList, &me.uid);
|
||||
(void)taosArrayPush(uidList, &me.uid);
|
||||
}
|
||||
}
|
||||
tDecoderClear(&dc);
|
||||
|
@ -1783,11 +1783,11 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
} else {
|
||||
memcpy(&val.i64, pAlterTbReq->pTagVal, pAlterTbReq->nTagVal);
|
||||
}
|
||||
taosArrayPush(pTagArray, &val);
|
||||
(void)taosArrayPush(pTagArray, &val);
|
||||
} else {
|
||||
STagVal val = {.cid = pCol->colId};
|
||||
if (tTagGet(pOldTag, &val)) {
|
||||
taosArrayPush(pTagArray, &val);
|
||||
(void)taosArrayPush(pTagArray, &val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2171,7 +2171,7 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
|
|||
}
|
||||
|
||||
SMetaPair pair = {.key = pKey, nKey = nKey};
|
||||
taosArrayPush(tagIdxList, &pair);
|
||||
(void)taosArrayPush(tagIdxList, &pair);
|
||||
}
|
||||
tdbTbcClose(pTagIdxc);
|
||||
|
||||
|
|
|
@ -770,7 +770,11 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
STFileSet *fset;
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
if (fset->channelOpened) {
|
||||
taosArrayPush(channelArray, &fset->channel);
|
||||
if (taosArrayPush(channelArray, &fset->channel) == NULL) {
|
||||
taosArrayDestroy(channelArray);
|
||||
taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return terrno;
|
||||
}
|
||||
fset->channel = (SVAChannelID){0};
|
||||
fset->mergeScheduled = false;
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
|
|
|
@ -88,6 +88,9 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
|||
int32_t remainder = (numOfTables - pBuf->numOfTables) % pBuf->numPerBucket;
|
||||
if (pBuf->pData == NULL) {
|
||||
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
|
||||
if (pBuf->pData == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
|
@ -163,22 +166,22 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in
|
|||
|
||||
if (IS_NUMERIC_TYPE(type)) {
|
||||
if (asc) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_BIGINT: {
|
||||
pKey->pks[0].val = INT64_MIN;
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_INT:{
|
||||
case TSDB_DATA_TYPE_INT: {
|
||||
int32_t min = INT32_MIN;
|
||||
(void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes);
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_SMALLINT:{
|
||||
case TSDB_DATA_TYPE_SMALLINT: {
|
||||
int16_t min = INT16_MIN;
|
||||
(void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes);
|
||||
break;
|
||||
}
|
||||
case TSDB_DATA_TYPE_TINYINT:{
|
||||
case TSDB_DATA_TYPE_TINYINT: {
|
||||
int8_t min = INT8_MIN;
|
||||
(void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes);
|
||||
break;
|
||||
|
@ -194,15 +197,31 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in
|
|||
ASSERT(0);
|
||||
}
|
||||
} else {
|
||||
switch(type) {
|
||||
case TSDB_DATA_TYPE_BIGINT:pKey->pks[0].val = INT64_MAX;break;
|
||||
case TSDB_DATA_TYPE_INT:pKey->pks[0].val = INT32_MAX;break;
|
||||
case TSDB_DATA_TYPE_SMALLINT:pKey->pks[0].val = INT16_MAX;break;
|
||||
case TSDB_DATA_TYPE_TINYINT:pKey->pks[0].val = INT8_MAX;break;
|
||||
case TSDB_DATA_TYPE_UBIGINT:pKey->pks[0].val = UINT64_MAX;break;
|
||||
case TSDB_DATA_TYPE_UINT:pKey->pks[0].val = UINT32_MAX;break;
|
||||
case TSDB_DATA_TYPE_USMALLINT:pKey->pks[0].val = UINT16_MAX;break;
|
||||
case TSDB_DATA_TYPE_UTINYINT:pKey->pks[0].val = UINT8_MAX;break;
|
||||
switch (type) {
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
pKey->pks[0].val = INT64_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
pKey->pks[0].val = INT32_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
pKey->pks[0].val = INT16_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
pKey->pks[0].val = INT8_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
pKey->pks[0].val = UINT64_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
pKey->pks[0].val = UINT32_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_USMALLINT:
|
||||
pKey->pks[0].val = UINT16_MAX;
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
pKey->pks[0].val = UINT8_MAX;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
@ -232,7 +251,7 @@ void clearRowKey(SRowKey* pKey) {
|
|||
taosMemoryFreeClear(pKey->pks[0].pData);
|
||||
}
|
||||
|
||||
static int32_t initLastProcKey(STableBlockScanInfo *pScanInfo, STsdbReader* pReader) {
|
||||
static int32_t initLastProcKey(STableBlockScanInfo* pScanInfo, STsdbReader* pReader) {
|
||||
int32_t code = 0;
|
||||
int32_t numOfPks = pReader->suppInfo.numOfPks;
|
||||
bool asc = ASCENDING_TRAVERSE(pReader->info.order);
|
||||
|
@ -448,8 +467,8 @@ void cleanupInfoForNextFileset(SSHashObj* pTableMap) {
|
|||
|
||||
// brin records iterator
|
||||
void initBrinRecordIter(SBrinRecordIter* pIter, SDataFileReader* pReader, SArray* pList) {
|
||||
(void) memset(&pIter->block, 0, sizeof(SBrinBlock));
|
||||
(void) memset(&pIter->record, 0, sizeof(SBrinRecord));
|
||||
(void)memset(&pIter->block, 0, sizeof(SBrinBlock));
|
||||
(void)memset(&pIter->record, 0, sizeof(SBrinRecord));
|
||||
pIter->blockIndex = -1;
|
||||
pIter->recordIndex = -1;
|
||||
|
||||
|
@ -471,7 +490,7 @@ int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord) {
|
|||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
(void) tBrinBlockClear(&pIter->block);
|
||||
(void)tBrinBlockClear(&pIter->block);
|
||||
int32_t code = tsdbDataFileReadBrinBlock(pIter->pReader, pIter->pCurrentBlk, &pIter->block);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tsdbError("failed to read brinBlock from file, code:%s", tstrerror(code));
|
||||
|
@ -488,7 +507,7 @@ int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord) {
|
|||
return code;
|
||||
}
|
||||
|
||||
void clearBrinBlockIter(SBrinRecordIter* pIter) { (void) tBrinBlockDestroy(&pIter->block); }
|
||||
void clearBrinBlockIter(SBrinRecordIter* pIter) { (void)tBrinBlockDestroy(&pIter->block); }
|
||||
|
||||
// initialize the file block access order
|
||||
// sort the file blocks according to the offset of each data block in the files
|
||||
|
@ -774,6 +793,9 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
|
|||
|
||||
if (pScanInfo->pFileDelData == NULL) {
|
||||
pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData));
|
||||
if (pScanInfo->pFileDelData == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t k = 0; k < pBlock->numOfRecords; ++k) {
|
||||
|
@ -810,6 +832,9 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
|
|||
|
||||
if (pScanInfo->pFileDelData == NULL) {
|
||||
pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData));
|
||||
if (pScanInfo->pFileDelData == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,7 +903,7 @@ static int32_t doLoadTombDataFromTombBlk(const TTombBlkArray* pTombBlkArray, STs
|
|||
ETombBlkCheckEnum ret = 0;
|
||||
code = doCheckTombBlock(&block, pReader, numOfTables, &j, &ret);
|
||||
|
||||
(void) tTombBlockDestroy(&block);
|
||||
(void)tTombBlockDestroy(&block);
|
||||
if (code != TSDB_CODE_SUCCESS || ret == BLK_CHECK_QUIT) {
|
||||
return code;
|
||||
}
|
||||
|
@ -977,7 +1002,7 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
|
|||
|
||||
SStatisBlk* p = &pStatisBlkArray->data[i];
|
||||
STbStatisBlock* pStatisBlock = taosMemoryCalloc(1, sizeof(STbStatisBlock));
|
||||
(void) tStatisBlockInit(pStatisBlock);
|
||||
(void)tStatisBlockInit(pStatisBlock);
|
||||
|
||||
int64_t st = taosGetTimestampMs();
|
||||
int32_t code = tsdbSttFileReadStatisBlock(pSttFileReader, p, pStatisBlock);
|
||||
|
@ -995,7 +1020,7 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
|
|||
}
|
||||
|
||||
if (index >= pStatisBlock->numOfRecords) {
|
||||
(void) tStatisBlockDestroy(pStatisBlock);
|
||||
(void)tStatisBlockDestroy(pStatisBlock);
|
||||
taosMemoryFreeClear(pStatisBlock);
|
||||
return num;
|
||||
}
|
||||
|
@ -1005,7 +1030,7 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
|
|||
while (i < TARRAY2_SIZE(pStatisBlkArray) && uidIndex < numOfTables) {
|
||||
p = &pStatisBlkArray->data[i];
|
||||
if (p->minTbid.suid > suid) {
|
||||
(void) tStatisBlockDestroy(pStatisBlock);
|
||||
(void)tStatisBlockDestroy(pStatisBlock);
|
||||
taosMemoryFreeClear(pStatisBlock);
|
||||
return num;
|
||||
}
|
||||
|
@ -1025,7 +1050,7 @@ int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo
|
|||
}
|
||||
}
|
||||
|
||||
(void) tStatisBlockDestroy(pStatisBlock);
|
||||
(void)tStatisBlockDestroy(pStatisBlock);
|
||||
taosMemoryFreeClear(pStatisBlock);
|
||||
return num;
|
||||
}
|
||||
|
@ -1037,7 +1062,7 @@ static void loadNextStatisticsBlock(SSttFileReader* pSttFileReader, STbStatisBlo
|
|||
(*i) += 1;
|
||||
(*j) = 0;
|
||||
if ((*i) < TARRAY2_SIZE(pStatisBlkArray)) {
|
||||
(void) tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[(*i)], pStatisBlock);
|
||||
(void)tsdbSttFileReadStatisBlock(pSttFileReader, &pStatisBlkArray->data[(*i)], pStatisBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1073,6 +1098,9 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet)
|
|||
// add the list/iter placeholder
|
||||
while (taosArrayGetSize(pSttFileBlockIterArray) < numOfLevels) {
|
||||
SArray* pList = taosArrayInit(4, POINTER_BYTES);
|
||||
if (pList == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
|
||||
if (px == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
@ -1210,8 +1238,7 @@ static int32_t sortUidComparFn(const void* p1, const void* p2) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool isCleanSttBlock(SArray* pKeyRangeList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo,
|
||||
int32_t order) {
|
||||
bool isCleanSttBlock(SArray* pKeyRangeList, STimeWindow* pQueryWindow, STableBlockScanInfo* pScanInfo, int32_t order) {
|
||||
// check if it overlap with del skyline
|
||||
taosArraySort(pKeyRangeList, sortUidComparFn);
|
||||
|
||||
|
|
|
@ -1124,7 +1124,11 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
sprintf(tbName, "%s.%s", pVnode->config.dbname, pCreateReq->name);
|
||||
if (vnodeValidateTableHash(pVnode, tbName) < 0) {
|
||||
cRsp.code = TSDB_CODE_VND_HASH_MISMATCH;
|
||||
taosArrayPush(rsp.pArray, &cRsp);
|
||||
if (taosArrayPush(rsp.pArray, &cRsp) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
rcode = -1;
|
||||
goto _exit;
|
||||
}
|
||||
vError("vgId:%d create-table:%s failed due to hash value mismatch", TD_VID(pVnode), tbName);
|
||||
continue;
|
||||
}
|
||||
|
@ -1139,11 +1143,19 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq,
|
|||
} else {
|
||||
cRsp.code = TSDB_CODE_SUCCESS;
|
||||
tdFetchTbUidList(pVnode->pSma, &pStore, pCreateReq->ctb.suid, pCreateReq->uid);
|
||||
taosArrayPush(tbUids, &pCreateReq->uid);
|
||||
if (taosArrayPush(tbUids, &pCreateReq->uid) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
rcode = -1;
|
||||
goto _exit;
|
||||
}
|
||||
vnodeUpdateMetaRsp(pVnode, cRsp.pMeta);
|
||||
}
|
||||
|
||||
taosArrayPush(rsp.pArray, &cRsp);
|
||||
if (taosArrayPush(rsp.pArray, &cRsp) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
rcode = -1;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
|
||||
vDebug("vgId:%d, add %d new created tables into query table list", TD_VID(pVnode), (int32_t)taosArrayGetSize(tbUids));
|
||||
|
@ -1375,12 +1387,20 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
if (tbUid > 0) tdFetchTbUidList(pVnode->pSma, &pStore, pDropTbReq->suid, tbUid);
|
||||
}
|
||||
|
||||
taosArrayPush(rsp.pArray, &dropTbRsp);
|
||||
if (taosArrayPush(rsp.pArray, &dropTbRsp) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pRsp->code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (tsEnableAuditCreateTable) {
|
||||
char *str = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN);
|
||||
strcpy(str, pDropTbReq->name);
|
||||
taosArrayPush(tbNames, &str);
|
||||
if (taosArrayPush(tbNames, &str) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pRsp->code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1499,11 +1519,13 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
|||
taosArrayDestroy(pCxt->pColValues);
|
||||
pCxt->pColValues = taosArrayInit(pCxt->pTbSchema->numOfCols, sizeof(SColVal));
|
||||
if (NULL == pCxt->pColValues) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < pCxt->pTbSchema->numOfCols; ++i) {
|
||||
SColVal val = COL_VAL_NONE(pCxt->pTbSchema->columns[i].colId, pCxt->pTbSchema->columns[i].type);
|
||||
taosArrayPush(pCxt->pColValues, &val);
|
||||
if (taosArrayPush(pCxt->pColValues, &val) == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -1819,7 +1841,10 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
|||
goto _exit;
|
||||
}
|
||||
|
||||
taosArrayPush(newTbUids, &pSubmitTbData->uid);
|
||||
if (taosArrayPush(newTbUids, &pSubmitTbData->uid) == NULL) {
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (pCreateTbRsp->pMeta) {
|
||||
vnodeUpdateMetaRsp(pVnode, pCreateTbRsp->pMeta);
|
||||
|
|
|
@ -142,7 +142,9 @@ static int32_t syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
|
|||
|
||||
int64_t nowMS = taosGetTimestampMs();
|
||||
if (nowMS - pStub->createTime > ttl || -1 == ttl) {
|
||||
taosArrayPush(delIndexArray, pSeqNum);
|
||||
if (taosArrayPush(delIndexArray, pSeqNum) == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
cnt++;
|
||||
|
||||
SFsmCbMeta cbMeta = {
|
||||
|
|
|
@ -1366,11 +1366,6 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
|
|||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
if (pDecoder->ofps) {
|
||||
taosArrayPush(pDecoder->ofps, &ofp);
|
||||
}
|
||||
*/
|
||||
ofpCell = tdbPageGetCell(ofp, 0);
|
||||
|
||||
if (nLeft <= ofp->maxLocal - sizeof(SPgno)) {
|
||||
|
@ -1411,11 +1406,6 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
|
|||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
if (pDecoder->ofps) {
|
||||
taosArrayPush(pDecoder->ofps, &ofp);
|
||||
}
|
||||
*/
|
||||
ofpCell = tdbPageGetCell(ofp, 0);
|
||||
|
||||
int lastKeyPage = 0;
|
||||
|
@ -1642,7 +1632,10 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell, int dropOfp, TXN *
|
|||
|
||||
SArray *ofps = pPage->pPager->ofps;
|
||||
if (ofps) {
|
||||
taosArrayPush(ofps, &ofp);
|
||||
if (taosArrayPush(ofps, &ofp) == NULL) {
|
||||
ASSERT(0);
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
tdbPagerReturnPage(pPage->pPager, ofp, pTxn);
|
||||
|
|
|
@ -34,14 +34,12 @@ SArray* taosArrayInit(size_t size, size_t elemSize) {
|
|||
|
||||
SArray* pArray = taosMemoryMalloc(sizeof(SArray));
|
||||
if (pArray == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pArray->size = 0;
|
||||
pArray->pData = taosMemoryCalloc(size, elemSize);
|
||||
if (pArray->pData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(pArray);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ TdThread doRegisterCacheObj(SCacheObj *pCacheObj) {
|
|||
taosThreadOnce(&cacheThreadInit, doInitRefreshThread);
|
||||
|
||||
taosThreadMutexLock(&guard);
|
||||
taosArrayPush(pCacheArrayList, &pCacheObj);
|
||||
(void)taosArrayPush(pCacheArrayList, &pCacheObj);
|
||||
taosThreadMutexUnlock(&guard);
|
||||
|
||||
return cacheRefreshWorker;
|
||||
|
|
|
@ -326,7 +326,7 @@ static void taosLRUCacheShardEvictLRU(SLRUCacheShard *shard, size_t charge, SArr
|
|||
ASSERT(shard->usage >= old->totalCharge);
|
||||
shard->usage -= old->totalCharge;
|
||||
|
||||
taosArrayPush(deleted, &old);
|
||||
(void)taosArrayPush(deleted, &old);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *
|
|||
if (shard->usage + e->totalCharge > shard->capacity && (shard->strictCapacity || handle == NULL)) {
|
||||
TAOS_LRU_ENTRY_SET_IN_CACHE(e, false);
|
||||
if (handle == NULL) {
|
||||
taosArrayPush(lastReferenceList, &e);
|
||||
(void)taosArrayPush(lastReferenceList, &e);
|
||||
} else {
|
||||
if (freeOnFail) {
|
||||
taosMemoryFree(e);
|
||||
|
@ -415,7 +415,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *
|
|||
ASSERT(shard->usage >= old->totalCharge);
|
||||
shard->usage -= old->totalCharge;
|
||||
|
||||
taosArrayPush(lastReferenceList, &old);
|
||||
(void)taosArrayPush(lastReferenceList, &old);
|
||||
}
|
||||
}
|
||||
if (handle == NULL) {
|
||||
|
@ -536,7 +536,7 @@ static void taosLRUCacheShardEraseUnrefEntries(SLRUCacheShard *shard) {
|
|||
ASSERT(shard->usage >= old->totalCharge);
|
||||
shard->usage -= old->totalCharge;
|
||||
|
||||
taosArrayPush(lastReferenceList, &old);
|
||||
(void)taosArrayPush(lastReferenceList, &old);
|
||||
}
|
||||
|
||||
(void)taosThreadMutexUnlock(&shard->mutex);
|
||||
|
|
Loading…
Reference in New Issue