diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 7d842be7de..2286186ebb 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -329,7 +329,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { pReq->info.rsp = pRsp; pReq->info.rspLen = size; - if (rowsRead == 0 || ((rowsRead < rowsToRead) && !pShow->restore)) { + if (rowsRead == 0 || mndCheckRetrieveFinished(pShow)) { pRsp->completed = 1; mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); mndReleaseShowObj(pShow, true); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index d666f80fd3..44842084c5 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -1324,7 +1324,14 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter)); } int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows); - if (read < rows) read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read); + if (read < rows) { + read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read); + } + // no more to read + if (read < rows) { + taosMemoryFree(pShow->pIter); + pShow->pIter = NULL; + } return read; } static void mndCancelRetrieveIdx(SMnode *pMnode, void *pIter) { diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index b16ec8c2cb..d819b71f18 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1091,7 +1091,7 @@ static int32_t mndRetrieveVnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB int32_t cols = 0; int64_t curMs = taosGetTimestampMs(); - while (numOfRows < rows) { + while (numOfRows < rows - TSDB_MAX_REPLICA) { pShow->pIter = sdbFetch(pSdb, SDB_VGROUP, pShow->pIter, (void **)&pVgroup); if (pShow->pIter == NULL) break;