Merge pull request #11064 from taosdata/feature/shm

TD-14351 incorrect ntables value in show databases results
This commit is contained in:
Shengliang Guan 2022-03-28 17:57:23 +08:00 committed by GitHub
commit c1a5775db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -1521,6 +1521,14 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) {
pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI;
}
static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) {
SVgObj *pVgroup = pObj;
int32_t *numOfTables = p1;
*numOfTables += pVgroup->numOfTables;
return true;
}
static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rowsCapacity) {
SMnode *pMnode = pReq->pNode;
SSdb *pSdb = pMnode->pSdb;
@ -1533,7 +1541,10 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
break;
}
dumpDbInfoToPayload(data, pDb, pShow, numOfRows, rowsCapacity, 0);
int32_t numOfTables = 0;
sdbTraverse(pSdb, SDB_VGROUP, mndGetTablesOfDbFp, &numOfTables, NULL, NULL);
dumpDbInfoToPayload(data, pDb, pShow, numOfRows, rowsCapacity, numOfTables);
numOfRows++;
sdbRelease(pSdb, pDb);
}