Merge branch '3.0' into enh/TD-31895-3.0

This commit is contained in:
kailixu 2024-09-20 15:50:13 +08:00
commit 6fe0529379
25 changed files with 329 additions and 261 deletions

View File

@ -2817,8 +2817,8 @@ enum {
TOPIC_SUB_TYPE__COLUMN, TOPIC_SUB_TYPE__COLUMN,
}; };
#define DEFAULT_MAX_POLL_INTERVAL 3000000 #define DEFAULT_MAX_POLL_INTERVAL 300000
#define DEFAULT_SESSION_TIMEOUT 12000 #define DEFAULT_SESSION_TIMEOUT 12000
typedef struct { typedef struct {
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic

View File

@ -287,6 +287,8 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
SCompactObj *pCompact = NULL; SCompactObj *pCompact = NULL;
char *sep = NULL; char *sep = NULL;
SDbObj *pDb = NULL; SDbObj *pDb = NULL;
int32_t code = 0;
int32_t lino = 0;
if (strlen(pShow->db) > 0) { if (strlen(pShow->db) > 0) {
sep = strchr(pShow->db, '.'); sep = strchr(pShow->db, '.');
@ -310,26 +312,30 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0}; char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0};
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false), pCompact, &lino,
_OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) { if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) {
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB); TAOS_CHECK_GOTO(tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB), &lino, _OVER);
(void)tNameGetDbName(&name, varDataVal(tmpBuf)); (void)tNameGetDbName(&name, varDataVal(tmpBuf));
} else { } else {
(void)strncpy(varDataVal(tmpBuf), pCompact->dbname, TSDB_SHOW_SQL_LEN); (void)strncpy(varDataVal(tmpBuf), pCompact->dbname, TSDB_SHOW_SQL_LEN);
} }
varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf))); varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf)));
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false), pCompact, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false), pCompact, &lino,
_OVER);
numOfRows++; numOfRows++;
sdbRelease(pSdb, pCompact); sdbRelease(pSdb, pCompact);
} }
_OVER:
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
pShow->numOfRows += numOfRows; pShow->numOfRows += numOfRows;
mndReleaseDb(pMnode, pDb); mndReleaseDb(pMnode, pDb);
return numOfRows; return numOfRows;
@ -468,7 +474,7 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
mndTransDrop(pTrans); mndTransDrop(pTrans);
return -1; return -1;
} }
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
*/ */
} }

View File

