commit
04663cb4b3
|
@ -480,7 +480,7 @@ int32_t funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow,
|
|||
pIter->pPrevData = taosMemoryMalloc(pIter->pDataCol->info.bytes);
|
||||
if (NULL == pIter->pPrevData) {
|
||||
qError("out of memory when function get input row.");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
char* srcData = colDataGetData(pIter->pDataCol, pIter->inputEndIndex);
|
||||
(void)memcpy(pIter->pPrevData, srcData, pIter->pDataCol->info.bytes);
|
||||
|
@ -489,7 +489,7 @@ int32_t funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow,
|
|||
if (NULL == pIter->pPrevPk) {
|
||||
qError("out of memory when function get input row.");
|
||||
taosMemoryFree(pIter->pPrevData);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
char* pkData = colDataGetData(pIter->pPkCol, pIter->inputEndIndex);
|
||||
(void)memcpy(pIter->pPrevPk, pkData, pIter->pPkCol->info.bytes);
|
||||
|
@ -545,14 +545,14 @@ int32_t funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow,
|
|||
pIter->pPrevData = taosMemoryMalloc(pIter->pDataCol->info.bytes);
|
||||
if (NULL == pIter->pPrevData) {
|
||||
qError("out of memory when function get input row.");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pIter->pPrevData, colDataGetData(pIter->pDataCol, pIter->inputEndIndex), pIter->pDataCol->info.bytes);
|
||||
pIter->pPrevPk = taosMemoryMalloc(pIter->pPkCol->info.bytes);
|
||||
if (NULL == pIter->pPrevPk) {
|
||||
qError("out of memory when function get input row.");
|
||||
taosMemoryFree(pIter->pPrevData);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pIter->pPrevPk, colDataGetData(pIter->pPkCol, pIter->inputEndIndex), pIter->pPkCol->info.bytes);
|
||||
|
||||
|
@ -2644,7 +2644,7 @@ static int32_t prepareBuf(SqlFunctionCtx* pCtx) {
|
|||
pCtx->subsidiaries.rowLen = rowLen + pCtx->subsidiaries.num * sizeof(bool);
|
||||
pCtx->subsidiaries.buf = taosMemoryMalloc(pCtx->subsidiaries.rowLen);
|
||||
if (NULL == pCtx->subsidiaries.buf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -6065,7 +6065,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
|
|||
if (NULL == pInfo->buf) {
|
||||
taosHashCleanup(pInfo->pHash);
|
||||
pInfo->pHash = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -947,7 +947,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
|
|||
case TSDB_DATA_TYPE_NCHAR: {
|
||||
pBuf->str = taosMemoryMalloc(pCol->info.bytes);
|
||||
if (pBuf->str == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)memcpy(pBuf->str, colDataGetData(pCol, i), varDataTLen(colDataGetData(pCol, i)));
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@ int32_t tHistogramCreate(int32_t numOfEntries, SHistogramInfo** pHisto) {
|
|||
/* need one redundant slot */
|
||||
*pHisto = taosMemoryMalloc(sizeof(SHistogramInfo) + sizeof(SHistBin) * (numOfEntries + 1));
|
||||
if (NULL == *pHisto) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
#if !defined(USE_ARRAYLIST)
|
||||
|
@ -468,7 +468,7 @@ int32_t tHistogramUniform(SHistogramInfo* pHisto, double* ratio, int32_t num, do
|
|||
#if defined(USE_ARRAYLIST)
|
||||
*pVal = taosMemoryMalloc(num * sizeof(double));
|
||||
if (NULL == *pVal) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
|
@ -521,7 +521,7 @@ int32_t tHistogramUniform(SHistogramInfo* pHisto, double* ratio, int32_t num, do
|
|||
#else
|
||||
double* pVal = taosMemoryMalloc(num * sizeof(double));
|
||||
if (NULL == *pVal) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
double numOfElem = ratio[i] * pHisto->numOfElems;
|
||||
|
|
|
@ -460,7 +460,7 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) {
|
|||
pSlot->info.pageId = pageId;
|
||||
if (taosArrayPush(pPageIdList, &pageId) == NULL) {
|
||||
taosArrayDestroy(pPageIdList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1678,7 +1678,7 @@ int32_t udfcInitializeUvTask(SClientUdfTask *task, int8_t uvTaskType, SClientUvT
|
|||
void *bufBegin = taosMemoryMalloc(bufLen);
|
||||
if(bufBegin == NULL) {
|
||||
fnError("udfc create uv task, malloc buffer failed. size: %d", bufLen);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
void *buf = bufBegin;
|
||||
if(encodeUdfRequest(&buf, &request) <= 0)
|
||||
|
@ -1733,7 +1733,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
|
|||
uv_pipe_t *pipe = taosMemoryMalloc(sizeof(uv_pipe_t));
|
||||
if(pipe == NULL) {
|
||||
fnError("udfc event loop start connect task malloc pipe failed.");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (uv_pipe_init(&uvTask->udfc->uvLoop, pipe, 0) != 0) {
|
||||
fnError("udfc event loop start connect task uv_pipe_init failed.");
|
||||
|
@ -1762,7 +1762,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
|
|||
fnError("udfc event loop start connect task malloc connReq failed.");
|
||||
taosMemoryFree(pipe);
|
||||
taosMemoryFree(conn);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
connReq->data = uvTask;
|
||||
uv_pipe_connect(connReq, pipe, uvTask->udfc->udfdPipeName, onUdfcPipeConnect);
|
||||
|
@ -1777,7 +1777,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
|
|||
uv_write_t *write = taosMemoryMalloc(sizeof(uv_write_t));
|
||||
if(write == NULL) {
|
||||
fnError("udfc event loop start req_rsp task malloc write failed.");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
write->data = pipe->data;
|
||||
QUEUE *connTaskQueue = &((SClientUvConn *)pipe->data)->taskQueue;
|
||||
|
|
|
@ -1617,7 +1617,7 @@ int32_t udfdInitResidentFuncs() {
|
|||
if(taosArrayPush(global.residentFuncs, func) == NULL)
|
||||
{
|
||||
taosArrayDestroy(global.residentFuncs);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,13 +128,13 @@ int32_t indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
|||
|
||||
idx->colObj = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
if (idx->colObj == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||
}
|
||||
|
||||
idx->version = 1;
|
||||
idx->path = taosStrdup(path);
|
||||
if (idx->path == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||
}
|
||||
|
||||
TAOS_UNUSED(taosThreadMutexInit(&idx->mtx, NULL));
|
||||
|
@ -261,7 +261,7 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
|||
|
||||
SArray* iRslts = taosArrayInit(4, POINTER_BYTES);
|
||||
if (iRslts == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int nQuery = taosArrayGetSize(multiQuerys->query);
|
||||
|
@ -275,7 +275,7 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
|||
}
|
||||
if (taosArrayPush(iRslts, (void*)&trslt) == NULL) {
|
||||
idxInterRsltDestroy(iRslts);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
TAOS_UNUSED(idxMergeFinalResults(iRslts, opera, result));
|
||||
|
@ -319,7 +319,7 @@ void indexMultiTermQueryDestroy(SIndexMultiTermQuery* pQuery) {
|
|||
int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) {
|
||||
SIndexTermQuery q = {.qType = qType, .term = term};
|
||||
if (taosArrayPush(pQuery->query, &q) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ SIndexMultiTerm* indexMultiTermCreate() { return taosArrayInit(4, sizeof(SIndexT
|
|||
|
||||
int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) {
|
||||
if (taosArrayPush(terms, &term) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu
|
|||
|
||||
*result = taosArrayInit(4, sizeof(uint64_t));
|
||||
if (*result == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
// TODO: iterator mem and tidex
|
||||
|
||||
|
@ -574,7 +574,7 @@ static int32_t idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxT
|
|||
}
|
||||
} else {
|
||||
if (taosArrayPush(result, &tfv) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
|
@ -658,7 +658,7 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
|||
|
||||
SArray* result = taosArrayInit(1024, sizeof(void*));
|
||||
if (result == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
|
||||
bool cn = cacheIter ? cacheIter->next(cacheIter) : false;
|
||||
|
@ -666,7 +666,7 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
|||
|
||||
SIdxTRslt* tr = idxTRsltCreate();
|
||||
if (tr == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
while (cn == true || tn == true) {
|
||||
IterateValue* cv = (cn == true) ? cacheIter->getValue(cacheIter) : NULL;
|
||||
|
|
|
@ -1033,7 +1033,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
|||
|
||||
if (NULL == ctx.pRes) {
|
||||
indexError("index-filter failed to taosHashInit");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx);
|
||||
|
@ -1073,7 +1073,7 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status, SMetaDataFilte
|
|||
ctx.pRes = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||
if (NULL == ctx.pRes) {
|
||||
indexError("index-filter failed to taosHashInit");
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx);
|
||||
|
@ -1113,7 +1113,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
|||
|
||||
SArray *output = taosArrayInit(8, sizeof(uint64_t));
|
||||
if (output == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SIFParam param = {.arg = *metaArg, .result = output, .status = SFLT_NOT_INDEX, .api = *pAPI};
|
||||
|
|
|
@ -149,7 +149,7 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
int32_t code = 0;
|
||||
SArray *tinsts = taosArrayInit(4, sizeof(uint32_t));
|
||||
if (tinsts == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exception;
|
||||
}
|
||||
bool isMatch = false;
|
||||
|
@ -163,13 +163,13 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
continue;
|
||||
} else if (inst->ty == RANGE) {
|
||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exception;
|
||||
}
|
||||
} else if (inst->ty == MATCH) {
|
||||
isMatch = true;
|
||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exception;
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
} else {
|
||||
DfaState st = {.insts = tinsts, .isMatch = isMatch};
|
||||
if (taosArrayPush(builder->dfa->states, &st) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,14 +76,14 @@ int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
|||
size_t sz = taosArrayGetSize(src->trans);
|
||||
dst->trans = taosArrayInit(sz, sizeof(FstTransition));
|
||||
if (dst->trans == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
FstTransition* trn = taosArrayGet(src->trans, i);
|
||||
if (taosArrayPush(dst->trans, trn) == NULL) {
|
||||
taosArrayDestroy(dst->trans);
|
||||
dst->trans = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -280,7 +280,7 @@ static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
|
||||
SArray* offsets = taosArrayInit(16, sizeof(uint64_t));
|
||||
if (offsets == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX);
|
||||
|
@ -675,7 +675,7 @@ int32_t tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
char* t = (char*)taosMemoryRealloc(buf, cap);
|
||||
if (t == NULL) {
|
||||
taosMemoryFree(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
buf = t;
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ int32_t tfileValuePush(TFileValue* tf, uint64_t val) {
|
|||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
if (taosArrayPush(tf->tableId, &val) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArr
|
|||
int32_t left = block + sizeof(block) - p;
|
||||
if (left >= sizeof(uint64_t)) {
|
||||
if (taosArrayPush(result, (uint64_t*)p) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
p += sizeof(uint64_t);
|
||||
} else {
|
||||
|
@ -1065,7 +1065,7 @@ static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArr
|
|||
memcpy(buf + left, block, sizeof(uint64_t) - left);
|
||||
|
||||
if (taosArrayPush(result, (uint64_t*)buf) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
p = block + sizeof(uint64_t) - left;
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
|||
int64_t version;
|
||||
SArray* files = taosArrayInit(4, sizeof(void*));
|
||||
if (files == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
TdDirPtr pDir = taosOpenDir(path);
|
||||
|
@ -1140,7 +1140,7 @@ static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
|||
|
||||
sprintf(buf, "%s/%s", path, file);
|
||||
if (taosArrayPush(files, &buf) == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
}
|
||||
TAOS_UNUSED(taosCloseDir(&pDir));
|
||||
|
|
|
@ -69,7 +69,7 @@ int32_t iIntersection(SArray *in, SArray *out) {
|
|||
}
|
||||
if (has == true) {
|
||||
if (taosArrayPush(out, &tgt) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ int32_t iUnion(SArray *in, SArray *out) {
|
|||
}
|
||||
}
|
||||
if (taosArrayPush(out, &mVal) == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -220,17 +220,17 @@ int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) {
|
|||
} else {
|
||||
SArray *arrs = taosArrayInit(2, sizeof(void *));
|
||||
if (arrs == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(arrs, &tr->total) == NULL) {
|
||||
taosArrayDestroy(arrs);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (taosArrayPush(arrs, &tr->add) == NULL) {
|
||||
taosArrayDestroy(arrs);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
code = iUnion(arrs, result);
|
||||
taosArrayDestroy(arrs);
|
||||
|
|
|
@ -118,7 +118,7 @@ void monSetBmInfo(SMonBmInfo *pInfo) {
|
|||
int32_t monInit(const SMonCfg *pCfg) {
|
||||
tsMonitor.logs = taosArrayInit(16, sizeof(SMonLogItem));
|
||||
if (tsMonitor.logs == NULL) {
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
TAOS_RETURN(terrno);
|
||||
}
|
||||
|
||||
tsMonitor.cfg = *pCfg;
|
||||
|
|
|
@ -440,7 +440,7 @@ static int32_t nodeListToJson(SJson* pJson, const char* pName, const SNodeList*
|
|||
if (LIST_LENGTH(pList) > 0) {
|
||||
SJson* jList = tjsonAddArrayToObject(pJson, pName);
|
||||
if (NULL == jList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SNode* pNode;
|
||||
FOREACH(pNode, pList) {
|
||||
|
@ -8246,8 +8246,7 @@ int32_t nodesNodeToString(const SNode* pNode, bool format, char** pStr, int32_t*
|
|||
|
||||
SJson* pJson = tjsonCreateObject();
|
||||
if (NULL == pJson) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = nodeToJson(pNode, pJson);
|
||||
|
@ -8297,8 +8296,7 @@ int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int3
|
|||
|
||||
SJson* pJson = tjsonCreateArray();
|
||||
if (NULL == pJson) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SNode* pNode;
|
||||
|
|
|
@ -79,7 +79,7 @@ static int32_t initTlvEncoder(STlvEncoder* pEncoder) {
|
|||
pEncoder->offset = 0;
|
||||
pEncoder->tlvCount = 0;
|
||||
pEncoder->pBuf = taosMemoryMalloc(pEncoder->allocSize);
|
||||
return NULL == pEncoder->pBuf ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS;
|
||||
return NULL == pEncoder->pBuf ? terrno : TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static void clearTlvEncoder(STlvEncoder* pEncoder) { taosMemoryFree(pEncoder->pBuf); }
|
||||
|
@ -96,7 +96,7 @@ static int32_t tlvEncodeImpl(STlvEncoder* pEncoder, int16_t type, const void* pV
|
|||
pEncoder->allocSize = TMAX(pEncoder->allocSize * 2, pEncoder->allocSize + tlvLen);
|
||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
||||
if (NULL == pNewBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pEncoder->pBuf = pNewBuf;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ static int32_t tlvEncodeValueImpl(STlvEncoder* pEncoder, const void* pValue, int
|
|||
if (pEncoder->offset + len > pEncoder->allocSize) {
|
||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize * 2);
|
||||
if (NULL == pNewBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pEncoder->pBuf = pNewBuf;
|
||||
pEncoder->allocSize = pEncoder->allocSize * 2;
|
||||
|
@ -248,7 +248,7 @@ static int32_t tlvEncodeObj(STlvEncoder* pEncoder, int16_t type, FToMsg func, co
|
|||
pEncoder->allocSize = TMAX(pEncoder->allocSize * 2, pEncoder->allocSize + sizeof(STlv));
|
||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
||||
if (NULL == pNewBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pEncoder->pBuf = pNewBuf;
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ static int32_t tlvDecodeCStrP(STlv* pTlv, char** pValue) {
|
|||
static int32_t tlvDecodeDynBinary(STlv* pTlv, void** pValue) {
|
||||
*pValue = taosMemoryMalloc(pTlv->len);
|
||||
if (NULL == *pValue) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(*pValue, pTlv->value, pTlv->len);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -4841,7 +4841,7 @@ static int32_t msgToSArray(STlv* pTlv, void** pObj){
|
|||
}
|
||||
pArray = taosArrayInit(capacity, elemSize);
|
||||
if (NULL == pArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pArray->size = actualSize;
|
||||
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
||||
|
@ -4859,7 +4859,7 @@ static int32_t msgToSArray(STlv* pTlv, void** pObj){
|
|||
if (pDataTlv != NULL) {
|
||||
pArray = taosArrayInit(capacity, elemSize);
|
||||
if (NULL == pArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pArray->size = actualSize;
|
||||
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
||||
|
|
|
@ -2764,7 +2764,7 @@ int32_t nodesMakeValueNodeFromString(char* literal, SValueNode** ppValNode) {
|
|||
pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE;
|
||||
char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(p, lenStr);
|
||||
memcpy(varDataVal(p), literal, lenStr + 1);
|
||||
|
|
|
@ -933,7 +933,7 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL
|
|||
SValueNode* pVal = (SValueNode*)pLeft;
|
||||
char* pNewLiteral = taosMemoryCalloc(1, strlen(pVal->literal) + 2);
|
||||
if (!pNewLiteral) {
|
||||
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
||||
pCxt->errCode = terrno;
|
||||
goto _err;
|
||||
}
|
||||
if ('+' == pVal->literal[0]) {
|
||||
|
|
|
@ -210,7 +210,7 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
|
|||
if (NULL != ((SExprNode*)pProject)->pAssociation) {
|
||||
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL);
|
||||
if (NULL == pAssociation) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,11 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
SMsgBuf* msg) {
|
||||
SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal));
|
||||
if (!pTagArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
*tagName = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||
if (!*tagName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -125,7 +125,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
}
|
||||
|
||||
if (taosArrayPush(*tagName, pTagSchema->name) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
uError("SML smlBuildTagRow error push tag name");
|
||||
goto end;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
(void)memcpy(&val.i64, &(kv->value), kv->length);
|
||||
}
|
||||
if (taosArrayPush(pTagArray, &val) == NULL){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
uError("SML smlBuildTagRow error push tag array");
|
||||
goto end;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void clearColValArraySml(SArray* pCols) {
|
|||
int32_t smlBuildRow(STableDataCxt* pTableCxt) {
|
||||
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
||||
if (pRow == NULL){
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
||||
if (TSDB_CODE_SUCCESS != ret) {
|
||||
|
@ -431,7 +431,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
pVal->value.nData = kv->length;
|
||||
pVal->value.pData = taosMemoryMalloc(kv->length);
|
||||
if (NULL == pVal->value.pData) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
(void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
||||
|
@ -443,7 +443,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
|
||||
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
||||
if (NULL == pRow) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
||||
|
@ -488,7 +488,7 @@ int32_t smlInitHandle(SQuery** query) {
|
|||
uError("create pTableBlockHashObj error");
|
||||
qDestroyQuery(pQuery);
|
||||
nodesDestroyNode((SNode*)stmt);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
stmt->freeHashFunc = insDestroyTableDataCxtHashMap;
|
||||
stmt->freeArrayFunc = insDestroyVgroupDataCxtList;
|
||||
|
|
|
@ -666,7 +666,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
|||
} else {
|
||||
val->pData = taosMemoryMalloc(size);
|
||||
if (NULL == val->pData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
memcpy(val->pData, output, size);
|
||||
val->nData = size;
|
||||
|
@ -683,7 +683,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
|||
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||
void* p = taosMemoryMalloc(realLen);
|
||||
if (p == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), realLen, &output)) {
|
||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||
|
@ -736,7 +736,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS
|
|||
bool isNull = isNullValue(pTagSchema->type, pToken);
|
||||
if (!isNull && pTagName) {
|
||||
if (NULL == taosArrayPush(pTagName, pTagSchema->name)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,7 +758,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS
|
|||
int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (NULL == taosArrayPush(pTagVals, &val)){
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
|||
|
||||
if (!(pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal))) ||
|
||||
!(pTagName = taosArrayInit(pCxt->tags.numOfBound, TSDB_COL_NAME_LEN))) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ int32_t initTableColSubmitData(STableDataCxt* pTableCxt) {
|
|||
SSchema* pSchema = &pTableCxt->pMeta->schema[pTableCxt->boundColsInfo.pColIndex[i]];
|
||||
SColData* pCol = taosArrayReserve(pTableCxt->pData->aCol, 1);
|
||||
if (NULL == pCol) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tColDataInit(pCol, pSchema->colId, pSchema->type, pSchema->flags);
|
||||
}
|
||||
|
@ -1595,7 +1595,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
}
|
||||
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
||||
if (NULL == pVal->value.pData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
||||
pVal->value.nData = pToken->n;
|
||||
|
@ -1615,7 +1615,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||
char* pUcs4 = taosMemoryMalloc(realLen);
|
||||
if (NULL == pUcs4) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) {
|
||||
taosMemoryFree(pUcs4);
|
||||
|
@ -1636,7 +1636,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
}
|
||||
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
||||
if (NULL == pVal->value.pData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
||||
pVal->value.nData = pToken->n;
|
||||
|
@ -1657,7 +1657,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
|||
} else {
|
||||
pVal->value.pData = taosMemoryMalloc(size);
|
||||
if (NULL == pVal->value.pData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
memcpy(pVal->value.pData, output, size);
|
||||
pVal->value.nData = size;
|
||||
|
@ -2218,7 +2218,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt
|
|||
if (NULL == pStmt->pTableCxtHashObj) {
|
||||
pStmt->pTableCxtHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (!pStmt->pTableCxtHashObj) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
int32_t numOfRows = 0;
|
||||
|
@ -2351,20 +2351,20 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa
|
|||
|
||||
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||
if (!pStbRowsCxt->aTagNames) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
||||
if (!pStbRowsCxt->aTagVals) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
// col values and bound cols info of STableDataContext is not used
|
||||
pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal));
|
||||
if (!pStbRowsCxt->aColVals)
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
||||
|
@ -2539,7 +2539,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif
|
|||
static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||
SBoundColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
|
||||
if (NULL == tags) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
|
||||
|
||||
|
@ -2726,13 +2726,13 @@ static int32_t addTableVgroupFromMetaData(const SArray* pTables, SVnodeModifyOpS
|
|||
static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) {
|
||||
*pTagName = taosArrayInit(pMeta->tableInfo.numOfTags, TSDB_COL_NAME_LEN);
|
||||
if (NULL == *pTagName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SSchema* pSchema = getTableTagSchema(pMeta);
|
||||
int32_t code = 0;
|
||||
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) {
|
||||
if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosArrayDestroy(*pTagName);
|
||||
*pTagName = NULL;
|
||||
break;
|
||||
|
@ -2872,12 +2872,12 @@ static int32_t setRefreshMeta(SQuery* pQuery) {
|
|||
taosArrayDestroy(pQuery->pTableList);
|
||||
pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName));
|
||||
if (!pQuery->pTableList) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL);
|
||||
while (NULL != pTable) {
|
||||
if (NULL == taosArrayPush(pQuery->pTableList, pTable)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosHashCancelIterate(pStmt->pTableNameHashObj, pTable);
|
||||
break;
|
||||
}
|
||||
|
@ -2890,12 +2890,12 @@ static int32_t setRefreshMeta(SQuery* pQuery) {
|
|||
taosArrayDestroy(pQuery->pDbList);
|
||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN);
|
||||
if (!pQuery->pDbList) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL);
|
||||
while (NULL != pDb) {
|
||||
if (NULL == taosArrayPush(pQuery->pDbList, pDb)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosHashCancelIterate(pStmt->pDbFNameHashObj, pDb);
|
||||
break;
|
||||
}
|
||||
|
@ -2970,13 +2970,13 @@ static int32_t parseInsertSqlImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
static int32_t buildInsertTableReq(SName* pName, SArray** pTables) {
|
||||
*pTables = taosArrayInit(1, sizeof(SName));
|
||||
if (NULL == *pTables) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (NULL == taosArrayPush(*pTables, pName)) {
|
||||
taosArrayDestroy(*pTables);
|
||||
*pTables = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -2985,7 +2985,7 @@ static int32_t buildInsertDbReq(SName* pName, SArray** pDbs) {
|
|||
if (NULL == *pDbs) {
|
||||
*pDbs = taosArrayInit(1, sizeof(STablesReq));
|
||||
if (NULL == *pDbs) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3002,7 +3002,7 @@ static int32_t buildInsertDbReq(SName* pName, SArray** pDbs) {
|
|||
static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** pUserAuth) {
|
||||
*pUserAuth = taosArrayInit(1, sizeof(SUserAuthInfo));
|
||||
if (NULL == *pUserAuth) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
|
||||
|
@ -3011,7 +3011,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
|
|||
if (NULL == taosArrayPush(*pUserAuth, &userAuth)) {
|
||||
taosArrayDestroy(*pUserAuth);
|
||||
*pUserAuth = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
|
@ -166,7 +166,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
}
|
||||
}
|
||||
if (NULL == taosArrayPush(tagName, pTagSchema->name)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
|
@ -178,7 +178,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
isJson = true;
|
||||
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
memcpy(tmp, bind[c].buffer, colLen);
|
||||
|
@ -219,7 +219,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
memcpy(&val.i64, bind[c].buffer, colLen);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTagArray, &val)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ int32_t convertStmtNcharCol(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_MULTI_BIND*
|
|||
if (dst->buffer_length < newBuflen) {
|
||||
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
||||
if (NULL == dst->buffer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ int32_t convertStmtNcharCol(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_MULTI_BIND*
|
|||
dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num);
|
||||
if (NULL == dst->length) {
|
||||
taosMemoryFreeClear(dst->buffer);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
}
|
||||
}
|
||||
if (NULL == taosArrayPush(tagName, pTagSchema->name)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
||||
|
@ -526,7 +526,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
isJson = true;
|
||||
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
||||
if (!tmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
memcpy(tmp, bind[c].buffer, colLen);
|
||||
|
@ -567,7 +567,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
memcpy(&val.i64, bind[c].buffer, colLen);
|
||||
}
|
||||
if (NULL == taosArrayPush(pTagArray, &val)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -690,12 +690,12 @@ int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bin
|
|||
if (!ncharBinds) {
|
||||
ncharBinds = taosArrayInit(1, sizeof(ncharBind));
|
||||
if (!ncharBinds) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
}
|
||||
if (!taosArrayPush(ncharBinds, &ncharBind)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _return;
|
||||
}
|
||||
pBindInfos[c].bind = taosArrayGetLast(ncharBinds);
|
||||
|
@ -733,7 +733,7 @@ static int32_t convertStmtNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_STM
|
|||
// if (dst->buffer_length < newBuflen) {
|
||||
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
||||
if (NULL == dst->buffer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
//}
|
||||
|
||||
|
@ -741,7 +741,7 @@ static int32_t convertStmtNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_STM
|
|||
dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num);
|
||||
if (NULL == dst->length) {
|
||||
taosMemoryFreeClear(dst->buffer);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese
|
|||
void* pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pCxt->pMeta));
|
||||
if (NULL == pNewMeta) {
|
||||
insDestroyTableDataCxt(*pDst);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pNewMeta, pCxt->pMeta, TABLE_META_SIZE(pCxt->pMeta));
|
||||
pNewCxt->pMeta = pNewMeta;
|
||||
|
@ -1013,7 +1013,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese
|
|||
void* pNewColIdx = taosMemoryMalloc(pCxt->boundColsInfo.numOfBound * sizeof(*pCxt->boundColsInfo.pColIndex));
|
||||
if (NULL == pNewColIdx) {
|
||||
insDestroyTableDataCxt(*pDst);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pNewColIdx, pCxt->boundColsInfo.pColIndex,
|
||||
pCxt->boundColsInfo.numOfBound * sizeof(*pCxt->boundColsInfo.pColIndex));
|
||||
|
@ -1024,7 +1024,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese
|
|||
SSubmitTbData* pNewTb = (SSubmitTbData*)taosMemoryMalloc(sizeof(SSubmitTbData));
|
||||
if (NULL == pNewTb) {
|
||||
insDestroyTableDataCxt(*pDst);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(pNewTb, pCxt->pData, sizeof(*pCxt->pData));
|
||||
|
|
|
@ -178,7 +178,7 @@ static int32_t initColValues(STableMeta* pTableMeta, SArray* pValues) {
|
|||
for (int32_t i = 0; i < pTableMeta->tableInfo.numOfColumns; ++i) {
|
||||
SColVal val = COL_VAL_NONE(pSchemas[i].colId, pSchemas[i].type);
|
||||
if (NULL == taosArrayPush(pValues, &val)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
|||
if (TSDB_CODE_SUCCESS == code && !ignoreColVals) {
|
||||
pTableCxt->pValues = taosArrayInit(pTableMeta->tableInfo.numOfColumns, sizeof(SColVal));
|
||||
if (NULL == pTableCxt->pValues) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
code = initColValues(pTableMeta, pTableCxt->pValues);
|
||||
}
|
||||
|
@ -281,12 +281,12 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
|||
if (pTableCxt->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||
pTableCxt->pData->aCol = taosArrayInit(128, sizeof(SColData));
|
||||
if (NULL == pTableCxt->pData->aCol) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
} else {
|
||||
pTableCxt->pData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||
if (NULL == pTableCxt->pData->aRowP) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,13 +323,13 @@ static int32_t rebuildTableData(SSubmitTbData* pSrc, SSubmitTbData** pDst) {
|
|||
if (pTmp->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||
pTmp->aCol = taosArrayInit(128, sizeof(SColData));
|
||||
if (NULL == pTmp->aCol) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFree(pTmp);
|
||||
}
|
||||
} else {
|
||||
pTmp->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||
if (NULL == pTmp->aRowP) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosMemoryFree(pTmp);
|
||||
}
|
||||
}
|
||||
|
@ -458,13 +458,13 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx
|
|||
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
||||
pVgCxt->pData->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
||||
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
// push data to submit, rebuild empty data for next submit
|
||||
if (NULL == taosArrayPush(pVgCxt->pData->aSubmitTbData, pTableCxt->pData)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = 0;
|
||||
if (isRebuild) {
|
||||
|
@ -494,7 +494,7 @@ static int32_t createVgroupDataCxt(STableDataCxt* pTableCxt, SHashObj* pVgroupHa
|
|||
int32_t code = taosHashPut(pVgroupHash, &pVgCxt->vgId, sizeof(pVgCxt->vgId), &pVgCxt, POINTER_BYTES);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (NULL == taosArrayPush(pVgroupList, &pVgCxt)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
insDestroyVgroupDataCxt(pVgCxt);
|
||||
return code;
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks, bool
|
|||
if (NULL == pVgroupHash || NULL == pVgroupList) {
|
||||
taosHashCleanup(pVgroupHash);
|
||||
taosArrayDestroy(pVgroupList);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -805,7 +805,7 @@ static int32_t buildSubmitReq(int32_t vgId, SSubmitReq2* pReq, void** pData, uin
|
|||
len += sizeof(SSubmitReq2Msg);
|
||||
pBuf = taosMemoryMalloc(len);
|
||||
if (NULL == pBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
((SSubmitReq2Msg*)pBuf)->header.vgId = htonl(vgId);
|
||||
((SSubmitReq2Msg*)pBuf)->header.contLen = htonl(len);
|
||||
|
|
|
@ -396,7 +396,7 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
|||
if (currTotalLevel > pCxt->currLevel) {
|
||||
SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel);
|
||||
if (NULL == taosArrayPush(pTables, &pTable)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (hasSameTableAlias(pTables)) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS,
|
||||
|
@ -406,7 +406,7 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
|||
do {
|
||||
SArray* pTables = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||
if (NULL == pTables) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (pCxt->currLevel == currTotalLevel) {
|
||||
if (NULL == taosArrayPush(pTables, &pTable)) {
|
||||
|
@ -420,7 +420,7 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
|
|||
}
|
||||
}
|
||||
if (NULL == taosArrayPush(pCxt->pNsLevel, &pTables)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
taosArrayDestroy(pTables);
|
||||
break;
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ static int32_t initTranslateContext(SParseContext* pParseCxt, SParseMetaCache* p
|
|||
pCxt->pTables = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
pCxt->pTargetTables = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||
if (NULL == pCxt->pNsLevel || NULL == pCxt->pDbs || NULL == pCxt->pTables || NULL == pCxt->pTargetTables) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ static int32_t resetHighLevelTranslateNamespace(STranslateContext* pCxt) {
|
|||
}
|
||||
pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||
if (NULL == pCxt->pNsLevel) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ static int32_t resetTranslateNamespace(STranslateContext* pCxt) {
|
|||
}
|
||||
pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES);
|
||||
if (NULL == pCxt->pNsLevel) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SCo
|
|||
|
||||
if (NULL == pExpr->pAssociation) {
|
||||
pExpr->pAssociation = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SAssociationNode));
|
||||
if (!pExpr->pAssociation) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pExpr->pAssociation) return terrno;
|
||||
}
|
||||
SAssociationNode assNode;
|
||||
assNode.pPlace = (SNode**)pColRef;
|
||||
|
@ -2700,7 +2700,7 @@ static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) {
|
|||
if (NULL != pCxt->pParseCxt->db) {
|
||||
pCurrDb = taosStrdup((void*)pCxt->pParseCxt->db);
|
||||
if (NULL == pCurrDb) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
int32_t code = rewriteFuncToValue(pCxt, &pCurrDb, pNode);
|
||||
|
@ -2711,7 +2711,7 @@ static int32_t rewriteDatabaseFunc(STranslateContext* pCxt, SNode** pNode) {
|
|||
static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) {
|
||||
char* pVer = taosStrdup((void*)version);
|
||||
if (NULL == pVer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = rewriteFuncToValue(pCxt, &pVer, pNode);
|
||||
if (TSDB_CODE_SUCCESS != code) taosMemoryFree(pVer);
|
||||
|
@ -2721,7 +2721,7 @@ static int32_t rewriteClentVersionFunc(STranslateContext* pCxt, SNode** pNode) {
|
|||
static int32_t rewriteServerVersionFunc(STranslateContext* pCxt, SNode** pNode) {
|
||||
char* pVer = taosStrdup((void*)pCxt->pParseCxt->svrVer);
|
||||
if (NULL == pVer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = rewriteFuncToValue(pCxt, &pVer, pNode);
|
||||
if (TSDB_CODE_SUCCESS != code) taosMemoryFree(pVer);
|
||||
|
@ -2749,7 +2749,7 @@ static int32_t rewriteUserFunc(STranslateContext* pCxt, SNode** pNode) {
|
|||
}
|
||||
char* pUserConn = taosStrdup((void*)userConn);
|
||||
if (NULL == pUserConn) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = rewriteFuncToValue(pCxt, &pUserConn, pNode);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
|
@ -3795,13 +3795,13 @@ static int32_t addMnodeToVgroupList(const SEpSet* pEpSet, SArray** pVgroupList)
|
|||
if (NULL == *pVgroupList) {
|
||||
*pVgroupList = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SVgroupInfo));
|
||||
if (NULL == *pVgroupList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
SVgroupInfo vg = {.vgId = MNODE_HANDLE};
|
||||
memcpy(&vg.epSet, pEpSet, sizeof(SEpSet));
|
||||
if (NULL == taosArrayPush(*pVgroupList, &vg)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -3853,10 +3853,10 @@ static int32_t getVnodeSysTableVgroupListImpl(STranslateContext* pCxt, SName* pT
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
*pVgroupList = taosArrayInit(1, sizeof(SVgroupInfo));
|
||||
if (NULL == *pVgroupList) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
if (NULL == taosArrayPush(*pVgroupList, &vgInfo)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
} else if (TSDB_CODE_MND_DB_NOT_EXIST == code || TSDB_CODE_MND_DB_IN_CREATING == code ||
|
||||
|
@ -4040,7 +4040,7 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
|||
if (!pRealTable->tsmaTargetTbVgInfo) {
|
||||
pRealTable->tsmaTargetTbVgInfo = taosArrayInit(pRealTable->pTsmas->size, POINTER_BYTES);
|
||||
if (!pRealTable->tsmaTargetTbVgInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4071,7 +4071,7 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
|||
if (!pRealTable->tsmaTargetTbInfo) {
|
||||
pRealTable->tsmaTargetTbInfo = taosArrayInit(pRealTable->pTsmas->size, sizeof(STsmaTargetTbInfo));
|
||||
if (!pRealTable->tsmaTargetTbInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5185,7 +5185,7 @@ static int32_t rewriteProjectAlias(SNodeList* pProjectionList) {
|
|||
static int32_t checkProjectAlias(STranslateContext* pCxt, SNodeList* pProjectionList, SHashObj** pOutput) {
|
||||
SHashObj* pUserAliasSet = taosHashInit(LIST_LENGTH(pProjectionList),
|
||||
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
if (!pUserAliasSet) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pUserAliasSet) return terrno;
|
||||
SNode* pProject = NULL;
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
FOREACH(pProject, pProjectionList) {
|
||||
|
@ -6077,7 +6077,7 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO
|
|||
}
|
||||
SNodeListNode* pValueListNode = (SNodeListNode*)pOperator->pRight;
|
||||
*ppTbNames = taosArrayInit(LIST_LENGTH(pValueListNode->pNodeList), sizeof(void*));
|
||||
if (!*ppTbNames) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!*ppTbNames) return terrno;
|
||||
SNodeList* pValueNodeList = pValueListNode->pNodeList;
|
||||
SNode* pValNode = NULL;
|
||||
FOREACH(pValNode, pValueNodeList) {
|
||||
|
@ -6147,7 +6147,7 @@ static int32_t findEqualCondTbnameInLogicCondAnd(STranslateContext* pCxt, SNode*
|
|||
if (!isTableExistInTableTbnames(aTableTbnames, info.pRealTable)) {
|
||||
// TODO: intersect tbNames of same table? speed
|
||||
if (NULL == taosArrayPush(aTableTbnames, &info)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
@ -6178,7 +6178,7 @@ static int32_t unionEqualCondTbnamesOfSameTable(SArray* aTableTbnames, SEqCondTb
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code && !bFoundTable) {
|
||||
if (NULL == taosArrayPush(aTableTbnames, pInfo)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
|
@ -6228,7 +6228,7 @@ static int32_t findEqualCondTbname(STranslateContext* pCxt, SNode* pWhere, SArra
|
|||
if (TSDB_CODE_SUCCESS != code) return code;
|
||||
if (bIsEqTbnameCond) {
|
||||
if (NULL == taosArrayPush(aTableTbnames, &info)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
} else if (nodeType(pWhere) == QUERY_NODE_LOGIC_CONDITION) {
|
||||
|
@ -6363,12 +6363,12 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
|||
|
||||
if (pInfo->pRealTable->pTsmas) {
|
||||
pInfo->pRealTable->tsmaTargetTbVgInfo = taosArrayInit(pInfo->pRealTable->pTsmas->size, POINTER_BYTES);
|
||||
if (!pInfo->pRealTable->tsmaTargetTbVgInfo) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pInfo->pRealTable->tsmaTargetTbVgInfo) return terrno;
|
||||
|
||||
for (int32_t i = 0; i < pInfo->pRealTable->pTsmas->size; ++i) {
|
||||
STableTSMAInfo* pTsma = taosArrayGetP(pInfo->pRealTable->pTsmas, i);
|
||||
SArray* pTbNames = taosArrayInit(pInfo->aTbnames->size, POINTER_BYTES);
|
||||
if (!pTbNames) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pTbNames) return terrno;
|
||||
|
||||
for (int32_t k = 0; k < pInfo->aTbnames->size; ++k) {
|
||||
const char* pTbName = taosArrayGetP(pInfo->aTbnames, k);
|
||||
|
@ -6387,7 +6387,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
vgsInfo = taosMemoryMalloc(sizeof(SVgroupsInfo) + nTbls * sizeof(SVgroupInfo));
|
||||
if (!vgsInfo) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!vgsInfo) code = terrno;
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
findVgroupsFromEqualTbname(pCxt, pTbNames, pInfo->pRealTable->table.dbName, numOfVgs, vgsInfo);
|
||||
|
@ -7161,7 +7161,7 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe
|
|||
if (NULL != pRetentions) {
|
||||
pReq->pRetensions = taosArrayInit(LIST_LENGTH(pRetentions), sizeof(SRetention));
|
||||
if (NULL == pReq->pRetensions) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SValueNode* pFreq = NULL;
|
||||
SValueNode* pKeep = NULL;
|
||||
|
@ -7173,7 +7173,7 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe
|
|||
SRetention retention = {
|
||||
.freq = pFreq->datum.i, .freqUnit = pFreq->unit, .keep = pKeep->datum.i, .keepUnit = pKeep->unit};
|
||||
if (NULL == taosArrayPush(pReq->pRetensions, &retention)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7718,7 +7718,7 @@ static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt*
|
|||
CMD_TYPE* pCmdReq = genericCmd; \
|
||||
char* cmdSql = taosMemoryMalloc(sqlLen); \
|
||||
if (cmdSql == NULL) { \
|
||||
return TSDB_CODE_OUT_OF_MEMORY; \
|
||||
return terrno; \
|
||||
} \
|
||||
memcpy(cmdSql, sql, sqlLen); \
|
||||
pCmdReq->sqlLen = sqlLen; \
|
||||
|
@ -7854,7 +7854,7 @@ static int32_t buildCmdMsg(STranslateContext* pCxt, int16_t msgType, FSerializeF
|
|||
if (TSDB_CODE_SUCCESS != code) return code;
|
||||
pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo));
|
||||
if (NULL == pCxt->pCmdMsg) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
||||
pCxt->pCmdMsg->msgType = msgType;
|
||||
|
@ -7865,7 +7865,7 @@ static int32_t buildCmdMsg(STranslateContext* pCxt, int16_t msgType, FSerializeF
|
|||
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
||||
if (NULL == pCxt->pCmdMsg->pMsg) {
|
||||
taosMemoryFreeClear(pCxt->pCmdMsg);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (-1 == func(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, pReq)) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
|
@ -8005,7 +8005,7 @@ static int32_t translateS3MigrateDatabase(STranslateContext* pCxt, SS3MigrateDat
|
|||
|
||||
static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) {
|
||||
*pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SFieldWithOptions));
|
||||
if (!pArray) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pArray) return terrno;
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SNode* pNode;
|
||||
|
@ -8031,7 +8031,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
|
|||
field.flags |= COL_IS_KEY;
|
||||
}
|
||||
if (NULL == taosArrayPush(*pArray, &field)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -8044,7 +8044,7 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray, bool calB
|
|||
|
||||
static int32_t tagDefNodeToField(SNodeList* pList, SArray** pArray, bool calBytes) {
|
||||
*pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField));
|
||||
if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!*pArray) return terrno;
|
||||
SNode* pNode;
|
||||
FOREACH(pNode, pList) {
|
||||
SColumnDefNode* pCol = (SColumnDefNode*)pNode;
|
||||
|
@ -8277,7 +8277,7 @@ static int32_t checkTableSchemaImpl(STranslateContext* pCxt, SNodeList* pTags, S
|
|||
SHashObj* pHash = taosHashInit(LIST_LENGTH(pTags) + LIST_LENGTH(pCols),
|
||||
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
|
||||
if (NULL == pHash) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = checkTableTagsSchema(pCxt, pHash, pTags);
|
||||
|
@ -8804,7 +8804,7 @@ static int32_t buildRollupFuncs(SNodeList* pFuncs, SArray** pArray) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
*pArray = taosArrayInit(LIST_LENGTH(pFuncs), TSDB_FUNC_NAME_LEN);
|
||||
if (!*pArray) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!*pArray) return terrno;
|
||||
SNode* pNode;
|
||||
FOREACH(pNode, pFuncs) {
|
||||
if (NULL == taosArrayPush(*pArray, ((SFunctionNode*)pNode)->functionName)) {
|
||||
|
@ -8840,7 +8840,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
|||
if (pStmt->pOptions->commentNull == false) {
|
||||
pReq->pComment = taosStrdup(pStmt->pOptions->comment);
|
||||
if (NULL == pReq->pComment) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->commentLen = strlen(pStmt->pOptions->comment);
|
||||
} else {
|
||||
|
@ -8917,7 +8917,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
if (pStmt->pOptions->commentNull == false) {
|
||||
pAlterReq->comment = taosStrdup(pStmt->pOptions->comment);
|
||||
if (NULL == pAlterReq->comment) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pAlterReq->commentLen = strlen(pStmt->pOptions->comment);
|
||||
} else {
|
||||
|
@ -8929,7 +8929,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
|
||||
pAlterReq->pFields = taosArrayInit(2, sizeof(TAOS_FIELD));
|
||||
if (NULL == pAlterReq->pFields) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
switch (pStmt->alterType) {
|
||||
|
@ -8942,7 +8942,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)};
|
||||
strcpy(field.name, pStmt->colName);
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &field)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -8951,12 +8951,12 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
TAOS_FIELD oldField = {0};
|
||||
strcpy(oldField.name, pStmt->colName);
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &oldField)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
TAOS_FIELD newField = {0};
|
||||
strcpy(newField.name, pStmt->newColName);
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &newField)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -8974,7 +8974,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
return code;
|
||||
}
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &field)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -8982,7 +8982,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
taosArrayDestroy(pAlterReq->pFields);
|
||||
|
||||
pAlterReq->pFields = taosArrayInit(1, sizeof(SFieldWithOptions));
|
||||
if (!pAlterReq->pFields) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pAlterReq->pFields) return terrno;
|
||||
SFieldWithOptions field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)};
|
||||
// TAOS_FIELD field = {.type = pStmt->dataType.type, .bytes = calcTypeBytes(pStmt->dataType)};
|
||||
strcpy(field.name, pStmt->colName);
|
||||
|
@ -9001,7 +9001,7 @@ static int32_t buildAlterSuperTableReq(STranslateContext* pCxt, SAlterTableStmt*
|
|||
return code;
|
||||
}
|
||||
}
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &field)) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (NULL == taosArrayPush(pAlterReq->pFields, &field)) return terrno;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -9396,7 +9396,7 @@ static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, const char* pDbName,
|
|||
static int32_t getSmaIndexSql(STranslateContext* pCxt, char** pSql, int32_t* pLen) {
|
||||
*pSql = taosStrdup(pCxt->pParseCxt->pSql);
|
||||
if (NULL == *pSql) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
*pLen = pCxt->pParseCxt->sqlLen + 1;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -9736,7 +9736,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
|
|||
|
||||
pReq->sql = taosStrdup(pCxt->pParseCxt->pSql);
|
||||
if (NULL == pReq->sql) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -10576,7 +10576,7 @@ static int32_t addProjToProjColPos(STranslateContext* pCxt, const SSchema* pSche
|
|||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
SProjColPos pos = {.colId = pSchema->colId, .pProj = pNewProj, .flags = pSchema->flags};
|
||||
code = (NULL == taosArrayPush(pProjColPos, &pos) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS);
|
||||
code = (NULL == taosArrayPush(pProjColPos, &pos) ? terrno : TSDB_CODE_SUCCESS);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
nodesDestroyNode(pNewProj);
|
||||
|
@ -10588,7 +10588,7 @@ static int32_t setFillNullCols(SArray* pProjColPos, const STableMeta* pMeta, SCM
|
|||
int32_t numOfBoundCols = taosArrayGetSize(pProjColPos);
|
||||
pReq->fillNullCols = taosArrayInit(pMeta->tableInfo.numOfColumns - numOfBoundCols, sizeof(SColLocation));
|
||||
if (NULL == pReq->fillNullCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
const SSchema* pSchemas = getTableColumnSchema(pMeta);
|
||||
int32_t indexOfBoundCols = 0;
|
||||
|
@ -10604,7 +10604,7 @@ static int32_t setFillNullCols(SArray* pProjColPos, const STableMeta* pMeta, SCM
|
|||
}
|
||||
SColLocation colLoc = {.colId = pSchema->colId, .slotId = i, .type = pSchema->type};
|
||||
if (NULL == taosArrayPush(pReq->fillNullCols, &colLoc)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -10619,7 +10619,7 @@ static int32_t adjustOrderOfProjections(STranslateContext* pCxt, SNodeList** ppC
|
|||
|
||||
SArray* pProjColPos = taosArrayInit(LIST_LENGTH((*ppCols)), sizeof(SProjColPos));
|
||||
if (NULL == pProjColPos) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -10746,7 +10746,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons
|
|||
|
||||
SArray* pTagPos = taosArrayInit(LIST_LENGTH(pTags), sizeof(SProjColPos));
|
||||
if (NULL == pTagPos) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -11151,7 +11151,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pReq->sql = taosStrdup(pCxt->pParseCxt->pSql);
|
||||
if (NULL == pReq->sql) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11193,7 +11193,7 @@ static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt*
|
|||
} else {
|
||||
pStmt->pReq = taosMemoryMalloc(sizeof(createReq));
|
||||
if (NULL == pStmt->pReq) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
memcpy(pStmt->pReq, &createReq, sizeof(createReq));
|
||||
memset(&createReq, 0, sizeof(createReq));
|
||||
|
@ -11232,7 +11232,7 @@ static int32_t buildIntervalForCreateStream(SCreateStreamStmt* pStmt, SInterval*
|
|||
static int32_t createStreamReqVersionInfo(SSDataBlock* pBlock, SArray** pArray, int64_t* lastTs, SInterval* pInterval) {
|
||||
*pArray = taosArrayInit(pBlock->info.rows, sizeof(SVgroupVer));
|
||||
if (*pArray == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pBlock->info.rows > 0) {
|
||||
|
@ -11797,7 +11797,7 @@ static int32_t buildTSMAAstStreamSubTable(SCreateTSMAStmt* pStmt, SMCreateSmaReq
|
|||
sprintf(pConcatFunc->functionName, "%s", "concat");
|
||||
pVal->literal = taosMemoryMalloc(TSDB_TABLE_FNAME_LEN + 1);
|
||||
if (!pVal->literal) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
sprintf(pVal->literal, "%s_", pReq->name);
|
||||
|
@ -13317,7 +13317,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
|||
req.comment = taosStrdup(pStmt->pOptions->comment);
|
||||
if (NULL == req.comment) {
|
||||
tdDestroySVCreateTbReq(&req);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
req.commentLen = strlen(pStmt->pOptions->comment);
|
||||
} else {
|
||||
|
@ -13362,11 +13362,11 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
|||
pBatch->req.pArray = taosArrayInit(1, sizeof(struct SVCreateTbReq));
|
||||
if (NULL == pBatch->req.pArray) {
|
||||
tdDestroySVCreateTbReq(&req);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (NULL == taosArrayPush(pBatch->req.pArray, &req)) {
|
||||
tdDestroySVCreateTbReq(&req);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -13388,7 +13388,7 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
|
|||
tlen += sizeof(SMsgHead);
|
||||
void* buf = taosMemoryMalloc(tlen);
|
||||
if (NULL == buf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
((SMsgHead*)buf)->vgId = htonl(pTbBatch->info.vgId);
|
||||
((SMsgHead*)buf)->contLen = htonl(tlen);
|
||||
|
@ -13412,7 +13412,7 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
|
|||
pVgData->size = tlen;
|
||||
pVgData->numOfTables = (int32_t)taosArrayGetSize(pTbBatch->req.pArray);
|
||||
if (NULL == taosArrayPush(pBufArray, &pVgData)) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
taosMemoryFreeClear(buf);
|
||||
taosMemoryFreeClear(pVgData);
|
||||
}
|
||||
|
@ -13458,7 +13458,7 @@ static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt*
|
|||
SArray** pBufArray) {
|
||||
*pBufArray = taosArrayInit(1, POINTER_BYTES);
|
||||
if (NULL == *pBufArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SVgroupCreateTableBatch tbatch = {0};
|
||||
|
@ -13541,7 +13541,7 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db
|
|||
code = terrno;
|
||||
} else if (NULL == taosArrayPush(tBatch.req.pArray, &req)) {
|
||||
taosArrayDestroy(tBatch.req.pArray);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
|
@ -13550,7 +13550,7 @@ static int32_t addCreateTbReqIntoVgroup(SHashObj* pVgroupHashmap, const char* db
|
|||
}
|
||||
} else { // add to the correct vgroup
|
||||
if (NULL == taosArrayPush(pTableBatch->req.pArray, &req)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13587,7 +13587,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla
|
|||
|
||||
SArray* pTagArray = taosArrayInit(LIST_LENGTH(pStmt->pValsOfTags), sizeof(STagVal));
|
||||
if (NULL == pTagArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -13654,7 +13654,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau
|
|||
|
||||
SArray* pTagArray = taosArrayInit(LIST_LENGTH(pStmt->pValsOfTags), sizeof(STagVal));
|
||||
if (NULL == pTagArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -13770,7 +13770,7 @@ static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFil
|
|||
|
||||
SHashObj* pIdxHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pIdxHash) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
bool tbnameFound = false;
|
||||
|
@ -13826,7 +13826,7 @@ static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFil
|
|||
}
|
||||
|
||||
if (NULL == taosArrayPush(aTagIndexs, &idx)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _OUT;
|
||||
}
|
||||
}
|
||||
|
@ -13987,7 +13987,7 @@ static int32_t parseCsvFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SParseFi
|
|||
|
||||
if (NULL == taosArrayPush(pParFileCxt->aCreateTbData, &data)) {
|
||||
taosMemoryFreeClear(pParFileCxt->pTag);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
} else {
|
||||
taosMemoryFreeClear(pParFileCxt->pTag);
|
||||
|
@ -14042,7 +14042,7 @@ static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, S
|
|||
if (NULL == pParFileCxt->aTagNames) {
|
||||
pParFileCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||
if (NULL == pParFileCxt->aTagNames) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERR;
|
||||
}
|
||||
}
|
||||
|
@ -14050,7 +14050,7 @@ static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, S
|
|||
if (NULL == pParFileCxt->aCreateTbData) {
|
||||
pParFileCxt->aCreateTbData = taosArrayInit(16, sizeof(SCreateTableData));
|
||||
if (NULL == pParFileCxt->aCreateTbData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERR;
|
||||
}
|
||||
}
|
||||
|
@ -14058,7 +14058,7 @@ static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, S
|
|||
if (NULL == pParFileCxt->aTagIndexs) {
|
||||
pParFileCxt->aTagIndexs = taosArrayInit(pStmt->pSpecificTags->length, sizeof(int16_t));
|
||||
if (!pParFileCxt->aTagIndexs) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERR;
|
||||
}
|
||||
}
|
||||
|
@ -14066,7 +14066,7 @@ static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, S
|
|||
if (NULL == pParFileCxt->aTagVals) {
|
||||
pParFileCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
||||
if (!pParFileCxt->aTagVals) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERR;
|
||||
}
|
||||
}
|
||||
|
@ -14219,7 +14219,7 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery)
|
|||
|
||||
SHashObj* pVgroupHashmap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pVgroupHashmap) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch);
|
||||
|
@ -14255,7 +14255,7 @@ static int32_t rewriteCreateTableFromFile(STranslateContext* pCxt, SQuery* pQuer
|
|||
pModifyStmt->destroyParseFileCxt = destructParseFileContext;
|
||||
pModifyStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
|
||||
if (NULL == pModifyStmt->pVgroupsHashObj) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
taosHashSetFreeFp(pModifyStmt->pVgroupsHashObj, destroyCreateTbReqBatch);
|
||||
|
||||
|
@ -14337,7 +14337,7 @@ static int32_t addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SVgroupInfo* pVg
|
|||
if (NULL == taosArrayPush(tBatch.req.pArray, pReq)) {
|
||||
taosArrayDestroy(tBatch.req.pArray);
|
||||
tBatch.req.pArray = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = taosHashPut(pVgroupHashmap, &pVgInfo->vgId, sizeof(pVgInfo->vgId), &tBatch, sizeof(tBatch));
|
||||
|
@ -14348,7 +14348,7 @@ static int32_t addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SVgroupInfo* pVg
|
|||
}
|
||||
} else { // add to the correct vgroup
|
||||
if (NULL == taosArrayPush(pTableBatch->req.pArray, pReq)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
return code;
|
||||
|
@ -14402,7 +14402,7 @@ static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SA
|
|||
tlen += sizeof(SMsgHead);
|
||||
void* buf = taosMemoryMalloc(tlen);
|
||||
if (NULL == buf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
((SMsgHead*)buf)->vgId = htonl(pTbBatch->info.vgId);
|
||||
((SMsgHead*)buf)->contLen = htonl(tlen);
|
||||
|
@ -14426,7 +14426,7 @@ static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SA
|
|||
pVgData->size = tlen;
|
||||
pVgData->numOfTables = (int32_t)taosArrayGetSize(pTbBatch->req.pArray);
|
||||
if (NULL == taosArrayPush(pBufArray, &pVgData)) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
taosMemoryFreeClear(pVgData);
|
||||
taosMemoryFreeClear(buf);
|
||||
}
|
||||
|
@ -14468,7 +14468,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
|
||||
SHashObj* pVgroupHashmap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
if (NULL == pVgroupHashmap) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch);
|
||||
|
@ -14522,7 +14522,7 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
reqOnVg.pTbs = pTbBatch->req.pArray;
|
||||
if (NULL == taosArrayPush(req.pVgReqs, &reqOnVg)) {
|
||||
taosHashCancelIterate(pVgroupHashmap, pTbBatch);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
|
@ -14564,11 +14564,11 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
|||
}
|
||||
pReq->tagName = taosStrdup(pStmt->colName);
|
||||
if (NULL == pReq->tagName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->pTagArray = taosArrayInit(1, sizeof(STagVal));
|
||||
if (NULL == pReq->pTagArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->colId = pSchema->colId;
|
||||
pReq->tagType = pSchema->type;
|
||||
|
@ -14651,7 +14651,7 @@ static int32_t buildAddColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, S
|
|||
|
||||
pReq->colName = taosStrdup(pStmt->colName);
|
||||
if (NULL == pReq->colName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pReq->type = pStmt->dataType.type;
|
||||
|
@ -14685,7 +14685,7 @@ static int32_t buildDropColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt,
|
|||
|
||||
pReq->colName = taosStrdup(pStmt->colName);
|
||||
if (NULL == pReq->colName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->colId = pSchema->colId;
|
||||
|
||||
|
@ -14716,7 +14716,7 @@ static int32_t buildUpdateColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt
|
|||
|
||||
pReq->colName = taosStrdup(pStmt->colName);
|
||||
if (NULL == pReq->colName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->colId = pSchema->colId;
|
||||
|
||||
|
@ -14746,7 +14746,7 @@ static int32_t buildRenameColReq(STranslateContext* pCxt, SAlterTableStmt* pStmt
|
|||
pReq->colName = taosStrdup(pStmt->colName);
|
||||
pReq->colNewName = taosStrdup(pStmt->newColName);
|
||||
if (NULL == pReq->colName || NULL == pReq->colNewName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -14763,7 +14763,7 @@ static int32_t buildUpdateOptionsReq(STranslateContext* pCxt, SAlterTableStmt* p
|
|||
if (pStmt->pOptions->commentNull == false) {
|
||||
pReq->newComment = taosStrdup(pStmt->pOptions->comment);
|
||||
if (NULL == pReq->newComment) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
pReq->newCommentLen = strlen(pReq->newComment);
|
||||
}
|
||||
|
@ -14785,7 +14785,7 @@ static int buildAlterTableColumnCompress(STranslateContext* pCxt, SAlterTableStm
|
|||
pReq->colName = taosStrdup(pStmt->colName);
|
||||
pReq->colId = pSchema->colId;
|
||||
if (NULL == pReq->colName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (!checkColumnEncode(pStmt->pColOptions->encode)) return TSDB_CODE_TSC_ENCODE_PARAM_ERROR;
|
||||
|
@ -14801,7 +14801,7 @@ static int32_t buildAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pStmt,
|
|||
SVAlterTbReq* pReq) {
|
||||
pReq->tbName = taosStrdup(pStmt->tableName);
|
||||
if (NULL == pReq->tbName) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pReq->action = pStmt->alterType;
|
||||
|
||||
|
@ -14853,7 +14853,7 @@ static int32_t serializeAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pSt
|
|||
tlen += sizeof(SMsgHead);
|
||||
void* pMsg = taosMemoryMalloc(tlen);
|
||||
if (NULL == pMsg) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
((SMsgHead*)pMsg)->vgId = htonl(vg.vgId);
|
||||
((SMsgHead*)pMsg)->contLen = htonl(tlen);
|
||||
|
@ -14876,7 +14876,7 @@ static int32_t serializeAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pSt
|
|||
pVgData->size = tlen;
|
||||
pVgData->numOfTables = 1;
|
||||
if (NULL == taosArrayPush(pArray, &pVgData)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14887,7 +14887,7 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p
|
|||
SArray** pArray) {
|
||||
SArray* pTmpArray = taosArrayInit(1, sizeof(void*));
|
||||
if (NULL == pTmpArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = serializeAlterTbReq(pCxt, pStmt, pReq, pTmpArray);
|
||||
|
@ -14966,7 +14966,7 @@ static int32_t serializeFlushVgroup(SVgroupInfo* pVg, SArray* pBufArray) {
|
|||
void* buf = taosMemoryMalloc(len);
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
if (NULL == buf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
((SMsgHead*)buf)->vgId = htonl(pVg->vgId);
|
||||
((SMsgHead*)buf)->contLen = htonl(len);
|
||||
|
@ -14980,7 +14980,7 @@ static int32_t serializeFlushVgroup(SVgroupInfo* pVg, SArray* pBufArray) {
|
|||
pVgData->pData = buf;
|
||||
pVgData->size = len;
|
||||
if (NULL == taosArrayPush(pBufArray, &pVgData)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
|
||||
return code;
|
||||
|
@ -14991,7 +14991,7 @@ static int32_t serializeFlushDb(SArray* pVgs, SArray** pOutput) {
|
|||
|
||||
SArray* pBufArray = taosArrayInit(numOfVgs, sizeof(void*));
|
||||
if (NULL == pBufArray) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfVgs; ++i) {
|
||||
|
@ -15657,13 +15657,13 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
taosArrayDestroy(pQuery->pDbList);
|
||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN);
|
||||
if (NULL == pQuery->pDbList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SFullDatabaseName* pDb = taosHashIterate(pCxt->pDbs, NULL);
|
||||
while (NULL != pDb) {
|
||||
if (NULL == taosArrayPush(pQuery->pDbList, pDb->fullDbName)) {
|
||||
taosHashCancelIterate(pCxt->pDbs, pDb);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pDb = taosHashIterate(pCxt->pDbs, pDb);
|
||||
}
|
||||
|
@ -15673,13 +15673,13 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
taosArrayDestroy(pQuery->pTableList);
|
||||
pQuery->pTableList = taosArrayInit(taosHashGetSize(pCxt->pTables), sizeof(SName));
|
||||
if (NULL == pQuery->pTableList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SName* pTable = taosHashIterate(pCxt->pTables, NULL);
|
||||
while (NULL != pTable) {
|
||||
if (NULL == taosArrayPush(pQuery->pTableList, pTable)) {
|
||||
taosHashCancelIterate(pCxt->pTables, pTable);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pTable = taosHashIterate(pCxt->pTables, pTable);
|
||||
}
|
||||
|
@ -15689,13 +15689,13 @@ static int32_t setRefreshMeta(STranslateContext* pCxt, SQuery* pQuery) {
|
|||
taosArrayDestroy(pQuery->pTargetTableList);
|
||||
pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName));
|
||||
if (NULL == pQuery->pTargetTableList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
SName* pTable = taosHashIterate(pCxt->pTargetTables, NULL);
|
||||
while (NULL != pTable) {
|
||||
if (NULL == taosArrayPush(pQuery->pTargetTableList, pTable)) {
|
||||
taosHashCancelIterate(pCxt->pTargetTables, pTable);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pTable = taosHashIterate(pCxt->pTargetTables, pTable);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue