From 3f96f0edfa5d20d8b1de1c5fce897c7b2741c43e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 1 Dec 2022 10:45:33 +0800 Subject: [PATCH] feat(mnode): modify keyword status to alive, conflict with log.dn fields --- src/client/src/tscSQLParser.c | 2 +- src/inc/taosmsg.h | 4 ++-- src/inc/ttokendef.h | 2 +- src/mnode/src/mnodeShow.c | 4 ++-- src/mnode/src/mnodeVgroup.c | 30 +++++++++++++++--------------- src/query/inc/sql.y | 12 ++++++------ src/query/src/sql.c | 20 ++++++++++---------- src/util/src/ttokenizer.c | 2 +- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 66db680b44..3976247c7c 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4099,7 +4099,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { SShowInfo* pShowInfo = &pInfo->pMiscInfo->showOpt; int16_t showType = pShowInfo->showType; if (showType == TSDB_MGMT_TABLE_TABLE || showType == TSDB_MGMT_TABLE_METRIC || showType == TSDB_MGMT_TABLE_VGROUP || - showType == TSDB_MGMT_STATUS_DB) { + showType == TSDB_MGMT_ALIVE_DB) { // db prefix in tagCond, show table conds in payload SStrToken* pDbPrefixToken = &pShowInfo->prefix; if (pDbPrefixToken->type != 0) { diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 0ba9b95234..c574c6b8c0 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -163,8 +163,8 @@ enum _mgmt_table { TSDB_MGMT_TABLE_CLUSTER, TSDB_MGMT_TABLE_TP, TSDB_MGMT_TABLE_FUNCTION, - TSDB_MGMT_STATUS_DB, // show database status - TSDB_MGMT_STATUS_CLUSTER, // show cluster status + TSDB_MGMT_ALIVE_DB, // show database status + TSDB_MGMT_ALIVE_CLUSTER, // show cluster status TSDB_MGMT_TABLE_MAX, }; diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h index f7b54bf88a..2c77ea0c76 100644 --- a/src/inc/ttokendef.h +++ b/src/inc/ttokendef.h @@ -88,7 +88,7 @@ #define TK_TABLES 70 #define TK_STABLES 71 #define TK_VGROUPS 72 -#define TK_STATUS 73 +#define TK_ALIVE 73 #define TK_CLUSTER 74 #define TK_DROP 75 #define TK_TOPIC 76 diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index 05200f5596..a4402b4a0e 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -110,8 +110,8 @@ static char *mnodeGetShowType(int32_t showType) { case TSDB_MGMT_TABLE_CLUSTER: return "show clusters"; case TSDB_MGMT_TABLE_STREAMTABLES : return "show streamtables"; case TSDB_MGMT_TABLE_TP: return "show topics"; - case TSDB_MGMT_STATUS_DB: return "show database status"; - case TSDB_MGMT_STATUS_CLUSTER: return "show cluster status"; + case TSDB_MGMT_ALIVE_DB: return "show database status"; + case TSDB_MGMT_ALIVE_CLUSTER: return "show cluster status"; default: return "undefined"; } } diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index da902dd67b..caa5e7b46f 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -59,9 +59,9 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup); static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pConn); // status -static int32_t mnodeGetStatusMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); -static int32_t mnodeRetrieveStatusDb(SShowObj *pShow, char *data, int32_t rows, void *pConn); -static int32_t mnodeRetrieveStatusCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn); +static int32_t mnodeGetAliveMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); +static int32_t mnodeRetrieveAliveDb(SShowObj *pShow, char *data, int32_t rows, void *pConn); +static int32_t mnodeRetrieveAliveCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn); static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg); static void mnodeProcessAlterVnodeRsp(SRpcMsg *rpcMsg); @@ -241,13 +241,13 @@ int32_t mnodeInitVgroups() { mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mnodeRetrieveVgroups); mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_VGROUP, mnodeCancelGetNextVgroup); // cluster status - mnodeAddShowMetaHandle(TSDB_MGMT_STATUS_CLUSTER, mnodeGetStatusMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_STATUS_CLUSTER, mnodeRetrieveStatusCluster); - mnodeAddShowFreeIterHandle(TSDB_MGMT_STATUS_CLUSTER, mnodeCancelGetNextVgroup); + mnodeAddShowMetaHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeGetAliveMeta); + mnodeAddShowRetrieveHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeRetrieveAliveCluster); + mnodeAddShowFreeIterHandle(TSDB_MGMT_ALIVE_CLUSTER, mnodeCancelGetNextVgroup); // db status - mnodeAddShowMetaHandle(TSDB_MGMT_STATUS_DB, mnodeGetStatusMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_STATUS_DB, mnodeRetrieveStatusDb); - mnodeAddShowFreeIterHandle(TSDB_MGMT_STATUS_DB, mnodeCancelGetNextVgroup); + mnodeAddShowMetaHandle(TSDB_MGMT_ALIVE_DB, mnodeGetAliveMeta); + mnodeAddShowRetrieveHandle(TSDB_MGMT_ALIVE_DB, mnodeRetrieveAliveDb); + mnodeAddShowFreeIterHandle(TSDB_MGMT_ALIVE_DB, mnodeCancelGetNextVgroup); mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mnodeProcessCreateVnodeRsp); mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_ALTER_VNODE_RSP, mnodeProcessAlterVnodeRsp); @@ -793,7 +793,7 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p return 0; } -static int32_t mnodeGetStatusMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { +static int32_t mnodeGetAliveMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) { SSchema *pSchema = pMeta->schema; pShow->bytes[0] = sizeof(int32_t); pSchema[0].type = TSDB_DATA_TYPE_INT; @@ -808,7 +808,7 @@ static int32_t mnodeGetStatusMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p return 0; } -static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, void *pConn, SDbObj* pDb) { +static int32_t mnodeRetrieveAlive(SShowObj *pShow, char *data, int32_t rows, void *pConn, SDbObj* pDb) { SVgObj *pVgroup = NULL; int32_t nAvailble = 0; int32_t nUnAvailble = 0; @@ -865,11 +865,11 @@ static int32_t mnodeRetrieveStatus(SShowObj *pShow, char *data, int32_t rows, vo return 1; } -static int32_t mnodeRetrieveStatusCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn) { - return mnodeRetrieveStatus(pShow, data, rows, pConn, NULL); +static int32_t mnodeRetrieveAliveCluster(SShowObj *pShow, char *data, int32_t rows, void *pConn) { + return mnodeRetrieveAlive(pShow, data, rows, pConn, NULL); } -static int32_t mnodeRetrieveStatusDb(SShowObj *pShow, char *data, int32_t rows, void *pConn) { +static int32_t mnodeRetrieveAliveDb(SShowObj *pShow, char *data, int32_t rows, void *pConn) { SDbObj *pDb = mnodeGetDb(pShow->db); if (pDb == NULL) return 0; @@ -880,7 +880,7 @@ static int32_t mnodeRetrieveStatusDb(SShowObj *pShow, char *data, int32_t rows, return 0; } - int32_t numOfRows = mnodeRetrieveStatus(pShow, data, rows, pConn, pDb); + int32_t numOfRows = mnodeRetrieveAlive(pShow, data, rows, pConn, pDb); mnodeDecDbRef(pDb); return numOfRows; diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 61a77ba51c..f833751685 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -127,17 +127,17 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } -// show db.status -cmd ::= SHOW dbPrefix(X) STATUS. { +// show db.alive +cmd ::= SHOW dbPrefix(X) ALIVE. { SStrToken token; tSetDbName(&token, &X); - setShowOptions(pInfo, TSDB_MGMT_STATUS_DB, &token, 0); + setShowOptions(pInfo, TSDB_MGMT_ALIVE_DB, &token, 0); } -// show cluster status -cmd ::= SHOW CLUSTER STATUS. { +// show cluster alive +cmd ::= SHOW CLUSTER ALIVE. { SStrToken token; - setShowOptions(pInfo, TSDB_MGMT_STATUS_CLUSTER, &token, 0); + setShowOptions(pInfo, TSDB_MGMT_ALIVE_CLUSTER, &token, 0); } //drop configure for tables diff --git a/src/query/src/sql.c b/src/query/src/sql.c index a27490413c..8fec34c9a4 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -632,7 +632,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLES => nothing */ 0, /* STABLES => nothing */ 0, /* VGROUPS => nothing */ - 0, /* STATUS => nothing */ + 0, /* ALIVE => nothing */ 1, /* CLUSTER => ID */ 0, /* DROP => nothing */ 0, /* TOPIC => nothing */ @@ -925,7 +925,7 @@ static const char *const yyTokenName[] = { /* 70 */ "TABLES", /* 71 */ "STABLES", /* 72 */ "VGROUPS", - /* 73 */ "STATUS", + /* 73 */ "ALIVE", /* 74 */ "CLUSTER", /* 75 */ "DROP", /* 76 */ "TOPIC", @@ -1182,8 +1182,8 @@ static const char *const yyRuleName[] = { /* 26 */ "cmd ::= SHOW dbPrefix STABLES", /* 27 */ "cmd ::= SHOW dbPrefix STABLES LIKE STRING", /* 28 */ "cmd ::= SHOW dbPrefix VGROUPS", - /* 29 */ "cmd ::= SHOW dbPrefix STATUS", - /* 30 */ "cmd ::= SHOW CLUSTER STATUS", + /* 29 */ "cmd ::= SHOW dbPrefix ALIVE", + /* 30 */ "cmd ::= SHOW CLUSTER ALIVE", /* 31 */ "cmd ::= DROP TABLE ifexists ids cpxName", /* 32 */ "cmd ::= DROP STABLE ifexists ids cpxName", /* 33 */ "cmd ::= DROP DATABASE ifexists ids", @@ -1978,8 +1978,8 @@ static const struct { { 209, -3 }, /* (26) cmd ::= SHOW dbPrefix STABLES */ { 209, -5 }, /* (27) cmd ::= SHOW dbPrefix STABLES LIKE STRING */ { 209, -3 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS */ - { 209, -3 }, /* (29) cmd ::= SHOW dbPrefix STATUS */ - { 209, -3 }, /* (30) cmd ::= SHOW CLUSTER STATUS */ + { 209, -3 }, /* (29) cmd ::= SHOW dbPrefix ALIVE */ + { 209, -3 }, /* (30) cmd ::= SHOW CLUSTER ALIVE */ { 209, -5 }, /* (31) cmd ::= DROP TABLE ifexists ids cpxName */ { 209, -5 }, /* (32) cmd ::= DROP STABLE ifexists ids cpxName */ { 209, -4 }, /* (33) cmd ::= DROP DATABASE ifexists ids */ @@ -2473,17 +2473,17 @@ static void yy_reduce( setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0); } break; - case 29: /* cmd ::= SHOW dbPrefix STATUS */ + case 29: /* cmd ::= SHOW dbPrefix ALIVE */ { SStrToken token; tSetDbName(&token, &yymsp[-1].minor.yy0); - setShowOptions(pInfo, TSDB_MGMT_STATUS_DB, &token, 0); + setShowOptions(pInfo, TSDB_MGMT_ALIVE_DB, &token, 0); } break; - case 30: /* cmd ::= SHOW CLUSTER STATUS */ + case 30: /* cmd ::= SHOW CLUSTER ALIVE */ { SStrToken token; - setShowOptions(pInfo, TSDB_MGMT_STATUS_CLUSTER, &token, 0); + setShowOptions(pInfo, TSDB_MGMT_ALIVE_CLUSTER, &token, 0); } break; case 31: /* cmd ::= DROP TABLE ifexists ids cpxName */ diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 61c852c4ce..faf675f5ae 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -230,7 +230,7 @@ static SKeyword keywordTable[] = { {"CONTAINS", TK_CONTAINS}, {"TO", TK_TO}, {"SPLIT", TK_SPLIT}, - {"STATUS", TK_STATUS}, + {"ALIVE", TK_ALIVE}, {"CLUSTER", TK_CLUSTER}, {"DELETE", TK_DELETE} }; -- GitLab