Merge branch '3.0' into fix/TS-5392-3.0
This commit is contained in:
commit
2a14189624
|
@ -4,7 +4,7 @@ sidebar_label: Taos-Explorer
|
|||
description: User guide about taosExplorer
|
||||
---
|
||||
|
||||
taos-explorer is a web service which provides GUI based interactive database management tool.
|
||||
taos-explorer is a web service which provides GUI based interactive database management tool. To ensure the best experience when accessing taosExplorer, please use Chrome version 79 or higher, Edge version 79 or higher.
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ sidebar_label: taosExplorer
|
|||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
taosExplorer 是一个为用户提供 TDengine 实例的可视化管理交互工具的 web 服务。本节主要讲述其安装和部署。它的各项功能都是基于简单易上手的图形界面,可以直接尝试,如果有需要也可以考高级功能和运维指南中的相关内容。
|
||||
taosExplorer 是一个为用户提供 TDengine 实例的可视化管理交互工具的 web 服务。本节主要讲述其安装和部署。它的各项功能都是基于简单易上手的图形界面,可以直接尝试,如果有需要也可以考高级功能和运维指南中的相关内容。为了确保访问 taosExplorer 的最佳体验,请使用 Chrome 79 及以上版本,或 Edge 79 及以上版本。
|
||||
|
||||
## 安装
|
||||
|
||||
|
|
|
@ -233,6 +233,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
|||
* @brief find how many rows already in order start from first row
|
||||
*/
|
||||
int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo);
|
||||
void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk);
|
||||
|
||||
int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows, bool clearPayload);
|
||||
int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
|
||||
|
|
|
@ -74,26 +74,26 @@ int32_t tGetMachineId(char **result);
|
|||
#ifdef TD_ENTERPRISE
|
||||
#define GRANTS_SCHEMA \
|
||||
static const SSysDbTableSchema grantsSchema[] = { \
|
||||
{.name = "version", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "version", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "state", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "cpu_cores", .bytes = 13 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "timeseries", .bytes = 43 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "dnodes", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "cpu_cores", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
}
|
||||
#else
|
||||
#define GRANTS_SCHEMA \
|
||||
static const SSysDbTableSchema grantsSchema[] = { \
|
||||
{.name = "version", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "version", .bytes = 64 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "state", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "cpu_cores", .bytes = 13 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "timeseries", .bytes = 43 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "dnodes", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
{.name = "cpu_cores", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, \
|
||||
}
|
||||
#endif
|
||||
// #define GRANT_CFG_ADD
|
||||
|
|
|
@ -1068,6 +1068,7 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock*
|
|||
TAOS_ROW pRow = taos_fetch_row(pRes);
|
||||
if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) {
|
||||
tscError("invalid data from vnode");
|
||||
blockDataDestroy(*pBlock);
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
int64_t ts = *(int64_t*)pRow[0];
|
||||
|
@ -1102,8 +1103,11 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) {
|
|||
}
|
||||
|
||||
SSDataBlock* pBlock = NULL;
|
||||
if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) {
|
||||
tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId);
|
||||
pRequest->code = createResultBlock(res, rowNum, &pBlock);
|
||||
if (TSDB_CODE_SUCCESS != pRequest->code) {
|
||||
tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId,
|
||||
tstrerror(pRequest->code));
|
||||
returnToUser(pRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -731,6 +731,10 @@ int32_t blockDataMergeNRows(SSDataBlock* pDest, const SSDataBlock* pSrc, int32_t
|
|||
}
|
||||
|
||||
void blockDataShrinkNRows(SSDataBlock* pBlock, int32_t numOfRows) {
|
||||
if (numOfRows == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (numOfRows >= pBlock->info.rows) {
|
||||
blockDataCleanup(pBlock);
|
||||
return;
|
||||
|
@ -2936,6 +2940,8 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha
|
|||
|
||||
// return length of encoded data, return -1 if failed
|
||||
int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
|
||||
blockDataCheck(pBlock, false);
|
||||
|
||||
int32_t dataLen = 0;
|
||||
|
||||
// todo extract method
|
||||
|
@ -3177,6 +3183,9 @@ int32_t blockDecode(SSDataBlock* pBlock, const char* pData, const char** pEndPos
|
|||
}
|
||||
|
||||
*pEndPos = pStart;
|
||||
|
||||
blockDataCheck(pBlock, false);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -3386,3 +3395,77 @@ int32_t blockDataGetSortedRows(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
|
|||
|
||||
return nextRowIdx;
|
||||
}
|
||||
|
||||
void blockDataCheck(const SSDataBlock* pDataBlock, bool forceChk) {
|
||||
return;
|
||||
|
||||
if (NULL == pDataBlock || pDataBlock->info.rows == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#define BLOCK_DATA_CHECK_TRESSA(o) ;
|
||||
//#define BLOCK_DATA_CHECK_TRESSA(o) A S S E R T(o)
|
||||
|
||||
BLOCK_DATA_CHECK_TRESSA(pDataBlock->info.rows > 0);
|
||||
|
||||
if (!pDataBlock->info.dataLoad && !forceChk) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isVarType = false;
|
||||
int32_t colLen = 0;
|
||||
int32_t nextPos = 0;
|
||||
int64_t checkRows = 0;
|
||||
int64_t typeValue = 0;
|
||||
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||
for (int32_t i = 0; i < colNum; ++i) {
|
||||
SColumnInfoData* pCol = (SColumnInfoData*)taosArrayGet(pDataBlock->pDataBlock, i);
|
||||
isVarType = IS_VAR_DATA_TYPE(pCol->info.type);
|
||||
checkRows = pDataBlock->info.rows;
|
||||
|
||||
if (isVarType) {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset);
|
||||
} else {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->nullbitmap);
|
||||
}
|
||||
|
||||
nextPos = 0;
|
||||
for (int64_t r = 0; r < checkRows; ++r) {
|
||||
if (!colDataIsNull_s(pCol, r)) {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->pData);
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.length <= pCol->varmeta.allocLen);
|
||||
|
||||
if (isVarType) {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.allocLen > 0);
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] < pCol->varmeta.length);
|
||||
if (pCol->reassigned) {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] >= 0);
|
||||
} else if (0 == r) {
|
||||
nextPos = pCol->varmeta.offset[r];
|
||||
} else {
|
||||
BLOCK_DATA_CHECK_TRESSA(pCol->varmeta.offset[r] == nextPos);
|
||||
}
|
||||
|
||||
colLen = varDataTLen(pCol->pData + pCol->varmeta.offset[r]);
|
||||
BLOCK_DATA_CHECK_TRESSA(colLen >= VARSTR_HEADER_SIZE);
|
||||
BLOCK_DATA_CHECK_TRESSA(colLen <= pCol->info.bytes);
|
||||
|
||||
if (pCol->reassigned) {
|
||||
BLOCK_DATA_CHECK_TRESSA((pCol->varmeta.offset[r] + colLen) <= pCol->varmeta.length);
|
||||
} else {
|
||||
nextPos += colLen;
|
||||
BLOCK_DATA_CHECK_TRESSA(nextPos <= pCol->varmeta.length);
|
||||
}
|
||||
|
||||
typeValue = *(char*)(pCol->pData + pCol->varmeta.offset[r] + colLen - 1);
|
||||
} else {
|
||||
GET_TYPED_DATA(typeValue, int64_t, pCol->info.type, colDataGetNumData(pCol, r));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
|
|||
|
||||
_OVER:
|
||||
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("stream:%s, failed to create at line:%d since %s", createReq.name, lino, terrstr(code));
|
||||
mError("stream:%s, failed to create at line:%d since %s", createReq.name, lino, tstrerror(code));
|
||||
} else {
|
||||
mDebug("stream:%s create stream completed", createReq.name);
|
||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
|
@ -1121,7 +1121,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
|
|||
|
||||
code = mndTransPrepare(pMnode, pTrans);
|
||||
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||
mError("failed to prepare checkpoint trans since %s", terrstr(code));
|
||||
mError("failed to prepare checkpoint trans since %s", tstrerror(code));
|
||||
} else {
|
||||
code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||
}
|
||||
|
|
|
@ -653,7 +653,7 @@ static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask
|
|||
return code;
|
||||
}
|
||||
|
||||
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, TSDB_CODE_VND_INVALID_VGROUP_ID, 0);
|
||||
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
taosMemoryFree(pBuf);
|
||||
}
|
||||
|
|
|
@ -280,13 +280,13 @@ void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t);
|
|||
// tsdbReaderWriter.c ==============================================================================================
|
||||
// SDataFReader
|
||||
int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pSet);
|
||||
int32_t tsdbDataFReaderClose(SDataFReader **ppReader);
|
||||
void tsdbDataFReaderClose(SDataFReader **ppReader);
|
||||
int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx);
|
||||
int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *mDataBlk);
|
||||
int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk);
|
||||
// SDelFReader
|
||||
int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb);
|
||||
int32_t tsdbDelFReaderClose(SDelFReader **ppReader);
|
||||
void tsdbDelFReaderClose(SDelFReader **ppReader);
|
||||
int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData, int64_t maxVer);
|
||||
int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData);
|
||||
int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx);
|
||||
|
@ -678,7 +678,7 @@ typedef TARRAY2(STFileSet *) TFileSetArray;
|
|||
typedef struct STFileSetRange STFileSetRange;
|
||||
typedef TARRAY2(STFileSetRange *) TFileSetRangeArray; // disjoint ranges
|
||||
|
||||
int32_t tsdbTFileSetRangeClear(STFileSetRange **fsr);
|
||||
void tsdbTFileSetRangeClear(STFileSetRange **fsr);
|
||||
void tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr);
|
||||
|
||||
// fset partition
|
||||
|
|
|
@ -56,12 +56,12 @@ typedef enum {
|
|||
} EVAPriority;
|
||||
|
||||
int32_t vnodeAsyncOpen(int32_t numOfThreads);
|
||||
int32_t vnodeAsyncClose();
|
||||
void vnodeAsyncClose();
|
||||
int32_t vnodeAChannelInit(int64_t async, SVAChannelID* channelID);
|
||||
int32_t vnodeAChannelDestroy(SVAChannelID* channelID, bool waitRunning);
|
||||
int32_t vnodeAsync(SVAChannelID* channelID, EVAPriority priority, int32_t (*execute)(void*), void (*complete)(void*),
|
||||
void* arg, SVATaskID* taskID);
|
||||
int32_t vnodeAWait(SVATaskID* taskID);
|
||||
void vnodeAWait(SVATaskID* taskID);
|
||||
int32_t vnodeACancel(SVATaskID* taskID);
|
||||
int32_t vnodeAsyncSetWorkers(int64_t async, int32_t numWorkers);
|
||||
|
||||
|
@ -95,7 +95,7 @@ struct SVBufPool {
|
|||
};
|
||||
|
||||
int32_t vnodeOpenBufPool(SVnode* pVnode);
|
||||
int32_t vnodeCloseBufPool(SVnode* pVnode);
|
||||
void vnodeCloseBufPool(SVnode* pVnode);
|
||||
void vnodeBufPoolReset(SVBufPool* pPool);
|
||||
void vnodeBufPoolAddToFreeList(SVBufPool* pPool);
|
||||
int32_t vnodeBufPoolRecycle(SVBufPool* pPool);
|
||||
|
|
|
@ -593,7 +593,7 @@ struct SVHashTable {
|
|||
|
||||
#define vHashNumEntries(ht) ((ht)->numEntries)
|
||||
int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*compare)(const void*, const void*));
|
||||
int32_t vHashDestroy(SVHashTable** ht);
|
||||
void vHashDestroy(SVHashTable** ht);
|
||||
int32_t vHashPut(SVHashTable* ht, void* obj);
|
||||
int32_t vHashGet(SVHashTable* ht, const void* obj, void** retObj);
|
||||
int32_t vHashDrop(SVHashTable* ht, const void* obj);
|
||||
|
|
|
@ -54,8 +54,8 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
|
|||
STbDbKey tbDbKey = {.version = version, .uid = uid};
|
||||
|
||||
// query table.db
|
||||
if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf) < 0) {
|
||||
return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||
if ((code = tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf)) < 0) {
|
||||
return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
|
||||
}
|
||||
|
||||
// decode the entry
|
||||
|
@ -98,8 +98,9 @@ int metaReaderGetTableEntryByUidCache(SMetaReader *pReader, tb_uid_t uid) {
|
|||
SMeta *pMeta = pReader->pMeta;
|
||||
|
||||
SMetaInfo info;
|
||||
if (metaGetInfo(pMeta, uid, &info, pReader) == TSDB_CODE_NOT_FOUND) {
|
||||
return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST;
|
||||
int32_t code = metaGetInfo(pMeta, uid, &info, pReader);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code);
|
||||
}
|
||||
|
||||
return metaGetTableEntryByVersion(pReader, info.version, uid);
|
||||
|
@ -1584,10 +1585,9 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
|
|||
}
|
||||
|
||||
// search TDB
|
||||
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
|
||||
if ((code = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData)) < 0) {
|
||||
// not found
|
||||
if (!lock) metaULock(pMeta);
|
||||
code = TSDB_CODE_NOT_FOUND;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -2153,7 +2153,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
uint64_t uid = uidList[j];
|
||||
STableLoadInfo *pInfo = getTableLoadInfo(pReader, uid);
|
||||
if (!pInfo) {
|
||||
(void)tTombBlockDestroy(&block);
|
||||
tTombBlockDestroy(&block);
|
||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
|
@ -2225,7 +2225,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
|||
}
|
||||
}
|
||||
|
||||
(void)tTombBlockDestroy(&block);
|
||||
tTombBlockDestroy(&block);
|
||||
|
||||
if (finished) {
|
||||
TAOS_RETURN(code);
|
||||
|
@ -2685,12 +2685,14 @@ static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow, bool *pIgnoreEarli
|
|||
switch (state->state) {
|
||||
case SMEMNEXTROW_ENTER: {
|
||||
if (state->pMem != NULL) {
|
||||
/*
|
||||
if (state->pMem->maxKey <= state->lastTs) {
|
||||
*ppRow = NULL;
|
||||
*pIgnoreEarlierTs = true;
|
||||
|
||||
TAOS_RETURN(code);
|
||||
}
|
||||
*/
|
||||
tsdbTbDataIterOpen(state->pMem, NULL, 1, &state->iter);
|
||||
|
||||
TSDBROW *pMemRow = tsdbTbDataIterGet(&state->iter);
|
||||
|
|
|
@ -418,7 +418,7 @@ static int32_t tsdbCommitInfoDestroy(STsdb *pTsdb) {
|
|||
taosMemoryFree(info);
|
||||
}
|
||||
|
||||
TAOS_UNUSED(vHashDestroy(&pTsdb->commitInfo->ht));
|
||||
vHashDestroy(&pTsdb->commitInfo->ht);
|
||||
taosArrayDestroy(pTsdb->commitInfo->arr);
|
||||
pTsdb->commitInfo->arr = NULL;
|
||||
taosMemoryFreeClear(pTsdb->commitInfo);
|
||||
|
@ -572,7 +572,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
// begin tasks on file set
|
||||
for (int i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
TAOS_UNUSED(tsdbBeginTaskOnFileSet(tsdb, info->fid, &fset));
|
||||
tsdbBeginTaskOnFileSet(tsdb, info->fid, &fset);
|
||||
if (fset) {
|
||||
code = tsdbTFileSetInitCopy(tsdb, fset, &info->fset);
|
||||
if (code) {
|
||||
|
@ -710,7 +710,7 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
TAOS_UNUSED(tsdbFinishTaskOnFileSet(tsdb, info->fid));
|
||||
tsdbFinishTaskOnFileSet(tsdb, info->fid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ int32_t tsdbCommitAbort(STsdb *pTsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(pTsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(pTsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
TAOS_UNUSED(tsdbFinishTaskOnFileSet(pTsdb, info->fid));
|
||||
tsdbFinishTaskOnFileSet(pTsdb, info->fid);
|
||||
}
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
|
|
|
@ -117,7 +117,7 @@ static int32_t tsdbDataFileRAWWriterCloseAbort(SDataFileRAWWriter *writer) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbDataFileRAWWriterDoClose(SDataFileRAWWriter *writer) { return 0; }
|
||||
static void tsdbDataFileRAWWriterDoClose(SDataFileRAWWriter *writer) { return; }
|
||||
|
||||
static int32_t tsdbDataFileRAWWriterCloseCommit(SDataFileRAWWriter *writer, TFileOpArray *opArr) {
|
||||
int32_t code = 0;
|
||||
|
@ -200,7 +200,7 @@ int32_t tsdbDataFileRAWWriterClose(SDataFileRAWWriter **writer, bool abort, TFil
|
|||
} else {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileRAWWriterCloseCommit(writer[0], opArr), &lino, _exit);
|
||||
}
|
||||
(void)tsdbDataFileRAWWriterDoClose(writer[0]);
|
||||
tsdbDataFileRAWWriterDoClose(writer[0]);
|
||||
}
|
||||
taosMemoryFree(writer[0]);
|
||||
writer[0] = NULL;
|
||||
|
|
|
@ -847,7 +847,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
|
|||
for (int i = 0; i < brinBlock->numOfRecords; i++) {
|
||||
SBrinRecord record;
|
||||
|
||||
(void)tBrinBlockGet(brinBlock, i, &record);
|
||||
TAOS_CHECK_RETURN(tBrinBlockGet(brinBlock, i, &record));
|
||||
if (i == 0) {
|
||||
brinBlk.minTbid.suid = record.suid;
|
||||
brinBlk.minTbid.uid = record.uid;
|
||||
|
@ -1160,7 +1160,8 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const ST
|
|||
|
||||
for (; writer->ctx->brinBlockIdx < writer->ctx->brinBlock->numOfRecords; writer->ctx->brinBlockIdx++) {
|
||||
SBrinRecord record;
|
||||
(void)tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
|
||||
code = tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
if (record.uid != writer->ctx->tbid->uid) {
|
||||
writer->ctx->tbHasOldData = false;
|
||||
goto _exit;
|
||||
|
@ -1170,7 +1171,8 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const ST
|
|||
goto _exit;
|
||||
} else {
|
||||
SBrinRecord record[1];
|
||||
(void)tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
|
||||
code = tBrinBlockGet(writer->ctx->brinBlock, writer->ctx->brinBlockIdx, record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
if (tsdbRowKeyCmprNullAsLargest(key, &record->lastKey) > 0) { // key > record->lastKey
|
||||
if (writer->blockData->nRow > 0) {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileDoWriteBlockData(writer, writer->blockData), &lino, _exit);
|
||||
|
|
|
@ -105,8 +105,10 @@ static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
|
|||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
(void)tsdbFSToBinary(pData, pFS);
|
||||
(void)taosCalcChecksumAppend(0, pData, size);
|
||||
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
||||
|
||||
code = taosCalcChecksumAppend(0, pData, size);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
// save to file
|
||||
pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
|
||||
|
|
|
@ -252,7 +252,7 @@ static int32_t apply_commit(STFileSystem *fs) {
|
|||
if (fset1 && fset2) {
|
||||
if (fset1->fid < fset2->fid) {
|
||||
// delete fset1
|
||||
(void)tsdbTFileSetRemove(fset1);
|
||||
tsdbTFileSetRemove(fset1);
|
||||
i1++;
|
||||
} else if (fset1->fid > fset2->fid) {
|
||||
// create new file set with fid of fset2->fid
|
||||
|
@ -271,7 +271,7 @@ static int32_t apply_commit(STFileSystem *fs) {
|
|||
}
|
||||
} else if (fset1) {
|
||||
// delete fset1
|
||||
(void)tsdbTFileSetRemove(fset1);
|
||||
tsdbTFileSetRemove(fset1);
|
||||
i1++;
|
||||
} else {
|
||||
// create new file set with fid of fset2->fid
|
||||
|
@ -365,7 +365,7 @@ static int32_t tsdbFSDoScanAndFixFile(STFileSystem *fs, const STFileObj *fobj) {
|
|||
|
||||
if (tsS3Enabled && fobj->f->lcn > 1) {
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
(void)tsdbTFileLastChunkName(fs->tsdb, fobj->f, fname1);
|
||||
tsdbTFileLastChunkName(fs->tsdb, fobj->f, fname1);
|
||||
if (!taosCheckExistFile(fname1)) {
|
||||
code = TSDB_CODE_FILE_CORRUPTED;
|
||||
tsdbError("vgId:%d %s failed since file:%s does not exist", TD_VID(fs->tsdb->pVnode), __func__, fname1);
|
||||
|
@ -648,10 +648,9 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t close_file_system(STFileSystem *fs) {
|
||||
static void close_file_system(STFileSystem *fs) {
|
||||
TARRAY2_CLEAR(fs->fSetArr, tsdbTFileSetClear);
|
||||
TARRAY2_CLEAR(fs->fSetArrTmp, tsdbTFileSetClear);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t fset_cmpr_fn(const struct STFileSet *pSet1, const struct STFileSet *pSet2) {
|
||||
|
@ -749,7 +748,7 @@ _exit:
|
|||
}
|
||||
|
||||
static void tsdbFSSetBlockCommit(STFileSet *fset, bool block);
|
||||
extern int32_t tsdbStopAllCompTask(STsdb *tsdb);
|
||||
extern void tsdbStopAllCompTask(STsdb *tsdb);
|
||||
|
||||
int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
||||
STFileSystem *fs = pTsdb->pFS;
|
||||
|
@ -784,30 +783,32 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
// destroy all channels
|
||||
for (int32_t i = 0; i < taosArrayGetSize(channelArray); i++) {
|
||||
SVAChannelID *channel = taosArrayGet(channelArray, i);
|
||||
(void)vnodeAChannelDestroy(channel, true);
|
||||
int32_t code = vnodeAChannelDestroy(channel, true);
|
||||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code));
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(channelArray);
|
||||
|
||||
#ifdef TD_ENTERPRISE
|
||||
(void)tsdbStopAllCompTask(pTsdb);
|
||||
tsdbStopAllCompTask(pTsdb);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbEnableBgTask(STsdb *pTsdb) {
|
||||
void tsdbEnableBgTask(STsdb *pTsdb) {
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
pTsdb->bgTaskDisabled = false;
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbCloseFS(STFileSystem **fs) {
|
||||
if (fs[0] == NULL) return 0;
|
||||
void tsdbCloseFS(STFileSystem **fs) {
|
||||
if (fs[0] == NULL) return;
|
||||
|
||||
(void)tsdbDisableAndCancelAllBgTask((*fs)->tsdb);
|
||||
(void)close_file_system(fs[0]);
|
||||
TAOS_UNUSED(tsdbDisableAndCancelAllBgTask((*fs)->tsdb));
|
||||
close_file_system(fs[0]);
|
||||
destroy_fs(fs);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t tsdbFSAllocEid(STFileSystem *fs) {
|
||||
|
@ -985,13 +986,12 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr) {
|
||||
void tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr) {
|
||||
if (fsetArr[0]) {
|
||||
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
||||
taosMemoryFree(fsetArr[0]);
|
||||
fsetArr[0] = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
||||
|
@ -1027,13 +1027,12 @@ int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fse
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbFSDestroyRefSnapshot(TFileSetArray **fsetArr) {
|
||||
void tsdbFSDestroyRefSnapshot(TFileSetArray **fsetArr) {
|
||||
if (fsetArr[0]) {
|
||||
TARRAY2_DESTROY(fsetArr[0], tsdbTFileSetClear);
|
||||
taosMemoryFreeClear(fsetArr[0]);
|
||||
fsetArr[0] = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SHashObj *tsdbFSetRangeArrayToHash(TFileSetRangeArray *pRanges) {
|
||||
|
@ -1104,7 +1103,7 @@ _out:
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbFSDestroyCopyRangedSnapshot(TFileSetArray **fsetArr) { return tsdbFSDestroyCopySnapshot(fsetArr); }
|
||||
void tsdbFSDestroyCopyRangedSnapshot(TFileSetArray **fsetArr) { tsdbFSDestroyCopySnapshot(fsetArr); }
|
||||
|
||||
int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ever, TFileSetRangeArray *pRanges,
|
||||
TFileSetRangeArray **fsrArr) {
|
||||
|
@ -1160,7 +1159,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
|
|||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
if (code) {
|
||||
(void)tsdbTFileSetRangeClear(&fsr1);
|
||||
tsdbTFileSetRangeClear(&fsr1);
|
||||
TARRAY2_DESTROY(fsrArr[0], tsdbTFileSetRangeClear);
|
||||
fsrArr[0] = NULL;
|
||||
}
|
||||
|
@ -1175,7 +1174,7 @@ _out:
|
|||
|
||||
void tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr) { tsdbTFileSetRangeArrayDestroy(fsrArr); }
|
||||
|
||||
int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
||||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
|
@ -1196,11 +1195,9 @@ int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
|||
}
|
||||
tsdbInfo("vgId:%d begin task on file set:%d", TD_VID(tsdb->pVnode), fid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
|
||||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
if (sttTrigger == 1) {
|
||||
STFileSet *fset = NULL;
|
||||
|
@ -1213,6 +1210,4 @@ int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
|
|||
tsdbInfo("vgId:%d finish task on file set:%d", TD_VID(tsdb->pVnode), fid);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,17 +38,17 @@ typedef enum {
|
|||
/* Exposed APIs */
|
||||
// open/close
|
||||
int32_t tsdbOpenFS(STsdb *pTsdb, STFileSystem **fs, int8_t rollback);
|
||||
int32_t tsdbCloseFS(STFileSystem **fs);
|
||||
void tsdbCloseFS(STFileSystem **fs);
|
||||
// snapshot
|
||||
int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr);
|
||||
int32_t tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr);
|
||||
void tsdbFSDestroyCopySnapshot(TFileSetArray **fsetArr);
|
||||
int32_t tsdbFSCreateRefSnapshot(STFileSystem *fs, TFileSetArray **fsetArr);
|
||||
int32_t tsdbFSCreateRefSnapshotWithoutLock(STFileSystem *fs, TFileSetArray **fsetArr);
|
||||
int32_t tsdbFSDestroyRefSnapshot(TFileSetArray **fsetArr);
|
||||
void tsdbFSDestroyRefSnapshot(TFileSetArray **fsetArr);
|
||||
|
||||
int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pExclude, TFileSetArray **fsetArr,
|
||||
TFileOpArray *fopArr);
|
||||
int32_t tsdbFSDestroyCopyRangedSnapshot(TFileSetArray **fsetArr);
|
||||
void tsdbFSDestroyCopyRangedSnapshot(TFileSetArray **fsetArr);
|
||||
int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ever, TFileSetRangeArray *pRanges,
|
||||
TFileSetRangeArray **fsrArr);
|
||||
void tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr);
|
||||
|
@ -61,8 +61,8 @@ int32_t tsdbFSEditAbort(STFileSystem *fs);
|
|||
// other
|
||||
void tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
|
||||
int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid);
|
||||
int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset);
|
||||
int32_t tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid);
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset);
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid);
|
||||
// utils
|
||||
int32_t save_fs(const TFileSetArray *arr, const char *fname);
|
||||
void current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype);
|
||||
|
|
|
@ -64,9 +64,16 @@ static int32_t tsdbSttLvlInitRef(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lv
|
|||
|
||||
STFileObj *fobj1;
|
||||
TARRAY2_FOREACH(lvl1->fobjArr, fobj1) {
|
||||
(void)tsdbTFileObjRef(fobj1);
|
||||
code = tsdbTFileObjRef(fobj1);
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
code = TARRAY2_APPEND(lvl[0]->fobjArr, fobj1);
|
||||
if (code) return code;
|
||||
if (code) {
|
||||
tsdbSttLvlClear(lvl);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -99,7 +106,12 @@ static int32_t tsdbSttLvlFilteredInitEx(STsdb *pTsdb, const SSttLvl *lvl1, int64
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void tsdbSttLvlRemoveFObj(void *data) { (void)tsdbTFileObjRemove(*(STFileObj **)data); }
|
||||
static void tsdbSttLvlRemoveFObj(void *data) {
|
||||
int32_t code = tsdbTFileObjRemove(*(STFileObj **)data);
|
||||
if (code) {
|
||||
tsdbError("failed to remove file obj, code:%d, error:%s", code, tstrerror(code));
|
||||
}
|
||||
}
|
||||
static void tsdbSttLvlRemove(SSttLvl **lvl) {
|
||||
TARRAY2_DESTROY(lvl[0]->fobjArr, tsdbSttLvlRemoveFObj);
|
||||
taosMemoryFree(lvl[0]);
|
||||
|
@ -348,7 +360,8 @@ int32_t tsdbTFileSetEdit(STsdb *pTsdb, STFileSet *fset, const STFileOp *op) {
|
|||
int32_t idx = TARRAY2_SEARCH_IDX(lvl->fobjArr, &tfobjp, tsdbTFileObjCmpr, TD_EQ);
|
||||
TARRAY2_REMOVE(lvl->fobjArr, idx, tsdbSttLvlClearFObj);
|
||||
} else {
|
||||
(void)tsdbTFileObjUnref(fset->farr[op->of.type]);
|
||||
code = tsdbTFileObjUnref(fset->farr[op->of.type]);
|
||||
if (code) return code;
|
||||
fset->farr[op->of.type] = NULL;
|
||||
}
|
||||
} else {
|
||||
|
@ -391,9 +404,11 @@ int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *f
|
|||
}
|
||||
} else {
|
||||
if (fobj1->f->cid != fobj2->f->cid) {
|
||||
(void)tsdbTFileObjRemove(fobj2);
|
||||
code = tsdbTFileObjRemove(fobj2);
|
||||
if (code) return code;
|
||||
} else {
|
||||
(void)tsdbTFileObjRemoveUpdateLC(fobj2);
|
||||
code = tsdbTFileObjRemoveUpdateLC(fobj2);
|
||||
if (code) return code;
|
||||
}
|
||||
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fset2->farr[ftype]);
|
||||
if (code) return code;
|
||||
|
@ -404,7 +419,8 @@ int32_t tsdbTFileSetApplyEdit(STsdb *pTsdb, const STFileSet *fset1, STFileSet *f
|
|||
if (code) return code;
|
||||
} else {
|
||||
// remove the file
|
||||
(void)tsdbTFileObjRemove(fobj2);
|
||||
code = tsdbTFileObjRemove(fobj2);
|
||||
if (code) return code;
|
||||
fset2->farr[ftype] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -570,7 +586,11 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
|
|||
for (int32_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if (fset1->farr[ftype] == NULL) continue;
|
||||
|
||||
(void)tsdbTFileObjRef(fset1->farr[ftype]);
|
||||
code = tsdbTFileObjRef(fset1->farr[ftype]);
|
||||
if (code) {
|
||||
tsdbTFileSetClear(fset);
|
||||
return code;
|
||||
}
|
||||
fset[0]->farr[ftype] = fset1->farr[ftype];
|
||||
}
|
||||
|
||||
|
@ -595,13 +615,13 @@ int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fs
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTFileSetRangeClear(STFileSetRange **fsr) {
|
||||
if (!fsr[0]) return 0;
|
||||
void tsdbTFileSetRangeClear(STFileSetRange **fsr) {
|
||||
if (!fsr[0]) return;
|
||||
|
||||
tsdbTFileSetClear(&fsr[0]->fset);
|
||||
taosMemoryFree(fsr[0]);
|
||||
fsr[0] = NULL;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
void tsdbTFileSetRangeArrayDestroy(TFileSetRangeArray **ppArr) {
|
||||
|
@ -616,7 +636,11 @@ void tsdbTFileSetClear(STFileSet **fset) {
|
|||
if (fset && *fset) {
|
||||
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if ((*fset)->farr[ftype] == NULL) continue;
|
||||
(void)tsdbTFileObjUnref((*fset)->farr[ftype]);
|
||||
int32_t code = tsdbTFileObjUnref((*fset)->farr[ftype]);
|
||||
if (code) {
|
||||
tsdbError("failed to unref file, fid:%d, ftype:%d", (*fset)->fid, ftype);
|
||||
}
|
||||
(*fset)->farr[ftype] = NULL;
|
||||
}
|
||||
|
||||
TARRAY2_DESTROY((*fset)->lvlArr, tsdbSttLvlClear);
|
||||
|
@ -627,19 +651,20 @@ void tsdbTFileSetClear(STFileSet **fset) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t tsdbTFileSetRemove(STFileSet *fset) {
|
||||
if (fset == NULL) return 0;
|
||||
void tsdbTFileSetRemove(STFileSet *fset) {
|
||||
if (fset == NULL) return;
|
||||
|
||||
for (tsdb_ftype_t ftype = TSDB_FTYPE_MIN; ftype < TSDB_FTYPE_MAX; ++ftype) {
|
||||
if (fset->farr[ftype] != NULL) {
|
||||
(void)tsdbTFileObjRemove(fset->farr[ftype]);
|
||||
int32_t code = tsdbTFileObjRemove(fset->farr[ftype]);
|
||||
if (code) {
|
||||
tsdbError("failed to remove file, fid:%d, ftype:%d", fset->fid, ftype);
|
||||
}
|
||||
fset->farr[ftype] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TARRAY2_DESTROY(fset->lvlArr, tsdbSttLvlRemove);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SSttLvl *tsdbTFileSetGetSttLvl(STFileSet *fset, int32_t level) {
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset);
|
|||
int32_t tsdbTFileSetInitCopy(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset);
|
||||
int32_t tsdbTFileSetInitRef(STsdb *pTsdb, const STFileSet *fset1, STFileSet **fset);
|
||||
void tsdbTFileSetClear(STFileSet **fset);
|
||||
int32_t tsdbTFileSetRemove(STFileSet *fset);
|
||||
void tsdbTFileSetRemove(STFileSet *fset);
|
||||
|
||||
int32_t tsdbTFileSetFilteredInitDup(STsdb *pTsdb, const STFileSet *fset1, int64_t ever, STFileSet **fset,
|
||||
TFileOpArray *fopArr);
|
||||
|
|
|
@ -249,8 +249,8 @@ int32_t tsdbTFileObjRef(STFileObj *fobj) {
|
|||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
|
||||
if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, fobj->ref);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
||||
|
@ -335,8 +335,8 @@ static void tsdbTFileObjRemoveLC(STFileObj *fobj, bool remove_all) {
|
|||
int32_t tsdbTFileObjRemove(STFileObj *fobj) {
|
||||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbError("file %s, fobj:%p ref %d", fobj->fname, fobj, fobj->ref);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
fobj->state = TSDB_FSTATE_DEAD;
|
||||
|
@ -399,7 +399,7 @@ void tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]) {
|
|||
}
|
||||
}
|
||||
|
||||
int32_t tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]) {
|
||||
void tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]) {
|
||||
SVnode *pVnode = pTsdb->pVnode;
|
||||
STfs *pTfs = pVnode->pTfs;
|
||||
|
||||
|
@ -428,7 +428,6 @@ int32_t tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]) {
|
|||
f->lcn, //
|
||||
g_tfile_info[f->type].suffix);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool tsdbIsSameTFile(const STFile *f1, const STFile *f2) {
|
||||
|
|
|
@ -45,7 +45,7 @@ enum {
|
|||
int32_t tsdbTFileToJson(const STFile *f, cJSON *json);
|
||||
int32_t tsdbJsonToTFile(const cJSON *json, tsdb_ftype_t ftype, STFile *f);
|
||||
void tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]);
|
||||
int32_t tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]);
|
||||
void tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]);
|
||||
bool tsdbIsSameTFile(const STFile *f1, const STFile *f2);
|
||||
bool tsdbIsTFileChanged(const STFile *f1, const STFile *f2);
|
||||
|
||||
|
|
|
@ -153,7 +153,8 @@ static int32_t tsdbDataIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
|||
|
||||
for (; iter->dataData->brinBlockIdx < iter->dataData->brinBlock->numOfRecords; iter->dataData->brinBlockIdx++) {
|
||||
SBrinRecord record[1];
|
||||
(void)tBrinBlockGet(iter->dataData->brinBlock, iter->dataData->brinBlockIdx, record);
|
||||
code = tBrinBlockGet(iter->dataData->brinBlock, iter->dataData->brinBlockIdx, record);
|
||||
if (code) return code;
|
||||
|
||||
if (iter->filterByVersion && (record->maxVer < iter->range[0] || record->minVer > iter->range[1])) {
|
||||
continue;
|
||||
|
@ -224,7 +225,7 @@ static int32_t tsdbMemTableIterNext(STsdbIter *iter, const TABLEID *tbid) {
|
|||
|
||||
iter->row->row = row[0];
|
||||
|
||||
(void)tsdbTbDataIterNext(iter->memtData->tbIter);
|
||||
TAOS_UNUSED(tsdbTbDataIterNext(iter->memtData->tbIter));
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -373,7 +374,8 @@ static int32_t tsdbDataIterOpen(STsdbIter *iter) {
|
|||
iter->dataData->brinBlkArrayIdx = 0;
|
||||
|
||||
// SBrinBlock
|
||||
(void)tBrinBlockInit(iter->dataData->brinBlock);
|
||||
code = tBrinBlockInit(iter->dataData->brinBlock);
|
||||
if (code) return code;
|
||||
iter->dataData->brinBlockIdx = 0;
|
||||
|
||||
// SBlockData
|
||||
|
|
|
@ -403,7 +403,11 @@ static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid
|
|||
pMemTable->aBucket[idx] = pTbData;
|
||||
pMemTable->nTbData++;
|
||||
|
||||
(void)tRBTreePut(pMemTable->tbDataTree, pTbData->rbtn);
|
||||
if (tRBTreePut(pMemTable->tbDataTree, pTbData->rbtn) == NULL) {
|
||||
taosWUnLockLatch(&pMemTable->latch);
|
||||
code = TSDB_CODE_INTERNAL_ERROR;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
taosWUnLockLatch(&pMemTable->latch);
|
||||
|
||||
|
|
|
@ -77,9 +77,8 @@ static int32_t tsdbMergerClose(SMerger *merger) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) {
|
||||
static void tsdbMergeFileSetEndCloseReader(SMerger *merger) {
|
||||
TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
|
||||
|
@ -204,7 +203,7 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
|
|||
TAOS_CHECK_GOTO(tsdbSttFileReaderOpen(fobj->fname, &config, &reader), &lino, _exit);
|
||||
|
||||
if ((code = TARRAY2_APPEND(merger->sttReaderArr, reader))) {
|
||||
(void)tsdbSttFileReaderClose(&reader);
|
||||
tsdbSttFileReaderClose(&reader);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +218,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(merger->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
(void)tsdbMergeFileSetEndCloseReader(merger);
|
||||
tsdbMergeFileSetEndCloseReader(merger);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -271,7 +270,9 @@ static int32_t tsdbMergeFileSetBeginOpenWriter(SMerger *merger) {
|
|||
|
||||
TAOS_CHECK_GOTO(tfsAllocDisk(merger->tsdb->pVnode->pTfs, level, &did), &lino, _exit);
|
||||
|
||||
(void)tfsMkdirRecurAt(merger->tsdb->pVnode->pTfs, merger->tsdb->path, did);
|
||||
code = tfsMkdirRecurAt(merger->tsdb->pVnode->pTfs, merger->tsdb->path, did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
SFSetWriterConfig config = {
|
||||
.tsdb = merger->tsdb,
|
||||
.toSttOnly = true,
|
||||
|
@ -354,7 +355,7 @@ static int32_t tsdbMergeFileSetEnd(SMerger *merger) {
|
|||
|
||||
TAOS_CHECK_GOTO(tsdbMergeFileSetEndCloseIter(merger), &lino, _exit);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbMergeFileSetEndCloseReader(merger), &lino, _exit);
|
||||
tsdbMergeFileSetEndCloseReader(merger);
|
||||
|
||||
// edit file system
|
||||
TAOS_CHECK_GOTO(tsdbFSEditBegin(merger->tsdb->pFS, merger->fopArr, TSDB_FEDIT_MERGE), &lino, _exit);
|
||||
|
|
|
@ -681,11 +681,7 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32
|
|||
}
|
||||
|
||||
void tLDataIterClose2(SLDataIter *pIter) {
|
||||
int32_t code = tsdbSttFileReaderClose(&pIter->pReader); // always return 0
|
||||
if (code != 0) {
|
||||
tsdbError("%" PRId64 " failed to close tsdb file reader, code:%s", pIter->cid, tstrerror(code));
|
||||
}
|
||||
|
||||
tsdbSttFileReaderClose(&pIter->pReader);
|
||||
pIter->pReader = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "tsdbFS2.h"
|
||||
|
||||
extern int32_t tsdbOpenCompMonitor(STsdb *tsdb);
|
||||
extern int32_t tsdbCloseCompMonitor(STsdb *tsdb);
|
||||
extern void tsdbCloseCompMonitor(STsdb *tsdb);
|
||||
|
||||
void tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) {
|
||||
STsdbKeepCfg *pKeepCfg = &pTsdb->keepCfg;
|
||||
|
@ -65,19 +65,23 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
|||
|
||||
// create dir
|
||||
if (pVnode->pTfs) {
|
||||
(void)tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
code = tfsMkdir(pVnode->pTfs, pTsdb->path);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
} else {
|
||||
(void)taosMkDir(pTsdb->path);
|
||||
code = taosMkDir(pTsdb->path);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
|
||||
// open tsdb
|
||||
TAOS_CHECK_GOTO(tsdbOpenFS(pTsdb, &pTsdb->pFS, rollback), &lino, _exit);
|
||||
code = tsdbOpenFS(pTsdb, &pTsdb->pFS, rollback);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if (pTsdb->pFS->fsstate == TSDB_FS_STATE_INCOMPLETE && force == false) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_NEED_RETRY, &lino, _exit);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbOpenCache(pTsdb), &lino, _exit);
|
||||
code = tsdbOpenCache(pTsdb);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
#ifdef TD_ENTERPRISE
|
||||
TAOS_CHECK_GOTO(tsdbOpenCompMonitor(pTsdb), &lino, _exit);
|
||||
|
@ -86,7 +90,7 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
|
|||
_exit:
|
||||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
(void)tsdbCloseFS(&pTsdb->pFS);
|
||||
tsdbCloseFS(&pTsdb->pFS);
|
||||
(void)taosThreadMutexDestroy(&pTsdb->mutex);
|
||||
taosMemoryFree(pTsdb);
|
||||
} else {
|
||||
|
@ -109,10 +113,10 @@ int32_t tsdbClose(STsdb **pTsdb) {
|
|||
(*pTsdb)->mem = NULL;
|
||||
(void)taosThreadMutexUnlock(&(*pTsdb)->mutex);
|
||||
|
||||
(void)tsdbCloseFS(&(*pTsdb)->pFS);
|
||||
tsdbCloseFS(&(*pTsdb)->pFS);
|
||||
tsdbCloseCache(*pTsdb);
|
||||
#ifdef TD_ENTERPRISE
|
||||
(void)tsdbCloseCompMonitor(*pTsdb);
|
||||
tsdbCloseCompMonitor(*pTsdb);
|
||||
#endif
|
||||
(void)taosThreadMutexDestroy(&(*pTsdb)->mutex);
|
||||
taosMemoryFreeClear(*pTsdb);
|
||||
|
|
|
@ -5967,7 +5967,7 @@ void tsdbUntakeReadSnap2(STsdbReader* pReader, STsdbReadSnap* pSnap, bool proact
|
|||
if (pSnap->pNode) taosMemoryFree(pSnap->pNode);
|
||||
if (pSnap->pINode) taosMemoryFree(pSnap->pINode);
|
||||
|
||||
(void) tsdbFSDestroyRefSnapshot(&pSnap->pfSetArray);
|
||||
tsdbFSDestroyRefSnapshot(&pSnap->pfSetArray);
|
||||
|
||||
taosMemoryFree(pSnap);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,8 @@ static int32_t tsdbWriteFilePage(STsdbFD *pFD, int32_t encryptAlgorithm, char *e
|
|||
TSDB_CHECK_CODE(code = TAOS_SYSTEM_ERROR(errno), lino, _exit);
|
||||
}
|
||||
|
||||
(void)taosCalcChecksumAppend(0, pFD->pBuf, pFD->szPage);
|
||||
code = taosCalcChecksumAppend(0, pFD->pBuf, pFD->szPage);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if (encryptAlgorithm == DND_CA_SM4) {
|
||||
// if(tsiEncryptAlgorithm == DND_CA_SM4 && (tsiEncryptScope & DND_CS_TSDB) == DND_CS_TSDB){
|
||||
|
@ -635,9 +636,8 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbDataFReaderClose(SDataFReader **ppReader) {
|
||||
int32_t code = 0;
|
||||
if (*ppReader == NULL) return code;
|
||||
void tsdbDataFReaderClose(SDataFReader **ppReader) {
|
||||
if (*ppReader == NULL) return;
|
||||
|
||||
// head
|
||||
tsdbCloseFile(&(*ppReader)->pHeadFD);
|
||||
|
@ -660,7 +660,6 @@ int32_t tsdbDataFReaderClose(SDataFReader **ppReader) {
|
|||
}
|
||||
taosMemoryFree(*ppReader);
|
||||
*ppReader = NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
|
||||
|
@ -819,7 +818,7 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
|
||||
void tsdbDelFReaderClose(SDelFReader **ppReader) {
|
||||
int32_t code = 0;
|
||||
SDelFReader *pReader = *ppReader;
|
||||
|
||||
|
@ -832,7 +831,6 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader) {
|
|||
}
|
||||
|
||||
*ppReader = NULL;
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData) {
|
||||
|
|
|
@ -71,8 +71,8 @@ static int32_t tsdbDoCopyFileLC(SRTNer *rtner, const STFileObj *from, const STFi
|
|||
char fname_from[TSDB_FILENAME_LEN];
|
||||
char fname_to[TSDB_FILENAME_LEN];
|
||||
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, from->f, fname_from);
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, to, fname_to);
|
||||
tsdbTFileLastChunkName(rtner->tsdb, from->f, fname_from);
|
||||
tsdbTFileLastChunkName(rtner->tsdb, to, fname_to);
|
||||
|
||||
fdFrom = taosOpenFile(fname_from, TD_FILE_READ);
|
||||
if (fdFrom == NULL) {
|
||||
|
@ -255,7 +255,8 @@ static int32_t tsdbDoRetention(SRTNer *rtner) {
|
|||
SDiskID did;
|
||||
|
||||
TAOS_CHECK_GOTO(tfsAllocDisk(rtner->tsdb->pVnode->pTfs, expLevel, &did), &lino, _exit);
|
||||
(void)tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did);
|
||||
code = tfsMkdirRecurAt(rtner->tsdb->pVnode->pTfs, rtner->tsdb->path, did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
// data
|
||||
for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX && (fobj = fset->farr[ftype], 1); ++ftype) {
|
||||
|
@ -316,7 +317,7 @@ static int32_t tsdbRetention(void *arg) {
|
|||
|
||||
// begin task
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)tsdbBeginTaskOnFileSet(pTsdb, rtnArg->fid, &fset);
|
||||
tsdbBeginTaskOnFileSet(pTsdb, rtnArg->fid, &fset);
|
||||
if (fset && (code = tsdbTFileSetInitCopy(pTsdb, fset, &rtner.fset))) {
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -337,7 +338,7 @@ static int32_t tsdbRetention(void *arg) {
|
|||
_exit:
|
||||
if (rtner.fset) {
|
||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||
(void)tsdbFinishTaskOnFileSet(pTsdb, rtnArg->fid);
|
||||
tsdbFinishTaskOnFileSet(pTsdb, rtnArg->fid);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
}
|
||||
|
||||
|
@ -693,7 +694,7 @@ static int32_t tsdbDoS3Migrate(SRTNer *rtner) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_INVALID_PARA, &lino, _exit);
|
||||
}
|
||||
char fname1[TSDB_FILENAME_LEN];
|
||||
(void)tsdbTFileLastChunkName(rtner->tsdb, fobj->f, fname1);
|
||||
tsdbTFileLastChunkName(rtner->tsdb, fobj->f, fname1);
|
||||
|
||||
if (taosCheckExistFile(fname1)) {
|
||||
int32_t mtime = 0;
|
||||
|
|
|
@ -102,7 +102,11 @@ static int32_t tsdbTFileSetToFSetPartition(STFileSet* fset, STsdbFSetPartition**
|
|||
}
|
||||
count++;
|
||||
SVersionRange vr = {.minVer = f->minVer, .maxVer = f->maxVer};
|
||||
(void)TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
code = TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
if (code) {
|
||||
tsdbFSetPartitionClear(&p);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
typ = TSDB_FSET_RANGE_TYP_STT;
|
||||
|
@ -120,12 +124,20 @@ static int32_t tsdbTFileSetToFSetPartition(STFileSet* fset, STsdbFSetPartition**
|
|||
}
|
||||
count++;
|
||||
SVersionRange vr = {.minVer = f->minVer, .maxVer = f->maxVer};
|
||||
(void)TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
code = TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
if (code) {
|
||||
tsdbFSetPartitionClear(&p);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (corrupt && count == 0) {
|
||||
SVersionRange vr = {.minVer = VERSION_MIN, .maxVer = fset->maxVerValid};
|
||||
(void)TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
code = TARRAY2_SORT_INSERT(&p->verRanges[typ], vr, tVersionRangeCmprFn);
|
||||
if (code) {
|
||||
tsdbFSetPartitionClear(&p);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
ppSP[0] = p;
|
||||
return 0;
|
||||
|
@ -182,7 +194,11 @@ int32_t tsdbFSetPartListToRangeDiff(STsdbFSetPartList* pList, TFileSetRangeArray
|
|||
r->sver = maxVerValid + 1;
|
||||
r->ever = VERSION_MAX;
|
||||
tsdbDebug("range diff fid:%" PRId64 ", sver:%" PRId64 ", ever:%" PRId64, part->fid, r->sver, r->ever);
|
||||
(void)TARRAY2_SORT_INSERT(pDiff, r, tsdbTFileSetRangeCmprFn);
|
||||
code = TARRAY2_SORT_INSERT(pDiff, r, tsdbTFileSetRangeCmprFn);
|
||||
if (code) {
|
||||
taosMemoryFree(r);
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
ppRanges[0] = pDiff;
|
||||
|
||||
|
@ -355,7 +371,11 @@ static STsdbFSetPartList* tsdbSnapGetFSetPartList(STFileSystem* fs) {
|
|||
terrno = code;
|
||||
break;
|
||||
}
|
||||
(void)TARRAY2_SORT_INSERT(pList, pItem, tsdbFSetPartCmprFn);
|
||||
code = TARRAY2_SORT_INSERT(pList, pItem, tsdbFSetPartCmprFn);
|
||||
if (code) {
|
||||
terrno = code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&fs->tsdb->mutex);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ static int32_t tsdbSnapReadFileSetOpenReader(STsdbSnapReader* reader) {
|
|||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
if ((code = TARRAY2_APPEND(reader->sttReaderArr, sttReader))) {
|
||||
TAOS_UNUSED(tsdbSttFileReaderClose(&sttReader));
|
||||
tsdbSttFileReaderClose(&sttReader);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** reader) {
|
|||
|
||||
STsdb* tsdb = reader[0]->tsdb;
|
||||
|
||||
TAOS_UNUSED(tTombBlockDestroy(reader[0]->tombBlock));
|
||||
tTombBlockDestroy(reader[0]->tombBlock);
|
||||
tBlockDataDestroy(reader[0]->blockData);
|
||||
|
||||
tsdbIterMergerClose(&reader[0]->dataIterMerger);
|
||||
|
@ -1127,7 +1127,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** writer, int8_t rollback) {
|
|||
tsdbDataFileReaderClose(&writer[0]->ctx->dataReader);
|
||||
|
||||
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
|
||||
TAOS_UNUSED(tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr));
|
||||
tsdbFSDestroyCopyRangedSnapshot(&writer[0]->fsetArr);
|
||||
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(writer[0]->buffers); ++i) {
|
||||
tBufferDestroy(writer[0]->buffers + i);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "tsdbFS2.h"
|
||||
#include "tsdbFSetRAW.h"
|
||||
|
||||
static int32_t tsdbSnapRAWReadFileSetCloseReader(STsdbSnapRAWReader* reader);
|
||||
static void tsdbSnapRAWReadFileSetCloseReader(STsdbSnapRAWReader* reader);
|
||||
|
||||
// reader
|
||||
typedef struct SDataFileRAWReaderIter {
|
||||
|
@ -65,7 +65,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at line %d since %s, sver:0, ever:%" PRId64 " type:%d", TD_VID(tsdb->pVnode), __func__,
|
||||
lino, tstrerror(code), ever, type);
|
||||
(void)tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
} else {
|
||||
|
@ -84,7 +84,7 @@ int32_t tsdbSnapRAWReaderClose(STsdbSnapRAWReader** reader) {
|
|||
STsdb* tsdb = reader[0]->tsdb;
|
||||
|
||||
TARRAY2_DESTROY(reader[0]->dataReaderArr, tsdbDataFileRAWReaderClose);
|
||||
(void)tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
tsdbFSDestroyRefSnapshot(&reader[0]->fsetArr);
|
||||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
|
||||
|
@ -141,15 +141,14 @@ static int32_t tsdbSnapRAWReadFileSetOpenReader(STsdbSnapRAWReader* reader) {
|
|||
|
||||
_exit:
|
||||
if (code) {
|
||||
(void)tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
TSDB_ERROR_LOG(TD_VID(reader->tsdb->pVnode), code, lino);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t tsdbSnapRAWReadFileSetCloseReader(STsdbSnapRAWReader* reader) {
|
||||
static void tsdbSnapRAWReadFileSetCloseReader(STsdbSnapRAWReader* reader) {
|
||||
TARRAY2_CLEAR(reader->dataReaderArr, tsdbDataFileRAWReaderClose);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbSnapRAWReadFileSetOpenIter(STsdbSnapRAWReader* reader) {
|
||||
|
@ -158,10 +157,9 @@ static int32_t tsdbSnapRAWReadFileSetOpenIter(STsdbSnapRAWReader* reader) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tsdbSnapRAWReadFileSetCloseIter(STsdbSnapRAWReader* reader) {
|
||||
static void tsdbSnapRAWReadFileSetCloseIter(STsdbSnapRAWReader* reader) {
|
||||
reader->dataIter->count = 0;
|
||||
reader->dataIter->idx = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int64_t tsdbSnapRAWReadPeek(SDataFileRAWReader* reader) {
|
||||
|
@ -261,8 +259,8 @@ _exit:
|
|||
}
|
||||
|
||||
static int32_t tsdbSnapRAWReadEnd(STsdbSnapRAWReader* reader) {
|
||||
(void)tsdbSnapRAWReadFileSetCloseIter(reader);
|
||||
(void)tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
tsdbSnapRAWReadFileSetCloseIter(reader);
|
||||
tsdbSnapRAWReadFileSetCloseReader(reader);
|
||||
reader->ctx->fset = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -411,7 +409,9 @@ static int32_t tsdbSnapRAWWriteFileSetBegin(STsdbSnapRAWWriter* writer, int32_t
|
|||
int32_t level = tsdbFidLevel(fid, &writer->tsdb->keepCfg, taosGetTimestampSec());
|
||||
code = tfsAllocDisk(writer->tsdb->pVnode->pTfs, level, &writer->ctx->did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
(void)tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
|
||||
code = tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = tsdbSnapRAWWriteFileSetOpenWriter(writer);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -490,7 +490,7 @@ int32_t tsdbSnapRAWWriterClose(STsdbSnapRAWWriter** writer, int8_t rollback) {
|
|||
}
|
||||
|
||||
TARRAY2_DESTROY(writer[0]->fopArr, NULL);
|
||||
(void)tsdbFSDestroyCopySnapshot(&writer[0]->fsetArr);
|
||||
tsdbFSDestroyCopySnapshot(&writer[0]->fsetArr);
|
||||
|
||||
taosMemoryFree(writer[0]);
|
||||
writer[0] = NULL;
|
||||
|
|
|
@ -93,12 +93,12 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(config->tsdb->pVnode), __func__, __FILE__, lino,
|
||||
tstrerror(code));
|
||||
(void)tsdbSttFileReaderClose(reader);
|
||||
tsdbSttFileReaderClose(reader);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tsdbSttFileReaderClose(SSttFileReader **reader) {
|
||||
void tsdbSttFileReaderClose(SSttFileReader **reader) {
|
||||
if (reader[0]) {
|
||||
for (int32_t i = 0; i < ARRAY_SIZE(reader[0]->local); ++i) {
|
||||
tBufferDestroy(reader[0]->local + i);
|
||||
|
@ -110,7 +110,6 @@ int32_t tsdbSttFileReaderClose(SSttFileReader **reader) {
|
|||
taosMemoryFree(reader[0]);
|
||||
reader[0] = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// SSttFSegReader
|
||||
|
@ -591,11 +590,13 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) {
|
|||
statisBlk.cmprAlg = writer->config->cmprAlg;
|
||||
statisBlk.numOfPKs = statisBlock->numOfPKs;
|
||||
|
||||
(void)tStatisBlockGet(statisBlock, 0, &record);
|
||||
code = tStatisBlockGet(statisBlock, 0, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
statisBlk.minTbid.suid = record.suid;
|
||||
statisBlk.minTbid.uid = record.uid;
|
||||
|
||||
(void)tStatisBlockGet(statisBlock, statisBlock->numOfRecords - 1, &record);
|
||||
code = tStatisBlockGet(statisBlock, statisBlock->numOfRecords - 1, &record);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
statisBlk.maxTbid.suid = record.suid;
|
||||
statisBlk.maxTbid.uid = record.uid;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef TARRAY2(SSttFileReader *) TSttFileReaderArray;
|
|||
|
||||
// SSttFileReader
|
||||
int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *config, SSttFileReader **reader);
|
||||
int32_t tsdbSttFileReaderClose(SSttFileReader **reader);
|
||||
void tsdbSttFileReaderClose(SSttFileReader **reader);
|
||||
|
||||
// SSttSegReader
|
||||
int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBlkArray);
|
||||
|
@ -72,9 +72,9 @@ int32_t tsdbSttFileWriteTombRecord(SSttFileWriter *writer, const STombRecord *re
|
|||
bool tsdbSttFileWriterIsOpened(SSttFileWriter *writer);
|
||||
|
||||
int32_t tsdbFileWriteSttBlk(STsdbFD *fd, const TSttBlkArray *sttBlkArray, SFDataPtr *ptr, int64_t *fileSize,
|
||||
int32_t encryptAlgorithm, char* encryptKey);
|
||||
int32_t encryptAlgorithm, char *encryptKey);
|
||||
int32_t tsdbFileWriteSttFooter(STsdbFD *fd, const SSttFooter *footer, int64_t *fileSize, int32_t encryptAlgorithm,
|
||||
char* encryptKey);
|
||||
char *encryptKey);
|
||||
|
||||
struct SSttFileWriterConfig {
|
||||
STsdb *tsdb;
|
||||
|
|
|
@ -356,7 +356,7 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr
|
|||
TAOS_CHECK_GOTO(tsdbUpgradeStt(tsdb, pDFileSet, reader, fset), &lino, _exit);
|
||||
}
|
||||
|
||||
(void)tsdbDataFReaderClose(&reader);
|
||||
tsdbDataFReaderClose(&reader);
|
||||
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND(fileSetArray, fset), &lino, _exit);
|
||||
|
||||
|
@ -568,7 +568,7 @@ _exit:
|
|||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
|
||||
}
|
||||
(void)tsdbDelFReaderClose(&reader);
|
||||
tsdbDelFReaderClose(&reader);
|
||||
taosArrayDestroy(aDelIdx);
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ _exit:
|
|||
#endif
|
||||
|
||||
void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) {
|
||||
(void)tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem);
|
||||
TAOS_UNUSED(tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem));
|
||||
}
|
||||
|
||||
#ifdef BUILD_NO_CALL
|
||||
|
|
|
@ -122,7 +122,7 @@ SVAsync *vnodeAsyncs[3];
|
|||
#define MIN_ASYNC_ID 1
|
||||
#define MAX_ASYNC_ID (sizeof(vnodeAsyncs) / sizeof(vnodeAsyncs[0]) - 1)
|
||||
|
||||
static int32_t vnodeAsyncTaskDone(SVAsync *async, SVATask *task) {
|
||||
static void vnodeAsyncTaskDone(SVAsync *async, SVATask *task) {
|
||||
int32_t ret;
|
||||
|
||||
if (task->channel != NULL && task->channel->scheduled == task) {
|
||||
|
@ -176,10 +176,9 @@ static int32_t vnodeAsyncTaskDone(SVAsync *async, SVATask *task) {
|
|||
} else {
|
||||
(void)taosThreadCondBroadcast(&task->waitCond);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t vnodeAsyncCancelAllTasks(SVAsync *async, SArray *cancelArray) {
|
||||
static void vnodeAsyncCancelAllTasks(SVAsync *async, SArray *cancelArray) {
|
||||
while (async->queue[0].next != &async->queue[0] || async->queue[1].next != &async->queue[1] ||
|
||||
async->queue[2].next != &async->queue[2]) {
|
||||
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
|
||||
|
@ -193,11 +192,10 @@ static int32_t vnodeAsyncCancelAllTasks(SVAsync *async, SArray *cancelArray) {
|
|||
.arg = task->arg,
|
||||
}));
|
||||
}
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *vnodeAsyncLoop(void *arg) {
|
||||
|
@ -215,14 +213,14 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
|
||||
// finish last running task
|
||||
if (worker->runningTask != NULL) {
|
||||
(void)vnodeAsyncTaskDone(async, worker->runningTask);
|
||||
vnodeAsyncTaskDone(async, worker->runningTask);
|
||||
worker->runningTask = NULL;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (async->stop || worker->workerId >= async->numWorkers) {
|
||||
if (async->stop) { // cancel all tasks
|
||||
(void)vnodeAsyncCancelAllTasks(async, cancelArray);
|
||||
vnodeAsyncCancelAllTasks(async, cancelArray);
|
||||
}
|
||||
worker->state = EVA_WORKER_STATE_STOP;
|
||||
async->numLaunchWorkers--;
|
||||
|
@ -269,7 +267,8 @@ static void *vnodeAsyncLoop(void *arg) {
|
|||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
// do run the task
|
||||
(void)worker->runningTask->execute(worker->runningTask->arg);
|
||||
int32_t code = worker->runningTask->execute(worker->runningTask->arg);
|
||||
TAOS_UNUSED(code);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -369,7 +368,7 @@ static int32_t vnodeAsyncInit(SVAsync **async, const char *label) {
|
|||
}
|
||||
ret = vHashInit(&(*async)->taskTable, vnodeAsyncTaskHash, vnodeAsyncTaskCompare);
|
||||
if (ret != 0) {
|
||||
(void)vHashDestroy(&(*async)->channelTable);
|
||||
vHashDestroy(&(*async)->channelTable);
|
||||
(void)taosThreadMutexDestroy(&(*async)->mutex);
|
||||
(void)taosThreadCondDestroy(&(*async)->hasTask);
|
||||
taosMemoryFree(*async);
|
||||
|
@ -418,29 +417,32 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
|
|||
(void)taosThreadMutexDestroy(&(*async)->mutex);
|
||||
(void)taosThreadCondDestroy(&(*async)->hasTask);
|
||||
|
||||
(void)vHashDestroy(&(*async)->channelTable);
|
||||
(void)vHashDestroy(&(*async)->taskTable);
|
||||
vHashDestroy(&(*async)->channelTable);
|
||||
vHashDestroy(&(*async)->taskTable);
|
||||
taosMemoryFree(*async);
|
||||
*async = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t vnodeAsyncLaunchWorker(SVAsync *async) {
|
||||
static void vnodeAsyncLaunchWorker(SVAsync *async) {
|
||||
for (int32_t i = 0; i < async->numWorkers; i++) {
|
||||
if (async->workers[i].state == EVA_WORKER_STATE_ACTIVE) {
|
||||
continue;
|
||||
} else if (async->workers[i].state == EVA_WORKER_STATE_STOP) {
|
||||
(void)taosThreadJoin(async->workers[i].thread, NULL);
|
||||
TAOS_UNUSED(taosThreadJoin(async->workers[i].thread, NULL));
|
||||
async->workers[i].state = EVA_WORKER_STATE_UINIT;
|
||||
}
|
||||
|
||||
(void)taosThreadCreate(&async->workers[i].thread, NULL, vnodeAsyncLoop, &async->workers[i]);
|
||||
int32_t ret = taosThreadCreate(&async->workers[i].thread, NULL, vnodeAsyncLoop, &async->workers[i]);
|
||||
if (ret) {
|
||||
vError("failed to create worker thread since %s", tstrerror(ret));
|
||||
} else {
|
||||
async->workers[i].state = EVA_WORKER_STATE_ACTIVE;
|
||||
async->numLaunchWorkers++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t vnodeAsyncOpen(int32_t numOfThreads) {
|
||||
|
@ -450,21 +452,25 @@ int32_t vnodeAsyncOpen(int32_t numOfThreads) {
|
|||
// vnode-commit
|
||||
code = vnodeAsyncInit(&vnodeAsyncs[1], "vnode-commit");
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
(void)vnodeAsyncSetWorkers(1, numOfThreads);
|
||||
|
||||
code = vnodeAsyncSetWorkers(1, numOfThreads);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
// vnode-merge
|
||||
code = vnodeAsyncInit(&vnodeAsyncs[2], "vnode-merge");
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
(void)vnodeAsyncSetWorkers(2, numOfThreads);
|
||||
|
||||
code = vnodeAsyncSetWorkers(2, numOfThreads);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
_exit:
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t vnodeAsyncClose() {
|
||||
(void)vnodeAsyncDestroy(&vnodeAsyncs[1]);
|
||||
(void)vnodeAsyncDestroy(&vnodeAsyncs[2]);
|
||||
return 0;
|
||||
void vnodeAsyncClose() {
|
||||
int32_t ret;
|
||||
ret = vnodeAsyncDestroy(&vnodeAsyncs[1]);
|
||||
ret = vnodeAsyncDestroy(&vnodeAsyncs[2]);
|
||||
}
|
||||
|
||||
int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*execute)(void *), void (*cancel)(void *),
|
||||
|
@ -474,6 +480,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t ret;
|
||||
int64_t id;
|
||||
SVAsync *async = vnodeAsyncs[channelID->async];
|
||||
|
||||
|
@ -501,7 +508,8 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
SVAChannel channel = {
|
||||
.channelId = channelID->id,
|
||||
};
|
||||
(void)vHashGet(async->channelTable, &channel, (void **)&task->channel);
|
||||
ret = vHashGet(async->channelTable, &channel, (void **)&task->channel);
|
||||
TAOS_UNUSED(ret);
|
||||
if (task->channel == NULL) {
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
|
@ -513,7 +521,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
task->taskId = id = ++async->nextTaskId;
|
||||
|
||||
// add task to hash table
|
||||
int32_t ret = vHashPut(async->taskTable, task);
|
||||
ret = vHashPut(async->taskTable, task);
|
||||
if (ret != 0) {
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
(void)taosThreadCondDestroy(&task->waitCond);
|
||||
|
@ -539,7 +547,7 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
if (async->numIdleWorkers > 0) {
|
||||
(void)taosThreadCondSignal(&(async->hasTask));
|
||||
} else if (async->numLaunchWorkers < async->numWorkers) {
|
||||
(void)vnodeAsyncLaunchWorker(async);
|
||||
vnodeAsyncLaunchWorker(async);
|
||||
}
|
||||
} else if (task->channel->scheduled->state == EVA_TASK_STATE_RUNNING ||
|
||||
priority >= VATASK_PIORITY(task->channel->scheduled)) {
|
||||
|
@ -579,9 +587,9 @@ int32_t vnodeAsync(SVAChannelID *channelID, EVAPriority priority, int32_t (*exec
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t vnodeAWait(SVATaskID *taskID) {
|
||||
void vnodeAWait(SVATaskID *taskID) {
|
||||
if (taskID == NULL || taskID->async < MIN_ASYNC_ID || taskID->async > MAX_ASYNC_ID || taskID->id <= 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
return;
|
||||
}
|
||||
|
||||
SVAsync *async = vnodeAsyncs[taskID->async];
|
||||
|
@ -592,7 +600,7 @@ int32_t vnodeAWait(SVATaskID *taskID) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
(void)vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
int32_t ret = vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
if (task) {
|
||||
task->numWait++;
|
||||
(void)taosThreadCondWait(&task->waitCond, &async->mutex);
|
||||
|
@ -605,8 +613,6 @@ int32_t vnodeAWait(SVATaskID *taskID) {
|
|||
}
|
||||
|
||||
(void)taosThreadMutexUnlock(&async->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t vnodeACancel(SVATaskID *taskID) {
|
||||
|
@ -625,14 +631,14 @@ int32_t vnodeACancel(SVATaskID *taskID) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
(void)vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
ret = vHashGet(async->taskTable, &task2, (void **)&task);
|
||||
if (task) {
|
||||
if (task->state == EVA_TASK_STATE_WAITTING) {
|
||||
cancel = task->cancel;
|
||||
arg = task->arg;
|
||||
task->next->prev = task->prev;
|
||||
task->prev->next = task->next;
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
} else {
|
||||
ret = TSDB_CODE_FAILED;
|
||||
}
|
||||
|
@ -651,6 +657,7 @@ int32_t vnodeAsyncSetWorkers(int64_t asyncID, int32_t numWorkers) {
|
|||
if (asyncID < MIN_ASYNC_ID || asyncID > MAX_ASYNC_ID || numWorkers <= 0 || numWorkers > VNODE_ASYNC_MAX_WORKERS) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t ret;
|
||||
SVAsync *async = vnodeAsyncs[asyncID];
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
async->numWorkers = numWorkers;
|
||||
|
@ -725,12 +732,13 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
|
||||
(void)taosThreadMutexLock(&async->mutex);
|
||||
|
||||
(void)vHashGet(async->channelTable, &channel2, (void **)&channel);
|
||||
int32_t ret = vHashGet(async->channelTable, &channel2, (void **)&channel);
|
||||
TAOS_UNUSED(ret);
|
||||
if (channel) {
|
||||
// unregister channel
|
||||
channel->next->prev = channel->prev;
|
||||
channel->prev->next = channel->next;
|
||||
(void)vHashDrop(async->channelTable, channel);
|
||||
ret = vHashDrop(async->channelTable, channel);
|
||||
async->numChannels--;
|
||||
|
||||
// cancel all waiting tasks
|
||||
|
@ -745,7 +753,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
.arg = task->arg,
|
||||
}));
|
||||
}
|
||||
(void)vnodeAsyncTaskDone(async, task);
|
||||
vnodeAsyncTaskDone(async, task);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -760,7 +768,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
|||
.arg = channel->scheduled->arg,
|
||||
}));
|
||||
}
|
||||
(void)vnodeAsyncTaskDone(async, channel->scheduled);
|
||||
vnodeAsyncTaskDone(async, channel->scheduled);
|
||||
}
|
||||
taosMemoryFree(channel);
|
||||
} else {
|
||||
|
|
|
@ -58,7 +58,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int vnodeBufPoolDestroy(SVBufPool *pPool) {
|
||||
static void vnodeBufPoolDestroy(SVBufPool *pPool) {
|
||||
vnodeBufPoolReset(pPool);
|
||||
if (pPool->lock) {
|
||||
(void)taosThreadSpinDestroy(pPool->lock);
|
||||
|
@ -66,7 +66,6 @@ static int vnodeBufPoolDestroy(SVBufPool *pPool) {
|
|||
}
|
||||
(void)taosThreadMutexDestroy(&pPool->mutex);
|
||||
taosMemoryFree(pPool);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnodeOpenBufPool(SVnode *pVnode) {
|
||||
|
@ -77,7 +76,7 @@ int vnodeOpenBufPool(SVnode *pVnode) {
|
|||
int32_t code;
|
||||
if ((code = vnodeBufPoolCreate(pVnode, i, size, &pVnode->aBufPool[i]))) {
|
||||
vError("vgId:%d, failed to open vnode buffer pool since %s", TD_VID(pVnode), tstrerror(terrno));
|
||||
(void)vnodeCloseBufPool(pVnode);
|
||||
vnodeCloseBufPool(pVnode);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -90,16 +89,15 @@ int vnodeOpenBufPool(SVnode *pVnode) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int vnodeCloseBufPool(SVnode *pVnode) {
|
||||
void vnodeCloseBufPool(SVnode *pVnode) {
|
||||
for (int32_t i = 0; i < VNODE_BUFPOOL_SEGMENTS; i++) {
|
||||
if (pVnode->aBufPool[i]) {
|
||||
(void)vnodeBufPoolDestroy(pVnode->aBufPool[i]);
|
||||
vnodeBufPoolDestroy(pVnode->aBufPool[i]);
|
||||
pVnode->aBufPool[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
vDebug("vgId:%d, vnode buffer pool is closed", TD_VID(pVnode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vnodeBufPoolReset(SVBufPool *pPool) {
|
||||
|
@ -234,7 +232,7 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
|
|||
vInfo("vgId:%d, buffer pool of id %d size changed from %" PRId64 " to %" PRId64, TD_VID(pVnode), pPool->id,
|
||||
pPool->node.size, size);
|
||||
|
||||
(void)vnodeBufPoolDestroy(pPool);
|
||||
vnodeBufPoolDestroy(pPool);
|
||||
pPool = pNewPool;
|
||||
pVnode->aBufPool[pPool->id] = pPool;
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
|
|||
if (info == NULL) return -1;
|
||||
tjsonGetNumberValue(info, "nodePort", pNode->nodePort, code);
|
||||
if (code) return code;
|
||||
(void)tjsonGetStringValue(info, "nodeFqdn", pNode->nodeFqdn);
|
||||
code = tjsonGetStringValue(info, "nodeFqdn", pNode->nodeFqdn);
|
||||
tjsonGetNumberValue(info, "nodeId", pNode->nodeId, code);
|
||||
if (code) return code;
|
||||
tjsonGetNumberValue(info, "clusterId", pNode->clusterId, code);
|
||||
|
|
|
@ -272,7 +272,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
int64_t lastCommitted = pInfo->info.state.committed;
|
||||
|
||||
// wait last commit task
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
|
||||
code = syncNodeGetConfig(pVnode->sync, &pVnode->config.syncCfg);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -293,7 +293,8 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
code = vnodeSaveInfo(dir, &pInfo->info);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
(void)tsdbPreCommit(pVnode->pTsdb);
|
||||
code = tsdbPreCommit(pVnode->pTsdb);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = metaPrepareAsyncCommit(pVnode->pMeta);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -395,10 +396,15 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
int vnodeSyncCommit(SVnode *pVnode) {
|
||||
(void)vnodeAsyncCommit(pVnode);
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
return 0;
|
||||
int32_t vnodeSyncCommit(SVnode *pVnode) {
|
||||
int32_t lino;
|
||||
int32_t code = vnodeAsyncCommit(pVnode);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
|
||||
_exit:
|
||||
vError("vgId:%d, %s failed at line %d since %s", TD_VID(pVnode), __func__, lino, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
||||
static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
||||
|
@ -419,7 +425,8 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
|||
|
||||
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, dir, TSDB_FILENAME_LEN);
|
||||
|
||||
(void)syncBeginSnapshot(pVnode->sync, pInfo->info.state.committed);
|
||||
code = syncBeginSnapshot(pVnode->sync, pInfo->info.state.committed);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = tsdbCommitBegin(pVnode->pTsdb, pInfo);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -456,7 +463,8 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
(void)syncEndSnapshot(pVnode->sync);
|
||||
code = syncEndSnapshot(pVnode->sync);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
|
|
@ -71,9 +71,9 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t vHashDestroy(SVHashTable** ht) {
|
||||
void vHashDestroy(SVHashTable** ht) {
|
||||
if (ht == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ht) {
|
||||
|
@ -81,7 +81,6 @@ int32_t vHashDestroy(SVHashTable** ht) {
|
|||
taosMemoryFree(*ht);
|
||||
(*ht) = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t vHashPut(SVHashTable* ht, void* obj) {
|
||||
|
|
|
@ -34,7 +34,7 @@ int vnodeInit(int nthreads, StopDnodeFp stopDnodeFp) {
|
|||
|
||||
void vnodeCleanup() {
|
||||
if (atomic_val_compare_exchange_32(&VINIT, 1, 0) == 0) return;
|
||||
(void)vnodeAsyncClose();
|
||||
vnodeAsyncClose();
|
||||
walCleanUp();
|
||||
smaCleanUp();
|
||||
}
|
||||
|
|
|
@ -502,7 +502,7 @@ _err:
|
|||
if (pVnode->pTsdb) (void)tsdbClose(&pVnode->pTsdb);
|
||||
if (pVnode->pSma) (void)smaClose(pVnode->pSma);
|
||||
if (pVnode->pMeta) (void)metaClose(&pVnode->pMeta);
|
||||
if (pVnode->freeList) (void)vnodeCloseBufPool(pVnode);
|
||||
if (pVnode->freeList) vnodeCloseBufPool(pVnode);
|
||||
|
||||
taosMemoryFree(pVnode);
|
||||
return NULL;
|
||||
|
@ -517,7 +517,7 @@ void vnodePostClose(SVnode *pVnode) { vnodeSyncPostClose(pVnode); }
|
|||
|
||||
void vnodeClose(SVnode *pVnode) {
|
||||
if (pVnode) {
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
(void)vnodeAChannelDestroy(&pVnode->commitChannel, true);
|
||||
vnodeSyncClose(pVnode);
|
||||
vnodeQueryClose(pVnode);
|
||||
|
@ -526,7 +526,7 @@ void vnodeClose(SVnode *pVnode) {
|
|||
if (pVnode->pTsdb) tsdbClose(&pVnode->pTsdb);
|
||||
(void)smaClose(pVnode->pSma);
|
||||
if (pVnode->pMeta) metaClose(&pVnode->pMeta);
|
||||
(void)vnodeCloseBufPool(pVnode);
|
||||
vnodeCloseBufPool(pVnode);
|
||||
|
||||
// destroy handle
|
||||
(void)tsem_destroy(&pVnode->syncSem);
|
||||
|
|
|
@ -586,7 +586,7 @@ _exit:
|
|||
}
|
||||
|
||||
extern int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb);
|
||||
extern int32_t tsdbEnableBgTask(STsdb *pTsdb);
|
||||
extern void tsdbEnableBgTask(STsdb *pTsdb);
|
||||
|
||||
static int32_t vnodeCancelAndDisableAllBgTask(SVnode *pVnode) {
|
||||
(void)tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
|
@ -596,7 +596,7 @@ static int32_t vnodeCancelAndDisableAllBgTask(SVnode *pVnode) {
|
|||
}
|
||||
|
||||
static int32_t vnodeEnableBgTask(SVnode *pVnode) {
|
||||
(void)tsdbEnableBgTask(pVnode->pTsdb);
|
||||
tsdbEnableBgTask(pVnode->pTsdb);
|
||||
(void)vnodeAChannelInit(1, &pVnode->commitChannel);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2041,7 +2041,7 @@ _exit:
|
|||
}
|
||||
|
||||
extern int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb);
|
||||
extern int32_t tsdbEnableBgTask(STsdb *pTsdb);
|
||||
extern void tsdbEnableBgTask(STsdb *pTsdb);
|
||||
|
||||
static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
||||
bool walChanged = false;
|
||||
|
@ -2143,10 +2143,10 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t ver, void *pRe
|
|||
if (req.sttTrigger > 1 && pVnode->config.sttTrigger > 1) {
|
||||
pVnode->config.sttTrigger = req.sttTrigger;
|
||||
} else {
|
||||
(void)vnodeAWait(&pVnode->commitTask);
|
||||
vnodeAWait(&pVnode->commitTask);
|
||||
(void)tsdbDisableAndCancelAllBgTask(pVnode->pTsdb);
|
||||
pVnode->config.sttTrigger = req.sttTrigger;
|
||||
(void)tsdbEnableBgTask(pVnode->pTsdb);
|
||||
tsdbEnableBgTask(pVnode->pTsdb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -528,6 +528,7 @@ static void seqJoinLaunchNewRetrieveImpl(SOperatorInfo* pOperator, SSDataBlock**
|
|||
qDebug("%s dynamic post task begin", GET_TASKID(pOperator->pTaskInfo));
|
||||
code = pOperator->pDownstream[1]->fpSet.getNextExtFn(pOperator->pDownstream[1], pParam, ppRes);
|
||||
if (*ppRes && (code == 0)) {
|
||||
blockDataCheck(*ppRes, false);
|
||||
pPost->isStarted = true;
|
||||
pStbJoin->execInfo.postBlkNum++;
|
||||
pStbJoin->execInfo.postBlkRows += (*ppRes)->info.rows;
|
||||
|
|
|
@ -692,8 +692,10 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
if (pTaskInfo->pOpParam && !pTaskInfo->paramSet) {
|
||||
pTaskInfo->paramSet = true;
|
||||
code = pTaskInfo->pRoot->fpSet.getNextExtFn(pTaskInfo->pRoot, pTaskInfo->pOpParam, &pRes);
|
||||
blockDataCheck(pRes, false);
|
||||
} else {
|
||||
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||
blockDataCheck(pRes, false);
|
||||
}
|
||||
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
@ -740,6 +742,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo
|
|||
}
|
||||
|
||||
code = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot, &pRes);
|
||||
blockDataCheck(pRes, false);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
@ -839,6 +842,8 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
|||
qError("%s failed at line %d, code:%s %s", __func__, lino, tstrerror(code), GET_TASKID(pTaskInfo));
|
||||
}
|
||||
|
||||
blockDataCheck(*pRes, false);
|
||||
|
||||
uint64_t el = (taosGetTimestampUs() - st);
|
||||
|
||||
pTaskInfo->cost.elapsedTime += el;
|
||||
|
|
|
@ -617,6 +617,8 @@ int32_t doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* p
|
|||
code = TSDB_CODE_SUCCESS;
|
||||
|
||||
_err:
|
||||
blockDataCheck(pBlock, true);
|
||||
|
||||
colDataDestroy(p);
|
||||
taosMemoryFree(p);
|
||||
return code;
|
||||
|
|
|
@ -733,6 +733,8 @@ static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* p
|
|||
}
|
||||
}
|
||||
|
||||
blockDataCheck(pBlock, false);
|
||||
|
||||
*ppRes = pBlock;
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -474,8 +474,11 @@ int32_t mJoinCopyMergeMidBlk(SMJoinMergeCtx* pCtx, SSDataBlock** ppMid, SSDataBl
|
|||
pCtx->midRemains = false;
|
||||
} else {
|
||||
int32_t copyRows = pMore->info.capacity - pMore->info.rows;
|
||||
if (copyRows > 0) {
|
||||
MJ_ERR_RET(blockDataMergeNRows(pMore, pLess, pLess->info.rows - copyRows, copyRows));
|
||||
blockDataShrinkNRows(pLess, copyRows);
|
||||
}
|
||||
|
||||
pCtx->midRemains = true;
|
||||
}
|
||||
|
||||
|
@ -1742,6 +1745,7 @@ int32_t mJoinMainProcess(struct SOperatorInfo* pOperator, SSDataBlock** pResBloc
|
|||
if (pBlock && pBlock->info.rows > 0) {
|
||||
*pResBlock = pBlock;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ static int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock);
|
|||
int32_t sortMergeloadNextDataBlock(void* param, SSDataBlock** ppBlock) {
|
||||
SOperatorInfo* pOperator = (SOperatorInfo*)param;
|
||||
int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock);
|
||||
blockDataCheck(*ppBlock, false);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -524,6 +525,7 @@ int32_t doMultiwayMerge(SOperatorInfo* pOperator, SSDataBlock** pResBlock) {
|
|||
|
||||
if ((*pResBlock) != NULL) {
|
||||
pOperator->resultInfo.totalRows += (*pResBlock)->info.rows;
|
||||
blockDataCheck(*pResBlock, false);
|
||||
} else {
|
||||
setOperatorCompleted(pOperator);
|
||||
}
|
||||
|
|
|
@ -868,12 +868,14 @@ int32_t setOperatorParams(struct SOperatorInfo* pOperator, SOperatorParam* pInpu
|
|||
SSDataBlock* getNextBlockFromDownstream(struct SOperatorInfo* pOperator, int32_t idx) {
|
||||
SSDataBlock* p = NULL;
|
||||
int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, true, &p);
|
||||
blockDataCheck(p, false);
|
||||
return (code == 0)? p:NULL;
|
||||
}
|
||||
|
||||
SSDataBlock* getNextBlockFromDownstreamRemain(struct SOperatorInfo* pOperator, int32_t idx) {
|
||||
SSDataBlock* p = NULL;
|
||||
int32_t code = getNextBlockFromDownstreamImpl(pOperator, idx, false, &p);
|
||||
blockDataCheck(p, false);
|
||||
return (code == 0)? p:NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -328,7 +328,9 @@ static int32_t getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock,
|
|||
|
||||
int32_t loadNextDataBlock(void* param, SSDataBlock** ppBlock) {
|
||||
SOperatorInfo* pOperator = (SOperatorInfo*)param;
|
||||
return pOperator->fpSet.getNextFn(pOperator, ppBlock);
|
||||
int32_t code = pOperator->fpSet.getNextFn(pOperator, ppBlock);
|
||||
blockDataCheck(*ppBlock, false);
|
||||
return code;
|
||||
}
|
||||
|
||||
// todo refactor: merged with fetch fp
|
||||
|
@ -611,6 +613,7 @@ int32_t fetchNextGroupSortDataBlock(void* param, SSDataBlock** ppBlock) {
|
|||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
if (block != NULL) {
|
||||
blockDataCheck(block, false);
|
||||
if (block->info.id.groupId == grpSortOpInfo->currGroupId) {
|
||||
grpSortOpInfo->childOpStatus = CHILD_OP_SAME_GROUP;
|
||||
*ppBlock = block;
|
||||
|
|
|
@ -1082,7 +1082,7 @@ static int32_t openStateWindowAggOptr(SOperatorInfo* pOperator) {
|
|||
}
|
||||
|
||||
pInfo->binfo.pRes->info.scanFlag = pBlock->info.scanFlag;
|
||||
code = setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
|
||||
code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
code = blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
|
||||
|
@ -1567,7 +1567,7 @@ static int32_t doSessionWindowAggNext(SOperatorInfo* pOperator, SSDataBlock** pp
|
|||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
// the pDataBlock are always the same one, no need to call this again
|
||||
code = setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
|
||||
code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
|
||||
code = blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
|
||||
|
|
|
@ -43,7 +43,7 @@ int32_t doMakePointFunc(double x, double y, unsigned char **output) {
|
|||
|
||||
*output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE);
|
||||
if (*output == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ int32_t doGeomFromTextFunc(const char *input, unsigned char **output) {
|
|||
// make a zero ending string
|
||||
inputGeom = taosMemoryCalloc(1, varDataLen(input) + 1);
|
||||
if (inputGeom == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
(void)memcpy(inputGeom, varDataVal(input), varDataLen(input));
|
||||
|
@ -83,7 +83,7 @@ int32_t doGeomFromTextFunc(const char *input, unsigned char **output) {
|
|||
|
||||
*output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE);
|
||||
if (*output == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ int32_t doAsTextFunc(unsigned char *input, char **output) {
|
|||
size_t size = strlen(outputWKT);
|
||||
*output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE);
|
||||
if (*output == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ static int32_t initWktRegex(pcre2_code **ppRegex, pcre2_match_data **ppMatchData
|
|||
int32_t code = 0;
|
||||
char *wktPatternWithSpace = taosMemoryCalloc(4, 1024);
|
||||
if (NULL == wktPatternWithSpace) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)sprintf(
|
||||
|
|
|
@ -112,7 +112,7 @@ int32_t indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
|||
int code = TSDB_CODE_SUCCESS;
|
||||
SIndex* idx = taosMemoryCalloc(1, sizeof(SIndex));
|
||||
if (idx == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, END);
|
||||
}
|
||||
|
||||
idx->lru = taosLRUCacheInit(opts->cacheSize, -1, .5);
|
||||
|
|
|
@ -137,7 +137,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
|
||||
CacheTerm* pCt = taosMemoryCalloc(1, sizeof(CacheTerm));
|
||||
if (pCt == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pCt->colVal = term->colVal;
|
||||
|
@ -206,7 +206,7 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr
|
|||
|
||||
CacheTerm* pCt = taosMemoryCalloc(1, sizeof(CacheTerm));
|
||||
if (pCt == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pCt->colVal = term->colVal;
|
||||
|
@ -584,7 +584,7 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
|
|||
// encode data
|
||||
CacheTerm* ct = taosMemoryCalloc(1, sizeof(CacheTerm));
|
||||
if (ct == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
// set up key
|
||||
ct->colType = term->colType;
|
||||
|
@ -594,7 +594,7 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
|
|||
ct->colVal = (char*)taosMemoryCalloc(1, sizeof(char) * (term->nColVal + 1));
|
||||
if (ct->colVal == NULL) {
|
||||
taosMemoryFree(ct);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(ct->colVal, term->colVal, term->nColVal);
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(int64_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -332,7 +332,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(uint8_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -340,7 +340,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_TINYINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(int8_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -348,7 +348,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(int16_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -361,7 +361,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_INT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(int32_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -369,7 +369,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_UINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(uint32_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -377,7 +377,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_BIGINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
sprintf(*dst, "%" PRIu64, *(uint64_t*)src);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -385,7 +385,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)idxInt2str(*(uint64_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -393,7 +393,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_FLOAT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
sprintf(*dst, "%.9lf", *(float*)src);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -401,7 +401,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
sprintf(*dst, "%.9lf", *(double*)src);
|
||||
tlen = strlen(*dst);
|
||||
|
@ -410,7 +410,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src));
|
||||
*dst = taosMemoryCalloc(1, tlen + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src));
|
||||
*dst = (char*)*dst - tlen;
|
||||
|
@ -422,7 +422,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src));
|
||||
*dst = taosMemoryCalloc(1, tlen + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src));
|
||||
*dst = (char*)*dst - tlen;
|
||||
|
|
|
@ -197,7 +197,7 @@ static FORCE_INLINE int32_t sifGetValueFromNode(SNode *node, char **value) {
|
|||
}
|
||||
char *tv = taosMemoryCalloc(1, valLen + 1);
|
||||
if (tv == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(tv, pData, valLen);
|
||||
|
@ -273,7 +273,7 @@ static int32_t sifInitParamValByCol(SNode *r, SNode *l, SIFParam *param, SIFCtx
|
|||
}
|
||||
char *tv = taosMemoryCalloc(1, valLen + 1);
|
||||
if (tv == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
memcpy(tv, pData, valLen);
|
||||
|
@ -373,7 +373,7 @@ static int32_t sifInitOperParams(SIFParam **params, SOperatorNode *node, SIFCtx
|
|||
SIFParam *paramList = taosMemoryCalloc(nParam, sizeof(SIFParam));
|
||||
|
||||
if (NULL == paramList) {
|
||||
SIF_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SIF_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (nodeType(node->pLeft) == QUERY_NODE_OPERATOR &&
|
||||
|
@ -405,7 +405,7 @@ static int32_t sifInitParamList(SIFParam **params, SNodeList *nodeList, SIFCtx *
|
|||
SIFParam *tParams = taosMemoryCalloc(nodeList->length, sizeof(SIFParam));
|
||||
if (tParams == NULL) {
|
||||
indexError("failed to calloc, nodeList: %p", nodeList);
|
||||
SIF_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SIF_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SListCell *cell = nodeList->pHead;
|
||||
|
|
|
@ -201,7 +201,7 @@ int32_t tfileReaderCreate(IFileCtx* ctx, TFileReader** pReader) {
|
|||
int32_t code = 0;
|
||||
TFileReader* reader = taosMemoryCalloc(1, sizeof(TFileReader));
|
||||
if (reader == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
reader->ctx = ctx;
|
||||
reader->remove = false;
|
||||
|
@ -609,7 +609,7 @@ int32_t tfileWriterCreate(IFileCtx* ctx, TFileHeader* header, TFileWriter** pWri
|
|||
int32_t code = 0;
|
||||
TFileWriter* tw = taosMemoryCalloc(1, sizeof(TFileWriter));
|
||||
if (tw == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
indexError("index: %" PRIu64 " failed to alloc TFilerWriter since %s", header->suid, tstrerror(code));
|
||||
return code;
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ int32_t tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
int32_t cap = 4 * 1024;
|
||||
char* buf = taosMemoryCalloc(1, cap);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
|
@ -1137,7 +1137,7 @@ static int32_t tfileGetFileList(const char* path, SArray** ppResult) {
|
|||
size_t len = strlen(path) + 1 + strlen(file) + 1;
|
||||
char* buf = taosMemoryCalloc(1, len);
|
||||
if (buf == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
|
||||
sprintf(buf, "%s/%s", path, file);
|
||||
|
|
|
@ -44,7 +44,7 @@ int32_t iIntersection(SArray *in, SArray *out) {
|
|||
}
|
||||
MergeIndex *mi = taosMemoryCalloc(sz, sizeof(MergeIndex));
|
||||
if (mi == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int i = 0; i < sz; i++) {
|
||||
SArray *t = taosArrayGetP(in, i);
|
||||
|
|
|
@ -179,7 +179,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
|
|||
int32_t len = pSrc->node.resType.bytes + 1;
|
||||
pDst->datum.p = taosMemoryCalloc(1, len);
|
||||
if (NULL == pDst->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pDst->datum.p, pSrc->datum.p, len);
|
||||
break;
|
||||
|
@ -188,7 +188,7 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
|
|||
int32_t len = getJsonValueLen(pSrc->datum.p);
|
||||
pDst->datum.p = taosMemoryCalloc(1, len);
|
||||
if (NULL == pDst->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pDst->datum.p, pSrc->datum.p, len);
|
||||
break;
|
||||
|
|
|
@ -4083,14 +4083,14 @@ static int32_t jsonToDatum(const SJson* pJson, void* pObj) {
|
|||
case TSDB_DATA_TYPE_GEOMETRY: {
|
||||
pNode->datum.p = taosMemoryCalloc(1, pNode->node.resType.bytes + 1);
|
||||
if (NULL == pNode->datum.p) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
varDataSetLen(pNode->datum.p, pNode->node.resType.bytes - VARSTR_HEADER_SIZE);
|
||||
if (TSDB_DATA_TYPE_NCHAR == pNode->node.resType.type) {
|
||||
char* buf = taosMemoryCalloc(1, pNode->node.resType.bytes * 2 + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == buf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
code = tjsonGetStringValue(pJson, jkValueDatum, buf);
|
||||
|
@ -4112,12 +4112,12 @@ static int32_t jsonToDatum(const SJson* pJson, void* pObj) {
|
|||
case TSDB_DATA_TYPE_JSON: {
|
||||
pNode->datum.p = taosMemoryCalloc(1, pNode->node.resType.bytes);
|
||||
if (NULL == pNode->datum.p) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
char* buf = taosMemoryCalloc(1, pNode->node.resType.bytes * 2 + 1);
|
||||
if (NULL == buf) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
code = tjsonGetStringValue(pJson, jkValueDatum, buf);
|
||||
|
|
|
@ -952,7 +952,7 @@ static int32_t msgToDatum(STlv* pTlv, void* pObj) {
|
|||
}
|
||||
pNode->datum.p = taosMemoryCalloc(1, pNode->node.resType.bytes + 1);
|
||||
if (NULL == pNode->datum.p) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
code = tlvDecodeBinary(pTlv, pNode->datum.p);
|
||||
|
|
|
@ -120,7 +120,7 @@ static int32_t callocNodeChunk(SNodeAllocator* pAllocator, SNodeMemChunk** pOutC
|
|||
SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize);
|
||||
if (NULL == pNewChunk) {
|
||||
if (pOutChunk) *pOutChunk = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pNewChunk->pBuf = (char*)(pNewChunk + 1);
|
||||
pNewChunk->availableSize = pAllocator->chunkSize;
|
||||
|
@ -141,7 +141,7 @@ static int32_t callocNodeChunk(SNodeAllocator* pAllocator, SNodeMemChunk** pOutC
|
|||
static int32_t nodesCallocImpl(int32_t size, void** pOut) {
|
||||
if (NULL == g_pNodeAllocator) {
|
||||
*pOut = taosMemoryCalloc(1, size);
|
||||
if (!*pOut) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!*pOut) return terrno;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ void nodesFree(void* p) {
|
|||
static int32_t createNodeAllocator(int32_t chunkSize, SNodeAllocator** pAllocator) {
|
||||
*pAllocator = taosMemoryCalloc(1, sizeof(SNodeAllocator));
|
||||
if (NULL == *pAllocator) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*pAllocator)->chunkSize = chunkSize;
|
||||
int32_t code = callocNodeChunk(*pAllocator, NULL);
|
||||
|
|
|
@ -48,7 +48,7 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char*
|
|||
static int32_t smlBoundColumnData(SArray* cols, SBoundColInfo* pBoundInfo, SSchema* pSchema, bool isTag) {
|
||||
bool* pUseCols = taosMemoryCalloc(pBoundInfo->numOfCols, sizeof(bool));
|
||||
if (NULL == pUseCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pBoundInfo->numOfBound = 0;
|
||||
|
@ -139,7 +139,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem
|
|||
int32_t output = 0;
|
||||
void* p = taosMemoryCalloc(1, kv->length * TSDB_NCHAR_SIZE);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)(p), kv->length * TSDB_NCHAR_SIZE, &output)) {
|
||||
|
@ -240,7 +240,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
|||
taosMemoryFree(tmp);
|
||||
} else {
|
||||
uError("SML smlBuildCol out of memory");
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
|||
}
|
||||
char* pUcs4 = taosMemoryCalloc(1, size);
|
||||
if (NULL == pUcs4) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, size, &len)) {
|
||||
|
@ -315,7 +315,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
|
||||
pCreateTblReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pCreateTblReq) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
insBuildCreateTbReq(pCreateTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, pTableMeta->tableInfo.numOfTags,
|
||||
|
@ -323,7 +323,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
|
||||
pCreateTblReq->ctb.stbName = taosMemoryCalloc(1, sTableNameLen + 1);
|
||||
if (pCreateTblReq->ctb.stbName == NULL){
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
(void)memcpy(pCreateTblReq->ctb.stbName, sTableName, sTableNameLen);
|
||||
|
@ -400,7 +400,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
|||
int32_t len = 0;
|
||||
char* pUcs4 = taosMemoryCalloc(1, pColSchema->bytes - VARSTR_HEADER_SIZE);
|
||||
if (NULL == pUcs4) {
|
||||
ret = TSDB_CODE_OUT_OF_MEMORY;
|
||||
ret = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)pUcs4, pColSchema->bytes - VARSTR_HEADER_SIZE, &len)) {
|
||||
|
|
|
@ -182,7 +182,7 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, const char** pSql, E
|
|||
|
||||
bool* pUseCols = taosMemoryCalloc(pBoundInfo->numOfCols, sizeof(bool));
|
||||
if (NULL == pUseCols) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pBoundInfo->numOfBound = 0;
|
||||
|
@ -768,7 +768,7 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p
|
|||
}
|
||||
pStmt->pCreateTblReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pStmt->pCreateTblReq) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
insBuildCreateTbReq(pStmt->pCreateTblReq, pStmt->targetTableName.tname, pTag, pStmt->pTableMeta->suid,
|
||||
pStmt->usingTableName.tname, pTagName, pStmt->pTableMeta->tableInfo.numOfTags,
|
||||
|
@ -850,7 +850,7 @@ static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) {
|
|||
case TSDB_DATA_TYPE_NCHAR:
|
||||
pValue->datum.p = taosMemoryCalloc(1, pVal->nData + VARSTR_HEADER_SIZE);
|
||||
if (NULL == pValue->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pValue->datum.p, pVal->nData);
|
||||
memcpy(varDataVal(pValue->datum.p), pVal->pData, pVal->nData);
|
||||
|
@ -1916,7 +1916,7 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod
|
|||
|
||||
pStbRowsCxt->pCreateCtbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (pStbRowsCxt->pCreateCtbReq == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
insBuildCreateTbReq(pStbRowsCxt->pCreateCtbReq, pStbRowsCxt->ctbName.tname, pStbRowsCxt->pTag,
|
||||
|
@ -2325,7 +2325,7 @@ static void destroyStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
|
|||
static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDataContext** ppStbRowsCxt) {
|
||||
SStbRowsDataContext* pStbRowsCxt = taosMemoryCalloc(1, sizeof(SStbRowsDataContext));
|
||||
if (!pStbRowsCxt) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
tNameAssign(&pStbRowsCxt->stbName, &pStmt->targetTableName);
|
||||
int32_t code = collectUseTable(&pStbRowsCxt->stbName, pStmt->pTableNameHashObj);
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct SKvParam {
|
|||
int32_t qCloneCurrentTbData(STableDataCxt* pDataBlock, SSubmitTbData** pData) {
|
||||
*pData = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
||||
if (NULL == *pData) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SSubmitTbData* pNew = *pData;
|
||||
|
@ -190,7 +190,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
int32_t output = 0;
|
||||
void* p = taosMemoryCalloc(1, colLen * TSDB_NCHAR_SIZE);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(bind[c].buffer, colLen, (TdUcs4*)(p), colLen * TSDB_NCHAR_SIZE, &output)) {
|
||||
|
@ -224,7 +224,7 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
|||
if (NULL == pDataBlock->pData->pCreateTbReq) {
|
||||
pDataBlock->pData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pDataBlock->pData->pCreateTbReq) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
int32_t output = 0;
|
||||
void* p = taosMemoryCalloc(1, colLen * TSDB_NCHAR_SIZE);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
if (!taosMbsToUcs4(bind[c].buffer, colLen, (TdUcs4*)(p), colLen * TSDB_NCHAR_SIZE, &output)) {
|
||||
|
@ -564,7 +564,7 @@ int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const c
|
|||
if (NULL == pDataBlock->pData->pCreateTbReq) {
|
||||
pDataBlock->pData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pDataBlock->pData->pCreateTbReq) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -593,13 +593,13 @@ static int32_t convertStmtStbNcharCol2(SMsgBuf* pMsgBuf, SSchema* pSchema, TAOS_
|
|||
|
||||
dst->buffer = taosMemoryCalloc(src->num, max_buf_len);
|
||||
if (NULL == dst->buffer) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
dst->length = taosMemoryCalloc(src->num, sizeof(int32_t));
|
||||
if (NULL == dst->length) {
|
||||
taosMemoryFreeClear(dst->buffer);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
char* src_buf = src->buffer;
|
||||
|
@ -865,7 +865,7 @@ int32_t buildBoundFields(int32_t numOfBound, int16_t* boundColumns, SSchema* pSc
|
|||
if (fields) {
|
||||
*fields = taosMemoryCalloc(numOfBound, sizeof(TAOS_FIELD_E));
|
||||
if (NULL == *fields) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SSchema* schema = &pSchema[boundColumns[0]];
|
||||
|
@ -972,7 +972,7 @@ int32_t qCloneStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, bool rese
|
|||
|
||||
*pDst = taosMemoryCalloc(1, sizeof(STableDataCxt));
|
||||
if (NULL == *pDst) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
STableDataCxt* pNewCxt = (STableDataCxt*)*pDst;
|
||||
|
@ -1050,7 +1050,7 @@ int32_t qRebuildStmtDataBlock(STableDataCxt** pDst, STableDataCxt* pSrc, uint64_
|
|||
if (rebuildCreateTb && NULL == pBlock->pData->pCreateTbReq) {
|
||||
pBlock->pData->pCreateTbReq = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == pBlock->pData->pCreateTbReq) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ int32_t insInitBoundColsInfo(int32_t numOfBound, SBoundColInfo* pInfo) {
|
|||
pInfo->hasBoundCols = false;
|
||||
pInfo->pColIndex = taosMemoryCalloc(numOfBound, sizeof(int16_t));
|
||||
if (NULL == pInfo->pColIndex) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
for (int32_t i = 0; i < numOfBound; ++i) {
|
||||
pInfo->pColIndex[i] = i;
|
||||
|
@ -230,7 +230,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
|||
STableDataCxt* pTableCxt = taosMemoryCalloc(1, sizeof(STableDataCxt));
|
||||
if (NULL == pTableCxt) {
|
||||
*pOutput = NULL;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -264,7 +264,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pTableCxt->pData = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
||||
if (NULL == pTableCxt->pData) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
pTableCxt->pData->flags = (pCreateTbReq != NULL && NULL != *pCreateTbReq) ? SUBMIT_REQ_AUTO_CREATE_TABLE : 0;
|
||||
pTableCxt->pData->flags |= colMode ? SUBMIT_REQ_COLUMN_DATA_FORMAT : 0;
|
||||
|
@ -300,7 +300,7 @@ static int32_t rebuildTableData(SSubmitTbData* pSrc, SSubmitTbData** pDst) {
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSubmitTbData* pTmp = taosMemoryCalloc(1, sizeof(SSubmitTbData));
|
||||
if (NULL == pTmp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
} else {
|
||||
pTmp->flags = pSrc->flags;
|
||||
pTmp->suid = pSrc->suid;
|
||||
|
@ -477,12 +477,12 @@ static int32_t createVgroupDataCxt(STableDataCxt* pTableCxt, SHashObj* pVgroupHa
|
|||
SVgroupDataCxt** pOutput) {
|
||||
SVgroupDataCxt* pVgCxt = taosMemoryCalloc(1, sizeof(SVgroupDataCxt));
|
||||
if (NULL == pVgCxt) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVgCxt->pData = taosMemoryCalloc(1, sizeof(SSubmitReq2));
|
||||
if (NULL == pVgCxt->pData) {
|
||||
insDestroyVgroupDataCxt(pVgCxt);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pVgCxt->vgId = pTableCxt->pMeta->vgId;
|
||||
|
@ -840,7 +840,7 @@ int32_t insBuildVgDataBlocks(SHashObj* pVgroupsHashObj, SArray* pVgDataCxtList,
|
|||
}
|
||||
SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == dst) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
dst->numOfTables = taosArrayGetSize(src->pData->aSubmitTbData);
|
||||
|
|
|
@ -2560,6 +2560,13 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
|
|||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
||||
"%s function is not supported in partition query", pFunc->functionName);
|
||||
}
|
||||
|
||||
if (NULL != pSelect->pWindow) {
|
||||
if (QUERY_NODE_EVENT_WINDOW == nodeType(pSelect->pWindow) || QUERY_NODE_COUNT_WINDOW == nodeType(pSelect->pWindow)) {
|
||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
||||
"%s function is not supported in count/event window", pFunc->functionName);
|
||||
}
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -2929,7 +2936,7 @@ static int32_t rewriteQueryTimeFunc(STranslateContext* pCxt, int64_t val, SNode*
|
|||
|
||||
char* pStr = taosMemoryCalloc(1, 20);
|
||||
if (NULL == pStr) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
snprintf(pStr, 20, "%" PRId64 "", val);
|
||||
int32_t code = rewriteFuncToValue(pCxt, &pStr, pNode);
|
||||
|
@ -3769,7 +3776,7 @@ static int32_t toVgroupsInfo(SArray* pVgs, SVgroupsInfo** pVgsInfo) {
|
|||
size_t vgroupNum = taosArrayGetSize(pVgs);
|
||||
*pVgsInfo = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo) * vgroupNum);
|
||||
if (NULL == *pVgsInfo) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*pVgsInfo)->numOfVgroups = vgroupNum;
|
||||
for (int32_t i = 0; i < vgroupNum; ++i) {
|
||||
|
@ -3798,7 +3805,7 @@ static int32_t dnodeToVgroupsInfo(SArray* pDnodes, SVgroupsInfo** pVgsInfo) {
|
|||
size_t ndnode = taosArrayGetSize(pDnodes);
|
||||
*pVgsInfo = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo) * ndnode);
|
||||
if (NULL == *pVgsInfo) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*pVgsInfo)->numOfVgroups = ndnode;
|
||||
for (int32_t i = 0; i < ndnode; ++i) {
|
||||
|
@ -3926,7 +3933,7 @@ static int32_t setSuperTableVgroupList(STranslateContext* pCxt, SName* pName, SR
|
|||
static int32_t setNormalTableVgroupList(STranslateContext* pCxt, SName* pName, SRealTableNode* pRealTable) {
|
||||
pRealTable->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
|
||||
if (NULL == pRealTable->pVgroupList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pRealTable->pVgroupList->numOfVgroups = 1;
|
||||
return getTableHashVgroupImpl(pCxt, pName, pRealTable->pVgroupList->vgroups);
|
||||
|
@ -4034,7 +4041,7 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
|||
}
|
||||
SVgroupsInfo* pVgpsInfo = taosMemoryCalloc(1, sizeof(int32_t) + sizeof(SVgroupInfo));
|
||||
if (!pVgpsInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
pVgpsInfo->numOfVgroups = 1;
|
||||
|
@ -6348,7 +6355,7 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
|||
const char* pTbName = taosArrayGetP(pInfo->aTbnames, k);
|
||||
char* pNewTbName = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN + 1);
|
||||
if (!pNewTbName) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
if (NULL == taosArrayPush(pTbNames, &pNewTbName)) {
|
||||
|
@ -8682,7 +8689,7 @@ static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision,
|
|||
int32_t numOfField = LIST_LENGTH(pStmt->pCols) + LIST_LENGTH(pStmt->pTags);
|
||||
STableMeta* pMeta = taosMemoryCalloc(1, sizeof(STableMeta) + numOfField * sizeof(SSchema));
|
||||
if (NULL == pMeta) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pMeta->tableType = TSDB_SUPER_TABLE;
|
||||
pMeta->tableInfo.numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||
|
@ -9478,7 +9485,7 @@ static int32_t checkCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt* pS
|
|||
static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
|
||||
int32_t code = checkCreateSmaIndex(pCxt, pStmt);
|
||||
pStmt->pReq = taosMemoryCalloc(1, sizeof(SMCreateSmaReq));
|
||||
if (pStmt->pReq == NULL) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pStmt->pReq == NULL) code = terrno;
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = buildCreateSmaReq(pCxt, pStmt, pStmt->pReq);
|
||||
}
|
||||
|
@ -11388,7 +11395,7 @@ static int32_t readFromFile(char* pName, int32_t* len, char** buf) {
|
|||
|
||||
*buf = taosMemoryCalloc(1, *len);
|
||||
if (*buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
TdFilePtr tfile = taosOpenFile(pName, O_RDONLY | O_BINARY);
|
||||
|
@ -11648,7 +11655,7 @@ static int32_t translateShowVariables(STranslateContext* pCxt, SShowStmt* pStmt)
|
|||
static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateDatabaseStmt* pStmt) {
|
||||
pStmt->pCfg = taosMemoryCalloc(1, sizeof(SDbCfgInfo));
|
||||
if (NULL == pStmt->pCfg) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SName name;
|
||||
|
@ -11662,7 +11669,7 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
|
|||
static int32_t translateShowCreateTable(STranslateContext* pCxt, SShowCreateTableStmt* pStmt) {
|
||||
pStmt->pDbCfg = taosMemoryCalloc(1, sizeof(SDbCfgInfo));
|
||||
if (NULL == pStmt->pDbCfg) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t code = getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pDbCfg);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
@ -12086,7 +12093,7 @@ static int32_t translateCreateTSMA(STranslateContext* pCxt, SCreateTSMAStmt* pSt
|
|||
SName useTbName = {0};
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
pStmt->pReq = taosMemoryCalloc(1, sizeof(SMCreateSmaReq));
|
||||
if (!pStmt->pReq) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pStmt->pReq) return terrno;
|
||||
}
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
code = buildCreateTSMAReq(pCxt, pStmt, pStmt->pReq, &useTbName);
|
||||
|
@ -12394,7 +12401,7 @@ static int32_t extractQueryResultSchema(const SNodeList* pProjections, int32_t*
|
|||
*numOfCols = LIST_LENGTH(pProjections);
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SNode* pNode;
|
||||
|
@ -12426,7 +12433,7 @@ static int32_t extractExplainResultSchema(int32_t* numOfCols, SSchema** pSchema)
|
|||
*numOfCols = 1;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
(*pSchema)[0].bytes = TSDB_EXPLAIN_RESULT_ROW_SIZE;
|
||||
|
@ -12439,7 +12446,7 @@ static int32_t extractDescribeResultSchema(STableMeta* pMeta, int32_t* numOfCols
|
|||
if (pMeta && useCompress(pMeta->tableType)) *numOfCols = DESCRIBE_RESULT_COLS_COMPRESS;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -12479,7 +12486,7 @@ static int32_t extractShowCreateDatabaseResultSchema(int32_t* numOfCols, SSchema
|
|||
*numOfCols = 2;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -12497,7 +12504,7 @@ static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema**
|
|||
*numOfCols = 2;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -12515,7 +12522,7 @@ static int32_t extractShowCreateViewResultSchema(int32_t* numOfCols, SSchema** p
|
|||
*numOfCols = SHOW_CREATE_VIEW_RESULT_COLS;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -12533,7 +12540,7 @@ static int32_t extractShowVariablesResultSchema(int32_t* numOfCols, SSchema** pS
|
|||
*numOfCols = 3;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -12555,7 +12562,7 @@ static int32_t extractCompactDbResultSchema(int32_t* numOfCols, SSchema** pSchem
|
|||
*numOfCols = COMPACT_DB_RESULT_COLS;
|
||||
*pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema));
|
||||
if (NULL == (*pSchema)) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pSchema)[0].type = TSDB_DATA_TYPE_BINARY;
|
||||
|
@ -13281,7 +13288,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
|
|||
req.ntb.schemaRow.pSchema = taosMemoryCalloc(req.ntb.schemaRow.nCols, sizeof(SSchema));
|
||||
if (NULL == req.name || NULL == req.ntb.schemaRow.pSchema) {
|
||||
tdDestroySVCreateTbReq(&req);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
if (pStmt->ignoreExists) {
|
||||
req.flags |= TD_CREATE_IF_NOT_EXISTS;
|
||||
|
@ -13358,7 +13365,7 @@ static int32_t serializeVgroupCreateTableBatch(SVgroupCreateTableBatch* pTbBatch
|
|||
SVgDataBlocks* pVgData = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == pVgData) {
|
||||
taosMemoryFreeClear(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVgData->vg = pTbBatch->info;
|
||||
pVgData->pData = buf;
|
||||
|
@ -14081,7 +14088,7 @@ static int32_t prepareReadCsvFile(STranslateContext* pCxt, SCreateSubTableFromFi
|
|||
{
|
||||
pCreateInfo = taosMemoryCalloc(1, sizeof(SCreateTbInfo));
|
||||
if (NULL == pCreateInfo) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERR;
|
||||
}
|
||||
|
||||
|
@ -14391,7 +14398,7 @@ static int32_t serializeVgroupDropTableBatch(SVgroupDropTableBatch* pTbBatch, SA
|
|||
SVgDataBlocks* pVgData = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == pVgData) {
|
||||
taosMemoryFreeClear(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVgData->vg = pTbBatch->info;
|
||||
pVgData->pData = buf;
|
||||
|
@ -14841,7 +14848,7 @@ static int32_t serializeAlterTbReq(STranslateContext* pCxt, SAlterTableStmt* pSt
|
|||
SVgDataBlocks* pVgData = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == pVgData) {
|
||||
taosMemoryFree(pMsg);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVgData->vg = vg;
|
||||
pVgData->pData = pMsg;
|
||||
|
@ -14946,7 +14953,7 @@ static int32_t serializeFlushVgroup(SVgroupInfo* pVg, SArray* pBufArray) {
|
|||
SVgDataBlocks* pVgData = taosMemoryCalloc(1, sizeof(SVgDataBlocks));
|
||||
if (NULL == pVgData) {
|
||||
taosMemoryFree(buf);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pVgData->vg = *pVg;
|
||||
pVgData->pData = buf;
|
||||
|
|
|
@ -463,7 +463,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
|
|||
int32_t valLen = (int32_t)strlen(jsonValue);
|
||||
char* tmp = taosMemoryCalloc(1, valLen * TSDB_NCHAR_SIZE);
|
||||
if (!tmp) {
|
||||
retCode = TSDB_CODE_OUT_OF_MEMORY;
|
||||
retCode = terrno;
|
||||
goto end;
|
||||
}
|
||||
val.type = TSDB_DATA_TYPE_NCHAR;
|
||||
|
@ -1039,7 +1039,7 @@ int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, S
|
|||
int32_t buildTableMetaFromViewMeta(STableMeta** pMeta, SViewMeta* pViewMeta) {
|
||||
*pMeta = taosMemoryCalloc(1, sizeof(STableMeta) + pViewMeta->numOfCols * sizeof(SSchema));
|
||||
if (NULL == *pMeta) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*pMeta)->uid = pViewMeta->viewId;
|
||||
(*pMeta)->vgId = MNODE_HANDLE;
|
||||
|
|
|
@ -172,7 +172,7 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
|
|||
case TSDB_DATA_TYPE_VARBINARY:
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
|
||||
memcpy(varDataVal(pVal->datum.p), pParam->buffer, pVal->node.resType.bytes);
|
||||
|
@ -182,7 +182,7 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
|
|||
case TSDB_DATA_TYPE_GEOMETRY:
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
|
||||
strncpy(varDataVal(pVal->datum.p), (const char*)pParam->buffer, pVal->node.resType.bytes);
|
||||
|
@ -192,7 +192,7 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
|
|||
pVal->node.resType.bytes *= TSDB_NCHAR_SIZE;
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t output = 0;
|
||||
|
@ -460,7 +460,7 @@ static int32_t setValueByBindParam2(SValueNode* pVal, TAOS_STMT2_BIND* pParam) {
|
|||
case TSDB_DATA_TYPE_VARBINARY:
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
|
||||
memcpy(varDataVal(pVal->datum.p), pParam->buffer, pVal->node.resType.bytes);
|
||||
|
@ -470,7 +470,7 @@ static int32_t setValueByBindParam2(SValueNode* pVal, TAOS_STMT2_BIND* pParam) {
|
|||
case TSDB_DATA_TYPE_GEOMETRY:
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
varDataSetLen(pVal->datum.p, pVal->node.resType.bytes);
|
||||
strncpy(varDataVal(pVal->datum.p), (const char*)pParam->buffer, pVal->node.resType.bytes);
|
||||
|
@ -480,7 +480,7 @@ static int32_t setValueByBindParam2(SValueNode* pVal, TAOS_STMT2_BIND* pParam) {
|
|||
pVal->node.resType.bytes *= TSDB_NCHAR_SIZE;
|
||||
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
|
||||
if (NULL == pVal->datum.p) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t output = 0;
|
||||
|
|
|
@ -202,7 +202,7 @@ static int32_t rewriteExprsForSelect(SNodeList* pExprs, SSelectStmt* pSelect, ES
|
|||
if (NULL != pRewriteExprs) {
|
||||
cxt.pOutputs = taosMemoryCalloc(LIST_LENGTH(pExprs), sizeof(bool));
|
||||
if (NULL == cxt.pOutputs) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
nodesRewriteSelectStmt(pSelect, clause, doRewriteExpr, &cxt);
|
||||
|
|
|
@ -2883,7 +2883,7 @@ static int32_t smaIndexOptCreateSmaScan(SScanLogicNode* pScan, STableIndexInfo*
|
|||
pSmaScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
|
||||
if (!pSmaScan->pVgroupList) {
|
||||
nodesDestroyNode((SNode*)pSmaScan);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
code = nodesCloneList(pCols, &pSmaScan->node.pTargets);
|
||||
if (NULL == pSmaScan->node.pTargets) {
|
||||
|
@ -4297,7 +4297,7 @@ static void lastRowScanOptRemoveUslessTargets(SNodeList* pTargets, SNodeList* pL
|
|||
static int32_t lastRowScanBuildFuncTypes(SScanLogicNode* pScan, SColumnNode* pColNode, int32_t funcType) {
|
||||
SFunctParam* pFuncTypeParam = taosMemoryCalloc(1, sizeof(SFunctParam));
|
||||
if (NULL == pFuncTypeParam) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pFuncTypeParam->type = funcType;
|
||||
if (NULL == pScan->pFuncTypes) {
|
||||
|
@ -4311,7 +4311,7 @@ static int32_t lastRowScanBuildFuncTypes(SScanLogicNode* pScan, SColumnNode* pCo
|
|||
pFuncTypeParam->pCol = taosMemoryCalloc(1, sizeof(SColumn));
|
||||
if (NULL == pFuncTypeParam->pCol) {
|
||||
taosMemoryFree(pFuncTypeParam);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
pFuncTypeParam->pCol->colId = pColNode->colId;
|
||||
strcpy(pFuncTypeParam->pCol->name, pColNode->colName);
|
||||
|
@ -6671,7 +6671,7 @@ static int32_t fillTSMAOptCtx(STSMAOptCtx* pTsmaOptCtx, SScanLogicNode* pScan) {
|
|||
|
||||
if (nodeType(pTsmaOptCtx->pParent) == QUERY_NODE_LOGIC_PLAN_WINDOW) {
|
||||
pTsmaOptCtx->queryInterval = taosMemoryCalloc(1, sizeof(SInterval));
|
||||
if (!pTsmaOptCtx->queryInterval) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pTsmaOptCtx->queryInterval) return terrno;
|
||||
|
||||
SWindowLogicNode* pWindow = (SWindowLogicNode*)pTsmaOptCtx->pParent;
|
||||
pTsmaOptCtx->queryInterval->interval = pWindow->interval;
|
||||
|
@ -7076,7 +7076,7 @@ static int32_t tsmaOptRewriteTbname(const STSMAOptCtx* pTsmaOptCtx, SNode** pTbN
|
|||
pValue->node.resType = ((SExprNode*)(*pTbNameNode))->resType;
|
||||
pValue->literal = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1);
|
||||
pValue->datum.p = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN + 1 + VARSTR_HEADER_SIZE);
|
||||
if (!pValue->literal || !pValue->datum.p) code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (!pValue->literal || !pValue->datum.p) code = terrno;
|
||||
}
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
|
@ -7204,7 +7204,7 @@ static int32_t tsmaOptRewriteScan(STSMAOptCtx* pTsmaOptCtx, SScanLogicNode* pNew
|
|||
int32_t len = sizeof(int32_t) + sizeof(SVgroupInfo) * pVgpsInfo->numOfVgroups;
|
||||
pNewScan->pVgroupList = taosMemoryCalloc(1, len);
|
||||
if (!pNewScan->pVgroupList) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
memcpy(pNewScan->pVgroupList, pVgpsInfo, len);
|
||||
|
|
|
@ -47,7 +47,7 @@ static int32_t doSetScanVgroup(SLogicNode* pNode, const SVgroupInfo* pVgroup, bo
|
|||
SScanLogicNode* pScan = (SScanLogicNode*)pNode;
|
||||
pScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo));
|
||||
if (NULL == pScan->pVgroupList) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
memcpy(pScan->pVgroupList->vgroups, pVgroup, sizeof(SVgroupInfo));
|
||||
*pFound = true;
|
||||
|
|
|
@ -623,7 +623,7 @@ int32_t cloneSVreateTbReq(SVCreateTbReq* pSrc, SVCreateTbReq** pDst) {
|
|||
|
||||
*pDst = taosMemoryCalloc(1, sizeof(SVCreateTbReq));
|
||||
if (NULL == *pDst) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pDst)->flags = pSrc->flags;
|
||||
|
|
|
@ -436,7 +436,7 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes
|
|||
|
||||
output.pData = taosMemoryCalloc(1, len);
|
||||
if (NULL == output.pData) {
|
||||
QW_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QW_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
code = dsGetDataBlock(ctx->sinkHandle, &output);
|
||||
|
@ -1324,7 +1324,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S
|
|||
if (NULL == mgmt) {
|
||||
qError("calloc %d failed", (int32_t)sizeof(SQWorker));
|
||||
(void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1);
|
||||
QW_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
QW_RET(terrno);
|
||||
}
|
||||
|
||||
mgmt->cfg.maxSchedulerNum = QW_DEFAULT_SCHEDULER_NUMBER;
|
||||
|
|
|
@ -468,20 +468,20 @@ int32_t filterInitUnitsFields(SFilterInfo *info) {
|
|||
info->unitSize = FILTER_DEFAULT_UNIT_SIZE;
|
||||
info->units = taosMemoryCalloc(info->unitSize, sizeof(SFilterUnit));
|
||||
if (info->units == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
info->fields[FLD_TYPE_COLUMN].num = 0;
|
||||
info->fields[FLD_TYPE_COLUMN].size = FILTER_DEFAULT_FIELD_SIZE;
|
||||
info->fields[FLD_TYPE_COLUMN].fields = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].size, sizeof(SFilterField));
|
||||
if (info->fields[FLD_TYPE_COLUMN].fields == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
info->fields[FLD_TYPE_VALUE].num = 0;
|
||||
info->fields[FLD_TYPE_VALUE].size = FILTER_DEFAULT_FIELD_SIZE;
|
||||
info->fields[FLD_TYPE_VALUE].fields = taosMemoryCalloc(info->fields[FLD_TYPE_VALUE].size, sizeof(SFilterField));
|
||||
if (info->fields[FLD_TYPE_VALUE].fields == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -497,7 +497,7 @@ static FORCE_INLINE int32_t filterNewRange(SFilterRangeCtx *ctx, SFilterRange *r
|
|||
} else {
|
||||
*r = taosMemoryCalloc(1, sizeof(SFilterRangeNode));
|
||||
if (*r == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ int32_t filterInitRangeCtx(int32_t type, int32_t options, SFilterRangeCtx **ctx)
|
|||
|
||||
*ctx = taosMemoryCalloc(1, sizeof(SFilterRangeCtx));
|
||||
if (*ctx == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(*ctx)->type = type;
|
||||
(*ctx)->options = options;
|
||||
|
@ -961,7 +961,7 @@ int32_t filterDetachCnfGroup(SFilterGroup *gp1, SFilterGroup *gp2, SArray *group
|
|||
gp.unitNum = gp1->unitNum + gp2->unitNum;
|
||||
gp.unitIdxs = taosMemoryCalloc(gp.unitNum, sizeof(*gp.unitIdxs));
|
||||
if (NULL == gp.unitIdxs) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(gp.unitIdxs, gp1->unitIdxs, gp1->unitNum * sizeof(*gp.unitIdxs));
|
||||
(void)memcpy(gp.unitIdxs + gp1->unitNum, gp2->unitIdxs, gp2->unitNum * sizeof(*gp.unitIdxs));
|
||||
|
@ -1300,7 +1300,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
|
|||
|
||||
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
|
||||
if (out.columnData == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
out.columnData->info.type = type;
|
||||
out.columnData->info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; // reserved space for simple_copy
|
||||
|
@ -1330,7 +1330,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode *tree, SArray *group) {
|
|||
} else {
|
||||
void *data = taosMemoryCalloc(1, tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes); // reserved space for simple_copy
|
||||
if (NULL == data) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
break;
|
||||
}
|
||||
(void)memcpy(data, nodesGetValueFromNode(valueNode), tDataTypes[type].bytes);
|
||||
|
@ -1729,11 +1729,9 @@ EDealRes fltTreeToGroup(SNode *pNode, void *pContext) {
|
|||
return DEAL_RES_IGNORE_CHILD;
|
||||
}
|
||||
|
||||
ctx->code = TSDB_CODE_APP_ERROR;
|
||||
|
||||
fltError("invalid condition type, type:%d", node->condType);
|
||||
|
||||
return DEAL_RES_ERROR;
|
||||
FLT_ERR_JRET(TSDB_CODE_APP_ERROR);
|
||||
}
|
||||
|
||||
if (QUERY_NODE_OPERATOR == nType) {
|
||||
|
@ -2203,13 +2201,13 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
|
|||
size_t bufBytes = TMAX(dType->bytes, sizeof(int64_t));
|
||||
fi->data = taosMemoryCalloc(1, bufBytes);
|
||||
if (fi->data == NULL) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
assignVal(fi->data, nodesGetValueFromNode(var), dType->bytes, type);
|
||||
} else {
|
||||
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
|
||||
if (out.columnData == NULL) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
out.columnData->info.type = type;
|
||||
out.columnData->info.precision = precision;
|
||||
|
@ -2230,7 +2228,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
|
|||
: TMAX(out.columnData->info.bytes, sizeof(int64_t));
|
||||
fi->data = taosMemoryCalloc(1, bufBytes);
|
||||
if (fi->data== NULL) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
size_t valBytes = IS_VAR_DATA_TYPE(type) ? varDataTLen(out.columnData->pData) : out.columnData->info.bytes;
|
||||
|
@ -2446,7 +2444,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx **gRes, int32_t
|
|||
|
||||
gRes[gResIdx] = taosMemoryCalloc(1, sizeof(SFilterGroupCtx));
|
||||
if (gRes[gResIdx] == NULL) {
|
||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo));
|
||||
if (gRes[gResIdx]->colInfo == NULL) {
|
||||
|
@ -2876,7 +2874,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
|
|||
info->groups = taosMemoryCalloc(info->groupNum, sizeof(*info->groups));
|
||||
if (info->groups == NULL) {
|
||||
info->groupNum = 0;
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2888,7 +2886,7 @@ int32_t filterConvertGroupFromArray(SFilterInfo *info, SArray *group) {
|
|||
pg->unitFlags = taosMemoryCalloc(pg->unitNum, sizeof(*pg->unitFlags));
|
||||
if (pg->unitFlags == NULL) {
|
||||
pg->unitNum = 0;
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
info->groups[i] = *pg;
|
||||
}
|
||||
|
@ -3005,7 +3003,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
uint32_t *idxNum = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxNum));
|
||||
if (idxNum == NULL) {
|
||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
for (int32_t i = 0; i < gResNum; ++i) {
|
||||
for (uint32_t m = 0; m < gRes[i]->colNum; ++m) {
|
||||
|
@ -3031,7 +3029,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
|
|||
if (idxs == NULL) {
|
||||
idxs = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxs));
|
||||
if (idxs == NULL) {
|
||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3044,7 +3042,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx **gRes, int32_
|
|||
info->colRange = taosMemoryCalloc(colNum, POINTER_BYTES);
|
||||
if (info->colRange == NULL) {
|
||||
info->colRangeNum = 0;
|
||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < gResNum; ++i) {
|
||||
|
@ -3584,7 +3582,7 @@ int32_t filterExecuteImplMisc(void *pinfo, int32_t numOfRows, SColumnInfoData *p
|
|||
(info->cunits[uidx].optr == OP_TYPE_MATCH || info->cunits[uidx].optr == OP_TYPE_NMATCH)) {
|
||||
char *newColData = taosMemoryCalloc(info->cunits[uidx].dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1);
|
||||
if (newColData == NULL) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData));
|
||||
if (len < 0) {
|
||||
|
@ -3659,7 +3657,7 @@ int32_t filterExecuteImpl(void *pinfo, int32_t numOfRows, SColumnInfoData *pRes,
|
|||
(cunit->optr == OP_TYPE_MATCH || cunit->optr == OP_TYPE_NMATCH)) {
|
||||
char *newColData = taosMemoryCalloc(cunit->dataSize * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE, 1);
|
||||
if (newColData == NULL) {
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(colData), varDataLen(colData), varDataVal(newColData));
|
||||
if (len < 0) {
|
||||
|
@ -3740,7 +3738,7 @@ int32_t filterPreprocess(SFilterInfo *info) {
|
|||
int32_t gResNum = 0;
|
||||
SFilterGroupCtx **gRes = taosMemoryCalloc(info->groupNum, sizeof(SFilterGroupCtx *));
|
||||
if (gRes == NULL) {
|
||||
FLT_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
FLT_ERR_JRET(filterMergeGroupUnits(info, gRes, &gResNum));
|
||||
|
@ -5218,7 +5216,7 @@ int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pInfo, uint32_t options)
|
|||
*pInfo = taosMemoryCalloc(1, sizeof(SFilterInfo));
|
||||
if (NULL == *pInfo) {
|
||||
fltError("taosMemoryCalloc %d failed", (int32_t)sizeof(SFilterInfo));
|
||||
FLT_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
FLT_ERR_RET(terrno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ int32_t sclConvertToTsValueNode(int8_t precision, SValueNode *valueNode) {
|
|||
int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarParam *pParam) {
|
||||
SColumnInfoData *pColumnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
||||
if (pColumnData == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -99,7 +98,7 @@ int32_t sclExtendResRows(SScalarParam *pDst, SScalarParam *pSrc, SArray *pBlockL
|
|||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
if (NULL == pLeft) {
|
||||
sclError("calloc %d failed", (int32_t)sizeof(SScalarParam));
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
pLeft->numOfRows = pb->info.rows;
|
||||
|
@ -131,7 +130,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
|||
SListCell *cell = nodeList->pNodeList->pHead;
|
||||
SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))};
|
||||
if (out.columnData == NULL) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
int32_t len = 0;
|
||||
void *buf = NULL;
|
||||
|
@ -485,7 +484,7 @@ int32_t sclInitParamList(SScalarParam **pParams, SNodeList *pParamList, SScalarC
|
|||
SScalarParam *paramList = taosMemoryCalloc(*paramNum, sizeof(SScalarParam));
|
||||
if (NULL == paramList) {
|
||||
sclError("calloc %d failed", (int32_t)((*paramNum) * sizeof(SScalarParam)));
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (pParamList) {
|
||||
|
@ -581,7 +580,7 @@ int32_t sclInitOperatorParams(SScalarParam **pParams, SOperatorNode *node, SScal
|
|||
SScalarParam *paramList = taosMemoryCalloc(paramNum, sizeof(SScalarParam));
|
||||
if (NULL == paramList) {
|
||||
sclError("calloc %d failed", (int32_t)(paramNum * sizeof(SScalarParam)));
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SCL_ERR_JRET(sclSetOperatorValueType(node, ctx));
|
||||
|
@ -608,7 +607,7 @@ int32_t sclGetNodeRes(SNode *node, SScalarCtx *ctx, SScalarParam **res) {
|
|||
int32_t rowNum = 0;
|
||||
*res = taosMemoryCalloc(1, sizeof(**res));
|
||||
if (NULL == *res) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
SCL_ERR_RET(sclInitParam(node, *res, ctx, &rowNum));
|
||||
|
|
|
@ -618,7 +618,7 @@ static int32_t trimHelper(char *orgStr, char* remStr, int32_t orgLen, int32_t re
|
|||
static int32_t convVarcharToNchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) {
|
||||
*output = taosMemoryCalloc(inputLen * TSDB_NCHAR_SIZE, 1);
|
||||
if (NULL == *output) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
bool ret = taosMbsToUcs4(input, inputLen, (TdUcs4 *)*output, inputLen * TSDB_NCHAR_SIZE, outputLen);
|
||||
if (!ret) {
|
||||
|
@ -631,7 +631,7 @@ static int32_t convVarcharToNchar(char *input, char **output, int32_t inputLen,
|
|||
static int32_t convNcharToVarchar(char *input, char **output, int32_t inputLen, int32_t *outputLen) {
|
||||
*output = taosMemoryCalloc(inputLen, 1);
|
||||
if (NULL == *output) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
*outputLen = taosUcs4ToMbs((TdUcs4 *)input, inputLen, *output);
|
||||
if (*outputLen < 0) {
|
||||
|
@ -814,7 +814,7 @@ static int32_t concatCopyHelper(const char *input, char *output, bool hasNchar,
|
|||
if (hasNchar && type == TSDB_DATA_TYPE_VARCHAR) {
|
||||
TdUcs4 *newBuf = taosMemoryCalloc((varDataLen(input) + 1) * TSDB_NCHAR_SIZE, 1);
|
||||
if (NULL == newBuf) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
int32_t len = varDataLen(input);
|
||||
bool ret = taosMbsToUcs4(varDataVal(input), len, newBuf, (varDataLen(input) + 1) * TSDB_NCHAR_SIZE, &len);
|
||||
|
@ -853,10 +853,10 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
char *outputBuf = NULL;
|
||||
|
||||
if (NULL == pInputData) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
if (NULL == input) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
int32_t inputLen = 0;
|
||||
|
@ -882,7 +882,7 @@ int32_t concatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
|
||||
outputBuf = taosMemoryCalloc(outputLen, 1);
|
||||
if (NULL == outputBuf) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t k = 0; k < numOfRows; ++k) {
|
||||
|
@ -928,7 +928,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
char *outputBuf = NULL;
|
||||
|
||||
if (NULL == pInputData) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
int32_t inputLen = 0;
|
||||
|
@ -960,7 +960,7 @@ int32_t concatWsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p
|
|||
|
||||
outputBuf = taosMemoryCalloc(outputLen, 1);
|
||||
if (NULL == outputBuf) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t k = 0; k < numOfRows; ++k) {
|
||||
|
@ -1016,7 +1016,7 @@ static int32_t doCaseConvFunction(SScalarParam *pInput, int32_t inputNum, SScala
|
|||
int32_t outputLen = pInputData->varmeta.length;
|
||||
char *outputBuf = taosMemoryCalloc(outputLen, 1);
|
||||
if (outputBuf == NULL) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *output = outputBuf;
|
||||
|
@ -1070,7 +1070,7 @@ static int32_t doTrimFunction(SScalarParam *pInput, int32_t inputNum, SScalarPar
|
|||
}
|
||||
char *outputBuf = taosMemoryCalloc(outputLen, 1);
|
||||
if (outputBuf == NULL) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *output = outputBuf;
|
||||
|
@ -1528,7 +1528,7 @@ int32_t replaceFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO
|
|||
|
||||
char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1);
|
||||
if (NULL == outputBuf) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||
|
@ -1643,7 +1643,7 @@ int32_t substrIdxFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
|||
}
|
||||
char *outputBuf = taosMemoryCalloc(outputLen + VARSTR_HEADER_SIZE, 1);
|
||||
if (NULL == outputBuf) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
for (int32_t k = 0; k < numOfRows; ++k) {
|
||||
|
@ -1741,7 +1741,7 @@ int32_t repeatFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu
|
|||
numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows);
|
||||
char *outputBuf = taosMemoryCalloc(outputLen, 1);
|
||||
if (outputBuf == NULL) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
char *output = outputBuf;
|
||||
|
@ -1834,7 +1834,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
|
|||
char *buf = taosMemoryMalloc(bufSize);
|
||||
|
||||
if (convBuf == NULL || output == NULL || buf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _end;
|
||||
}
|
||||
|
||||
|
@ -2403,7 +2403,7 @@ int32_t toCharFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOu
|
|||
int32_t code = 0;
|
||||
|
||||
if (format == NULL || out == NULL) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
for (int32_t i = 0; i < pInput[0].numOfRows; ++i) {
|
||||
if (colDataIsNull_s(pInput[1].columnData, i) || colDataIsNull_s(pInput[0].columnData, i)) {
|
||||
|
@ -4230,7 +4230,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
|
|||
intervals = taosMemoryCalloc(numOfBins, sizeof(double));
|
||||
if (NULL == intervals) {
|
||||
cJSON_Delete(binDesc);
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
if (cJSON_IsNumber(width) && factor == NULL && binType == LINEAR_BIN) {
|
||||
// linear bin process
|
||||
|
@ -4295,7 +4295,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
|
|||
intervals = taosMemoryCalloc(numOfBins, sizeof(double));
|
||||
if (NULL == intervals) {
|
||||
cJSON_Delete(binDesc);
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
cJSON *bin = binDesc->child;
|
||||
if (bin == NULL) {
|
||||
|
@ -4327,7 +4327,7 @@ static int32_t getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *
|
|||
*binNum = numOfBins - 1;
|
||||
*bins = taosMemoryCalloc(numOfBins, sizeof(SHistoFuncBin));
|
||||
if (NULL == bins) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
for (int32_t i = 0; i < *binNum; ++i) {
|
||||
(*bins)[i].lower = intervals[i] < intervals[i + 1] ? intervals[i] : intervals[i + 1];
|
||||
|
|
|
@ -124,7 +124,7 @@ int32_t convertBinaryToDouble(const void *inData, void *outData) {
|
|||
char *tmp = taosMemoryCalloc(1, varDataTLen(inData));
|
||||
if (tmp == NULL) {
|
||||
*((double *)outData) = 0.;
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(tmp, varDataVal(inData), varDataLen(inData));
|
||||
double ret = taosStr2Double(tmp, NULL);
|
||||
|
@ -370,7 +370,7 @@ static FORCE_INLINE int32_t varToVarbinary(char *buf, SScalarParam *pOut, int32_
|
|||
if (t == NULL) {
|
||||
sclError("Out of memory");
|
||||
taosMemoryFree(data);
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
varDataSetLen(t, size);
|
||||
(void)memcpy(varDataVal(t), data, size);
|
||||
|
@ -383,7 +383,7 @@ static FORCE_INLINE int32_t varToVarbinary(char *buf, SScalarParam *pOut, int32_
|
|||
char *t = taosMemoryCalloc(1, inputLen);
|
||||
if (t == NULL) {
|
||||
sclError("Out of memory");
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(t, buf, inputLen);
|
||||
int32_t code = colDataSetVal(pOut->columnData, rowIndex, t, false);
|
||||
|
@ -401,7 +401,7 @@ static FORCE_INLINE int32_t varToNchar(char *buf, SScalarParam *pOut, int32_t ro
|
|||
|
||||
char *t = taosMemoryCalloc(1, outputMaxLen);
|
||||
if (NULL == t) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
int32_t ret =
|
||||
taosMbsToUcs4(varDataVal(buf), inputLen, (TdUcs4 *)varDataVal(t), outputMaxLen - VARSTR_HEADER_SIZE, &len);
|
||||
|
@ -424,7 +424,7 @@ static FORCE_INLINE int32_t ncharToVar(char *buf, SScalarParam *pOut, int32_t ro
|
|||
|
||||
char *t = taosMemoryCalloc(1, inputLen + VARSTR_HEADER_SIZE);
|
||||
if (NULL == t) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(buf), varDataLen(buf), varDataVal(t));
|
||||
if (len < 0) {
|
||||
|
@ -457,7 +457,7 @@ static FORCE_INLINE int32_t varToGeometry(char *buf, SScalarParam *pOut, int32_t
|
|||
|
||||
output = taosMemoryCalloc(1, len + VARSTR_HEADER_SIZE);
|
||||
if (NULL == output) {
|
||||
SCL_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_JRET(terrno);
|
||||
}
|
||||
(void)memcpy(output + VARSTR_HEADER_SIZE, t, len);
|
||||
varDataSetLen(output, len);
|
||||
|
@ -2155,7 +2155,7 @@ int32_t vectorJsonContains(SScalarParam *pLeft, SScalarParam *pRight, SScalarPar
|
|||
char *pRightData = colDataGetVarData(pRight->columnData, 0);
|
||||
char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1);
|
||||
if (NULL == jsonKey) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData));
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
||||
|
@ -2189,7 +2189,7 @@ int32_t vectorJsonArrow(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam
|
|||
char *pRightData = colDataGetVarData(pRight->columnData, 0);
|
||||
char *jsonKey = taosMemoryCalloc(1, varDataLen(pRightData) + 1);
|
||||
if (NULL == jsonKey) {
|
||||
SCL_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCL_ERR_RET(terrno);
|
||||
}
|
||||
(void)memcpy(jsonKey, varDataVal(pRightData), varDataLen(pRightData));
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
||||
|
|
|
@ -810,7 +810,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
|
|||
SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob));
|
||||
if (NULL == pJob) {
|
||||
qError("qid:0x%" PRIx64 " calloc %d failed", pReq->pDag->queryId, (int32_t)sizeof(SSchJob));
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
pJob->attr.explainMode = pReq->pDag->explainInfo.mode;
|
||||
|
|
|
@ -583,7 +583,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
|
|||
SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam));
|
||||
if (NULL == param) {
|
||||
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchTaskCallbackParam));
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
param->queryId = pJob->queryId;
|
||||
|
@ -600,7 +600,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
|
|||
SSchHbCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam));
|
||||
if (NULL == param) {
|
||||
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam));
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
param->head.isHbParam = true;
|
||||
|
@ -625,7 +625,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo
|
|||
SSchTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SSchTaskCallbackParam));
|
||||
if (NULL == param) {
|
||||
qError("calloc SSchTaskCallbackParam failed");
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
param->pTrans = trans->pTrans;
|
||||
|
@ -640,7 +640,7 @@ int32_t schGenerateCallBackInfo(SSchJob *pJob, SSchTask *pTask, void *msg, uint3
|
|||
SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
if (NULL == msgSendInfo) {
|
||||
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo));
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msgSendInfo->paramFreeFp = taosMemoryFree;
|
||||
|
@ -797,13 +797,13 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) {
|
|||
pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo));
|
||||
if (NULL == pMsgSendInfo) {
|
||||
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo));
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
param = taosMemoryCalloc(1, sizeof(SSchHbCallbackParam));
|
||||
if (NULL == param) {
|
||||
SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SSchHbCallbackParam));
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP;
|
||||
|
@ -927,7 +927,7 @@ int32_t schCloneSMsgSendInfo(void *src, void **dst) {
|
|||
SMsgSendInfo *pDst = taosMemoryCalloc(1, sizeof(*pSrc));
|
||||
if (NULL == pDst) {
|
||||
qError("malloc SMsgSendInfo for rpcCtx failed, len:%d", (int32_t)sizeof(*pSrc));
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(pDst, pSrc, sizeof(*pSrc));
|
||||
|
@ -1059,7 +1059,7 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId, SArray *taskAction) {
|
|||
void *msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
qError("calloc hb req %d failed", msgSize);
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) {
|
||||
|
@ -1116,7 +1116,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
TAOS_MEMCPY(msg, pTask->msg, msgSize);
|
||||
|
@ -1142,7 +1142,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_JRET(terrno);
|
||||
}
|
||||
|
||||
msgSize = tSerializeSVDeleteReq(msg, msgSize, &req);
|
||||
|
@ -1190,7 +1190,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (tSerializeSSubQueryMsg(msg, msgSize, &qMsg) < 0) {
|
||||
|
@ -1228,7 +1228,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (tSerializeSResFetchReq(msg, msgSize, &req) < 0) {
|
||||
|
@ -1256,7 +1256,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (tSerializeSTaskDropReq(msg, msgSize, &qMsg) < 0) {
|
||||
|
@ -1283,7 +1283,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_JOB_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) {
|
||||
SCH_JOB_ELOG("tSerializeSSchedulerHbReq hbReq failed, size:%d", msgSize);
|
||||
|
@ -1314,7 +1314,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
msg = taosMemoryCalloc(1, msgSize);
|
||||
if (NULL == msg) {
|
||||
SCH_TASK_ELOG("calloc %d failed", msgSize);
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
if (tSerializeSTaskNotifyReq(msg, msgSize, &qMsg) < 0) {
|
||||
|
|
|
@ -1237,7 +1237,7 @@ _return:
|
|||
int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
|
||||
SSchTaskCtx *param = taosMemoryCalloc(1, sizeof(SSchTaskCtx));
|
||||
if (NULL == param) {
|
||||
SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
||||
SCH_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
param->jobRid = pJob->refId;
|
||||
|
|
|
@ -213,7 +213,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
|
|||
|
||||
char* state = taosMemoryCalloc(1, cap);
|
||||
if (state == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes = snprintf(state, cap, "%s%s%s", path, TD_DIRSEP, "state");
|
||||
|
@ -226,7 +226,7 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
|
|||
char* chkp = taosMemoryCalloc(1, cap);
|
||||
if (chkp == NULL) {
|
||||
taosMemoryFree(state);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes = snprintf(chkp, cap, "%s%s%s%scheckpoint%" PRId64 "", path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
|
||||
|
@ -279,7 +279,7 @@ int32_t remoteChkp_readMetaData(char* path, SSChkpMetaOnS3** pMeta) {
|
|||
|
||||
char* metaPath = taosMemoryCalloc(1, cap);
|
||||
if (metaPath == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t n = snprintf(metaPath, cap, "%s%s%s", path, TD_DIRSEP, "META");
|
||||
|
@ -302,7 +302,7 @@ int32_t remoteChkp_readMetaData(char* path, SSChkpMetaOnS3** pMeta) {
|
|||
|
||||
SSChkpMetaOnS3* p = taosMemoryCalloc(1, sizeof(SSChkpMetaOnS3));
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
n = sscanf(buf, META_ON_S3_FORMATE, p->pCurrName, &p->currChkptId, p->pManifestName, &p->manifestChkptId,
|
||||
|
@ -334,7 +334,7 @@ int32_t remoteChkp_validAndCvtMeta(char* path, SSChkpMetaOnS3* pMeta, int64_t ch
|
|||
char* src = taosMemoryCalloc(1, cap);
|
||||
char* dst = taosMemoryCalloc(1, cap);
|
||||
if (src == NULL || dst == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ int32_t remoteChkpGetDelFile(char* path, SArray* toDel) {
|
|||
char* p = taosMemoryCalloc(1, cap);
|
||||
if (p == NULL) {
|
||||
taosMemoryFree(pMeta);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes = snprintf(p, cap, "%s_%" PRId64 "", key, pMeta->currChkptId);
|
||||
|
@ -494,7 +494,7 @@ int32_t rebuildFromRemoteChkp_s3(const char* key, char* chkpPath, int64_t chkpId
|
|||
|
||||
char* defaultTmp = taosMemoryCalloc(1, cap);
|
||||
if (defaultTmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t nBytes = snprintf(defaultPath, cap, "%s%s", defaultPath, "_tmp");
|
||||
|
@ -592,8 +592,7 @@ int32_t backendFileCopyFilesImpl(const char* src, const char* dst) {
|
|||
if (srcName == NULL || dstName == NULL) {
|
||||
taosMemoryFree(srcName);
|
||||
taosMemoryFree(dstName);
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// copy file to dst
|
||||
|
@ -711,7 +710,7 @@ int32_t restoreCheckpointData(const char* path, const char* key, int64_t chkptId
|
|||
checkpointPath = taosMemoryCalloc(1, cap);
|
||||
checkpointRoot = taosMemoryCalloc(1, cap);
|
||||
if (prefixPath == NULL || defaultPath == NULL || checkpointPath == NULL || checkpointRoot == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -904,7 +903,7 @@ _EXIT:
|
|||
streamMutexDestroy(&pHandle->mutex);
|
||||
streamMutexDestroy(&pHandle->cfMutex);
|
||||
taosHashCleanup(pHandle->cfInst);
|
||||
(void)tdListFree(pHandle->list);
|
||||
pHandle->list = tdListFree(pHandle->list);
|
||||
taosMemoryFree(pHandle);
|
||||
stDebug("failed to init stream backend at %s", backendPath);
|
||||
taosMemoryFree(backendPath);
|
||||
|
@ -937,7 +936,7 @@ void streamBackendCleanup(void* arg) {
|
|||
head = tdListPopHead(pHandle->list);
|
||||
}
|
||||
|
||||
(void)tdListFree(pHandle->list);
|
||||
pHandle->list = tdListFree(pHandle->list);
|
||||
streamMutexDestroy(&pHandle->mutex);
|
||||
|
||||
streamMutexDestroy(&pHandle->cfMutex);
|
||||
|
@ -1343,7 +1342,7 @@ int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_ha
|
|||
|
||||
rocksdb_column_family_handle_t** ppCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*));
|
||||
if (ppCf == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
||||
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||
}
|
||||
for (int i = 0; i < nCf; i++) {
|
||||
ppCf[i] = taosArrayGetP(pHandle, i);
|
||||
|
@ -1410,7 +1409,7 @@ int32_t chkpPreBuildDir(char* path, int64_t chkpId, char** chkpDir, char** chkpI
|
|||
char* pChkpDir = taosMemoryCalloc(1, cap);
|
||||
char* pChkpIdDir = taosMemoryCalloc(1, cap);
|
||||
if (pChkpDir == NULL || pChkpIdDir == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -1587,7 +1586,7 @@ int32_t chkpLoadExtraInfo(char* pChkpIdDir, int64_t* chkpId, int64_t* processId)
|
|||
int32_t cap = len + 64;
|
||||
char* pDst = taosMemoryCalloc(1, cap);
|
||||
if (pDst == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
stError("failed to alloc memory to load extra info, dir:%s", pChkpIdDir);
|
||||
goto _EXIT;
|
||||
}
|
||||
|
@ -1643,7 +1642,7 @@ int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
|
|||
int32_t cap = len + 64;
|
||||
char* pDst = taosMemoryCalloc(1, cap);
|
||||
if (pDst == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
stError("failed to alloc memory to add extra info, dir:%s", pChkpIdDir);
|
||||
goto _EXIT;
|
||||
}
|
||||
|
@ -2112,11 +2111,15 @@ void destroyCompare(void* arg) {
|
|||
}
|
||||
|
||||
int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
|
||||
int32_t code = 0;
|
||||
SStreamValue key = {.unixTimestamp = ttl, .len = vlen, .rawLen = vlen, .compress = 0, .data = (char*)(value)};
|
||||
int32_t len = 0;
|
||||
char* dst = NULL;
|
||||
if (vlen > 512) {
|
||||
dst = taosMemoryCalloc(1, vlen + 128);
|
||||
if (dst == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
int32_t dstCap = vlen + 128;
|
||||
int32_t compressedSize = LZ4_compress_default((char*)value, dst, vlen, dstCap);
|
||||
if (compressedSize < vlen) {
|
||||
|
@ -2129,6 +2132,10 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
|
|||
if (*dest == NULL) {
|
||||
size_t size = sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len;
|
||||
char* p = taosMemoryCalloc(1, size);
|
||||
if (p == NULL) {
|
||||
code = terrno;
|
||||
goto _exception;
|
||||
}
|
||||
char* buf = p;
|
||||
len += taosEncodeFixedI64((void**)&buf, key.unixTimestamp);
|
||||
len += taosEncodeFixedI32((void**)&buf, key.len);
|
||||
|
@ -2151,6 +2158,9 @@ int32_t valueEncode(void* value, int32_t vlen, int64_t ttl, char** dest) {
|
|||
|
||||
taosMemoryFree(dst);
|
||||
return len;
|
||||
_exception:
|
||||
taosMemoryFree(dst);
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2165,6 +2175,7 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
|
|||
char* pCompressData = NULL;
|
||||
char* pOutput = NULL;
|
||||
if (streamStateValueIsStale(p)) {
|
||||
code = TSDB_CODE_INVALID_DATA_FMT;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
|
||||
|
@ -2177,24 +2188,44 @@ int32_t valueDecode(void* value, int32_t vlen, int64_t* ttl, char** dest) {
|
|||
if (vlen == (sizeof(key.unixTimestamp) + sizeof(key.len) + key.len)) {
|
||||
// compatiable with previous data
|
||||
p = taosDecodeBinary(p, (void**)&pOutput, key.len);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
|
||||
} else {
|
||||
p = taosDecodeFixedI32(p, &key.rawLen);
|
||||
p = taosDecodeFixedI8(p, &key.compress);
|
||||
if (vlen != (sizeof(key.unixTimestamp) + sizeof(key.len) + sizeof(key.rawLen) + sizeof(key.compress) + key.len)) {
|
||||
stError("vlen: %d, read len: %d", vlen, key.len);
|
||||
code = TSDB_CODE_INVALID_DATA_FMT;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
if (key.compress == 1) {
|
||||
p = taosDecodeBinary(p, (void**)&pCompressData, key.len);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
pOutput = taosMemoryCalloc(1, key.rawLen);
|
||||
if (pOutput == NULL) {
|
||||
code = terrno;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
|
||||
int32_t rawLen = LZ4_decompress_safe(pCompressData, pOutput, key.len, key.rawLen);
|
||||
if (rawLen != key.rawLen) {
|
||||
stError("read invalid read, rawlen: %d, currlen: %d", key.rawLen, key.len);
|
||||
code = TSDB_CODE_INVALID_DATA_FMT;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
key.len = rawLen;
|
||||
} else {
|
||||
p = taosDecodeBinary(p, (void**)&pOutput, key.len);
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _EXCEPT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2498,7 +2529,7 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
|
|||
int32_t code = 0;
|
||||
char* statePath = taosMemoryCalloc(1, strlen(path) + 128);
|
||||
if (statePath == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
sprintf(statePath, "%s%s%s", path, TD_DIRSEP, key);
|
||||
|
@ -2515,7 +2546,7 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
|
|||
char* dbPath = taosMemoryCalloc(1, strlen(statePath) + 128);
|
||||
if (dbPath == NULL) {
|
||||
taosMemoryFree(statePath);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
sprintf(dbPath, "%s%s%s", statePath, TD_DIRSEP, "state");
|
||||
|
@ -2733,7 +2764,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
|
|||
char* buf = taosMemoryCalloc(1, cap);
|
||||
if (buf == NULL) {
|
||||
(void)taosReleaseRef(taskDbWrapperId, refId);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes =
|
||||
|
@ -2763,7 +2794,7 @@ int32_t taskDbGenChkpUploadData__s3(STaskDbWrapper* pDb, void* bkdChkpMgt, int64
|
|||
|
||||
char* temp = taosMemoryCalloc(1, cap);
|
||||
if (temp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t nBytes = snprintf(temp, cap, "%s%s%s%" PRId64, pDb->path, TD_DIRSEP, "tmp", chkpId);
|
||||
|
@ -3179,6 +3210,7 @@ int streamStateGetCfIdx(SStreamState* pState, const char* funcName) {
|
|||
if (err != NULL) {
|
||||
idx = -1;
|
||||
stError("failed to open cf, %p %s_%s, reason:%s", pState, wrapper->idstr, funcName, err);
|
||||
rocksdb_column_family_handle_destroy(cf);
|
||||
taosMemoryFree(err);
|
||||
} else {
|
||||
stDebug("succ to open cf, %p %s_%s", pState, wrapper->idstr, funcName);
|
||||
|
@ -3224,7 +3256,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
|||
int i = streamStateGetCfIdx(pState, funcname); \
|
||||
if (i < 0) { \
|
||||
stWarn("streamState failed to get cf name: %s", funcname); \
|
||||
code = -1; \
|
||||
code = TSDB_CODE_THIRDPARTY_ERROR; \
|
||||
break; \
|
||||
} \
|
||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
||||
|
@ -3241,7 +3273,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
|||
if (err != NULL) { \
|
||||
stError("streamState str: %s failed to write to %s, err: %s", toString, funcname, err); \
|
||||
taosMemoryFree(err); \
|
||||
code = -1; \
|
||||
code = TSDB_CODE_THIRDPARTY_ERROR; \
|
||||
} else { \
|
||||
stTrace("streamState str:%s succ to write to %s, rowValLen:%d, ttlValLen:%d, %p", toString, funcname, vLen, \
|
||||
ttlVLen, wrapper); \
|
||||
|
@ -3301,7 +3333,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
|||
int i = streamStateGetCfIdx(pState, funcname); \
|
||||
if (i < 0) { \
|
||||
stWarn("streamState failed to get cf name: %s_%s", pState->pTdbState->idstr, funcname); \
|
||||
code = -1; \
|
||||
code = TSDB_CODE_THIRDPARTY_ERROR; \
|
||||
break; \
|
||||
} \
|
||||
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
|
||||
|
@ -3316,7 +3348,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
|||
if (err != NULL) { \
|
||||
stError("streamState str: %s failed to del from %s_%s, err: %s", toString, wrapper->idstr, funcname, err); \
|
||||
taosMemoryFree(err); \
|
||||
code = -1; \
|
||||
code = TSDB_CODE_THIRDPARTY_ERROR; \
|
||||
} else { \
|
||||
stTrace("streamState str: %s succ to del from %s_%s", toString, wrapper->idstr, funcname); \
|
||||
} \
|
||||
|
@ -4522,7 +4554,7 @@ int32_t compareHashTableImpl(SHashObj* p1, SHashObj* p2, SArray* diff) {
|
|||
if (!isBkdDataMeta(name, len) && !taosHashGet(p1, name, len)) {
|
||||
char* fname = taosMemoryCalloc(1, len + 1);
|
||||
if (fname == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
(void)strncpy(fname, name, len);
|
||||
if (taosArrayPush(diff, &fname) == NULL) {
|
||||
|
@ -4683,7 +4715,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
|
|||
char* fname = taosMemoryCalloc(1, len + 1);
|
||||
if (fname == NULL) {
|
||||
(void)taosThreadRwlockUnlock(&p->rwLock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(void)strncpy(fname, name, len);
|
||||
|
@ -4734,7 +4766,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
|
|||
int32_t code = 0;
|
||||
SDbChkp* p = taosMemoryCalloc(1, sizeof(SDbChkp));
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -4751,7 +4783,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
|
|||
p->len = strlen(path) + 128;
|
||||
p->buf = taosMemoryCalloc(1, p->len);
|
||||
if (p->buf == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _EXIT;
|
||||
}
|
||||
|
||||
|
@ -4828,7 +4860,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
|
|||
|
||||
char* buffer = taosMemoryCalloc(4, cap);
|
||||
if (buffer == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _ERROR;
|
||||
}
|
||||
|
||||
|
@ -4993,8 +5025,7 @@ int32_t bkdMgtCreate(char* path, SBkdMgt** mgt) {
|
|||
int32_t code = 0;
|
||||
SBkdMgt* p = taosMemoryCalloc(1, sizeof(SBkdMgt));
|
||||
if (p == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return code;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
p->pDbChkpTbl = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||
|
@ -5048,7 +5079,7 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
|
|||
char* path = taosMemoryCalloc(1, cap);
|
||||
if (path == NULL) {
|
||||
(void)taosThreadRwlockUnlock(&bm->rwLock);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId);
|
||||
|
|
|
@ -49,7 +49,7 @@ int32_t createChkptTriggerBlock(SStreamTask* pTask, int32_t checkpointType, int6
|
|||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||
if (pBlock == NULL) {
|
||||
taosFreeQitem(pChkpoint);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pBlock->info.type = STREAM_CHECKPOINT;
|
||||
|
@ -235,6 +235,16 @@ int32_t streamProcessCheckpointTriggerBlock(SStreamTask* pTask, SStreamDataBlock
|
|||
return code;
|
||||
}
|
||||
|
||||
if (pActiveInfo->failedId >= checkpointId) {
|
||||
stError("s-task:%s vgId:%d checkpointId:%" PRId64 " transId:%d, has been marked failed, failedId:%" PRId64
|
||||
"discard the checkpoint-trigger block",
|
||||
id, vgId, checkpointId, transId, pActiveInfo->failedId);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
|
||||
streamFreeQitem((SStreamQueueItem*)pBlock);
|
||||
return code;
|
||||
}
|
||||
|
||||
if (pTask->chkInfo.checkpointId == checkpointId) {
|
||||
{ // send checkpoint-ready msg to upstream
|
||||
SRpcMsg msg = {0};
|
||||
|
@ -531,15 +541,20 @@ int32_t streamTaskProcessCheckpointReadyRsp(SStreamTask* pTask, int32_t upstream
|
|||
}
|
||||
|
||||
void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg) {
|
||||
SActiveCheckpointInfo* pInfo = pTask->chkInfo.pActiveInfo;
|
||||
|
||||
pTask->chkInfo.startTs = 0; // clear the recorded start time
|
||||
streamTaskOpenAllUpstreamInput(pTask); // open inputQ for all upstream tasks
|
||||
|
||||
streamMutexLock(&pTask->chkInfo.pActiveInfo->lock);
|
||||
streamTaskClearActiveInfo(pTask->chkInfo.pActiveInfo);
|
||||
streamMutexLock(&pInfo->lock);
|
||||
streamTaskClearActiveInfo(pInfo);
|
||||
if (clearChkpReadyMsg) {
|
||||
streamClearChkptReadyMsg(pTask->chkInfo.pActiveInfo);
|
||||
streamClearChkptReadyMsg(pInfo);
|
||||
}
|
||||
streamMutexUnlock(&pTask->chkInfo.pActiveInfo->lock);
|
||||
streamMutexUnlock(&pInfo->lock);
|
||||
|
||||
stDebug("s-task:%s clear active checkpointInfo, failed checkpointId:%"PRId64", current checkpointId:%"PRId64,
|
||||
pTask->id.idStr, pInfo->failedId, pTask->chkInfo.checkpointId);
|
||||
}
|
||||
|
||||
int32_t streamTaskUpdateTaskCheckpointInfo(SStreamTask* pTask, bool restored, SVUpdateCheckpointInfoReq* pReq) {
|
||||
|
@ -669,7 +684,7 @@ void streamTaskSetFailedCheckpointId(SStreamTask* pTask) {
|
|||
stWarn("s-task:%s checkpoint-info is cleared now, not set the failed checkpoint info", pTask->id.idStr);
|
||||
} else {
|
||||
pInfo->failedId = pInfo->activeId;
|
||||
stDebug("s-task:%s mark the checkpointId:%" PRId64 " (transId:%d) failed", pTask->id.idStr, pInfo->activeId,
|
||||
stDebug("s-task:%s mark and set the failed checkpointId:%" PRId64 " (transId:%d)", pTask->id.idStr, pInfo->activeId,
|
||||
pInfo->transId);
|
||||
}
|
||||
}
|
||||
|
@ -689,7 +704,7 @@ static int32_t getCheckpointDataMeta(const char* id, const char* path, SArray* l
|
|||
|
||||
char* filePath = taosMemoryCalloc(1, cap);
|
||||
if (filePath == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t nBytes = snprintf(filePath, cap, "%s%s%s", path, TD_DIRSEP, "META_TMP");
|
||||
|
@ -1281,7 +1296,7 @@ int32_t downloadCheckpointByNameS3(const char* id, const char* fname, const char
|
|||
|
||||
char* buf = taosMemoryCalloc(1, cap);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes = snprintf(buf, cap, "%s/%s", id, fname);
|
||||
|
|
|
@ -143,7 +143,7 @@ static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBl
|
|||
int32_t len = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock) + PAYLOAD_PREFIX_LEN;
|
||||
|
||||
pRetrieve = taosMemoryCalloc(1, len);
|
||||
if (pRetrieve == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
||||
if (pRetrieve == NULL) return terrno;
|
||||
|
||||
int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||
pRetrieve->useconds = 0;
|
||||
|
@ -729,6 +729,7 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
|
|||
const char* id = pTask->id.idStr;
|
||||
int32_t code = 0;
|
||||
SStreamDataBlock* pBlock = NULL;
|
||||
SActiveCheckpointInfo* pInfo = pTask->chkInfo.pActiveInfo;
|
||||
|
||||
int32_t numOfElems = streamQueueGetNumOfItems(pTask->outputq.queue);
|
||||
if (numOfElems > 0) {
|
||||
|
@ -746,10 +747,15 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (pTask->chkInfo.pActiveInfo->dispatchTrigger) {
|
||||
if (pInfo->dispatchTrigger) {
|
||||
if ((pInfo->activeId != 0) && (pInfo->failedId < pInfo->activeId)) {
|
||||
stDebug("s-task:%s already send checkpoint-trigger, no longer dispatch any other data", id);
|
||||
atomic_store_8(&pTask->outputq.status, TASK_OUTPUT_STATUS__NORMAL);
|
||||
return 0;
|
||||
} else {
|
||||
stDebug("s-task:%s dispatch trigger set, and ignore since current active checkpointId:%" PRId64 " failed", id,
|
||||
pInfo->activeId);
|
||||
}
|
||||
}
|
||||
|
||||
if (pTask->msgInfo.pData != NULL) {
|
||||
|
@ -788,7 +794,9 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
|
|||
if (type == STREAM_INPUT__CHECKPOINT_TRIGGER) {
|
||||
// outputQ should be empty here, otherwise, set the checkpoint failed due to the retrieve req happens
|
||||
if (streamQueueGetNumOfUnAccessedItems(pTask->outputq.queue) > 0) {
|
||||
stError("s-task:%s items are still in outputQ due to downstream retrieve, failed to init trigger dispatch",
|
||||
stError(
|
||||
"s-task:%s items are still in outputQ due to downstream retrieve, failed to init and discard "
|
||||
"checkpoint-trigger dispatch",
|
||||
pTask->id.idStr);
|
||||
streamTaskSetCheckpointFailed(pTask);
|
||||
clearBufferedDispatchMsg(pTask);
|
||||
|
|
|
@ -314,7 +314,7 @@ int32_t createMetaHbInfo(int64_t* pRid, SMetaHbInfo** pRes) {
|
|||
*pRes = NULL;
|
||||
SMetaHbInfo* pInfo = taosMemoryCalloc(1, sizeof(SMetaHbInfo));
|
||||
if (pInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pInfo->hbTmr = taosTmrStart(streamMetaHbToMnode, META_HB_CHECK_INTERVAL, pRid, streamTimer);
|
||||
|
|
|
@ -357,13 +357,13 @@ int32_t streamMetaOpen(const char* path, void* ahandle, FTaskBuild buildTaskFn,
|
|||
SStreamMeta* pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta));
|
||||
if (pMeta == NULL) {
|
||||
stError("vgId:%d failed to prepare stream meta, alloc size:%" PRIzu ", out of memory", vgId, sizeof(SStreamMeta));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t len = strlen(path) + 64;
|
||||
char* tpath = taosMemoryCalloc(1, len);
|
||||
if (tpath == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask) {
|
|||
|
||||
buf = taosMemoryCalloc(1, len);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
if (pTask->ver < SSTREAM_TASK_SUBTABLE_CHANGED_VER) {
|
||||
|
|
|
@ -51,7 +51,7 @@ int32_t streamQueueOpen(int64_t cap, SStreamQueue** pQ) {
|
|||
|
||||
SStreamQueue* pQueue = taosMemoryCalloc(1, sizeof(SStreamQueue));
|
||||
if (pQueue == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
code = taosOpenQueue(&pQueue->pQueue);
|
||||
|
@ -372,7 +372,7 @@ int32_t streamTaskPutTranstateIntoInputQ(SStreamTask* pTask) {
|
|||
|
||||
pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||
if (pBlock == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ int32_t streamBackendSnapInitFile(char* metaPath, SStreamTaskSnap* pSnap, SBacke
|
|||
|
||||
char* path = taosMemoryCalloc(1, cap);
|
||||
if (path == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
nBytes = snprintf(path, cap, "%s%s%s%s%s%" PRId64 "", pSnap->dbPrefixPath, TD_DIRSEP, "checkpoints", TD_DIRSEP,
|
||||
|
@ -492,7 +492,7 @@ int32_t streamSnapReaderOpen(void* pMeta, int64_t sver, int64_t chkpId, char* pa
|
|||
// impl later
|
||||
SStreamSnapReader* pReader = taosMemoryCalloc(1, sizeof(SStreamSnapReader));
|
||||
if (pReader == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = streamSnapHandleInit(&pReader->handle, (char*)path, pMeta);
|
||||
|
@ -632,7 +632,7 @@ int32_t streamSnapWriterOpen(void* pMeta, int64_t sver, int64_t ever, char* path
|
|||
int32_t code = 0;
|
||||
SStreamSnapWriter* pWriter = taosMemoryCalloc(1, sizeof(SStreamSnapWriter));
|
||||
if (pWriter == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
SStreamSnapHandle* pHandle = &pWriter->handle;
|
||||
|
|
|
@ -432,7 +432,7 @@ int32_t createHTaskLaunchInfo(SStreamMeta* pMeta, STaskId* pTaskId, int64_t hStr
|
|||
SLaunchHTaskInfo** pInfo) {
|
||||
*pInfo = taosMemoryCalloc(1, sizeof(SLaunchHTaskInfo));
|
||||
if ((*pInfo) == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
(*pInfo)->id.streamId = pTaskId->streamId;
|
||||
|
|
|
@ -483,7 +483,7 @@ int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal
|
|||
}
|
||||
*pVal = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN);
|
||||
if (!(*pVal)) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ int32_t tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool
|
|||
if (pTask == NULL) {
|
||||
stError("s-task:0x%" PRIx64 " failed malloc new stream task, size:%d, code:%s", streamId,
|
||||
(int32_t)sizeof(SStreamTask), tstrerror(terrno));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pTask->ver = SSTREAM_TASK_VER;
|
||||
|
@ -489,7 +489,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
|
|||
if (pOutputInfo->pTokenBucket == NULL) {
|
||||
stError("s-task:%s failed to prepare the tokenBucket, code:%s", pTask->id.idStr,
|
||||
tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
// 2MiB per second for sink task
|
||||
|
@ -1190,12 +1190,13 @@ void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t c
|
|||
pTask->chkInfo.pActiveInfo->transId = transId;
|
||||
pTask->chkInfo.pActiveInfo->activeId = checkpointId;
|
||||
pTask->chkInfo.pActiveInfo->failedId = checkpointId;
|
||||
stDebug("s-task:%s set failed checkpointId:%"PRId64, pTask->id.idStr, checkpointId);
|
||||
}
|
||||
|
||||
int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes) {
|
||||
SActiveCheckpointInfo* pInfo = taosMemoryCalloc(1, sizeof(SActiveCheckpointInfo));
|
||||
if (pInfo == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = taosThreadMutexInit(&pInfo->lock, NULL);
|
||||
|
@ -1239,12 +1240,13 @@ void streamTaskDestroyActiveChkptInfo(SActiveCheckpointInfo* pInfo) {
|
|||
taosMemoryFree(pInfo);
|
||||
}
|
||||
|
||||
//NOTE: clear the checkpoint id, and keep the failed id
|
||||
void streamTaskClearActiveInfo(SActiveCheckpointInfo* pInfo) {
|
||||
pInfo->activeId = 0; // clear the checkpoint id
|
||||
pInfo->activeId = 0;
|
||||
pInfo->transId = 0;
|
||||
pInfo->allUpstreamTriggerRecv = 0;
|
||||
pInfo->dispatchTrigger = false;
|
||||
pInfo->failedId = 0;
|
||||
// pInfo->failedId = 0;
|
||||
|
||||
taosArrayClear(pInfo->pDispatchTriggerList);
|
||||
taosArrayClear(pInfo->pCheckpointReadyRecvList);
|
||||
|
|
|
@ -286,7 +286,7 @@ int32_t streamCreateStateMachine(SStreamTask* pTask) {
|
|||
if (pSM == NULL) {
|
||||
stError("s-task:%s failed to create task stateMachine, size:%d, code:%s", id, (int32_t)sizeof(SStreamTaskSM),
|
||||
tstrerror(terrno));
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
return terrno;
|
||||
}
|
||||
|
||||
pSM->pTask = pTask;
|
||||
|
|
|
@ -150,7 +150,7 @@ int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, b
|
|||
int32_t lino = 0;
|
||||
SUpdateInfo* pInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo));
|
||||
if (pInfo == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
pInfo->pTsBuckets = NULL;
|
||||
|
@ -203,12 +203,12 @@ int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, b
|
|||
pInfo->pkColType = pkType;
|
||||
pInfo->pKeyBuff = taosMemoryCalloc(1, sizeof(TSKEY) + sizeof(int64_t) + pkLen);
|
||||
if (!pInfo->pKeyBuff) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
pInfo->pValueBuff = taosMemoryCalloc(1, sizeof(TSKEY) + pkLen);
|
||||
if (!pInfo->pValueBuff) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
if (pkLen != 0) {
|
||||
|
|
|
@ -626,7 +626,7 @@ int32_t getRowBuffByPos(SStreamFileState* pFileState, SRowBuffPos* pPos, void**
|
|||
if (pFileState->curRowCount < pFileState->maxRowCount) {
|
||||
pPos->pRowBuff = taosMemoryCalloc(1, pFileState->rowSize);
|
||||
if (!pPos->pRowBuff) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
code = terrno;
|
||||
QUERY_CHECK_CODE(code, lino, _end);
|
||||
}
|
||||
pFileState->curRowCount++;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue