Merge pull request #29099 from taosdata/fix/main/TD-33179

Enh(mnode):Add sdbCancelFetch and sdbRelease while exit iter.
This commit is contained in:
Shengliang Guan 2024-12-13 11:05:24 +08:00 committed by GitHub
commit 925a222366
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 6 deletions

View File

@ -920,7 +920,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false); code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }
@ -930,7 +932,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, b1, false); code = colDataSetVal(pColInfo, numOfRows, b1, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }
@ -951,7 +955,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)b2, false); code = colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }
const char *status = "ready"; const char *status = "ready";
@ -963,14 +969,18 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)b3, false); code = colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false); code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }
@ -978,7 +988,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false); code = colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
if (code != 0) { if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, terrstr()); mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out; goto _out;
} }