@ -981,7 +981,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB); if (tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
mError("db:%s, failed to parse db name", createReq.db);
auditRecord(pReq, pMnode->clusterId, "createDB", name.dbname, "", createReq.sql, createReq.sqlLen); auditRecord(pReq, pMnode->clusterId, "createDB", name.dbname, "", createReq.sql, createReq.sqlLen);
@ -1135,7 +1136,10 @@ static int32_t mndSetAlterDbPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); if ((code = sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY)) != 0) {
sdbFreeRaw(pRedoRaw);
TAOS_RETURN(code);
}
return 0; return 0;
} }
@ -1152,7 +1156,10 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); if ((code = sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY)) != 0) {
sdbFreeRaw(pCommitRaw);
TAOS_RETURN(code);
}
TAOS_RETURN(code); TAOS_RETURN(code);
} }
@ -1284,7 +1291,8 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
} }
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB); if (tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
mError("db:%s, failed to parse db name", alterReq.db);
auditRecord(pReq, pMnode->clusterId, "alterDB", name.dbname, "", alterReq.sql, alterReq.sqlLen); auditRecord(pReq, pMnode->clusterId, "alterDB", name.dbname, "", alterReq.sql, alterReq.sqlLen);
@ -1371,7 +1379,11 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
goto _OVER; goto _OVER;
} }
(void)tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp); int32_t ret = 0;
if ((ret = tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp)) < 0) {
code = ret;
goto _OVER;
}
pReq->info.rsp = pRsp; pReq->info.rsp = pRsp;
pReq->info.rspLen = contLen; pReq->info.rspLen = contLen;
@ -1473,7 +1485,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
sdbRelease(pSdb, pVgroup); sdbRelease(pSdb, pVgroup);
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED); if ((code = sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED)) != 0) {
sdbCancelFetch(pSdb, pIter);
sdbRelease(pSdb, pVgroup);
TAOS_RETURN(code);
}
} }
sdbRelease(pSdb, pVgroup); sdbRelease(pSdb, pVgroup);
@ -1498,7 +1514,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
sdbRelease(pSdb, pStbRaw); sdbRelease(pSdb, pStbRaw);
return -1; return -1;
} }
(void)sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED); if ((code = sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED)) != 0) {
sdbCancelFetch(pSdb, pIter);
sdbRelease(pSdb, pStbRaw);
return -1;
}
} }
sdbRelease(pSdb, pStb); sdbRelease(pSdb, pStb);
@ -1562,7 +1582,8 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp); int32_t ret = 0;
if ((ret = tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp)) < 0) return ret;
*pRspLen = rspLen; *pRspLen = rspLen;
*ppRsp = pRsp; *ppRsp = pRsp;
TAOS_RETURN(code); TAOS_RETURN(code);
@ -1643,7 +1664,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
} }
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB); if (tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
mError("db:%s, failed to parse db name", dropReq.db);
auditRecord(pReq, pMnode->clusterId, "dropDB", name.dbname, "", dropReq.sql, dropReq.sqlLen); auditRecord(pReq, pMnode->clusterId, "dropDB", name.dbname, "", dropReq.sql, dropReq.sqlLen);
@ -1805,14 +1827,18 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
goto _OVER; goto _OVER;
} }
(void)tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp); int32_t ret = 0;
if ((ret = tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp)) < 0) {
code = ret;
goto _OVER;
}
pReq->info.rsp = pRsp; pReq->info.rsp = pRsp;
pReq->info.rspLen = contLen; pReq->info.rspLen = contLen;
_OVER: _OVER:
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr()); mError("db:%s, failed to process use db req since %s", usedbReq.db, tstrerror(code));
} }
mndReleaseDb(pMnode, pDb); mndReleaseDb(pMnode, pDb);
@ -1964,7 +1990,8 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
tFreeSDbHbBatchRsp(&batchRsp); tFreeSDbHbBatchRsp(&batchRsp);
return -1; return -1;
} }
(void)tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp); int32_t ret = 0;
if ((ret = tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp)) < 0) return ret;
*ppRsp = pRsp; *ppRsp = pRsp;
*pRspLen = rspLen; *pRspLen = rspLen;
@ -1977,6 +2004,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
SSdb *pSdb = pMnode->pSdb; SSdb *pSdb = pMnode->pSdb;
SVgObj *pVgroup = NULL; SVgObj *pVgroup = NULL;
void *pIter = NULL; void *pIter = NULL;
int32_t code = 0;
SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()}; SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()};
int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq); int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq);
int32_t contLen = reqLen + sizeof(SMsgHead); int32_t contLen = reqLen + sizeof(SMsgHead);
@ -1993,7 +2021,11 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
} }
pHead->contLen = htonl(contLen); pHead->contLen = htonl(contLen);
pHead->vgId = htonl(pVgroup->vgId); pHead->vgId = htonl(pVgroup->vgId);
(void)tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq); int32_t ret = 0;
if ((ret = tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq)) < 0) {
sdbRelease(pSdb, pVgroup);
return ret;
}
SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen}; SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen};
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
@ -2046,6 +2078,7 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
SVS3MigrateDbReq s3migrateReq = {.timestamp = taosGetTimestampSec()}; SVS3MigrateDbReq s3migrateReq = {.timestamp = taosGetTimestampSec()};
int32_t reqLen = tSerializeSVS3MigrateDbReq(NULL, 0, &s3migrateReq); int32_t reqLen = tSerializeSVS3MigrateDbReq(NULL, 0, &s3migrateReq);
int32_t contLen = reqLen + sizeof(SMsgHead); int32_t contLen = reqLen + sizeof(SMsgHead);
int32_t code = 0;
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
@ -2061,7 +2094,11 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
} }
pHead->contLen = htonl(contLen); pHead->contLen = htonl(contLen);
pHead->vgId = htonl(pVgroup->vgId); pHead->vgId = htonl(pVgroup->vgId);
(void)tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq); int32_t ret = 0;
if ((ret = tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq)) < 0) {
sdbRelease(pSdb, pVgroup);
return ret;
}
SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen}; SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen};
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup); SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
@ -2243,6 +2280,8 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
int32_t cols = 0; int32_t cols = 0;
int32_t bytes = pShow->pMeta->pSchemas[cols].bytes; int32_t bytes = pShow->pMeta->pSchemas[cols].bytes;
char *buf = taosMemoryMalloc(bytes); char *buf = taosMemoryMalloc(bytes);
int32_t code = 0;
int32_t lino = 0;
const char *name = mndGetDbStr(pDb->name); const char *name = mndGetDbStr(pDb->name);
if (name != NULL) { if (name != NULL) {
@ -2286,47 +2325,47 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
for (int32_t i = 0; i < pShow->numOfColumns; ++i) { for (int32_t i = 0; i < pShow->numOfColumns; ++i) {
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, i); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, i);
if (i == 0) { if (i == 0) {
(void)colDataSetVal(pColInfo, rows, buf, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
} else if (i == 1) { } else if (i == 1) {
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
} else if (i == 3) { } else if (i == 3) {
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
} else if (i == 14) { } else if (i == 14) {
(void)colDataSetVal(pColInfo, rows, precVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, precVstr, false), &lino, _OVER);
} else if (i == 15) { } else if (i == 15) {
(void)colDataSetVal(pColInfo, rows, statusVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, statusVstr, false), &lino, _OVER);
} else { } else {
colDataSetNULL(pColInfo, rows); colDataSetNULL(pColInfo, rows);
} }
} }
} else { } else {
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, buf, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false), &lino, _OVER);
const char *strictStr = pDb->cfg.strict ? "on" : "off"; const char *strictStr = pDb->cfg.strict ? "on" : "off";
char strictVstr[24] = {0}; char strictVstr[24] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(strictVstr, strictStr, 24); STR_WITH_MAXSIZE_TO_VARSTR(strictVstr, strictStr, 24);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)strictVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)strictVstr, false), &lino, _OVER);
char durationVstr[128] = {0}; char durationVstr[128] = {0};
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile); int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile);
varDataSetLen(durationVstr, len); varDataSetLen(durationVstr, len);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)durationVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
char keepVstr[512] = {0}; char keepVstr[512] = {0};
char keep0Str[128] = {0}; char keep0Str[128] = {0};
@ -2344,67 +2383,67 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
} }
varDataSetLen(keepVstr, len); varDataSetLen(keepVstr, len);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)keepVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keepVstr, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)precVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)precVstr, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)statusVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)statusVstr, false), &lino, _OVER);
char *rentensionVstr = buildRetension(pDb->cfg.pRetensions); char *rentensionVstr = buildRetension(pDb->cfg.pRetensions);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
if (rentensionVstr == NULL) { if (rentensionVstr == NULL) {
colDataSetNULL(pColInfo, rows); colDataSetNULL(pColInfo, rows);
} else { } else {
(void)colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false), &lino, _OVER);
taosMemoryFree(rentensionVstr); taosMemoryFree(rentensionVstr);
} }
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false), &lino, _OVER);
const char *cacheModelStr = getCacheModelStr(pDb->cfg.cacheLast); const char *cacheModelStr = getCacheModelStr(pDb->cfg.cacheLast);
char cacheModelVstr[24] = {0}; char cacheModelVstr[24] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(cacheModelVstr, cacheModelStr, 24); STR_WITH_MAXSIZE_TO_VARSTR(cacheModelVstr, cacheModelStr, 24);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
int16_t hashPrefix = pDb->cfg.hashPrefix; int16_t hashPrefix = pDb->cfg.hashPrefix;
@ -2413,39 +2452,40 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
} else if (hashPrefix < 0) { } else if (hashPrefix < 0) {
hashPrefix = pDb->cfg.hashPrefix + strlen(pDb->name) + 1; hashPrefix = pDb->cfg.hashPrefix + strlen(pDb->name) + 1;
} }
(void)colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false), &lino, _OVER);
char keeplocalVstr[128] = {0}; char keeplocalVstr[128] = {0};
len = sprintf(&keeplocalVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.s3KeepLocal); len = sprintf(&keeplocalVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.s3KeepLocal);
varDataSetLen(keeplocalVstr, len); varDataSetLen(keeplocalVstr, len);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false), &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false), &lino, _OVER);
const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm); const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm);
char encryptAlgorithmVStr[24] = {0}; char encryptAlgorithmVStr[24] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24); STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false); TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false), &lino, _OVER);
} }
_OVER:
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
taosMemoryFree(buf); taosMemoryFree(buf);
} }

