提交 69c2cf11 编写于 作者: H Haojun Liao

ehn(query): return the performance_schema db when "show databases" sql statement issued.

上级 739c4e38
...@@ -95,6 +95,7 @@ extern const int32_t TYPE_BYTES[15]; ...@@ -95,6 +95,7 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_TIME_PRECISION_NANO_STR "ns" #define TSDB_TIME_PRECISION_NANO_STR "ns"
#define TSDB_INFORMATION_SCHEMA_DB "information_schema" #define TSDB_INFORMATION_SCHEMA_DB "information_schema"
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
#define TSDB_INS_TABLE_DNODES "dnodes" #define TSDB_INS_TABLE_DNODES "dnodes"
#define TSDB_INS_TABLE_MNODES "mnodes" #define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules" #define TSDB_INS_TABLE_MODULES "modules"
......
...@@ -1486,6 +1486,18 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) { ...@@ -1486,6 +1486,18 @@ static void setInformationSchemaDbCfg(SDbObj *pDbObj) {
pDbObj->cfg.precision = TSDB_TIME_PRECISION_MILLI; 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) { static bool mndGetTablesOfDbFp(SMnode *pMnode, void *pObj, void *p1, void *p2, void *p3) {
SVgObj *pVgroup = pObj; SVgObj *pVgroup = pObj;
int32_t *numOfTables = p1; int32_t *numOfTables = p1;
...@@ -1515,10 +1527,15 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 ...@@ -1515,10 +1527,15 @@ static int32_t mndRetrieveDbs(SNodeMsg *pReq, SShowObj *pShow, char *data, int32
} }
// Append the information_schema database into the result. // Append the information_schema database into the result.
if (numOfRows < rowsCapacity) { if (numOfRows + 2 < rowsCapacity) {
SDbObj dummyISDb = {0}; SDbObj infoschemaDb = {0};
setInformationSchemaDbCfg(&dummyISDb); setInformationSchemaDbCfg(&infoschemaDb);
dumpDbInfoToPayload(data, &dummyISDb, pShow, numOfRows, rowsCapacity, 14); dumpDbInfoToPayload(data, &infoschemaDb, pShow, numOfRows, rowsCapacity, 14);
numOfRows += 1;
SDbObj perfschemaDb = {0};
setPerfSchemaDbCfg(&perfschemaDb);
dumpDbInfoToPayload(data, &perfschemaDb, pShow, numOfRows, rowsCapacity, 14);
numOfRows += 1; numOfRows += 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册