From 38e6bf3b6e4c463b11398857ff03e2c0a95a79ef Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 10 Jun 2022 19:56:11 +0800 Subject: [PATCH] fix tmq crash issue --- source/client/src/clientImpl.c | 4 +++- source/client/src/tmq.c | 2 +- source/dnode/mnode/impl/inc/mndDef.h | 1 + source/libs/scheduler/src/schJob.c | 2 +- tests/test/c/tmqSim.c | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 561b3b30f8..ce6f28fe7e 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -727,7 +727,9 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery) { if (TSDB_CODE_SUCCESS == code) { code = qCreateQueryPlan(&cxt, &pRequest->body.pDag, pNodeList); - tscError("0x%"PRIx64" failed to create query plan, code:%s 0x%"PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); + if (code) { + tscError("0x%"PRIx64" failed to create query plan, code:%s 0x%"PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); + } } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 58905cac19..3634a688cd 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -1162,7 +1162,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { pParam->vgId = pVg->vgId; pParam->epoch = tmq->epoch; - SMsgSendInfo* sendInfo = taosMemoryMalloc(sizeof(SMsgSendInfo)); + SMsgSendInfo* sendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (sendInfo == NULL) { taosMemoryFree(pReq); taosMemoryFree(pParam); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 3ad55e4793..12650c75b7 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -334,6 +334,7 @@ typedef struct { int64_t dbUid; int32_t tagVer; int32_t colVer; + int32_t smaVer; int32_t nextColId; float xFilesFactor; int32_t delay; diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index a6bc4a9e14..3e3f3639d7 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -1514,7 +1514,7 @@ int32_t schExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes) { if (EXPLAIN_MODE_STATIC == pReq->pDag->explainInfo.mode) { SCH_ERR_JRET(schExecStaticExplainJob(pReq, pJob, true)); } else { - SCH_ERR_JRET(schExecJobImpl(pReq, pJob, pRes, true)); + SCH_ERR_JRET(schExecJobImpl(pReq, pJob, NULL, true)); } _return: diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 4d9e2275f4..405fec4861 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -490,6 +490,7 @@ void* consumeThreadFunc(void* param) { build_consumer(pInfo); build_topic_list(pInfo); if ((NULL == pInfo->tmq) || (NULL == pInfo->topicList)) { + assert(0); return NULL; }