提交 ff20d564 编写于 作者: H Haojun Liao

[td-1109]

上级 3e2ea659
...@@ -133,7 +133,7 @@ enum _mgmt_table { ...@@ -133,7 +133,7 @@ enum _mgmt_table {
TSDB_MGMT_TABLE_MODULE, TSDB_MGMT_TABLE_MODULE,
TSDB_MGMT_TABLE_QUERIES, TSDB_MGMT_TABLE_QUERIES,
TSDB_MGMT_TABLE_STREAMS, TSDB_MGMT_TABLE_STREAMS,
TSDB_MGMT_TABLE_CONFIGS, TSDB_MGMT_TABLE_VARIABLES,
TSDB_MGMT_TABLE_CONNS, TSDB_MGMT_TABLE_CONNS,
TSDB_MGMT_TABLE_SCORES, TSDB_MGMT_TABLE_SCORES,
TSDB_MGMT_TABLE_GRANTS, TSDB_MGMT_TABLE_GRANTS,
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#define TK_QUERIES 51 #define TK_QUERIES 51
#define TK_CONNECTIONS 52 #define TK_CONNECTIONS 52
#define TK_STREAMS 53 #define TK_STREAMS 53
#define TK_CONFIGS 54 #define TK_VARIABLES 54
#define TK_SCORES 55 #define TK_SCORES 55
#define TK_GRANTS 56 #define TK_GRANTS 56
#define TK_VNODES 57 #define TK_VNODES 57
......
...@@ -49,7 +49,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg); ...@@ -49,7 +49,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg);
static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) ; 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 mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, 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); static int32_t mnodeGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
...@@ -161,8 +161,8 @@ int32_t mnodeInitDnodes() { ...@@ -161,8 +161,8 @@ int32_t mnodeInitDnodes() {
mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mnodeProcessDnodeStatusMsg); mnodeAddPeerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mnodeProcessDnodeStatusMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mnodeGetModuleMeta); mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mnodeGetModuleMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mnodeRetrieveModules); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mnodeRetrieveModules);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONFIGS, mnodeGetConfigMeta); mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeGetConfigMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONFIGS, mnodeRetrieveConfigs); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VARIABLES, mnodeRetrieveConfigs);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mnodeGetVnodeMeta); mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mnodeGetVnodeMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mnodeRetrieveVnodes); mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mnodeRetrieveVnodes);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mnodeGetDnodeMeta); mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mnodeGetDnodeMeta);
...@@ -728,7 +728,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo ...@@ -728,7 +728,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
} }
static bool mnodeCheckModuleInDnode(SDnodeObj *pDnode, int32_t moduleType) { 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; return status > 0;
} }
...@@ -753,7 +753,7 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p ...@@ -753,7 +753,7 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE; pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY; 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]); pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++; cols++;
...@@ -787,7 +787,9 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p ...@@ -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 mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
int32_t numOfRows = 0; int32_t numOfRows = 0;
char * pWrite;
char* pWrite;
char* moduleName[5] = { "MNODE", "HTTP", "MONITOR", "MQTT", "UNKNOWN" };
while (numOfRows < rows) { while (numOfRows < rows) {
SDnodeObj *pDnode = NULL; SDnodeObj *pDnode = NULL;
...@@ -802,28 +804,18 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC ...@@ -802,28 +804,18 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; 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++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
switch (moduleType) { STR_WITH_MAXSIZE_TO_VARSTR(pWrite, moduleName[moduleType], pShow->bytes[cols]);
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");
}
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
bool enable = mnodeCheckModuleInDnode(pDnode, moduleType); bool enable = mnodeCheckModuleInDnode(pDnode, moduleType);
strcpy(pWrite, enable ? "enable" : "disable");
char* v = enable? "enable":"disable";
STR_TO_VARSTR(pWrite, v);
cols++; cols++;
numOfRows++; numOfRows++;
......
...@@ -98,7 +98,7 @@ static char *mnodeGetShowType(int32_t showType) { ...@@ -98,7 +98,7 @@ static char *mnodeGetShowType(int32_t showType) {
case TSDB_MGMT_TABLE_MODULE: return "show modules"; case TSDB_MGMT_TABLE_MODULE: return "show modules";
case TSDB_MGMT_TABLE_QUERIES: return "show queries"; case TSDB_MGMT_TABLE_QUERIES: return "show queries";
case TSDB_MGMT_TABLE_STREAMS: return "show streams"; 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_CONNS: return "show connections";
case TSDB_MGMT_TABLE_SCORES: return "show scores"; case TSDB_MGMT_TABLE_SCORES: return "show scores";
case TSDB_MGMT_TABLE_GRANTS: return "show grants"; case TSDB_MGMT_TABLE_GRANTS: return "show grants";
......
...@@ -73,7 +73,7 @@ cmd ::= SHOW MODULES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_MODULE, 0, 0); ...@@ -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 QUERIES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); }
cmd ::= SHOW CONNECTIONS.{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 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 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 SCORES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); }
cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); }
......
...@@ -85,7 +85,7 @@ static SKeyword keywordTable[] = { ...@@ -85,7 +85,7 @@ static SKeyword keywordTable[] = {
{"QUERIES", TK_QUERIES}, {"QUERIES", TK_QUERIES},
{"CONNECTIONS", TK_CONNECTIONS}, {"CONNECTIONS", TK_CONNECTIONS},
{"STREAMS", TK_STREAMS}, {"STREAMS", TK_STREAMS},
{"CONFIGS", TK_CONFIGS}, {"VARIABLES", TK_VARIABLES},
{"SCORES", TK_SCORES}, {"SCORES", TK_SCORES},
{"GRANTS", TK_GRANTS}, {"GRANTS", TK_GRANTS},
{"DOT", TK_DOT}, {"DOT", TK_DOT},
......
...@@ -488,7 +488,7 @@ static const YYCODETYPE yyFallback[] = { ...@@ -488,7 +488,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* QUERIES => nothing */ 0, /* QUERIES => nothing */
0, /* CONNECTIONS => nothing */ 0, /* CONNECTIONS => nothing */
0, /* STREAMS => nothing */ 0, /* STREAMS => nothing */
0, /* CONFIGS => nothing */ 0, /* VARIABLES => nothing */
0, /* SCORES => nothing */ 0, /* SCORES => nothing */
0, /* GRANTS => nothing */ 0, /* GRANTS => nothing */
0, /* VNODES => nothing */ 0, /* VNODES => nothing */
...@@ -781,7 +781,7 @@ static const char *const yyTokenName[] = { ...@@ -781,7 +781,7 @@ static const char *const yyTokenName[] = {
/* 51 */ "QUERIES", /* 51 */ "QUERIES",
/* 52 */ "CONNECTIONS", /* 52 */ "CONNECTIONS",
/* 53 */ "STREAMS", /* 53 */ "STREAMS",
/* 54 */ "CONFIGS", /* 54 */ "VARIABLES",
/* 55 */ "SCORES", /* 55 */ "SCORES",
/* 56 */ "GRANTS", /* 56 */ "GRANTS",
/* 57 */ "VNODES", /* 57 */ "VNODES",
...@@ -1017,7 +1017,7 @@ static const char *const yyRuleName[] = { ...@@ -1017,7 +1017,7 @@ static const char *const yyRuleName[] = {
/* 7 */ "cmd ::= SHOW QUERIES", /* 7 */ "cmd ::= SHOW QUERIES",
/* 8 */ "cmd ::= SHOW CONNECTIONS", /* 8 */ "cmd ::= SHOW CONNECTIONS",
/* 9 */ "cmd ::= SHOW STREAMS", /* 9 */ "cmd ::= SHOW STREAMS",
/* 10 */ "cmd ::= SHOW CONFIGS", /* 10 */ "cmd ::= SHOW VARIABLES",
/* 11 */ "cmd ::= SHOW SCORES", /* 11 */ "cmd ::= SHOW SCORES",
/* 12 */ "cmd ::= SHOW GRANTS", /* 12 */ "cmd ::= SHOW GRANTS",
/* 13 */ "cmd ::= SHOW VNODES", /* 13 */ "cmd ::= SHOW VNODES",
...@@ -1702,7 +1702,7 @@ static const struct { ...@@ -1702,7 +1702,7 @@ static const struct {
{ 209, -2 }, /* (7) cmd ::= SHOW QUERIES */ { 209, -2 }, /* (7) cmd ::= SHOW QUERIES */
{ 209, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */ { 209, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */
{ 209, -2 }, /* (9) cmd ::= SHOW STREAMS */ { 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 }, /* (11) cmd ::= SHOW SCORES */
{ 209, -2 }, /* (12) cmd ::= SHOW GRANTS */ { 209, -2 }, /* (12) cmd ::= SHOW GRANTS */
{ 209, -2 }, /* (13) cmd ::= SHOW VNODES */ { 209, -2 }, /* (13) cmd ::= SHOW VNODES */
...@@ -2029,8 +2029,8 @@ static void yy_reduce( ...@@ -2029,8 +2029,8 @@ static void yy_reduce(
case 9: /* cmd ::= SHOW STREAMS */ case 9: /* cmd ::= SHOW STREAMS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); }
break; break;
case 10: /* cmd ::= SHOW CONFIGS */ case 10: /* cmd ::= SHOW VARIABLES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONFIGS, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); }
break; break;
case 11: /* cmd ::= SHOW SCORES */ case 11: /* cmd ::= SHOW SCORES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); }
...@@ -2277,6 +2277,7 @@ static void yy_reduce( ...@@ -2277,6 +2277,7 @@ static void yy_reduce(
yymsp[-1].minor.yy268 = yylhsminor.yy268; yymsp[-1].minor.yy268 = yylhsminor.yy268;
break; break;
case 95: /* db_optr ::= db_optr fsync */ 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); } { yylhsminor.yy268 = yymsp[-1].minor.yy268; yylhsminor.yy268.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy268 = yylhsminor.yy268; yymsp[-1].minor.yy268 = yylhsminor.yy268;
break; break;
...@@ -2297,10 +2298,6 @@ static void yy_reduce( ...@@ -2297,10 +2298,6 @@ static void yy_reduce(
case 99: /* alter_db_optr ::= */ case 99: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy268);} { setDefaultCreateDbOption(&yymsp[1].minor.yy268);}
break; 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 */ case 108: /* typename ::= ids */
{ {
yymsp[0].minor.yy0.type = 0; yymsp[0].minor.yy0.type = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册