View File

@ -133,7 +133,6 @@ int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStb
} }
static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbObj, SIdxObj *pIdx, int32_t *contLen) { static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbObj, SIdxObj *pIdx, int32_t *contLen) {
int32_t len = 0; int32_t len = 0;
int32_t ret = 0;
SDropIndexReq req = {0}; SDropIndexReq req = {0};
memcpy(req.colName, pIdx->colName, sizeof(pIdx->colName)); memcpy(req.colName, pIdx->colName, sizeof(pIdx->colName));
@ -159,7 +158,11 @@ static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbOb
pHead->vgId = htonl(pVgroup->vgId); pHead->vgId = htonl(pVgroup->vgId);
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead)); void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
(void)tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req); int32_t ret = 0;
if ((ret = tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req)) < 0) {
terrno = ret;
return NULL;
}
*contLen = len; *contLen = len;
return pHead; return pHead;
_err: _err:
@ -333,7 +336,7 @@ void mndReleaseIdx(SMnode *pMnode, SIdxObj *pIdx) {
SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) { SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) {
SName name = {0}; SName name = {0};
(void)tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); if ((terrno = tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) < 0) return NULL;
char db[TSDB_TABLE_FNAME_LEN] = {0}; char db[TSDB_TABLE_FNAME_LEN] = {0};
(void)tNameGetFullDbName(&name, db); (void)tNameGetFullDbName(&name, db);
@ -559,6 +562,8 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
int32_t numOfRows = 0; int32_t numOfRows = 0;
SIdxObj *pIdx = NULL; SIdxObj *pIdx = NULL;
int32_t cols = 0; int32_t cols = 0;
int32_t code = 0;
int32_t lino = 0;
SDbObj *pDb = NULL; SDbObj *pDb = NULL;
if (strlen(pShow->db) > 0) { if (strlen(pShow->db) > 0) {
@ -578,7 +583,10 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
cols = 0; cols = 0;
SName idxName = {0}; SName idxName = {0};
(void)tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); if ((code = tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
sdbRelease(pSdb, pIdx);
goto _OVER;
}
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName)); STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName));
@ -587,42 +595,49 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db)); STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db));
SName stbName = {0}; SName stbName = {0};
(void)tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); if ((code = tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
sdbRelease(pSdb, pIdx);
goto _OVER;
}
char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName)); STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n1, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n1, false), pIdx, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n2, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n2, false), pIdx, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n3, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n3, false), pIdx, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, NULL, true); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, NULL, true), pIdx, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false), pIdx, &lino,
_OVER);
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_TO_VARSTR(col, (char *)pIdx->colName); STR_TO_VARSTR(col, (char *)pIdx->colName);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)col, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)col, false), pIdx, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0}; char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_TO_VARSTR(tag, (char *)"tag_index"); STR_TO_VARSTR(tag, (char *)"tag_index");
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tag, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tag, false), pIdx, &lino, _OVER);
numOfRows++; numOfRows++;
sdbRelease(pSdb, pIdx); sdbRelease(pSdb, pIdx);
} }
_OVER:
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
mndReleaseDb(pMnode, pDb); mndReleaseDb(pMnode, pDb);
pShow->numOfRows += numOfRows; pShow->numOfRows += numOfRows;
return numOfRows; return numOfRows;

View File

@ -795,7 +795,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, tstrerror(code)); mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, tstrerror(code));
TAOS_RETURN(code); TAOS_RETURN(code);
} }
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage), mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage),
pTrans->createdTime); pTrans->createdTime);
@ -1778,7 +1778,7 @@ static bool mndTransPerformFinishStage(SMnode *pMnode, STrans *pTrans, bool topH
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr()); mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
return false; return false;
} }
(void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED); TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED));
int32_t code = sdbWrite(pMnode->pSdb, pRaw); int32_t code = sdbWrite(pMnode->pSdb, pRaw);
if (code != 0) { if (code != 0) {
@ -1943,6 +1943,8 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
int32_t numOfRows = 0; int32_t numOfRows = 0;
STrans *pTrans = NULL; STrans *pTrans = NULL;
int32_t cols = 0; int32_t cols = 0;
int32_t code = 0;
int32_t lino = 0;
while (numOfRows < rows) { while (numOfRows < rows) {
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans); pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
@ -1951,36 +1953,39 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
cols = 0; cols = 0;
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false), pTrans, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false), pTrans, &lino,
_OVER);
char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0}; char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes); STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stage, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stage, false), pTrans, &lino, _OVER);
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0}; char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes); STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)opername, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)opername, false), pTrans, &lino, _OVER);
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes); STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false), pTrans, &lino, _OVER);
char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes); STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false), pTrans, &lino, _OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false), pTrans, &lino,
_OVER);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false), pTrans, &lino,
_OVER);
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0}; char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0}; char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
@ -1996,12 +2001,14 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
} }
STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes); STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
(void)colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false), pTrans, &lino, _OVER);
numOfRows++; numOfRows++;
sdbRelease(pSdb, pTrans); sdbRelease(pSdb, pTrans);
} }
_OVER:
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
pShow->numOfRows += numOfRows; pShow->numOfRows += numOfRows;
return numOfRows; return numOfRows;
} }

View File

