enh:modify error code passing
This commit is contained in:
parent
e45edbbda2
commit
69d62454d7
|
@ -480,7 +480,7 @@ int32_t funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow,
|
||||||
pIter->pPrevData = taosMemoryMalloc(pIter->pDataCol->info.bytes);
|
pIter->pPrevData = taosMemoryMalloc(pIter->pDataCol->info.bytes);
|
||||||
if (NULL == pIter->pPrevData) {
|
if (NULL == pIter->pPrevData) {
|
||||||
qError("out of memory when function get input row.");
|
qError("out of memory when function get input row.");
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
char* srcData = colDataGetData(pIter->pDataCol, pIter->inputEndIndex);
|
char* srcData = colDataGetData(pIter->pDataCol, pIter->inputEndIndex);
|
||||||
(void)memcpy(pIter->pPrevData, srcData, pIter->pDataCol->info.bytes);
|
(void)memcpy(pIter->pPrevData, srcData, pIter->pDataCol->info.bytes);
|
||||||
|
@ -489,7 +489,7 @@ int32_t funcInputGetNextRowDescPk(SFuncInputRowIter* pIter, SFuncInputRow* pRow,
|
||||||
if (NULL == pIter->pPrevPk) {
|
if (NULL == pIter->pPrevPk) {
|
||||||
qError("out of memory when function get input row.");
|
qError("out of memory when function get input row.");
|
||||||
taosMemoryFree(pIter->pPrevData);
|
taosMemoryFree(pIter->pPrevData);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
char* pkData = colDataGetData(pIter->pPkCol, pIter->inputEndIndex);
|
char* pkData = colDataGetData(pIter->pPkCol, pIter->inputEndIndex);
|
||||||
(void)memcpy(pIter->pPrevPk, pkData, pIter->pPkCol->info.bytes);
|
(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);
|
pIter->pPrevData = taosMemoryMalloc(pIter->pDataCol->info.bytes);
|
||||||
if (NULL == pIter->pPrevData) {
|
if (NULL == pIter->pPrevData) {
|
||||||
qError("out of memory when function get input row.");
|
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);
|
(void)memcpy(pIter->pPrevData, colDataGetData(pIter->pDataCol, pIter->inputEndIndex), pIter->pDataCol->info.bytes);
|
||||||
pIter->pPrevPk = taosMemoryMalloc(pIter->pPkCol->info.bytes);
|
pIter->pPrevPk = taosMemoryMalloc(pIter->pPkCol->info.bytes);
|
||||||
if (NULL == pIter->pPrevPk) {
|
if (NULL == pIter->pPrevPk) {
|
||||||
qError("out of memory when function get input row.");
|
qError("out of memory when function get input row.");
|
||||||
taosMemoryFree(pIter->pPrevData);
|
taosMemoryFree(pIter->pPrevData);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
(void)memcpy(pIter->pPrevPk, colDataGetData(pIter->pPkCol, pIter->inputEndIndex), pIter->pPkCol->info.bytes);
|
(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.rowLen = rowLen + pCtx->subsidiaries.num * sizeof(bool);
|
||||||
pCtx->subsidiaries.buf = taosMemoryMalloc(pCtx->subsidiaries.rowLen);
|
pCtx->subsidiaries.buf = taosMemoryMalloc(pCtx->subsidiaries.rowLen);
|
||||||
if (NULL == pCtx->subsidiaries.buf) {
|
if (NULL == pCtx->subsidiaries.buf) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -6066,7 +6066,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
|
||||||
if (NULL == pInfo->buf) {
|
if (NULL == pInfo->buf) {
|
||||||
taosHashCleanup(pInfo->pHash);
|
taosHashCleanup(pInfo->pHash);
|
||||||
pInfo->pHash = NULL;
|
pInfo->pHash = NULL;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
|
@ -947,7 +947,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc, int32_t* nElems)
|
||||||
case TSDB_DATA_TYPE_NCHAR: {
|
case TSDB_DATA_TYPE_NCHAR: {
|
||||||
pBuf->str = taosMemoryMalloc(pCol->info.bytes);
|
pBuf->str = taosMemoryMalloc(pCol->info.bytes);
|
||||||
if (pBuf->str == NULL) {
|
if (pBuf->str == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
(void)memcpy(pBuf->str, colDataGetData(pCol, i), varDataTLen(colDataGetData(pCol, i)));
|
(void)memcpy(pBuf->str, colDataGetData(pCol, i), varDataTLen(colDataGetData(pCol, i)));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,7 +37,7 @@ int32_t tHistogramCreate(int32_t numOfEntries, SHistogramInfo** pHisto) {
|
||||||
/* need one redundant slot */
|
/* need one redundant slot */
|
||||||
*pHisto = taosMemoryMalloc(sizeof(SHistogramInfo) + sizeof(SHistBin) * (numOfEntries + 1));
|
*pHisto = taosMemoryMalloc(sizeof(SHistogramInfo) + sizeof(SHistBin) * (numOfEntries + 1));
|
||||||
if (NULL == *pHisto) {
|
if (NULL == *pHisto) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(USE_ARRAYLIST)
|
#if !defined(USE_ARRAYLIST)
|
||||||
|
@ -468,7 +468,7 @@ int32_t tHistogramUniform(SHistogramInfo* pHisto, double* ratio, int32_t num, do
|
||||||
#if defined(USE_ARRAYLIST)
|
#if defined(USE_ARRAYLIST)
|
||||||
*pVal = taosMemoryMalloc(num * sizeof(double));
|
*pVal = taosMemoryMalloc(num * sizeof(double));
|
||||||
if (NULL == *pVal) {
|
if (NULL == *pVal) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
|
@ -521,7 +521,7 @@ int32_t tHistogramUniform(SHistogramInfo* pHisto, double* ratio, int32_t num, do
|
||||||
#else
|
#else
|
||||||
double* pVal = taosMemoryMalloc(num * sizeof(double));
|
double* pVal = taosMemoryMalloc(num * sizeof(double));
|
||||||
if (NULL == *pVal) {
|
if (NULL == *pVal) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
double numOfElem = ratio[i] * pHisto->numOfElems;
|
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;
|
pSlot->info.pageId = pageId;
|
||||||
if (taosArrayPush(pPageIdList, &pageId) == NULL) {
|
if (taosArrayPush(pPageIdList, &pageId) == NULL) {
|
||||||
taosArrayDestroy(pPageIdList);
|
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);
|
void *bufBegin = taosMemoryMalloc(bufLen);
|
||||||
if(bufBegin == NULL) {
|
if(bufBegin == NULL) {
|
||||||
fnError("udfc create uv task, malloc buffer failed. size: %d", bufLen);
|
fnError("udfc create uv task, malloc buffer failed. size: %d", bufLen);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
void *buf = bufBegin;
|
void *buf = bufBegin;
|
||||||
if(encodeUdfRequest(&buf, &request) <= 0)
|
if(encodeUdfRequest(&buf, &request) <= 0)
|
||||||
|
@ -1733,7 +1733,7 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
|
||||||
uv_pipe_t *pipe = taosMemoryMalloc(sizeof(uv_pipe_t));
|
uv_pipe_t *pipe = taosMemoryMalloc(sizeof(uv_pipe_t));
|
||||||
if(pipe == NULL) {
|
if(pipe == NULL) {
|
||||||
fnError("udfc event loop start connect task malloc pipe failed.");
|
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) {
|
if (uv_pipe_init(&uvTask->udfc->uvLoop, pipe, 0) != 0) {
|
||||||
fnError("udfc event loop start connect task uv_pipe_init failed.");
|
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.");
|
fnError("udfc event loop start connect task malloc connReq failed.");
|
||||||
taosMemoryFree(pipe);
|
taosMemoryFree(pipe);
|
||||||
taosMemoryFree(conn);
|
taosMemoryFree(conn);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
connReq->data = uvTask;
|
connReq->data = uvTask;
|
||||||
uv_pipe_connect(connReq, pipe, uvTask->udfc->udfdPipeName, onUdfcPipeConnect);
|
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));
|
uv_write_t *write = taosMemoryMalloc(sizeof(uv_write_t));
|
||||||
if(write == NULL) {
|
if(write == NULL) {
|
||||||
fnError("udfc event loop start req_rsp task malloc write failed.");
|
fnError("udfc event loop start req_rsp task malloc write failed.");
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
write->data = pipe->data;
|
write->data = pipe->data;
|
||||||
QUEUE *connTaskQueue = &((SClientUvConn *)pipe->data)->taskQueue;
|
QUEUE *connTaskQueue = &((SClientUvConn *)pipe->data)->taskQueue;
|
||||||
|
|
|
@ -1616,7 +1616,7 @@ int32_t udfdInitResidentFuncs() {
|
||||||
if(taosArrayPush(global.residentFuncs, func) == NULL)
|
if(taosArrayPush(global.residentFuncs, func) == NULL)
|
||||||
{
|
{
|
||||||
taosArrayDestroy(global.residentFuncs);
|
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);
|
idx->colObj = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
if (idx->colObj == NULL) {
|
if (idx->colObj == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx->version = 1;
|
idx->version = 1;
|
||||||
idx->path = taosStrdup(path);
|
idx->path = taosStrdup(path);
|
||||||
if (idx->path == NULL) {
|
if (idx->path == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexInit(&idx->mtx, NULL);
|
(void)taosThreadMutexInit(&idx->mtx, NULL);
|
||||||
|
@ -261,7 +261,7 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
||||||
|
|
||||||
SArray* iRslts = taosArrayInit(4, POINTER_BYTES);
|
SArray* iRslts = taosArrayInit(4, POINTER_BYTES);
|
||||||
if (iRslts == NULL) {
|
if (iRslts == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nQuery = taosArrayGetSize(multiQuerys->query);
|
int nQuery = taosArrayGetSize(multiQuerys->query);
|
||||||
|
@ -275,7 +275,7 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
||||||
}
|
}
|
||||||
if (taosArrayPush(iRslts, (void*)&trslt) == NULL) {
|
if (taosArrayPush(iRslts, (void*)&trslt) == NULL) {
|
||||||
idxInterRsltDestroy(iRslts);
|
idxInterRsltDestroy(iRslts);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)idxMergeFinalResults(iRslts, opera, result);
|
(void)idxMergeFinalResults(iRslts, opera, result);
|
||||||
|
@ -319,7 +319,7 @@ void indexMultiTermQueryDestroy(SIndexMultiTermQuery* pQuery) {
|
||||||
int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) {
|
int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) {
|
||||||
SIndexTermQuery q = {.qType = qType, .term = term};
|
SIndexTermQuery q = {.qType = qType, .term = term};
|
||||||
if (taosArrayPush(pQuery->query, &q) == NULL) {
|
if (taosArrayPush(pQuery->query, &q) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ SIndexMultiTerm* indexMultiTermCreate() { return taosArrayInit(4, sizeof(SIndexT
|
||||||
|
|
||||||
int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) {
|
int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) {
|
||||||
if (taosArrayPush(terms, &term) == NULL) {
|
if (taosArrayPush(terms, &term) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu
|
||||||
|
|
||||||
*result = taosArrayInit(4, sizeof(uint64_t));
|
*result = taosArrayInit(4, sizeof(uint64_t));
|
||||||
if (*result == NULL) {
|
if (*result == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
// TODO: iterator mem and tidex
|
// TODO: iterator mem and tidex
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ static int32_t idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxT
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (taosArrayPush(result, &tfv) == NULL) {
|
if (taosArrayPush(result, &tfv) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
|
@ -658,7 +658,7 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
||||||
|
|
||||||
SArray* result = taosArrayInit(1024, sizeof(void*));
|
SArray* result = taosArrayInit(1024, sizeof(void*));
|
||||||
if (result == NULL) {
|
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;
|
bool cn = cacheIter ? cacheIter->next(cacheIter) : false;
|
||||||
|
@ -666,7 +666,7 @@ int32_t idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
|
||||||
|
|
||||||
SIdxTRslt* tr = idxTRsltCreate();
|
SIdxTRslt* tr = idxTRsltCreate();
|
||||||
if (tr == NULL) {
|
if (tr == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
while (cn == true || tn == true) {
|
while (cn == true || tn == true) {
|
||||||
IterateValue* cv = (cn == true) ? cacheIter->getValue(cacheIter) : NULL;
|
IterateValue* cv = (cn == true) ? cacheIter->getValue(cacheIter) : NULL;
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
||||||
|
|
||||||
if (NULL == ctx.pRes) {
|
if (NULL == ctx.pRes) {
|
||||||
indexError("index-filter failed to taosHashInit");
|
indexError("index-filter failed to taosHashInit");
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx);
|
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);
|
ctx.pRes = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
if (NULL == ctx.pRes) {
|
if (NULL == ctx.pRes) {
|
||||||
indexError("index-filter failed to taosHashInit");
|
indexError("index-filter failed to taosHashInit");
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx);
|
nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx);
|
||||||
|
@ -1113,7 +1113,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
||||||
|
|
||||||
SArray *output = taosArrayInit(8, sizeof(uint64_t));
|
SArray *output = taosArrayInit(8, sizeof(uint64_t));
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIFParam param = {.arg = *metaArg, .result = output, .status = SFLT_NOT_INDEX, .api = *pAPI};
|
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;
|
int32_t code = 0;
|
||||||
SArray *tinsts = taosArrayInit(4, sizeof(uint32_t));
|
SArray *tinsts = taosArrayInit(4, sizeof(uint32_t));
|
||||||
if (tinsts == NULL) {
|
if (tinsts == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
}
|
}
|
||||||
bool isMatch = false;
|
bool isMatch = false;
|
||||||
|
@ -163,13 +163,13 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
||||||
continue;
|
continue;
|
||||||
} else if (inst->ty == RANGE) {
|
} else if (inst->ty == RANGE) {
|
||||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
}
|
}
|
||||||
} else if (inst->ty == MATCH) {
|
} else if (inst->ty == MATCH) {
|
||||||
isMatch = true;
|
isMatch = true;
|
||||||
if (taosArrayPush(tinsts, &ip) == NULL) {
|
if (taosArrayPush(tinsts, &ip) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
||||||
} else {
|
} else {
|
||||||
DfaState st = {.insts = tinsts, .isMatch = isMatch};
|
DfaState st = {.insts = tinsts, .isMatch = isMatch};
|
||||||
if (taosArrayPush(builder->dfa->states, &st) == NULL) {
|
if (taosArrayPush(builder->dfa->states, &st) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,14 +76,14 @@ int32_t fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
||||||
size_t sz = taosArrayGetSize(src->trans);
|
size_t sz = taosArrayGetSize(src->trans);
|
||||||
dst->trans = taosArrayInit(sz, sizeof(FstTransition));
|
dst->trans = taosArrayInit(sz, sizeof(FstTransition));
|
||||||
if (dst->trans == NULL) {
|
if (dst->trans == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < sz; i++) {
|
for (size_t i = 0; i < sz; i++) {
|
||||||
FstTransition* trn = taosArrayGet(src->trans, i);
|
FstTransition* trn = taosArrayGet(src->trans, i);
|
||||||
if (taosArrayPush(dst->trans, trn) == NULL) {
|
if (taosArrayPush(dst->trans, trn) == NULL) {
|
||||||
taosArrayDestroy(dst->trans);
|
taosArrayDestroy(dst->trans);
|
||||||
dst->trans = NULL;
|
dst->trans = NULL;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -280,7 +280,7 @@ static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
||||||
|
|
||||||
SArray* offsets = taosArrayInit(16, sizeof(uint64_t));
|
SArray* offsets = taosArrayInit(16, sizeof(uint64_t));
|
||||||
if (offsets == NULL) {
|
if (offsets == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAutoCtx* ctx = automCtxCreate((void*)p, AUTOMATION_PREFIX);
|
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);
|
char* t = (char*)taosMemoryRealloc(buf, cap);
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
buf = t;
|
buf = t;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ int32_t tfileValuePush(TFileValue* tf, uint64_t val) {
|
||||||
return TSDB_CODE_INVALID_PARA;
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(tf->tableId, &val) == NULL) {
|
if (taosArrayPush(tf->tableId, &val) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1052,7 @@ static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArr
|
||||||
int32_t left = block + sizeof(block) - p;
|
int32_t left = block + sizeof(block) - p;
|
||||||
if (left >= sizeof(uint64_t)) {
|
if (left >= sizeof(uint64_t)) {
|
||||||
if (taosArrayPush(result, (uint64_t*)p) == NULL) {
|
if (taosArrayPush(result, (uint64_t*)p) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
p += sizeof(uint64_t);
|
p += sizeof(uint64_t);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1065,7 +1065,7 @@ static int32_t tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArr
|
||||||
memcpy(buf + left, block, sizeof(uint64_t) - left);
|
memcpy(buf + left, block, sizeof(uint64_t) - left);
|
||||||
|
|
||||||
if (taosArrayPush(result, (uint64_t*)buf) == NULL) {
|
if (taosArrayPush(result, (uint64_t*)buf) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
p = block + sizeof(uint64_t) - left;
|
p = block + sizeof(uint64_t) - left;
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
||||||
int64_t version;
|
int64_t version;
|
||||||
SArray* files = taosArrayInit(4, sizeof(void*));
|
SArray* files = taosArrayInit(4, sizeof(void*));
|
||||||
if (files == NULL) {
|
if (files == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
TdDirPtr pDir = taosOpenDir(path);
|
TdDirPtr pDir = taosOpenDir(path);
|
||||||
|
@ -1140,7 +1140,7 @@ static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
||||||
|
|
||||||
sprintf(buf, "%s/%s", path, file);
|
sprintf(buf, "%s/%s", path, file);
|
||||||
if (taosArrayPush(files, &buf) == NULL) {
|
if (taosArrayPush(files, &buf) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)taosCloseDir(&pDir);
|
(void)taosCloseDir(&pDir);
|
||||||
|
|
|
@ -69,7 +69,7 @@ int32_t iIntersection(SArray *in, SArray *out) {
|
||||||
}
|
}
|
||||||
if (has == true) {
|
if (has == true) {
|
||||||
if (taosArrayPush(out, &tgt) == NULL) {
|
if (taosArrayPush(out, &tgt) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ int32_t iUnion(SArray *in, SArray *out) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (taosArrayPush(out, &mVal) == NULL) {
|
if (taosArrayPush(out, &mVal) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -220,17 +220,17 @@ int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) {
|
||||||
} else {
|
} else {
|
||||||
SArray *arrs = taosArrayInit(2, sizeof(void *));
|
SArray *arrs = taosArrayInit(2, sizeof(void *));
|
||||||
if (arrs == NULL) {
|
if (arrs == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosArrayPush(arrs, &tr->total) == NULL) {
|
if (taosArrayPush(arrs, &tr->total) == NULL) {
|
||||||
taosArrayDestroy(arrs);
|
taosArrayDestroy(arrs);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosArrayPush(arrs, &tr->add) == NULL) {
|
if (taosArrayPush(arrs, &tr->add) == NULL) {
|
||||||
taosArrayDestroy(arrs);
|
taosArrayDestroy(arrs);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
code = iUnion(arrs, result);
|
code = iUnion(arrs, result);
|
||||||
taosArrayDestroy(arrs);
|
taosArrayDestroy(arrs);
|
||||||
|
|
|
@ -118,7 +118,7 @@ void monSetBmInfo(SMonBmInfo *pInfo) {
|
||||||
int32_t monInit(const SMonCfg *pCfg) {
|
int32_t monInit(const SMonCfg *pCfg) {
|
||||||
tsMonitor.logs = taosArrayInit(16, sizeof(SMonLogItem));
|
tsMonitor.logs = taosArrayInit(16, sizeof(SMonLogItem));
|
||||||
if (tsMonitor.logs == NULL) {
|
if (tsMonitor.logs == NULL) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
tsMonitor.cfg = *pCfg;
|
tsMonitor.cfg = *pCfg;
|
||||||
|
|
|
@ -440,7 +440,7 @@ static int32_t nodeListToJson(SJson* pJson, const char* pName, const SNodeList*
|
||||||
if (LIST_LENGTH(pList) > 0) {
|
if (LIST_LENGTH(pList) > 0) {
|
||||||
SJson* jList = tjsonAddArrayToObject(pJson, pName);
|
SJson* jList = tjsonAddArrayToObject(pJson, pName);
|
||||||
if (NULL == jList) {
|
if (NULL == jList) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
SNode* pNode;
|
SNode* pNode;
|
||||||
FOREACH(pNode, pList) {
|
FOREACH(pNode, pList) {
|
||||||
|
@ -8244,8 +8244,7 @@ int32_t nodesNodeToString(const SNode* pNode, bool format, char** pStr, int32_t*
|
||||||
|
|
||||||
SJson* pJson = tjsonCreateObject();
|
SJson* pJson = tjsonCreateObject();
|
||||||
if (NULL == pJson) {
|
if (NULL == pJson) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = nodeToJson(pNode, pJson);
|
int32_t code = nodeToJson(pNode, pJson);
|
||||||
|
@ -8295,8 +8294,7 @@ int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int3
|
||||||
|
|
||||||
SJson* pJson = tjsonCreateArray();
|
SJson* pJson = tjsonCreateArray();
|
||||||
if (NULL == pJson) {
|
if (NULL == pJson) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* pNode;
|
SNode* pNode;
|
||||||
|
|
|
@ -79,7 +79,7 @@ static int32_t initTlvEncoder(STlvEncoder* pEncoder) {
|
||||||
pEncoder->offset = 0;
|
pEncoder->offset = 0;
|
||||||
pEncoder->tlvCount = 0;
|
pEncoder->tlvCount = 0;
|
||||||
pEncoder->pBuf = taosMemoryMalloc(pEncoder->allocSize);
|
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); }
|
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);
|
pEncoder->allocSize = TMAX(pEncoder->allocSize * 2, pEncoder->allocSize + tlvLen);
|
||||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
||||||
if (NULL == pNewBuf) {
|
if (NULL == pNewBuf) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pEncoder->pBuf = pNewBuf;
|
pEncoder->pBuf = pNewBuf;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ static int32_t tlvEncodeValueImpl(STlvEncoder* pEncoder, const void* pValue, int
|
||||||
if (pEncoder->offset + len > pEncoder->allocSize) {
|
if (pEncoder->offset + len > pEncoder->allocSize) {
|
||||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize * 2);
|
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize * 2);
|
||||||
if (NULL == pNewBuf) {
|
if (NULL == pNewBuf) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pEncoder->pBuf = pNewBuf;
|
pEncoder->pBuf = pNewBuf;
|
||||||
pEncoder->allocSize = pEncoder->allocSize * 2;
|
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));
|
pEncoder->allocSize = TMAX(pEncoder->allocSize * 2, pEncoder->allocSize + sizeof(STlv));
|
||||||
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
void* pNewBuf = taosMemoryRealloc(pEncoder->pBuf, pEncoder->allocSize);
|
||||||
if (NULL == pNewBuf) {
|
if (NULL == pNewBuf) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pEncoder->pBuf = pNewBuf;
|
pEncoder->pBuf = pNewBuf;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ static int32_t tlvDecodeCStrP(STlv* pTlv, char** pValue) {
|
||||||
static int32_t tlvDecodeDynBinary(STlv* pTlv, void** pValue) {
|
static int32_t tlvDecodeDynBinary(STlv* pTlv, void** pValue) {
|
||||||
*pValue = taosMemoryMalloc(pTlv->len);
|
*pValue = taosMemoryMalloc(pTlv->len);
|
||||||
if (NULL == *pValue) {
|
if (NULL == *pValue) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(*pValue, pTlv->value, pTlv->len);
|
memcpy(*pValue, pTlv->value, pTlv->len);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -4841,7 +4841,7 @@ static int32_t msgToSArray(STlv* pTlv, void** pObj){
|
||||||
}
|
}
|
||||||
pArray = taosArrayInit(capacity, elemSize);
|
pArray = taosArrayInit(capacity, elemSize);
|
||||||
if (NULL == pArray) {
|
if (NULL == pArray) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pArray->size = actualSize;
|
pArray->size = actualSize;
|
||||||
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
||||||
|
@ -4859,7 +4859,7 @@ static int32_t msgToSArray(STlv* pTlv, void** pObj){
|
||||||
if (pDataTlv != NULL) {
|
if (pDataTlv != NULL) {
|
||||||
pArray = taosArrayInit(capacity, elemSize);
|
pArray = taosArrayInit(capacity, elemSize);
|
||||||
if (NULL == pArray) {
|
if (NULL == pArray) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
pArray->size = actualSize;
|
pArray->size = actualSize;
|
||||||
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
if (TSDB_CODE_SUCCESS != code || pTlvTemp == NULL) {
|
||||||
|
|
|
@ -2765,7 +2765,7 @@ int32_t nodesMakeValueNodeFromString(char* literal, SValueNode** ppValNode) {
|
||||||
pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE;
|
pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE;
|
||||||
char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE);
|
char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
varDataSetLen(p, lenStr);
|
varDataSetLen(p, lenStr);
|
||||||
memcpy(varDataVal(p), literal, lenStr + 1);
|
memcpy(varDataVal(p), literal, lenStr + 1);
|
||||||
|
|
|
@ -932,7 +932,7 @@ SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pL
|
||||||
SValueNode* pVal = (SValueNode*)pLeft;
|
SValueNode* pVal = (SValueNode*)pLeft;
|
||||||
char* pNewLiteral = taosMemoryCalloc(1, strlen(pVal->literal) + 2);
|
char* pNewLiteral = taosMemoryCalloc(1, strlen(pVal->literal) + 2);
|
||||||
if (!pNewLiteral) {
|
if (!pNewLiteral) {
|
||||||
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
|
pCxt->errCode = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
if ('+' == pVal->literal[0]) {
|
if ('+' == pVal->literal[0]) {
|
||||||
|
|
|
@ -210,7 +210,7 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
|
||||||
if (NULL != ((SExprNode*)pProject)->pAssociation) {
|
if (NULL != ((SExprNode*)pProject)->pAssociation) {
|
||||||
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL);
|
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL);
|
||||||
if (NULL == pAssociation) {
|
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) {
|
SMsgBuf* msg) {
|
||||||
SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal));
|
SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal));
|
||||||
if (!pTagArray) {
|
if (!pTagArray) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
*tagName = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
*tagName = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||||
if (!*tagName) {
|
if (!*tagName) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
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){
|
if (taosArrayPush(*tagName, pTagSchema->name) == NULL){
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
uError("SML smlBuildTagRow error push tag name");
|
uError("SML smlBuildTagRow error push tag name");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
||||||
(void)memcpy(&val.i64, &(kv->value), kv->length);
|
(void)memcpy(&val.i64, &(kv->value), kv->length);
|
||||||
}
|
}
|
||||||
if (taosArrayPush(pTagArray, &val) == NULL){
|
if (taosArrayPush(pTagArray, &val) == NULL){
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
uError("SML smlBuildTagRow error push tag array");
|
uError("SML smlBuildTagRow error push tag array");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ void clearColValArraySml(SArray* pCols) {
|
||||||
int32_t smlBuildRow(STableDataCxt* pTableCxt) {
|
int32_t smlBuildRow(STableDataCxt* pTableCxt) {
|
||||||
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
||||||
if (pRow == NULL){
|
if (pRow == NULL){
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
||||||
if (TSDB_CODE_SUCCESS != ret) {
|
if (TSDB_CODE_SUCCESS != ret) {
|
||||||
|
@ -423,7 +423,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
pVal->value.nData = kv->length;
|
pVal->value.nData = kv->length;
|
||||||
pVal->value.pData = taosMemoryMalloc(kv->length);
|
pVal->value.pData = taosMemoryMalloc(kv->length);
|
||||||
if (NULL == pVal->value.pData) {
|
if (NULL == pVal->value.pData) {
|
||||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
ret = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
(void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
(void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
||||||
|
@ -435,7 +435,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
|
|
||||||
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1);
|
||||||
if (NULL == pRow) {
|
if (NULL == pRow) {
|
||||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
ret = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow);
|
||||||
|
@ -480,7 +480,7 @@ int32_t smlInitHandle(SQuery** query) {
|
||||||
uError("create pTableBlockHashObj error");
|
uError("create pTableBlockHashObj error");
|
||||||
qDestroyQuery(pQuery);
|
qDestroyQuery(pQuery);
|
||||||
nodesDestroyNode((SNode*)stmt);
|
nodesDestroyNode((SNode*)stmt);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
stmt->freeHashFunc = insDestroyTableDataCxtHashMap;
|
stmt->freeHashFunc = insDestroyTableDataCxtHashMap;
|
||||||
stmt->freeArrayFunc = insDestroyVgroupDataCxtList;
|
stmt->freeArrayFunc = insDestroyVgroupDataCxtList;
|
||||||
|
|
|
@ -662,7 +662,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
|
||||||
} else {
|
} else {
|
||||||
val->pData = taosMemoryMalloc(size);
|
val->pData = taosMemoryMalloc(size);
|
||||||
if (NULL == val->pData) {
|
if (NULL == val->pData) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
memcpy(val->pData, output, size);
|
memcpy(val->pData, output, size);
|
||||||
val->nData = size;
|
val->nData = size;
|
||||||
|
@ -679,7 +679,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;
|
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||||
void* p = taosMemoryMalloc(realLen);
|
void* p = taosMemoryMalloc(realLen);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), realLen, &output)) {
|
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)(p), realLen, &output)) {
|
||||||
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
if (terrno == TAOS_SYSTEM_ERROR(E2BIG)) {
|
||||||
|
@ -732,7 +732,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS
|
||||||
bool isNull = isNullValue(pTagSchema->type, pToken);
|
bool isNull = isNullValue(pTagSchema->type, pToken);
|
||||||
if (!isNull && pTagName) {
|
if (!isNull && pTagName) {
|
||||||
if (NULL == taosArrayPush(pTagName, pTagSchema->name)) {
|
if (NULL == taosArrayPush(pTagName, pTagSchema->name)) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ int32_t parseTagValue(SMsgBuf* pMsgBuf, const char** pSql, uint8_t precision, SS
|
||||||
int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf);
|
int32_t code = parseTagToken(pSql, pToken, pTagSchema, precision, &val, pMsgBuf);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (NULL == taosArrayPush(pTagVals, &val)){
|
if (NULL == taosArrayPush(pTagVals, &val)){
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -943,7 +943,7 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt
|
||||||
|
|
||||||
if (!(pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal))) ||
|
if (!(pTagVals = taosArrayInit(pCxt->tags.numOfBound, sizeof(STagVal))) ||
|
||||||
!(pTagName = taosArrayInit(pCxt->tags.numOfBound, TSDB_COL_NAME_LEN))) {
|
!(pTagName = taosArrayInit(pCxt->tags.numOfBound, TSDB_COL_NAME_LEN))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,7 +1422,7 @@ int32_t initTableColSubmitData(STableDataCxt* pTableCxt) {
|
||||||
SSchema* pSchema = &pTableCxt->pMeta->schema[pTableCxt->boundColsInfo.pColIndex[i]];
|
SSchema* pSchema = &pTableCxt->pMeta->schema[pTableCxt->boundColsInfo.pColIndex[i]];
|
||||||
SColData* pCol = taosArrayReserve(pTableCxt->pData->aCol, 1);
|
SColData* pCol = taosArrayReserve(pTableCxt->pData->aCol, 1);
|
||||||
if (NULL == pCol) {
|
if (NULL == pCol) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
tColDataInit(pCol, pSchema->colId, pSchema->type, pSchema->flags);
|
tColDataInit(pCol, pSchema->colId, pSchema->type, pSchema->flags);
|
||||||
}
|
}
|
||||||
|
@ -1592,7 +1592,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
||||||
}
|
}
|
||||||
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
||||||
if (NULL == pVal->value.pData) {
|
if (NULL == pVal->value.pData) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
||||||
pVal->value.nData = pToken->n;
|
pVal->value.nData = pToken->n;
|
||||||
|
@ -1612,7 +1612,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
||||||
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
if (realLen > pSchema->bytes - VARSTR_HEADER_SIZE) realLen = pSchema->bytes - VARSTR_HEADER_SIZE;
|
||||||
char* pUcs4 = taosMemoryMalloc(realLen);
|
char* pUcs4 = taosMemoryMalloc(realLen);
|
||||||
if (NULL == pUcs4) {
|
if (NULL == pUcs4) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) {
|
if (!taosMbsToUcs4(pToken->z, pToken->n, (TdUcs4*)pUcs4, realLen, &len)) {
|
||||||
taosMemoryFree(pUcs4);
|
taosMemoryFree(pUcs4);
|
||||||
|
@ -1633,7 +1633,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
||||||
}
|
}
|
||||||
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
pVal->value.pData = taosMemoryMalloc(pToken->n);
|
||||||
if (NULL == pVal->value.pData) {
|
if (NULL == pVal->value.pData) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
memcpy(pVal->value.pData, pToken->z, pToken->n);
|
||||||
pVal->value.nData = pToken->n;
|
pVal->value.nData = pToken->n;
|
||||||
|
@ -1654,7 +1654,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql,
|
||||||
} else {
|
} else {
|
||||||
pVal->value.pData = taosMemoryMalloc(size);
|
pVal->value.pData = taosMemoryMalloc(size);
|
||||||
if (NULL == pVal->value.pData) {
|
if (NULL == pVal->value.pData) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pVal->value.pData, output, size);
|
memcpy(pVal->value.pData, output, size);
|
||||||
pVal->value.nData = size;
|
pVal->value.nData = size;
|
||||||
|
@ -2215,7 +2215,7 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt
|
||||||
if (NULL == pStmt->pTableCxtHashObj) {
|
if (NULL == pStmt->pTableCxtHashObj) {
|
||||||
pStmt->pTableCxtHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
pStmt->pTableCxtHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
|
||||||
if (!pStmt->pTableCxtHashObj) {
|
if (!pStmt->pTableCxtHashObj) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
|
@ -2348,20 +2348,20 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa
|
||||||
|
|
||||||
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
pStbRowsCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN);
|
||||||
if (!pStbRowsCxt->aTagNames) {
|
if (!pStbRowsCxt->aTagNames) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
pStbRowsCxt->aTagVals = taosArrayInit(8, sizeof(STagVal));
|
||||||
if (!pStbRowsCxt->aTagVals) {
|
if (!pStbRowsCxt->aTagVals) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
// col values and bound cols info of STableDataContext is not used
|
// col values and bound cols info of STableDataContext is not used
|
||||||
pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal));
|
pStbRowsCxt->aColVals = taosArrayInit(getNumOfColumns(pStbRowsCxt->pStbMeta), sizeof(SColVal));
|
||||||
if (!pStbRowsCxt->aColVals)
|
if (!pStbRowsCxt->aColVals)
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
code = insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
||||||
|
@ -2536,7 +2536,7 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif
|
||||||
static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) {
|
||||||
SBoundColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
|
SBoundColInfo* tags = taosMemoryMalloc(sizeof(pCxt->tags));
|
||||||
if (NULL == tags) {
|
if (NULL == tags) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
|
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
|
||||||
|
|
||||||
|
@ -2723,13 +2723,13 @@ static int32_t addTableVgroupFromMetaData(const SArray* pTables, SVnodeModifyOpS
|
||||||
static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) {
|
static int32_t buildTagNameFromMeta(STableMeta* pMeta, SArray** pTagName) {
|
||||||
*pTagName = taosArrayInit(pMeta->tableInfo.numOfTags, TSDB_COL_NAME_LEN);
|
*pTagName = taosArrayInit(pMeta->tableInfo.numOfTags, TSDB_COL_NAME_LEN);
|
||||||
if (NULL == *pTagName) {
|
if (NULL == *pTagName) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
SSchema* pSchema = getTableTagSchema(pMeta);
|
SSchema* pSchema = getTableTagSchema(pMeta);
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) {
|
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) {
|
||||||
if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) {
|
if (NULL == taosArrayPush(*pTagName, pSchema[i].name)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosArrayDestroy(*pTagName);
|
taosArrayDestroy(*pTagName);
|
||||||
*pTagName = NULL;
|
*pTagName = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -2869,12 +2869,12 @@ static int32_t setRefreshMeta(SQuery* pQuery) {
|
||||||
taosArrayDestroy(pQuery->pTableList);
|
taosArrayDestroy(pQuery->pTableList);
|
||||||
pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName));
|
pQuery->pTableList = taosArrayInit(taosHashGetSize(pStmt->pTableNameHashObj), sizeof(SName));
|
||||||
if (!pQuery->pTableList) {
|
if (!pQuery->pTableList) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL);
|
SName* pTable = taosHashIterate(pStmt->pTableNameHashObj, NULL);
|
||||||
while (NULL != pTable) {
|
while (NULL != pTable) {
|
||||||
if (NULL == taosArrayPush(pQuery->pTableList, pTable)) {
|
if (NULL == taosArrayPush(pQuery->pTableList, pTable)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosHashCancelIterate(pStmt->pTableNameHashObj, pTable);
|
taosHashCancelIterate(pStmt->pTableNameHashObj, pTable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2887,12 +2887,12 @@ static int32_t setRefreshMeta(SQuery* pQuery) {
|
||||||
taosArrayDestroy(pQuery->pDbList);
|
taosArrayDestroy(pQuery->pDbList);
|
||||||
pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN);
|
pQuery->pDbList = taosArrayInit(taosHashGetSize(pStmt->pDbFNameHashObj), TSDB_DB_FNAME_LEN);
|
||||||
if (!pQuery->pDbList) {
|
if (!pQuery->pDbList) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL);
|
char* pDb = taosHashIterate(pStmt->pDbFNameHashObj, NULL);
|
||||||
while (NULL != pDb) {
|
while (NULL != pDb) {
|
||||||
if (NULL == taosArrayPush(pQuery->pDbList, pDb)) {
|
if (NULL == taosArrayPush(pQuery->pDbList, pDb)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosHashCancelIterate(pStmt->pDbFNameHashObj, pDb);
|
taosHashCancelIterate(pStmt->pDbFNameHashObj, pDb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2967,13 +2967,13 @@ static int32_t parseInsertSqlImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
||||||
static int32_t buildInsertTableReq(SName* pName, SArray** pTables) {
|
static int32_t buildInsertTableReq(SName* pName, SArray** pTables) {
|
||||||
*pTables = taosArrayInit(1, sizeof(SName));
|
*pTables = taosArrayInit(1, sizeof(SName));
|
||||||
if (NULL == *pTables) {
|
if (NULL == *pTables) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(*pTables, pName)) {
|
if (NULL == taosArrayPush(*pTables, pName)) {
|
||||||
taosArrayDestroy(*pTables);
|
taosArrayDestroy(*pTables);
|
||||||
*pTables = NULL;
|
*pTables = NULL;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2982,7 +2982,7 @@ static int32_t buildInsertDbReq(SName* pName, SArray** pDbs) {
|
||||||
if (NULL == *pDbs) {
|
if (NULL == *pDbs) {
|
||||||
*pDbs = taosArrayInit(1, sizeof(STablesReq));
|
*pDbs = taosArrayInit(1, sizeof(STablesReq));
|
||||||
if (NULL == *pDbs) {
|
if (NULL == *pDbs) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2999,7 +2999,7 @@ static int32_t buildInsertDbReq(SName* pName, SArray** pDbs) {
|
||||||
static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** pUserAuth) {
|
static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** pUserAuth) {
|
||||||
*pUserAuth = taosArrayInit(1, sizeof(SUserAuthInfo));
|
*pUserAuth = taosArrayInit(1, sizeof(SUserAuthInfo));
|
||||||
if (NULL == *pUserAuth) {
|
if (NULL == *pUserAuth) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
|
SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE};
|
||||||
|
@ -3008,7 +3008,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray**
|
||||||
if (NULL == taosArrayPush(*pUserAuth, &userAuth)) {
|
if (NULL == taosArrayPush(*pUserAuth, &userAuth)) {
|
||||||
taosArrayDestroy(*pUserAuth);
|
taosArrayDestroy(*pUserAuth);
|
||||||
*pUserAuth = NULL;
|
*pUserAuth = NULL;
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
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)) {
|
if (NULL == taosArrayPush(tagName, pTagSchema->name)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
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;
|
isJson = true;
|
||||||
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
memcpy(tmp, bind[c].buffer, colLen);
|
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);
|
memcpy(&val.i64, bind[c].buffer, colLen);
|
||||||
}
|
}
|
||||||
if (NULL == taosArrayPush(pTagArray, &val)) {
|
if (NULL == taosArrayPush(pTagArray, &val)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ int32_t convertStmtNcharCol(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_MULTI_BIND*
|
||||||
if (dst->buffer_length < newBuflen) {
|
if (dst->buffer_length < newBuflen) {
|
||||||
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
||||||
if (NULL == dst->buffer) {
|
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);
|
dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num);
|
||||||
if (NULL == dst->length) {
|
if (NULL == dst->length) {
|
||||||
taosMemoryFreeClear(dst->buffer);
|
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)) {
|
if (NULL == taosArrayPush(tagName, pTagSchema->name)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (pTagSchema->type == TSDB_DATA_TYPE_JSON) {
|
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;
|
isJson = true;
|
||||||
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
char* tmp = taosMemoryCalloc(1, colLen + 1);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
memcpy(tmp, bind[c].buffer, colLen);
|
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);
|
memcpy(&val.i64, bind[c].buffer, colLen);
|
||||||
}
|
}
|
||||||
if (NULL == taosArrayPush(pTagArray, &val)) {
|
if (NULL == taosArrayPush(pTagArray, &val)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -690,12 +690,12 @@ int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bin
|
||||||
if (!ncharBinds) {
|
if (!ncharBinds) {
|
||||||
ncharBinds = taosArrayInit(1, sizeof(ncharBind));
|
ncharBinds = taosArrayInit(1, sizeof(ncharBind));
|
||||||
if (!ncharBinds) {
|
if (!ncharBinds) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(ncharBinds, &ncharBind)) {
|
if (!taosArrayPush(ncharBinds, &ncharBind)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
pBindInfos[c].bind = taosArrayGetLast(ncharBinds);
|
pBindInfos[c].bind = taosArrayGetLast(ncharBinds);
|
||||||
|
@ -733,7 +733,7 @@ static int32_t convertStmtNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_STM
|
||||||
// if (dst->buffer_length < newBuflen) {
|
// if (dst->buffer_length < newBuflen) {
|
||||||
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
dst->buffer = taosMemoryRealloc(dst->buffer, newBuflen);
|
||||||
if (NULL == dst->buffer) {
|
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);
|
dst->length = taosMemoryRealloc(dst->length, sizeof(int32_t) * src->num);
|
||||||
if (NULL == dst->length) {
|
if (NULL == dst->length) {
|
||||||
taosMemoryFreeClear(dst->buffer);
|
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));
|
void* pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pCxt->pMeta));
|
||||||
if (NULL == pNewMeta) {
|
if (NULL == pNewMeta) {
|
||||||
insDestroyTableDataCxt(*pDst);
|
insDestroyTableDataCxt(*pDst);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pNewMeta, pCxt->pMeta, TABLE_META_SIZE(pCxt->pMeta));
|
memcpy(pNewMeta, pCxt->pMeta, TABLE_META_SIZE(pCxt->pMeta));
|
||||||
pNewCxt->pMeta = pNewMeta;
|
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));
|
void* pNewColIdx = taosMemoryMalloc(pCxt->boundColsInfo.numOfBound * sizeof(*pCxt->boundColsInfo.pColIndex));
|
||||||
if (NULL == pNewColIdx) {
|
if (NULL == pNewColIdx) {
|
||||||
insDestroyTableDataCxt(*pDst);
|
insDestroyTableDataCxt(*pDst);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pNewColIdx, pCxt->boundColsInfo.pColIndex,
|
memcpy(pNewColIdx, pCxt->boundColsInfo.pColIndex,
|
||||||
pCxt->boundColsInfo.numOfBound * sizeof(*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));
|
SSubmitTbData* pNewTb = (SSubmitTbData*)taosMemoryMalloc(sizeof(SSubmitTbData));
|
||||||
if (NULL == pNewTb) {
|
if (NULL == pNewTb) {
|
||||||
insDestroyTableDataCxt(*pDst);
|
insDestroyTableDataCxt(*pDst);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pNewTb, pCxt->pData, sizeof(*pCxt->pData));
|
memcpy(pNewTb, pCxt->pData, sizeof(*pCxt->pData));
|
||||||
|
|
|
@ -173,7 +173,7 @@ static int32_t initColValues(STableMeta* pTableMeta, SArray* pValues) {
|
||||||
for (int32_t i = 0; i < pTableMeta->tableInfo.numOfColumns; ++i) {
|
for (int32_t i = 0; i < pTableMeta->tableInfo.numOfColumns; ++i) {
|
||||||
SColVal val = COL_VAL_NONE(pSchemas[i].colId, pSchemas[i].type);
|
SColVal val = COL_VAL_NONE(pSchemas[i].colId, pSchemas[i].type);
|
||||||
if (NULL == taosArrayPush(pValues, &val)) {
|
if (NULL == taosArrayPush(pValues, &val)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
||||||
if (TSDB_CODE_SUCCESS == code && !ignoreColVals) {
|
if (TSDB_CODE_SUCCESS == code && !ignoreColVals) {
|
||||||
pTableCxt->pValues = taosArrayInit(pTableMeta->tableInfo.numOfColumns, sizeof(SColVal));
|
pTableCxt->pValues = taosArrayInit(pTableMeta->tableInfo.numOfColumns, sizeof(SColVal));
|
||||||
if (NULL == pTableCxt->pValues) {
|
if (NULL == pTableCxt->pValues) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
code = initColValues(pTableMeta, pTableCxt->pValues);
|
code = initColValues(pTableMeta, pTableCxt->pValues);
|
||||||
}
|
}
|
||||||
|
@ -276,12 +276,12 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
||||||
if (pTableCxt->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
if (pTableCxt->pData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
pTableCxt->pData->aCol = taosArrayInit(128, sizeof(SColData));
|
pTableCxt->pData->aCol = taosArrayInit(128, sizeof(SColData));
|
||||||
if (NULL == pTableCxt->pData->aCol) {
|
if (NULL == pTableCxt->pData->aCol) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pTableCxt->pData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
pTableCxt->pData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||||
if (NULL == pTableCxt->pData->aRowP) {
|
if (NULL == pTableCxt->pData->aRowP) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,13 +318,13 @@ static int32_t rebuildTableData(SSubmitTbData* pSrc, SSubmitTbData** pDst) {
|
||||||
if (pTmp->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
if (pTmp->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
pTmp->aCol = taosArrayInit(128, sizeof(SColData));
|
pTmp->aCol = taosArrayInit(128, sizeof(SColData));
|
||||||
if (NULL == pTmp->aCol) {
|
if (NULL == pTmp->aCol) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosMemoryFree(pTmp);
|
taosMemoryFree(pTmp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pTmp->aRowP = taosArrayInit(128, POINTER_BYTES);
|
pTmp->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||||
if (NULL == pTmp->aRowP) {
|
if (NULL == pTmp->aRowP) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
taosMemoryFree(pTmp);
|
taosMemoryFree(pTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -453,13 +453,13 @@ static int32_t fillVgroupDataCxt(STableDataCxt* pTableCxt, SVgroupDataCxt* pVgCx
|
||||||
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
||||||
pVgCxt->pData->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
pVgCxt->pData->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
||||||
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
if (NULL == pVgCxt->pData->aSubmitTbData) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// push data to submit, rebuild empty data for next submit
|
// push data to submit, rebuild empty data for next submit
|
||||||
if (NULL == taosArrayPush(pVgCxt->pData->aSubmitTbData, pTableCxt->pData)) {
|
if (NULL == taosArrayPush(pVgCxt->pData->aSubmitTbData, pTableCxt->pData)) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
if (isRebuild) {
|
if (isRebuild) {
|
||||||
|
@ -489,7 +489,7 @@ static int32_t createVgroupDataCxt(STableDataCxt* pTableCxt, SHashObj* pVgroupHa
|
||||||
int32_t code = taosHashPut(pVgroupHash, &pVgCxt->vgId, sizeof(pVgCxt->vgId), &pVgCxt, POINTER_BYTES);
|
int32_t code = taosHashPut(pVgroupHash, &pVgCxt->vgId, sizeof(pVgCxt->vgId), &pVgCxt, POINTER_BYTES);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (NULL == taosArrayPush(pVgroupList, &pVgCxt)) {
|
if (NULL == taosArrayPush(pVgroupList, &pVgCxt)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
insDestroyVgroupDataCxt(pVgCxt);
|
insDestroyVgroupDataCxt(pVgCxt);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks, bool
|
||||||
if (NULL == pVgroupHash || NULL == pVgroupList) {
|
if (NULL == pVgroupHash || NULL == pVgroupList) {
|
||||||
taosHashCleanup(pVgroupHash);
|
taosHashCleanup(pVgroupHash);
|
||||||
taosArrayDestroy(pVgroupList);
|
taosArrayDestroy(pVgroupList);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
@ -800,7 +800,7 @@ static int32_t buildSubmitReq(int32_t vgId, SSubmitReq2* pReq, void** pData, uin
|
||||||
len += sizeof(SSubmitReq2Msg);
|
len += sizeof(SSubmitReq2Msg);
|
||||||
pBuf = taosMemoryMalloc(len);
|
pBuf = taosMemoryMalloc(len);
|
||||||
if (NULL == pBuf) {
|
if (NULL == pBuf) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
((SSubmitReq2Msg*)pBuf)->header.vgId = htonl(vgId);
|
((SSubmitReq2Msg*)pBuf)->header.vgId = htonl(vgId);
|
||||||
((SSubmitReq2Msg*)pBuf)->header.contLen = htonl(len);
|
((SSubmitReq2Msg*)pBuf)->header.contLen = htonl(len);
|
||||||
|
|
Loading…
Reference in New Issue