提交 14ff088d 编写于 作者: H Hongze Cheng

Merge branch '3.0' of https://github.com/taosdata/TDengine into feature/meta

...@@ -226,10 +226,10 @@ endif(${BUILD_WITH_NURAFT}) ...@@ -226,10 +226,10 @@ endif(${BUILD_WITH_NURAFT})
if(${BUILD_PTHREAD}) if(${BUILD_PTHREAD})
set(CMAKE_BUILD_TYPE release) set(CMAKE_BUILD_TYPE release)
add_definitions(-DPTW32_STATIC_LIB) add_definitions(-DPTW32_STATIC_LIB)
add_subdirectory(pthread) add_subdirectory(pthread EXCLUDE_FROM_ALL)
set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread) set_target_properties(libpthreadVC3 PROPERTIES OUTPUT_NAME pthread)
add_library(pthread STATIC IMPORTED GLOBAL) add_library(pthread INTERFACE)
SET_PROPERTY(TARGET pthread PROPERTY IMPORTED_LOCATION ${LIBRARY_OUTPUT_PATH}/pthread.lib) target_link_libraries(pthread INTERFACE libpthreadVC3)
endif() endif()
# iconv # iconv
......
...@@ -260,8 +260,8 @@ int32_t stmtCleanBindInfo(STscStmt* pStmt) { ...@@ -260,8 +260,8 @@ int32_t stmtCleanBindInfo(STscStmt* pStmt) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool freeRequest) { int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
if (STMT_TYPE_QUERY != pStmt->sql.type || freeRequest) { if (STMT_TYPE_QUERY != pStmt->sql.type || deepClean) {
taos_free_result(pStmt->exec.pRequest); taos_free_result(pStmt->exec.pRequest);
pStmt->exec.pRequest = NULL; pStmt->exec.pRequest = NULL;
} }
...@@ -280,7 +280,11 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool freeRequest) { ...@@ -280,7 +280,11 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool freeRequest) {
continue; continue;
} }
qFreeStmtDataBlock(pBlocks); if (STMT_TYPE_MULTI_INSERT == pStmt->sql.type) {
qFreeStmtDataBlock(pBlocks);
} else {
qDestroyStmtDataBlock(pBlocks);
}
taosHashRemove(pStmt->exec.pBlockHash, key, keyLen); taosHashRemove(pStmt->exec.pBlockHash, key, keyLen);
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter); pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
...@@ -320,11 +324,11 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) { ...@@ -320,11 +324,11 @@ int32_t stmtCleanSQLInfo(STscStmt* pStmt) {
taosHashCleanup(pStmt->sql.pTableCache); taosHashCleanup(pStmt->sql.pTableCache);
pStmt->sql.pTableCache = NULL; pStmt->sql.pTableCache = NULL;
memset(&pStmt->sql, 0, sizeof(pStmt->sql));
STMT_ERR_RET(stmtCleanExecInfo(pStmt, false, true)); STMT_ERR_RET(stmtCleanExecInfo(pStmt, false, true));
STMT_ERR_RET(stmtCleanBindInfo(pStmt)); STMT_ERR_RET(stmtCleanBindInfo(pStmt));
memset(&pStmt->sql, 0, sizeof(pStmt->sql));
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -58,6 +58,7 @@ static int32_t dmNewProc(SMgmtWrapper *pWrapper, EDndNodeType ntype) { ...@@ -58,6 +58,7 @@ static int32_t dmNewProc(SMgmtWrapper *pWrapper, EDndNodeType ntype) {
return -1; return -1;
} }
taosIgnSignal(SIGCHLD);
pWrapper->proc.pid = pid; pWrapper->proc.pid = pid;
dInfo("node:%s, continue running in new process:%d", pWrapper->name, pid); dInfo("node:%s, continue running in new process:%d", pWrapper->name, pid);
return 0; return 0;
...@@ -254,7 +255,7 @@ static void dmWatchNodes(SDnode *pDnode) { ...@@ -254,7 +255,7 @@ static void dmWatchNodes(SDnode *pDnode) {
if (!OnlyInParentProc(pWrapper)) continue; if (!OnlyInParentProc(pWrapper)) continue;
if (proc->pid <= 0 || !taosProcExist(proc->pid)) { if (proc->pid <= 0 || !taosProcExist(proc->pid)) {
dWarn("node:%s, process:%d is killed and needs to restart", pWrapper->name, proc->pid); dError("node:%s, process:%d is killed and needs to restart", pWrapper->name, proc->pid);
dmCloseProcRpcHandles(&pWrapper->proc); dmCloseProcRpcHandles(&pWrapper->proc);
dmNewProc(pWrapper, ntype); dmNewProc(pWrapper, ntype);
} }
......
...@@ -131,6 +131,7 @@ typedef struct SCtgCacheStat { ...@@ -131,6 +131,7 @@ typedef struct SCtgCacheStat {
uint64_t dbNum; uint64_t dbNum;
uint64_t tblNum; uint64_t tblNum;
uint64_t stblNum; uint64_t stblNum;
uint64_t userNum;
uint64_t vgHitNum; uint64_t vgHitNum;
uint64_t vgMissNum; uint64_t vgMissNum;
uint64_t tblHitNum; uint64_t tblHitNum;
......
...@@ -122,6 +122,11 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) { ...@@ -122,6 +122,11 @@ void ctgFreeDbCache(SCtgDBCache *dbCache) {
ctgFreeTableMetaCache(&dbCache->tbCache); ctgFreeTableMetaCache(&dbCache->tbCache);
} }
void ctgFreeSCtgUserAuth(SCtgUserAuth *userCache) {
taosHashCleanup(userCache->createdDbs);
taosHashCleanup(userCache->readDbs);
taosHashCleanup(userCache->writeDbs);
}
void ctgFreeHandle(SCatalog* pCtg) { void ctgFreeHandle(SCatalog* pCtg) {
ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->dbRent);
...@@ -145,7 +150,24 @@ void ctgFreeHandle(SCatalog* pCtg) { ...@@ -145,7 +150,24 @@ void ctgFreeHandle(SCatalog* pCtg) {
CTG_CACHE_STAT_SUB(dbNum, dbNum); CTG_CACHE_STAT_SUB(dbNum, dbNum);
} }
if (pCtg->userCache) {
int32_t userNum = taosHashGetSize(pCtg->userCache);
void *pIter = taosHashIterate(pCtg->userCache, NULL);
while (pIter) {
SCtgUserAuth *userCache = pIter;
ctgFreeSCtgUserAuth(userCache);
pIter = taosHashIterate(pCtg->userCache, pIter);
}
taosHashCleanup(pCtg->userCache);
CTG_CACHE_STAT_SUB(userNum, userNum);
}
taosMemoryFree(pCtg); taosMemoryFree(pCtg);
} }
...@@ -2031,10 +2053,13 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons ...@@ -2031,10 +2053,13 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
SName stbName = *pTableName; SName stbName = *pTableName;
strcpy(stbName.tname, output->tbName); strcpy(stbName.tname, output->tbName);
taosMemoryFreeClear(output->tbMeta);
CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, &stbName, pTableMeta, &inCache, flag, NULL)); CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, &stbName, pTableMeta, &inCache, flag, NULL));
if (!inCache) { if (!inCache) {
ctgDebug("stb no longer exist, dbFName:%s, tbName:%s", output->dbFName, pTableName->tname); ctgDebug("stb no longer exist, dbFName:%s, tbName:%s", output->dbFName, pTableName->tname);
continue; continue;
} }
...@@ -2306,6 +2331,8 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) { ...@@ -2306,6 +2331,8 @@ int32_t ctgActUpdateUser(SCtgMetaAction *action) {
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
} }
taosMemoryFreeClear(msg);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -361,7 +361,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) { ...@@ -361,7 +361,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src));
*dst = taosMemoryCalloc(1, tlen + 1); *dst = taosMemoryCalloc(1, tlen + 1);
tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src)); tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src));
*dst = *dst - tlen; *dst = (char*) * dst - tlen;
break; break;
} }
case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY
......
...@@ -1045,6 +1045,7 @@ static void destroyInsertParseContext(SInsertParseContext* pCxt) { ...@@ -1045,6 +1045,7 @@ static void destroyInsertParseContext(SInsertParseContext* pCxt) {
destroyInsertParseContextForTable(pCxt); destroyInsertParseContextForTable(pCxt);
taosHashCleanup(pCxt->pVgroupsHashObj); taosHashCleanup(pCxt->pVgroupsHashObj);
taosHashCleanup(pCxt->pSubTableHashObj); taosHashCleanup(pCxt->pSubTableHashObj);
taosHashCleanup(pCxt->pTableNameHashObj);
destroyBlockHashmap(pCxt->pTableBlockHashObj); destroyBlockHashmap(pCxt->pTableBlockHashObj);
destroyBlockArrayList(pCxt->pVgDataBlocks); destroyBlockArrayList(pCxt->pVgDataBlocks);
......
...@@ -235,12 +235,12 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) { ...@@ -235,12 +235,12 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) {
} }
taosMemoryFreeClear(pDataBlock->pData); taosMemoryFreeClear(pDataBlock->pData);
if (!pDataBlock->cloned) { // if (!pDataBlock->cloned) {
// free the refcount for metermeta // free the refcount for metermeta
taosMemoryFreeClear(pDataBlock->pTableMeta); taosMemoryFreeClear(pDataBlock->pTableMeta);
destroyBoundColumnInfo(&pDataBlock->boundColumnInfo); destroyBoundColumnInfo(&pDataBlock->boundColumnInfo);
} // }
taosMemoryFreeClear(pDataBlock); taosMemoryFreeClear(pDataBlock);
} }
......
...@@ -1438,24 +1438,24 @@ int32_t schHandleDropCallback(void *param, const SDataBuf *pMsg, int32_t code) { ...@@ -1438,24 +1438,24 @@ int32_t schHandleDropCallback(void *param, const SDataBuf *pMsg, int32_t code) {
} }
int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) {
SSchedulerHbRsp rsp = {0};
SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param;
if (code) { if (code) {
qError("hb rsp error:%s", tstrerror(code)); qError("hb rsp error:%s", tstrerror(code));
SCH_ERR_RET(code); SCH_ERR_JRET(code);
} }
SSchedulerHbRsp rsp = {0};
if (tDeserializeSSchedulerHbRsp(pMsg->pData, pMsg->len, &rsp)) { if (tDeserializeSSchedulerHbRsp(pMsg->pData, pMsg->len, &rsp)) {
qError("invalid hb rsp msg, size:%d", pMsg->len); qError("invalid hb rsp msg, size:%d", pMsg->len);
SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT);
} }
SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param;
SSchTrans trans = {0}; SSchTrans trans = {0};
trans.transInst = pParam->transport; trans.transInst = pParam->transport;
trans.transHandle = pMsg->handle; trans.transHandle = pMsg->handle;
SCH_ERR_RET(schUpdateHbConnection(&rsp.epId, &trans)); SCH_ERR_JRET(schUpdateHbConnection(&rsp.epId, &trans));
int32_t taskNum = (int32_t)taosArrayGetSize(rsp.taskStatus); int32_t taskNum = (int32_t)taosArrayGetSize(rsp.taskStatus);
qDebug("%d task status in hb rsp, nodeId:%d, fqdn:%s, port:%d", taskNum, rsp.epId.nodeId, rsp.epId.ep.fqdn, qDebug("%d task status in hb rsp, nodeId:%d, fqdn:%s, port:%d", taskNum, rsp.epId.nodeId, rsp.epId.ep.fqdn,
...@@ -1483,6 +1483,7 @@ int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { ...@@ -1483,6 +1483,7 @@ int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) {
_return: _return:
tFreeSSchedulerHbRsp(&rsp); tFreeSSchedulerHbRsp(&rsp);
taosMemoryFree(param);
SCH_RET(code); SCH_RET(code);
} }
......
...@@ -251,16 +251,12 @@ CaseCtrl gCaseCtrl = { ...@@ -251,16 +251,12 @@ CaseCtrl gCaseCtrl = {
.bindColNum = 0, .bindColNum = 0,
.bindTagNum = 0, .bindTagNum = 0,
.bindRowNum = 0, .bindRowNum = 0,
.bindColTypeNum = tListLen(bindColTypeList),
.bindColTypeList = bindColTypeList,
.bindTagTypeNum = 0, .bindTagTypeNum = 0,
.bindTagTypeList = NULL, .bindTagTypeList = NULL,
.optrIdxListNum = tListLen(optrIdxList),
.optrIdxList = optrIdxList,
.checkParamNum = false, .checkParamNum = false,
.printRes = false, .printRes = false,
.runTimes = 0, .runTimes = 0,
.caseIdx = 23, .caseIdx = 1,
.caseNum = 1, .caseNum = 1,
.caseRunIdx = -1, .caseRunIdx = -1,
.caseRunNum = 1, .caseRunNum = 1,
...@@ -1101,7 +1097,9 @@ void destroyData(BindData *data) { ...@@ -1101,7 +1097,9 @@ void destroyData(BindData *data) {
taosMemoryFree(data->binaryLen); taosMemoryFree(data->binaryLen);
taosMemoryFree(data->isNull); taosMemoryFree(data->isNull);
taosMemoryFree(data->pBind); taosMemoryFree(data->pBind);
taosMemoryFree(data->pTags);
taosMemoryFree(data->colTypes); taosMemoryFree(data->colTypes);
taosMemoryFree(data->sql);
} }
void bpFetchRows(TAOS_RES *result, bool printr, int32_t *rows) { void bpFetchRows(TAOS_RES *result, bool printr, int32_t *rows) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册