@ -31,7 +31,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
if (pBuf->pData == NULL) { if (pBuf->pData == NULL) {
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES); pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
if (pBuf->pData == NULL) { if (pBuf->pData == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -43,7 +43,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
void* px = taosArrayPush(pBuf->pData, &p); void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -54,7 +54,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
} }
void* px = taosArrayPush(pBuf->pData, &p); void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -101,7 +101,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
void* px = taosArrayPush(pBuf->pData, &p); void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -112,7 +112,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
} }
void* px = taosArrayPush(pBuf->pData, &p); void* px = taosArrayPush(pBuf->pData, &p);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -655,7 +655,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num); char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
if (buf == NULL) { if (buf == NULL) {
cleanupBlockOrderSupporter(&sup); cleanupBlockOrderSupporter(&sup);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf; sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
@ -686,7 +686,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i}; STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i};
void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx); void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
@ -730,7 +730,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo); void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo; STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo;
@ -738,7 +738,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx); px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
// set data block index overflow, in order to disable the offset comparator // set data block index overflow, in order to disable the offset comparator
@ -862,7 +862,7 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey}; SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
void* px = taosArrayPush(pScanInfo->pFileDelData, &delData); void* px = taosArrayPush(pScanInfo->pFileDelData, &delData);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
} }
@ -1122,7 +1122,7 @@ int32_t doAdjustValidDataIters(SArray* pLDIterList, int32_t numOfFileObj) {
void* px = taosArrayPush(pLDIterList, &pIter); void* px = taosArrayPush(pLDIterList, &pIter);
if (px == NULL) { if (px == NULL) {
taosMemoryFree(pIter); taosMemoryFree(pIter);
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }
} else if (size > numOfFileObj) { // remove unused LDataIter } else if (size > numOfFileObj) { // remove unused LDataIter
@ -1149,7 +1149,7 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet)
} }
void* px = taosArrayPush(pSttFileBlockIterArray, &pList); void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
if (px == NULL) { if (px == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
} }

View File

@ -691,7 +691,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx); n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx);
if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) { if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
} }
if (n != size) { if (n != size) {
@ -734,7 +734,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) {
n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk); n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk);
if (taosArrayPush(aSttBlk, &sttBlk) == NULL) { if (taosArrayPush(aSttBlk, &sttBlk) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
} }
if (n != size) { if (n != size) {
@ -866,7 +866,7 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa
continue; continue;
} }
if (taosArrayPush(aDelData, &delData) == NULL) { if (taosArrayPush(aDelData, &delData) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
} }
@ -908,7 +908,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) {
n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx); n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx);
if (taosArrayPush(aDelIdx, &delIdx) == NULL) { if (taosArrayPush(aDelIdx, &delIdx) == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
} }

View File

@ -364,7 +364,7 @@ static int32_t tsdbAsyncRetentionImpl(STsdb *tsdb, int64_t now, bool s3Migrate)
SRtnArg *arg = taosMemoryMalloc(sizeof(*arg)); SRtnArg *arg = taosMemoryMalloc(sizeof(*arg));
if (arg == NULL) { if (arg == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
arg->tsdb = tsdb; arg->tsdb = tsdb;

View File

@ -244,7 +244,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
} }
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size); *data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
if (*data == NULL) { if (*data == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} }
@ -347,7 +347,7 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr)); data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
if (data[0] == NULL) { if (data[0] == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} }

View File

@ -123,7 +123,7 @@ int32_t tsdbSttFileReadStatisBlk(SSttFileReader *reader, const TStatisBlkArray *
int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk); int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk);
void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size); void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size);
if (!data) { if (!data) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@ -157,7 +157,7 @@ int32_t tsdbSttFileReadTombBlk(SSttFileReader *reader, const TTombBlkArray **tom
int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk); int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk);
void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size); void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size);
if (!data) { if (!data) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@ -191,7 +191,7 @@ int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBl
int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk); int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk);
void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size); void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size);
if (!data) { if (!data) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;

View File

@ -56,7 +56,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
// read SBlockIdx array // read SBlockIdx array
if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) { if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit); TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit);
@ -236,7 +236,7 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade
SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk)); SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
if (aSttBlk == NULL) { if (aSttBlk == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit); TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit);
@ -460,7 +460,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey); tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey);
if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) { if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) { for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) {
@ -550,7 +550,7 @@ static int32_t tsdbUpgradeTombFile(STsdb *tsdb, SDelFile *pDelFile, TFileSetArra
SArray *aDelIdx = NULL; SArray *aDelIdx = NULL;
if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) { if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); TAOS_CHECK_GOTO(terrno, &lino, _exit);
} }
TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit); TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit);

View File

