refact: merge unnecessary code.
This commit is contained in:
parent
f2e9e91487
commit
8136363fbe
|
@ -951,12 +951,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";
|
||||
|
@ -965,31 +961,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);
|
||||
|
@ -1000,6 +981,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) {
|
||||
|
|
Loading…
Reference in New Issue