diff --git a/include/util/tdef.h b/include/util/tdef.h index 263c90c0f8cea5772d2bb18843dec899f02d72de..246c3e2eaab44ed78d06eea102a09ebbb415fac9 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -95,6 +95,7 @@ extern const int32_t TYPE_BYTES[15]; #define TSDB_TIME_PRECISION_NANO_STR "ns" #define TSDB_INFORMATION_SCHEMA_DB "information_schema" +#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_INS_TABLE_DNODES "dnodes" #define TSDB_INS_TABLE_MNODES "mnodes" #define TSDB_INS_TABLE_MODULES "modules" diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 49e9ccaba66c44140c7cd615d5641928a3f72069..f82e3817158ce73ca7c23d8bb3d71f84069c373c 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1486,6 +1486,18 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) { pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; } +static void setPerfSchemaDbCfg(SDbObj* pDbObj) { + ASSERT(pDbObj != NULL); + strncpy(pDbObj->name, TSDB_PERFORMANCE_SCHEMA_DB, tListLen(pDbObj->name)); + + pDbObj->createdTime = 0; + pDbObj->cfg.numOfVgroups = 0; + pDbObj->cfg.quorum = 1; + pDbObj->cfg.replications = 1; + pDbObj->cfg.update = 1; + 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; @@ -1515,10 +1527,15 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 } // Append the information_schema database into the result. - if (numOfRows < rowsCapacity) { - SDbObj dummyISDb = {0}; - setInformationSchemaDbCfg(&dummyISDb); - dumpDbInfoToPayload(data, &dummyISDb, pShow, numOfRows, rowsCapacity, 14); + if (numOfRows + 2 < rowsCapacity) { + SDbObj infoschemaDb = {0}; + setInformationSchemaDbCfg(&infoschemaDb); + dumpDbInfoToPayload(data, &infoschemaDb, pShow, numOfRows, rowsCapacity, 14); + numOfRows += 1; + + SDbObj perfschemaDb = {0}; + setPerfSchemaDbCfg(&perfschemaDb); + dumpDbInfoToPayload(data, &perfschemaDb, pShow, numOfRows, rowsCapacity, 14); numOfRows += 1; }