@ -116,7 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize); SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
if (pArray == NULL) { if (pArray == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }

View File

@ -679,7 +679,7 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
// create channel object // create channel object
SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel)); SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel));
if (channel == NULL) { if (channel == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
channel->state = EVA_CHANNEL_STATE_OPEN; channel->state = EVA_CHANNEL_STATE_OPEN;
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) { for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
@ -727,7 +727,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
}; };
SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo)); SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo));
if (cancelArray == NULL) { if (cancelArray == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(void)taosThreadMutexLock(&async->mutex); (void)taosThreadMutexLock(&async->mutex);

View File

@ -21,7 +21,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
pPool = taosMemoryMalloc(sizeof(SVBufPool) + size); pPool = taosMemoryMalloc(sizeof(SVBufPool) + size);
if (pPool == NULL) { if (pPool == NULL) {
return terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
memset(pPool, 0, sizeof(SVBufPool)); memset(pPool, 0, sizeof(SVBufPool));
@ -43,7 +43,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock)); pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock));
if (!pPool->lock) { if (!pPool->lock) {
taosMemoryFree(pPool); taosMemoryFree(pPool);
return terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
if (taosThreadSpinInit(pPool->lock, 0) != 0) { if (taosThreadSpinInit(pPool->lock, 0) != 0) {
taosMemoryFree((void *)pPool->lock); taosMemoryFree((void *)pPool->lock);

View File

@ -125,7 +125,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
} }
SJson *pNodeRetentions = tjsonCreateArray(); SJson *pNodeRetentions = tjsonCreateArray();
if (pNodeRetentions == NULL) { if (pNodeRetentions == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions)); TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
for (int32_t i = 0; i < nRetention; ++i) { for (int32_t i = 0; i < nRetention; ++i) {
@ -167,7 +167,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
SJson *nodeInfo = tjsonCreateArray(); SJson *nodeInfo = tjsonCreateArray();
if (nodeInfo == NULL) { if (nodeInfo == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo)); TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo));
vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId, vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId,
@ -175,7 +175,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) { for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) {
SJson *info = tjsonCreateObject(); SJson *info = tjsonCreateObject();
if (info == NULL) { if (info == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i]; SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i];

View File

@ -241,7 +241,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
pData = taosMemoryMalloc(size + 1); pData = taosMemoryMalloc(size + 1);
if (pData == NULL) { if (pData == NULL) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
if (taosReadFile(pFile, pData, size) < 0) { if (taosReadFile(pFile, pData, size) < 0) {

View File

@ -55,7 +55,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
(*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable)); (*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable));
if (*ht == NULL) { if (*ht == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
(*ht)->hash = hash; (*ht)->hash = hash;
@ -102,7 +102,7 @@ int32_t vHashPut(SVHashTable* ht, void* obj) {
SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry)); SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry));
if (entry == NULL) { if (entry == NULL) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
entry->obj = obj; entry->obj = obj;
entry->next = ht->buckets[bucketIndex]; entry->next = ht->buckets[bucketIndex];

View File

@ -248,7 +248,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
cfgRsp.tagsLen = pTag->len; cfgRsp.tagsLen = pTag->len;
cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen); cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
if (NULL == cfgRsp.pTags) { if (NULL == cfgRsp.pTags) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
(void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen); (void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
@ -274,7 +274,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt)); cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) { if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
(void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols); (void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
@ -377,7 +377,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg)); batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
if (NULL == batchRsp.pRsps) { if (NULL == batchRsp.pRsps) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
qError("taosArrayInit %d SBatchRspMsg failed", msgNum); qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
goto _exit; goto _exit;
} }
@ -428,7 +428,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) { if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
qError("taosArrayPush failed"); qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -566,7 +566,7 @@ int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list) {
STableKeyInfo info = {uid = id}; STableKeyInfo info = {uid = id};
if (NULL == taosArrayPush(list, &info)) { if (NULL == taosArrayPush(list, &info)) {
qError("taosArrayPush failed"); qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -596,7 +596,7 @@ int32_t vnodeGetCtbIdList(void *pVnode, int64_t suid, SArray *list) {
if (NULL == taosArrayPush(list, &id)) { if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed"); qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -621,7 +621,7 @@ int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
if (NULL == taosArrayPush(list, &id)) { if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed"); qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -651,7 +651,7 @@ int32_t vnodeGetStbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bo
if (NULL == taosArrayPush(list, &id)) { if (NULL == taosArrayPush(list, &id)) {
qError("taosArrayPush failed"); qError("taosArrayPush failed");
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
} }
@ -766,7 +766,7 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
SArray *suidList = NULL; SArray *suidList = NULL;
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) { if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
return terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
int32_t tbFilterSize = 0; int32_t tbFilterSize = 0;

View File

@ -281,7 +281,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
if (*ppData == NULL) { if (*ppData == NULL) {
(void)taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = terrno, lino, _exit);
} }
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG; ((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
((SSnapDataHdr *)(*ppData))->size = size + 1; ((SSnapDataHdr *)(*ppData))->size = size + 1;

View File

@ -180,7 +180,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
{ // find expired uids { // find expired uids
tbUids = taosArrayInit(8, sizeof(tb_uid_t)); tbUids = taosArrayInit(8, sizeof(tb_uid_t));
if (tbUids == NULL) { if (tbUids == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} }
@ -206,7 +206,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
SMsgHead *pContNew = rpcMallocCont(contLenNew); SMsgHead *pContNew = rpcMallocCont(contLenNew);
if (pContNew == NULL) { if (pContNew == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
} }
@ -1535,7 +1535,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
pCxt->pTbData->pCreateTbReq = NULL; pCxt->pTbData->pCreateTbReq = NULL;
pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES); pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES);
if (NULL == pCxt->pTbData->aRowP) { if (NULL == pCxt->pTbData->aRowP) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
taosArrayDestroy(pCxt->pColValues); taosArrayDestroy(pCxt->pColValues);
@ -1622,7 +1622,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) { static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) {
pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData)); pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
if (NULL == pReq2->aSubmitTbData) { if (NULL == pReq2->aSubmitTbData) {
return TSDB_CODE_OUT_OF_MEMORY; return terrno;
} }
SSubmitReqConvertCxt cxt = {0}; SSubmitReqConvertCxt cxt = {0};
@ -1650,7 +1650,7 @@ static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pRe
} }
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS); code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? terrno : TSDB_CODE_SUCCESS);
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
taosMemoryFreeClear(cxt.pTbData); taosMemoryFreeClear(cxt.pTbData);
@ -1669,7 +1669,7 @@ static int32_t vnodeRebuildSubmitReqMsg(SSubmitReq2 *pSubmitReq, void **ppMsg) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
pMsg = taosMemoryMalloc(msglen); pMsg = taosMemoryMalloc(msglen);
if (NULL == pMsg) { if (NULL == pMsg) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
} }
} }
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
@ -1846,7 +1846,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
if (pSubmitRsp->aCreateTbRsp == NULL && if (pSubmitRsp->aCreateTbRsp == NULL &&
(pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) == (pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) ==
NULL) { NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
@ -1858,7 +1858,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
if (newTbUids == NULL && if (newTbUids == NULL &&
(newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) { (newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _exit; goto _exit;
} }
@ -2237,7 +2237,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t)); pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t));
if (pRes->uidList == NULL) { if (pRes->uidList == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
goto _err; goto _err;
} }

View File

@ -32,7 +32,7 @@ char* tsAuditBatchUri = "/audit-batch";
int32_t auditInit(const SAuditCfg *pCfg) { int32_t auditInit(const SAuditCfg *pCfg) {
tsAudit.cfg = *pCfg; tsAudit.cfg = *pCfg;
tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *)); tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *));
if(tsAudit.records == NULL) return TSDB_CODE_OUT_OF_MEMORY; if(tsAudit.records == NULL) return terrno;
return taosThreadMutexInit(&tsAudit.lock, NULL); return taosThreadMutexInit(&tsAudit.lock, NULL);
} }

View File

