[td-1109]
This commit is contained in:
parent
3e2ea659cb
commit
ff20d564ab
|
@ -133,7 +133,7 @@ enum _mgmt_table {
|
|||
TSDB_MGMT_TABLE_MODULE,
|
||||
TSDB_MGMT_TABLE_QUERIES,
|
||||
TSDB_MGMT_TABLE_STREAMS,
|
||||
TSDB_MGMT_TABLE_CONFIGS,
|
||||
TSDB_MGMT_TABLE_VARIABLES,
|
||||
TSDB_MGMT_TABLE_CONNS,
|
||||
TSDB_MGMT_TABLE_SCORES,
|
||||
TSDB_MGMT_TABLE_GRANTS,
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#define TK_QUERIES 51
|
||||
#define TK_CONNECTIONS 52
|
||||
#define TK_STREAMS 53
|
||||
#define TK_CONFIGS 54
|
||||
#define TK_VARIABLES 54
|
||||
#define TK_SCORES 55
|
||||
#define TK_GRANTS 56
|
||||
#define TK_VNODES 57
|
||||
|
|
|
@ -49,7 +49,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg);
|
|||
static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg);
|
||||
static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg);
|
||||
static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) ;
|
||||
static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *rpcMsg);
|
||||
static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg);
|
||||
static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
|
||||
static int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
||||
static int32_t mnodeGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
|
||||
|
@ -161,8 +161,8 @@ int32_t mnodeInitDnodes() {
|
|||
mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mnodeProcessDnodeStatusMsg);
|
||||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mnodeGetModuleMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mnodeRetrieveModules);
|
||||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONFIGS, mnodeGetConfigMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONFIGS, mnodeRetrieveConfigs);
|
||||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeGetConfigMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeRetrieveConfigs);
|
||||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mnodeGetVnodeMeta);
|
||||
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mnodeRetrieveVnodes);
|
||||
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mnodeGetDnodeMeta);
|
||||
|
@ -728,7 +728,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
|
|||
}
|
||||
|
||||
static bool mnodeCheckModuleInDnode(SDnodeObj *pDnode, int32_t moduleType) {
|
||||
uint32_t status = pDnode->moduleStatus & (1 << moduleType);
|
||||
uint32_t status = pDnode->moduleStatus & (1u << moduleType);
|
||||
return status > 0;
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
|||
|
||||
pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "end point");
|
||||
strcpy(pSchema[cols].name, "end_point");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
|
@ -787,7 +787,9 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
|||
|
||||
int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
|
||||
int32_t numOfRows = 0;
|
||||
char * pWrite;
|
||||
|
||||
char* pWrite;
|
||||
char* moduleName[5] = { "MNODE", "HTTP", "MONITOR", "MQTT", "UNKNOWN" };
|
||||
|
||||
while (numOfRows < rows) {
|
||||
SDnodeObj *pDnode = NULL;
|
||||
|
@ -802,28 +804,18 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC
|
|||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strncpy(pWrite, pDnode->dnodeEp, pShow->bytes[cols]-1);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - 1);
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
switch (moduleType) {
|
||||
case TSDB_MOD_MNODE:
|
||||
strcpy(pWrite, "mnode");
|
||||
break;
|
||||
case TSDB_MOD_HTTP:
|
||||
strcpy(pWrite, "http");
|
||||
break;
|
||||
case TSDB_MOD_MONITOR:
|
||||
strcpy(pWrite, "monitor");
|
||||
break;
|
||||
default:
|
||||
strcpy(pWrite, "unknown");
|
||||
}
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, moduleName[moduleType], pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
bool enable = mnodeCheckModuleInDnode(pDnode, moduleType);
|
||||
strcpy(pWrite, enable ? "enable" : "disable");
|
||||
|
||||
char* v = enable? "enable":"disable";
|
||||
STR_TO_VARSTR(pWrite, v);
|
||||
cols++;
|
||||
|
||||
numOfRows++;
|
||||
|
|
|
@ -98,7 +98,7 @@ static char *mnodeGetShowType(int32_t showType) {
|
|||
case TSDB_MGMT_TABLE_MODULE: return "show modules";
|
||||
case TSDB_MGMT_TABLE_QUERIES: return "show queries";
|
||||
case TSDB_MGMT_TABLE_STREAMS: return "show streams";
|
||||
case TSDB_MGMT_TABLE_CONFIGS: return "show configs";
|
||||
case TSDB_MGMT_TABLE_VARIABLES: return "show configs";
|
||||
case TSDB_MGMT_TABLE_CONNS: return "show connections";
|
||||
case TSDB_MGMT_TABLE_SCORES: return "show scores";
|
||||
case TSDB_MGMT_TABLE_GRANTS: return "show grants";
|
||||
|
|
|
@ -73,7 +73,7 @@ cmd ::= SHOW MODULES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0);
|
|||
cmd ::= SHOW QUERIES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); }
|
||||
cmd ::= SHOW CONNECTIONS.{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);}
|
||||
cmd ::= SHOW STREAMS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); }
|
||||
cmd ::= SHOW CONFIGS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_CONFIGS, 0, 0); }
|
||||
cmd ::= SHOW VARIABLES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); }
|
||||
cmd ::= SHOW SCORES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); }
|
||||
cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); }
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static SKeyword keywordTable[] = {
|
|||
{"QUERIES", TK_QUERIES},
|
||||
{"CONNECTIONS", TK_CONNECTIONS},
|
||||
{"STREAMS", TK_STREAMS},
|
||||
{"CONFIGS", TK_CONFIGS},
|
||||
{"VARIABLES", TK_VARIABLES},
|
||||
{"SCORES", TK_SCORES},
|
||||
{"GRANTS", TK_GRANTS},
|
||||
{"DOT", TK_DOT},
|
||||
|
|
|
@ -488,7 +488,7 @@ static const YYCODETYPE yyFallback[] = {
|
|||
0, /* QUERIES => nothing */
|
||||
0, /* CONNECTIONS => nothing */
|
||||
0, /* STREAMS => nothing */
|
||||
0, /* CONFIGS => nothing */
|
||||
0, /* VARIABLES => nothing */
|
||||
0, /* SCORES => nothing */
|
||||
0, /* GRANTS => nothing */
|
||||
0, /* VNODES => nothing */
|
||||
|
@ -781,7 +781,7 @@ static const char *const yyTokenName[] = {
|
|||
/* 51 */ "QUERIES",
|
||||
/* 52 */ "CONNECTIONS",
|
||||
/* 53 */ "STREAMS",
|
||||
/* 54 */ "CONFIGS",
|
||||
/* 54 */ "VARIABLES",
|
||||
/* 55 */ "SCORES",
|
||||
/* 56 */ "GRANTS",
|
||||
/* 57 */ "VNODES",
|
||||
|
@ -1017,7 +1017,7 @@ static const char *const yyRuleName[] = {
|
|||
/* 7 */ "cmd ::= SHOW QUERIES",
|
||||
/* 8 */ "cmd ::= SHOW CONNECTIONS",
|
||||
/* 9 */ "cmd ::= SHOW STREAMS",
|
||||
/* 10 */ "cmd ::= SHOW CONFIGS",
|
||||
/* 10 */ "cmd ::= SHOW VARIABLES",
|
||||
/* 11 */ "cmd ::= SHOW SCORES",
|
||||
/* 12 */ "cmd ::= SHOW GRANTS",
|
||||
/* 13 */ "cmd ::= SHOW VNODES",
|
||||
|
@ -1702,7 +1702,7 @@ static const struct {
|
|||
{ 209, -2 }, /* (7) cmd ::= SHOW QUERIES */
|
||||
{ 209, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */
|
||||
{ 209, -2 }, /* (9) cmd ::= SHOW STREAMS */
|
||||
{ 209, -2 }, /* (10) cmd ::= SHOW CONFIGS */
|
||||
{ 209, -2 }, /* (10) cmd ::= SHOW VARIABLES */
|
||||
{ 209, -2 }, /* (11) cmd ::= SHOW SCORES */
|
||||
{ 209, -2 }, /* (12) cmd ::= SHOW GRANTS */
|
||||
{ 209, -2 }, /* (13) cmd ::= SHOW VNODES */
|
||||
|
@ -2029,8 +2029,8 @@ static void yy_reduce(
|
|||
case 9: /* cmd ::= SHOW STREAMS */
|
||||
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); }
|
||||
break;
|
||||
case 10: /* cmd ::= SHOW CONFIGS */
|
||||
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONFIGS, 0, 0); }
|
||||
case 10: /* cmd ::= SHOW VARIABLES */
|
||||
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); }
|
||||
break;
|
||||
case 11: /* cmd ::= SHOW SCORES */
|
||||
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); }
|
||||
|
@ -2277,6 +2277,7 @@ static void yy_reduce(
|
|||
yymsp[-1].minor.yy268 = yylhsminor.yy268;
|
||||
break;
|
||||
case 95: /* db_optr ::= db_optr fsync */
|
||||
case 107: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==107);
|
||||
{ yylhsminor.yy268 = yymsp[-1].minor.yy268; yylhsminor.yy268.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
|
||||
yymsp[-1].minor.yy268 = yylhsminor.yy268;
|
||||
break;
|
||||
|
@ -2297,10 +2298,6 @@ static void yy_reduce(
|
|||
case 99: /* alter_db_optr ::= */
|
||||
{ setDefaultCreateDbOption(&yymsp[1].minor.yy268);}
|
||||
break;
|
||||
case 107: /* alter_db_optr ::= alter_db_optr fsync */
|
||||
{ yylhsminor.yy268 = yymsp[-1].minor.yy268; yylhsminor.yy268.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
|
||||
yymsp[-1].minor.yy268 = yylhsminor.yy268;
|
||||
break;
|
||||
case 108: /* typename ::= ids */
|
||||
{
|
||||
yymsp[0].minor.yy0.type = 0;
|
||||
|
|
Loading…
Reference in New Issue