[TD-6131]<fix> show vnodes crash

This commit is contained in:
yihaoDeng 2021-08-17 20:11:47 +00:00
parent 121e0bc033
commit c4136b1b39
2 changed files with 4 additions and 4 deletions

View File

@ -274,6 +274,7 @@ typedef struct {
int32_t rowSize;
int32_t numOfRows;
void * pIter;
void * pVgIter;
void ** ppShow;
int16_t offset[TSDB_MAX_COLUMNS];
int32_t bytes[TSDB_MAX_COLUMNS];

View File

@ -1232,13 +1232,12 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo
pDnode = (SDnodeObj *)(pShow->pIter);
if (pDnode != NULL) {
void *pIter = NULL;
SVgObj *pVgroup;
while (1) {
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
pShow->pVgIter = mnodeGetNextVgroup(pShow->pVgIter, &pVgroup);
if (pVgroup == NULL) break;
for (int32_t i = pShow->index; i < pVgroup->numOfVnodes && numOfRows < rows; ++i) {
for (int32_t i = 0; i < pVgroup->numOfVnodes && numOfRows < rows; ++i) {
SVnodeGid *pVgid = &pVgroup->vnodeGid[i];
if (pVgid->pDnode == pDnode) {
cols = 0;
@ -1251,8 +1250,8 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo
STR_TO_VARSTR(pWrite, syncRole[pVgid->role]);
cols++;
numOfRows++;
}
pShow->index = i;
}
if (numOfRows >= rows) {
break;