@ -443,7 +443,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
if (tTagIsJson(pTag)) { if (tTagIsJson(pTag)) {
pTagVals = taosArrayInit(1, sizeof(STagVal)); pTagVals = taosArrayInit(1, sizeof(STagVal));
if (NULL == pTagVals) { if (NULL == pTagVals) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
char* pJson = NULL; char* pJson = NULL;
@ -460,7 +460,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
if (NULL == taosArrayPush(pTagVals, &tagVal)) { if (NULL == taosArrayPush(pTagVals, &tagVal)) {
taosMemoryFree(pJson); taosMemoryFree(pJson);
taosArrayDestroy(pTagVals); taosArrayDestroy(pTagVals);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} else { } else {
CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals)); CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals));
@ -938,14 +938,14 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) {
false, HASH_ENTRY_LOCK); false, HASH_ENTRY_LOCK);
if (NULL == clusterCtg->dbCache) { if (NULL == clusterCtg->dbCache) {
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER); qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum, clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum,
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
if (NULL == clusterCtg->userCache) { if (NULL == clusterCtg->userCache) {
qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum); qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES); code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES);
@ -1592,7 +1592,7 @@ int32_t catalogGetExpiredViews(SCatalog* pCtg, SViewVersion** views, uint32_t* n
*dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion)); *dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion));
if (NULL == *dynViewVersion) { if (NULL == *dynViewVersion) {
CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY); CTG_API_LEAVE(terrno);
} }
(*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs); (*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs);

View File

