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

refact: merge unnecessary code.
This commit is contained in:
Shengliang Guan 2024-12-13 14:38:04 +08:00 committed by GitHub
commit b11638812b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 24 deletions

View File

@ -954,12 +954,8 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
STR_WITH_MAXSIZE_TO_VARSTR(b2, role, pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)b2, false);
if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out;
}
if (code != 0) goto _err;
const char *status = "ready";
if (objStatus == SDB_STATUS_CREATING) status = "creating";
if (objStatus == SDB_STATUS_DROPPING) status = "dropping";
@ -968,31 +964,16 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
STR_WITH_MAXSIZE_TO_VARSTR(b3, status, pShow->pMeta->pSchemas[cols].bytes);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)b3, false);
if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out;
}
if (code != 0) goto _err;
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out;
}
if (code != 0) goto _err;
int64_t roleTimeMs = (isDnodeOnline) ? pObj->roleTimeMs : 0;
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
if (code != 0) {
mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
goto _out;
}
if (code != 0) goto _err;
numOfRows++;
sdbRelease(pSdb, pObj);
@ -1003,6 +984,13 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
_out:
sdbRelease(pSdb, pSelfObj);
return numOfRows;
_err:
mError("mnode:%d, failed to set col data val since %s", pObj->id, tstrerror(code));
sdbCancelFetch(pSdb, pShow->pIter);
sdbRelease(pSdb, pObj);
sdbRelease(pSdb, pSelfObj);
return numOfRows;
}
static void mndCancelGetNextMnode(SMnode *pMnode, void *pIter) {