From a43e03c1f747725a49ad535ab3ba51136574c843 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 20 Sep 2022 16:02:56 +0800 Subject: [PATCH] fix(tsc):fix taosdump failure --- source/client/src/clientHb.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 75ccd44977..383d6ca37e 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -606,28 +606,34 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { int32_t connKeyCnt = atomic_load_32(&pAppHbMgr->connKeyCnt); pBatchReq->reqs = taosArrayInit(connKeyCnt, sizeof(SClientHbReq)); + int64_t rid = -1; int32_t code = 0; - void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL); - while (pIter != NULL) { - SClientHbReq *pOneReq = pIter; - pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq); + void *pIter = taosHashIterate(pAppHbMgr->activeInfo, NULL); + SClientHbReq *pOneReq = pIter; + SClientHbKey *connKey = pOneReq ? &pOneReq->connKey : NULL; + if (connKey != NULL) rid = connKey->tscRid; + + STscObj *pTscObj = (STscObj *)acquireTscObj(rid); + if (pTscObj == NULL) { + tFreeClientHbBatchReq(pBatchReq); + return NULL; + } + + while (pIter != NULL) { + pOneReq = taosArrayPush(pBatchReq->reqs, pOneReq); code = (*clientHbMgr.reqHandle[pOneReq->connKey.connType])(&pOneReq->connKey, &pOneReq->clusterId, pOneReq); if (code) { pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); + pOneReq = pIter; continue; } - // hbClearClientHbReq(pOneReq); - pIter = taosHashIterate(pAppHbMgr->activeInfo, pIter); + pOneReq = pIter; } - - // if (code) { - // taosArrayDestroyEx(pBatchReq->reqs, hbFreeReq); - // taosMemoryFreeClear(pBatchReq); - // } + releaseTscObj(rid); return pBatchReq; } -- GitLab