@ -61,7 +61,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name)); ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) { if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx); taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(ctx->pName, name, sizeof(*name)); TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
@ -69,7 +69,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -97,12 +97,12 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum, qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum,
(int32_t)sizeof(SMetaRes)); (int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
@ -130,7 +130,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -158,7 +158,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -186,7 +186,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
@ -212,7 +212,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name)); ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) { if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx); taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(ctx->pName, name, sizeof(*name)); TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
@ -220,7 +220,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx,
@ -248,12 +248,12 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum, qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum,
(int32_t)sizeof(SMetaRes)); (int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
@ -272,7 +272,7 @@ int32_t ctgInitGetQnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -290,7 +290,7 @@ int32_t ctgInitGetDnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -317,7 +317,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx,
@ -345,7 +345,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx,
@ -373,7 +373,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx,
@ -391,7 +391,7 @@ int32_t ctgInitGetSvrVerTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type)); qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
@ -416,14 +416,14 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name)); ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) { if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx); taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(ctx->pName, name, sizeof(*name)); TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -449,14 +449,14 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name)); ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) { if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx); taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(ctx->pName, name, sizeof(*name)); TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -482,14 +482,14 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
ctx->pName = taosMemoryMalloc(sizeof(*name)); ctx->pName = taosMemoryMalloc(sizeof(*name));
if (NULL == ctx->pName) { if (NULL == ctx->pName) {
taosMemoryFree(task.taskCtx); taosMemoryFree(task.taskCtx);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(ctx->pName, name, sizeof(*name)); TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
@ -517,12 +517,12 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum, qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum,
(int32_t)sizeof(SMetaRes)); (int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx, qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx,
@ -549,12 +549,12 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum, qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum,
(int32_t)sizeof(SMetaRes)); (int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -577,12 +577,12 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum, qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum,
(int32_t)sizeof(SMetaRes)); (int32_t)sizeof(SMetaRes));
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
if (NULL == taosArrayPush(pJob->pTasks, &task)) { if (NULL == taosArrayPush(pJob->pTasks, &task)) {
ctgFreeTask(&task, true); ctgFreeTask(&task, true);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -614,7 +614,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con
if (NULL == pDb || NULL == pTb) { if (NULL == pDb || NULL == pTb) {
taosHashCleanup(pDb); taosHashCleanup(pDb);
taosHashCleanup(pTb); taosHashCleanup(pTb);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
for (int32_t i = 0; i < pJob->dbVgNum; ++i) { for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
@ -865,14 +865,14 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
if (NULL == pJob->pBatchs) { if (NULL == pJob->pBatchs) {
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM); ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
#endif #endif
pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask)); pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask));
if (NULL == pJob->pTasks) { if (NULL == pJob->pTasks) {
ctgError("taosArrayInit %d tasks failed", taskNum); ctgError("taosArrayInit %d tasks failed", taskNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
if (pReq->forceUpdate && taskNum) { if (pReq->forceUpdate && taskNum) {
@ -1035,7 +1035,7 @@ int32_t ctgDumpTbMetaRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pTableMeta) { if (NULL == pJob->jobRes.pTableMeta) {
pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes)); pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pTableMeta) { if (NULL == pJob->jobRes.pTableMeta) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1068,7 +1068,7 @@ int32_t ctgDumpDbVgRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbVgroup) { if (NULL == pJob->jobRes.pDbVgroup) {
pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes)); pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbVgroup) { if (NULL == pJob->jobRes.pDbVgroup) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1089,7 +1089,7 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pTableHash) { if (NULL == pJob->jobRes.pTableHash) {
pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes)); pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pTableHash) { if (NULL == pJob->jobRes.pTableHash) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1197,7 +1197,7 @@ int32_t ctgDumpIndexRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pIndex) { if (NULL == pJob->jobRes.pIndex) {
pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes)); pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pIndex) { if (NULL == pJob->jobRes.pIndex) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1218,7 +1218,7 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pQnodeList) { if (NULL == pJob->jobRes.pQnodeList) {
pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes)); pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pQnodeList) { if (NULL == pJob->jobRes.pQnodeList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1239,7 +1239,7 @@ int32_t ctgDumpDnodeRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDnodeList) { if (NULL == pJob->jobRes.pDnodeList) {
pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes)); pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDnodeList) { if (NULL == pJob->jobRes.pDnodeList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1260,7 +1260,7 @@ int32_t ctgDumpDbCfgRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbCfg) { if (NULL == pJob->jobRes.pDbCfg) {
pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes)); pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbCfg) { if (NULL == pJob->jobRes.pDbCfg) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1281,7 +1281,7 @@ int32_t ctgDumpDbInfoRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pDbInfo) { if (NULL == pJob->jobRes.pDbInfo) {
pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes)); pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pDbInfo) { if (NULL == pJob->jobRes.pDbInfo) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1302,7 +1302,7 @@ int32_t ctgDumpUdfRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pUdfList) { if (NULL == pJob->jobRes.pUdfList) {
pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes)); pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pUdfList) { if (NULL == pJob->jobRes.pUdfList) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1323,7 +1323,7 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
if (NULL == pJob->jobRes.pUser) { if (NULL == pJob->jobRes.pUser) {
pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes)); pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes));
if (NULL == pJob->jobRes.pUser) { if (NULL == pJob->jobRes.pUser) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -1909,7 +1909,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo)); pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
if (NULL == pTask->res) { if (NULL == pTask->res) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName, CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName,
@ -2088,7 +2088,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
if (tTagIsJson(pTag)) { if (tTagIsJson(pTag)) {
pTagVals = taosArrayInit(1, sizeof(STagVal)); pTagVals = taosArrayInit(1, sizeof(STagVal));
if (NULL == pTagVals) { if (NULL == pTagVals) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
char* pJson = NULL; char* pJson = NULL;
@ -2105,7 +2105,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
if (NULL == taosArrayPush(pTagVals, &tagVal)) { if (NULL == taosArrayPush(pTagVals, &tagVal)) {
taosMemoryFree(pJson); taosMemoryFree(pJson);
taosArrayDestroy(pTagVals); taosArrayDestroy(pTagVals);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} else { } else {
CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals)); CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals));
@ -2850,7 +2850,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum); pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) { if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx)); ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
for (int32_t i = 0; i < pCtx->fetchNum; ++i) { for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -2953,7 +2953,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
if (NULL != dbCache) { if (NULL != dbCache) {
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo)); pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
if (NULL == pTask->res) { if (NULL == pTask->res) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName, CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName,
(SVgroupInfo*)pTask->res)); (SVgroupInfo*)pTask->res));
@ -3021,7 +3021,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList); int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
for (int32_t j = 0; j < inc; ++j) { for (int32_t j = 0; j < inc; ++j) {
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
} }
@ -3038,7 +3038,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum); pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) { if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx)); ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
for (int32_t i = 0; i < pCtx->fetchNum; ++i) { for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -3507,7 +3507,7 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum); pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) { if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx)); ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
for (int32_t i = 0; i < pCtx->fetchNum; ++i) { for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
@ -3600,7 +3600,7 @@ int32_t ctgLaunchGetTbTSMATask(SCtgTask* pTask) {
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum); pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
if (NULL == pTask->msgCtxs) { if (NULL == pTask->msgCtxs) {
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx)); ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
for (int32_t i = 0; i < pCtx->fetchNum; ++i) { for (int32_t i = 0; i < pCtx->fetchNum; ++i) {

View File

@ -600,7 +600,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
metaSize = CTG_META_SIZE(stbMeta); metaSize = CTG_META_SIZE(stbMeta);
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize); *pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
if (NULL == *pTableMeta) { if (NULL == *pTableMeta) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta)); TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
@ -814,7 +814,7 @@ int32_t ctgGetCachedStbNameFromSuid(SCatalog* pCtg, char* dbFName, uint64_t suid
*stbName = taosStrdup(stb); *stbName = taosStrdup(stb);
if (NULL == *stbName) { if (NULL == *stbName) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
} }
taosHashRelease(dbCache->stbCache, stb); taosHashRelease(dbCache->stbCache, stb);
@ -956,7 +956,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId)
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
char *p = strchr(dbFName, '.'); char *p = strchr(dbFName, '.');
@ -1032,7 +1032,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1067,7 +1067,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1102,7 +1102,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
taosMemoryFree(op); taosMemoryFree(op);
freeVgInfo(dbInfo); freeVgInfo(dbInfo);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
char *p = strchr(dbFName, '.'); char *p = strchr(dbFName, '.');
@ -1152,7 +1152,7 @@ int32_t ctgUpdateDbCfgEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg));
taosMemoryFree(op); taosMemoryFree(op);
freeDbCfgInfo(cfgInfo); freeDbCfgInfo(cfgInfo);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
char *p = strchr(dbFName, '.'); char *p = strchr(dbFName, '.');
@ -1193,7 +1193,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool sy
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
char *p = strchr(output->dbFName, '.'); char *p = strchr(output->dbFName, '.');
@ -1235,7 +1235,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEp
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1269,7 +1269,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1303,7 +1303,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncO
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1339,7 +1339,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) {
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1374,7 +1374,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1406,7 +1406,7 @@ int32_t ctgUpdateViewMetaEnqueue(SCatalog *pCtg, SViewMetaRsp *pRsp, bool syncOp
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
char *p = strchr(pRsp->dbFName, '.'); char *p = strchr(pRsp->dbFName, '.');
@ -1450,7 +1450,7 @@ int32_t ctgDropViewMetaEnqueue(SCatalog *pCtg, const char *dbFName, uint64_t dbI
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1485,7 +1485,7 @@ int32_t ctgUpdateTbTSMAEnqueue(SCatalog *pCtg, STSMACache **pTsma, int32_t tsmaV
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1644,7 +1644,7 @@ int32_t ctgUpdateDbTsmaVersionEnqueue(SCatalog* pCtg, int32_t tsmaVersion, const
if (NULL == msg) { if (NULL == msg) {
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg)); ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
taosMemoryFree(op); taosMemoryFree(op);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
msg->pCtg = pCtg; msg->pCtg = pCtg;
@ -1675,28 +1675,28 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
true, HASH_ENTRY_LOCK); true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.tbCache) { if (NULL == newDBCache.tbCache) {
ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum); ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
true, HASH_ENTRY_LOCK); true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.stbCache) { if (NULL == newDBCache.stbCache) {
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum); ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
true, HASH_ENTRY_LOCK); true, HASH_ENTRY_LOCK);
if (NULL == newDBCache.viewCache) { if (NULL == newDBCache.viewCache) {
ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum); ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
true, HASH_ENTRY_LOCK); true, HASH_ENTRY_LOCK);
if (!newDBCache.tsmaCache) { if (!newDBCache.tsmaCache) {
ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum); ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache)); code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache));
@ -1707,7 +1707,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
} }
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName); ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_CACHE_NUM_INC(CTG_CI_DB, 1); CTG_CACHE_NUM_INC(CTG_CI_DB, 1);
@ -1845,7 +1845,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) { if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) {
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
taosMemoryFree(meta); taosMemoryFree(meta);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta)); (void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta));
@ -1879,7 +1879,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) { if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid); ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1); (void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1);
@ -1911,7 +1911,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa
ctgFreeSTableIndex(*index); ctgFreeSTableIndex(*index);
taosMemoryFreeClear(*index); taosMemoryFreeClear(*index);
ctgError("taosHashPut new tbCache failed, tbName:%s", tbName); ctgError("taosHashPut new tbCache failed, tbName:%s", tbName);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex)); (void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex));
@ -1971,7 +1971,7 @@ int32_t ctgWriteViewMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFN
if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) { if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) {
ctgError("taosHashPut new tbCache failed, viewName:%s", viewName); ctgError("taosHashPut new tbCache failed, viewName:%s", viewName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta)); (void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta));
@ -2101,16 +2101,16 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
SCtgTSMACache cache = {0}; SCtgTSMACache cache = {0};
cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES)); cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
if (NULL == cache.pTsmas) { if (NULL == cache.pTsmas) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) { if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) { if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) {
ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName); ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache)); (void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache));
@ -2155,13 +2155,13 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES)); pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
if (!pCache->pTsmas) { if (!pCache->pTsmas) {
CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock); CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
// push the new cache // push the new cache
if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) { if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) {
code = TSDB_CODE_OUT_OF_MEMORY; code = terrno;
} else { } else {
*ppTsmaCache = NULL; *ppTsmaCache = NULL;
@ -2437,7 +2437,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) { if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta)); SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
if (NULL == ctbMeta) { if (NULL == ctbMeta) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta)); TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName, CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
@ -2590,7 +2590,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) { if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user); ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
@ -3423,7 +3423,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
@ -3442,7 +3442,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName); ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_META_NHIT_INC(); CTG_META_NHIT_INC();
@ -3459,7 +3459,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_META_NHIT_INC(); CTG_META_NHIT_INC();
@ -3508,7 +3508,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta; res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) { if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
continue; continue;
@ -3533,7 +3533,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta; res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) { if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
continue; continue;
@ -3559,7 +3559,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName); ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosMemoryFreeClear(pTableMeta); taosMemoryFreeClear(pTableMeta);
@ -3574,7 +3574,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosMemoryFreeClear(pTableMeta); taosMemoryFreeClear(pTableMeta);
@ -3593,7 +3593,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosMemoryFreeClear(pTableMeta); taosMemoryFreeClear(pTableMeta);
@ -3612,7 +3612,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosMemoryFreeClear(pTableMeta); taosMemoryFreeClear(pTableMeta);
@ -3629,7 +3629,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize); pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize);
if (NULL == pTableMeta) { if (NULL == pTableMeta) {
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache); ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta)); TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta));
@ -3646,7 +3646,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
res.pRes = pTableMeta; res.pRes = pTableMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) { if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
lastSuid = pTableMeta->suid; lastSuid = pTableMeta->suid;
@ -3759,7 +3759,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -3778,7 +3778,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName); ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1); CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
@ -3792,7 +3792,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName); ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName);
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag)); CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1); CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
@ -3824,7 +3824,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
ctgReleaseViewMetaToCache(pCtg, dbCache, pCache); ctgReleaseViewMetaToCache(pCtg, dbCache, pCache);
ctgFreeSViewMeta(pViewMeta); ctgFreeSViewMeta(pViewMeta);
taosMemoryFree(pViewMeta); taosMemoryFree(pViewMeta);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema)); TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
@ -3835,7 +3835,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
res.pRes = pViewMeta; res.pRes = pViewMeta;
if (NULL == taosArrayPush(ctx->pResList, &res)) { if (NULL == taosArrayPush(ctx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
@ -3875,7 +3875,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
for (int32_t i = 0; i < tbNum; ++i) { for (int32_t i = 0; i < tbNum; ++i) {
CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL)); CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
@ -3895,7 +3895,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname); ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL)); CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
continue; continue;
@ -3908,7 +3908,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL)); CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
taosHashRelease(dbCache->tbCache, pTbCache); taosHashRelease(dbCache->tbCache, pTbCache);
@ -3933,7 +3933,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL)); CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
continue; continue;
@ -3945,7 +3945,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) { if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) {
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
ctgReleaseTSMAToCache(pCtg, dbCache, pCache); ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
continue; continue;
@ -3960,7 +3960,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName)); CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName));
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) { if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1); CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1);
@ -3979,7 +3979,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
if (!pRsp->pTsmas) { if (!pRsp->pTsmas) {
ctgReleaseTSMAToCache(pCtg, dbCache, pCache); ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
taosMemoryFreeClear(pRsp); taosMemoryFreeClear(pRsp);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
SMetaRes res = {0}; SMetaRes res = {0};
@ -3998,14 +3998,14 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
ctgReleaseTSMAToCache(pCtg, dbCache, pCache); ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
tFreeTableTSMAInfoRsp(pRsp); tFreeTableTSMAInfoRsp(pRsp);
taosMemoryFreeClear(pRsp); taosMemoryFreeClear(pRsp);
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_RET(terrno);
} }
} }
res.pRes = pRsp; res.pRes = pRsp;
CTG_UNLOCK(CTG_READ, &pCache->tsmaLock); CTG_UNLOCK(CTG_READ, &pCache->tsmaLock);
taosHashRelease(dbCache->tsmaCache, pCache); taosHashRelease(dbCache->tsmaCache, pCache);
if (NULL == taosArrayPush(pCtx->pResList, &res)) { if (NULL == taosArrayPush(pCtx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
@ -4075,16 +4075,16 @@ int32_t ctgGetTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, SName* pTsmaNam
pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES); pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES);
if (!pRsp->pTsmas) { if (!pRsp->pTsmas) {
tFreeAndClearTableTSMAInfo(pTsmaOut); tFreeAndClearTableTSMAInfo(pTsmaOut);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) { if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) {
tFreeAndClearTableTSMAInfo(pTsmaOut); tFreeAndClearTableTSMAInfo(pTsmaOut);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
if (NULL == taosArrayPush(pCtx->pResList, &res)) { if (NULL == taosArrayPush(pCtx->pResList, &res)) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }

View File

@ -52,13 +52,13 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size)
if (NULL == slot->meta) { if (NULL == slot->meta) {
qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx, qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
mgmt->type); mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
} }
if (NULL == taosArrayPush(slot->meta, meta)) { if (NULL == taosArrayPush(slot->meta, meta)) {
qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type); qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
mgmt->rentCacheSize += size; mgmt->rentCacheSize += size;
@ -181,7 +181,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_
*res = taosMemoryMalloc(msize); *res = taosMemoryMalloc(msize);
if (NULL == *res) { if (NULL == *res) {
qError("malloc %d failed", (int32_t)msize); qError("malloc %d failed", (int32_t)msize);
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(terrno);
} }
void *meta = taosArrayGet(slot->meta, 0); void *meta = taosArrayGet(slot->meta, 0);