diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index d23d0e1860..087f546eaa 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2175,7 +2175,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { */ SShowInfo* pShowInfo = &pInfo->pDCLInfo->showOpt; int16_t showType = pShowInfo->showType; - if (showType == TSDB_MGMT_TABLE_TABLE || showType == TSDB_MGMT_TABLE_METRIC || showType == TSDB_MGMT_TABLE_VGROUP) { + if (showType == TSDB_MNODE_TABLE_TABLE || showType == TSDB_MNODE_TABLE_METRIC || showType == TSDB_MNODE_TABLE_VGROUP) { // db prefix in tagCond, show table conds in payload SSQLToken* pDbPrefixToken = &pShowInfo->prefix; if (pDbPrefixToken->type != 0) { @@ -2212,7 +2212,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } } - } else if (showType == TSDB_MGMT_TABLE_VNODES) { + } else if (showType == TSDB_MNODE_TABLE_VNODES) { if (pShowInfo->prefix.type == 0) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "No specified ip of dnode"); } diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 0aac5daa2e..669f777d81 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1116,7 +1116,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SShowInfo *pShowInfo = &pInfo->pDCLInfo->showOpt; pShowMsg->type = pShowInfo->showType; - if (pShowInfo->showType != TSDB_MGMT_TABLE_VNODES) { + if (pShowInfo->showType != TSDB_MNODE_TABLE_VNODES) { SSQLToken *pPattern = &pShowInfo->pattern; if (pPattern->type > 0) { // only show tables support wildcard query strncpy(pShowMsg->payload, pPattern->z, pPattern->n); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index f550b1660f..f493a2b542 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -121,23 +121,23 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY14, "dummy14" ) #define TSDB_IE_TYPE_DNODE_STATE 7 enum _mgmt_table { - TSDB_MGMT_TABLE_ACCT, - TSDB_MGMT_TABLE_USER, - TSDB_MGMT_TABLE_DB, - TSDB_MGMT_TABLE_TABLE, - TSDB_MGMT_TABLE_DNODE, - TSDB_MGMT_TABLE_MNODE, - TSDB_MGMT_TABLE_VGROUP, - TSDB_MGMT_TABLE_METRIC, - TSDB_MGMT_TABLE_MODULE, - TSDB_MGMT_TABLE_QUERIES, - TSDB_MGMT_TABLE_STREAMS, - TSDB_MGMT_TABLE_CONFIGS, - TSDB_MGMT_TABLE_CONNS, - TSDB_MGMT_TABLE_SCORES, - TSDB_MGMT_TABLE_GRANTS, - TSDB_MGMT_TABLE_VNODES, - TSDB_MGMT_TABLE_MAX, + TSDB_MNODE_TABLE_ACCT, + TSDB_MNODE_TABLE_USER, + TSDB_MNODE_TABLE_DB, + TSDB_MNODE_TABLE_TABLE, + TSDB_MNODE_TABLE_DNODE, + TSDB_MNODE_TABLE_MNODE, + TSDB_MNODE_TABLE_VGROUP, + TSDB_MNODE_TABLE_METRIC, + TSDB_MNODE_TABLE_MODULE, + TSDB_MNODE_TABLE_QUERIES, + TSDB_MNODE_TABLE_STREAMS, + TSDB_MNODE_TABLE_CONFIGS, + TSDB_MNODE_TABLE_CONNS, + TSDB_MNODE_TABLE_SCORES, + TSDB_MNODE_TABLE_GRANTS, + TSDB_MNODE_TABLE_VNODES, + TSDB_MNODE_TABLE_MAX, }; #define TSDB_ALTER_TABLE_ADD_TAG_COLUMN 1 diff --git a/src/mnode/inc/mnodeDb.h b/src/mnode/inc/mnodeDb.h index 4ad46eee7b..5339a878f1 100644 --- a/src/mnode/inc/mnodeDb.h +++ b/src/mnode/inc/mnodeDb.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" enum _TSDB_DB_STATUS { TSDB_DB_STATUS_READY, diff --git a/src/mnode/inc/mnodeProfile.h b/src/mnode/inc/mnodeProfile.h index f33ff9c3fa..cb5234c7e6 100644 --- a/src/mnode/inc/mnodeProfile.h +++ b/src/mnode/inc/mnodeProfile.h @@ -19,7 +19,7 @@ #ifdef __cplusplus extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" int32_t mgmtInitProfile(); void mgmtCleanUpProfile(); diff --git a/src/mnode/inc/mnodeShell.h b/src/mnode/inc/mnodeShell.h index 976dc360f3..53fb5827c1 100644 --- a/src/mnode/inc/mnodeShell.h +++ b/src/mnode/inc/mnodeShell.h @@ -19,7 +19,7 @@ #ifdef __cplusplus extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" int32_t mgmtInitShell(); void mgmtCleanUpShell(); diff --git a/src/mnode/inc/mnodeTable.h b/src/mnode/inc/mnodeTable.h index 3ef4c6d453..cee2a88ee4 100644 --- a/src/mnode/inc/mnodeTable.h +++ b/src/mnode/inc/mnodeTable.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" int32_t mgmtInitTables(); void mgmtCleanUpTables(); diff --git a/src/mnode/inc/mnodeUser.h b/src/mnode/inc/mnodeUser.h index 2edd71f3e7..fc5ad13b8a 100644 --- a/src/mnode/inc/mnodeUser.h +++ b/src/mnode/inc/mnodeUser.h @@ -19,7 +19,7 @@ #ifdef __cplusplus extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" int32_t mgmtInitUsers(); void mgmtCleanUpUsers(); diff --git a/src/mnode/inc/mnodeVgroup.h b/src/mnode/inc/mnodeVgroup.h index 948aec06e5..b1359e0734 100644 --- a/src/mnode/inc/mnodeVgroup.h +++ b/src/mnode/inc/mnodeVgroup.h @@ -20,7 +20,7 @@ extern "C" { #endif -#include "mgmtDef.h" +#include "mnodeDef.h" int32_t mgmtInitVgroups(); void mgmtCleanUpVgroups(); diff --git a/src/mnode/src/mnodeAcct.c b/src/mnode/src/mnodeAcct.c index a35591382c..dce771fefd 100644 --- a/src/mnode/src/mnodeAcct.c +++ b/src/mnode/src/mnodeAcct.c @@ -19,12 +19,12 @@ #include "ttime.h" #include "tutil.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtDb.h" -#include "mgmtSdb.h" -#include "mgmtUser.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeDb.h" +#include "mnodeSdb.h" +#include "mnodeUser.h" void * tsAcctSdb = NULL; static int32_t tsAcctUpdateSize; diff --git a/src/mnode/src/mnodeBalance.c b/src/mnode/src/mnodeBalance.c index f8410a207e..e70458a3fa 100644 --- a/src/mnode/src/mnodeBalance.c +++ b/src/mnode/src/mnodeBalance.c @@ -18,12 +18,12 @@ #include "trpc.h" #include "tbalance.h" #include "tglobal.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtMnode.h" -#include "mgmtDnode.h" -#include "mgmtSdb.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeMnode.h" +#include "mnodeDnode.h" +#include "mnodeSdb.h" +#include "mnodeVgroup.h" #ifndef _SYNC diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 09e53d13c9..871ce32c6f 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -24,18 +24,18 @@ #include "tname.h" #include "tbalance.h" #include "tdataformat.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtDb.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtShell.h" -#include "mgmtProfile.h" -#include "mgmtSdb.h" -#include "mgmtTable.h" -#include "mgmtUser.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeDb.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeShell.h" +#include "mnodeProfile.h" +#include "mnodeSdb.h" +#include "mnodeTable.h" +#include "mnodeUser.h" +#include "mnodeVgroup.h" static void * tsDbSdb = NULL; static int32_t tsDbUpdateSize; @@ -150,8 +150,8 @@ int32_t mgmtInitDbs() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DB, mgmtProcessCreateDbMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_DB, mgmtProcessAlterDbMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_DB, mgmtProcessDropDbMsg); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DB, mgmtGetDbMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DB, mgmtRetrieveDbs); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_DB, mgmtGetDbMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_DB, mgmtRetrieveDbs); mTrace("table:dbs table is created"); return 0; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index ce0b1d07e9..5715554935 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -26,14 +26,14 @@ #include "tsync.h" #include "tdataformat.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtUser.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeUser.h" +#include "mnodeVgroup.h" int32_t tsAccessSquence = 0; static void *tsDnodeSdb = NULL; @@ -153,14 +153,14 @@ int32_t mgmtInitDnodes() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mgmtProcessCfgDnodeMsg); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mgmtProcessDnodeStatusMsg); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mgmtGetModuleMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mgmtRetrieveModules); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONFIGS, mgmtGetConfigMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONFIGS, mgmtRetrieveConfigs); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mgmtGetVnodeMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mgmtRetrieveVnodes); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mgmtGetDnodeMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DNODE, mgmtRetrieveDnodes); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_MODULE, mgmtGetModuleMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_MODULE, mgmtRetrieveModules); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_CONFIGS, mgmtGetConfigMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_CONFIGS, mgmtRetrieveConfigs); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_VNODES, mgmtGetVnodeMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_VNODES, mgmtRetrieveVnodes); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_DNODE, mgmtGetDnodeMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_DNODE, mgmtRetrieveDnodes); mTrace("table:dnodes table is created"); return 0; diff --git a/src/mnode/src/mnodeGrant.c b/src/mnode/src/mnodeGrant.c index f44b47e20c..7329629ef9 100644 --- a/src/mnode/src/mnodeGrant.c +++ b/src/mnode/src/mnodeGrant.c @@ -18,7 +18,7 @@ #include "os.h" #include "taoserror.h" #include "tgrant.h" -#include "mgmtInt.h" +#include "mnodeInt.h" int32_t grantInit() { return TSDB_CODE_SUCCESS; } void grantCleanUp() {} diff --git a/src/mnode/src/mnodeMain.c b/src/mnode/src/mnodeMain.c index 204a8a638e..563e679b34 100644 --- a/src/mnode/src/mnodeMain.c +++ b/src/mnode/src/mnodeMain.c @@ -22,18 +22,18 @@ #include "ttimer.h" #include "tglobal.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtServer.h" -#include "mgmtAcct.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtDb.h" -#include "mgmtSdb.h" -#include "mgmtVgroup.h" -#include "mgmtUser.h" -#include "mgmtTable.h" -#include "mgmtShell.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeServer.h" +#include "mnodeAcct.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeDb.h" +#include "mnodeSdb.h" +#include "mnodeVgroup.h" +#include "mnodeUser.h" +#include "mnodeTable.h" +#include "mnodeShell.h" static void *tsMgmtTmr; static bool tsMgmtIsRunning = false; diff --git a/src/mnode/src/mnodeMgmt.c b/src/mnode/src/mnodeMgmt.c index 8833462406..49f4c90fa5 100644 --- a/src/mnode/src/mnodeMgmt.c +++ b/src/mnode/src/mnodeMgmt.c @@ -24,15 +24,15 @@ #include "tbalance.h" #include "tglobal.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtDb.h" -#include "mgmtMnode.h" -#include "mgmtProfile.h" -#include "mgmtShell.h" -#include "mgmtSdb.h" -#include "mgmtTable.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeDb.h" +#include "mnodeMnode.h" +#include "mnodeProfile.h" +#include "mnodeShell.h" +#include "mnodeSdb.h" +#include "mnodeTable.h" +#include "mnodeVgroup.h" static void (*tsMnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *); diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index aa028f594b..f939dfb426 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -23,13 +23,13 @@ #include "ttime.h" #include "tsocket.h" #include "tdataformat.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtMnode.h" -#include "mgmtDnode.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtUser.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeMnode.h" +#include "mnodeDnode.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeUser.h" static void * tsMnodeSdb = NULL; static int32_t tsMnodeUpdateSize = 0; @@ -154,8 +154,8 @@ int32_t mgmtInitMnodes() { return -1; } - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MNODE, mgmtGetMnodeMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MNODE, mgmtRetrieveMnodes); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_MNODE, mgmtGetMnodeMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_MNODE, mgmtRetrieveMnodes); mTrace("table:mnodes table is created"); return TSDB_CODE_SUCCESS; diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c index 3cf340db4a..3236197c83 100644 --- a/src/mnode/src/mnodeProfile.c +++ b/src/mnode/src/mnodeProfile.c @@ -18,17 +18,17 @@ #include "taosmsg.h" #include "taoserror.h" #include "tutil.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtDnode.h" -#include "mgmtDb.h" -#include "mgmtMnode.h" -#include "mgmtProfile.h" -#include "mgmtShell.h" -#include "mgmtTable.h" -#include "mgmtUser.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeDnode.h" +#include "mnodeDb.h" +#include "mnodeMnode.h" +#include "mnodeProfile.h" +#include "mnodeShell.h" +#include "mnodeTable.h" +#include "mnodeUser.h" +#include "mnodeVgroup.h" int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg); @@ -745,12 +745,12 @@ void mgmtProcessKillConnectionMsg(SMnodeMsg *pMsg) { } int32_t mgmtInitProfile() { - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_QUERIES, mgmtGetQueryMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_QUERIES, mgmtRetrieveQueries); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONNS, mgmtGetConnsMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONNS, mgmtRetrieveConns); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_STREAMS, mgmtGetStreamMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_STREAMS, mgmtRetrieveStreams); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_QUERIES, mgmtGetQueryMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_QUERIES, mgmtRetrieveQueries); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_CONNS, mgmtGetConnsMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_CONNS, mgmtRetrieveConns); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_STREAMS, mgmtGetStreamMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_STREAMS, mgmtRetrieveStreams); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_QUERY, mgmtProcessKillQueryMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_STREAM, mgmtProcessKillStreamMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_CONN, mgmtProcessKillConnectionMsg); diff --git a/src/mnode/src/mnodeRead.c b/src/mnode/src/mnodeRead.c index 8d06113f8a..c8983bf1e7 100644 --- a/src/mnode/src/mnodeRead.c +++ b/src/mnode/src/mnodeRead.c @@ -23,13 +23,13 @@ #include "tglobal.h" #include "mnode.h" #include "dnode.h" -#include "mgmtDef.h" +#include "mnodeDef.h" #include "mgmtInt.h" #include "mgmtServer.h" -#include "mgmtAcct.h" +#include "mnodeAcct.h" #include "mgmtDnode.h" #include "mgmtMnode.h" -#include "mgmtDb.h" +#include "mnodeDb.h" #include "mgmtSdb.h" #include "mgmtVgroup.h" #include "mgmtUser.h" diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 237d2ca499..e873c0b573 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -25,11 +25,11 @@ #include "tsync.h" #include "tglobal.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtMnode.h" -#include "mgmtDnode.h" -#include "mgmtSdb.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeMnode.h" +#include "mnodeDnode.h" +#include "mnodeSdb.h" typedef enum { SDB_ACTION_INSERT, diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index 8138fafc06..a629d02fdd 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -25,41 +25,41 @@ #include "tglobal.h" #include "tcache.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtDb.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtProfile.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtTable.h" -#include "mgmtUser.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeDb.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeProfile.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeTable.h" +#include "mnodeUser.h" +#include "mnodeVgroup.h" typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn); -static void mgmtProcessShowMsg(SMnodeMsg *queuedMsg); -static void mgmtProcessRetrieveMsg(SMnodeMsg *queuedMsg); -static void mgmtProcessHeartBeatMsg(SMnodeMsg *queuedMsg); -static void mgmtProcessConnectMsg(SMnodeMsg *queuedMsg); -static void mgmtProcessUseMsg(SMnodeMsg *queuedMsg); -static void mgmtFreeShowObj(void *data); +static void mnodeProcessShowMsg(SMnodeMsg *queuedMsg); +static void mnodeProcessRetrieveMsg(SMnodeMsg *queuedMsg); +static void mnodeProcessHeartBeatMsg(SMnodeMsg *queuedMsg); +static void mnodeProcessConnectMsg(SMnodeMsg *queuedMsg); +static void mnodeProcessUseMsg(SMnodeMsg *queuedMsg); +static void mnodeFreeShowObj(void *data); static void *tsQhandleCache = NULL; -static SShowMetaFp tsMnodeShowMetaFp[TSDB_MGMT_TABLE_MAX] = {0}; -static SShowRetrieveFp tsMnodeShowRetrieveFp[TSDB_MGMT_TABLE_MAX] = {0}; +static SShowMetaFp tsMnodeShowMetaFp[TSDB_MNODE_TABLE_MAX] = {0}; +static SShowRetrieveFp tsMnodeShowRetrieveFp[TSDB_MNODE_TABLE_MAX] = {0}; void mnodeInitShow() { - mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_SHOW, mgmtProcessShowMsg); - mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_RETRIEVE, mgmtProcessRetrieveMsg); - mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_HEARTBEAT, mgmtProcessHeartBeatMsg); - mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mgmtProcessConnectMsg); - mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mgmtProcessUseMsg); + mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_SHOW, mnodeProcessShowMsg); + mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_RETRIEVE, mnodeProcessRetrieveMsg); + mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_HEARTBEAT, mnodeProcessHeartBeatMsg); + mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mnodeProcessConnectMsg); + mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mnodeProcessUseMsg); - tsQhandleCache = taosCacheInitWithCb(tsMgmtTmr, 10, mgmtFreeShowObj); + tsQhandleCache = taosCacheInitWithCb(tsMgmtTmr, 10, mnodeFreeShowObj); } void mnodeCleanUpShow() { @@ -77,48 +77,37 @@ void mnodeAddShowRetrieveHandle(uint8_t msgType, SShowRetrieveFp fp) { tsMnodeShowRetrieveFp[msgType] = fp; } -int32_t mnodeProcessRead(int msgType, void *pCont, int32_t contLen, SRspRet *ret) { - if (vnodeProcessReadMsgFp[msgType] == NULL) - return TSDB_CODE_MSG_NOT_PROCESSED; - - if (pVnode->status == TAOS_VN_STATUS_DELETING || pVnode->status == TAOS_VN_STATUS_CLOSING) - return TSDB_CODE_NOT_ACTIVE_VNODE; - - return (*vnodeProcessReadMsgFp[msgType])(pVnode, pCont, contLen, ret); -} - - -char *mgmtGetShowTypeStr(int32_t showType) { +char *mnodeGetShowType(int32_t showType) { switch (showType) { - case TSDB_MGMT_TABLE_ACCT: return "show accounts"; - case TSDB_MGMT_TABLE_USER: return "show users"; - case TSDB_MGMT_TABLE_DB: return "show databases"; - case TSDB_MGMT_TABLE_TABLE: return "show tables"; - case TSDB_MGMT_TABLE_DNODE: return "show dnodes"; - case TSDB_MGMT_TABLE_MNODE: return "show mnodes"; - case TSDB_MGMT_TABLE_VGROUP: return "show vgroups"; - case TSDB_MGMT_TABLE_METRIC: return "show stables"; - 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_CONNS: return "show connections"; - case TSDB_MGMT_TABLE_SCORES: return "show scores"; - case TSDB_MGMT_TABLE_GRANTS: return "show grants"; - case TSDB_MGMT_TABLE_VNODES: return "show vnodes"; + case TSDB_MNODE_TABLE_ACCT: return "show accounts"; + case TSDB_MNODE_TABLE_USER: return "show users"; + case TSDB_MNODE_TABLE_DB: return "show databases"; + case TSDB_MNODE_TABLE_TABLE: return "show tables"; + case TSDB_MNODE_TABLE_DNODE: return "show dnodes"; + case TSDB_MNODE_TABLE_MNODE: return "show mnodes"; + case TSDB_MNODE_TABLE_VGROUP: return "show vgroups"; + case TSDB_MNODE_TABLE_METRIC: return "show stables"; + case TSDB_MNODE_TABLE_MODULE: return "show modules"; + case TSDB_MNODE_TABLE_QUERIES: return "show queries"; + case TSDB_MNODE_TABLE_STREAMS: return "show streams"; + case TSDB_MNODE_TABLE_CONFIGS: return "show configs"; + case TSDB_MNODE_TABLE_CONNS: return "show connections"; + case TSDB_MNODE_TABLE_SCORES: return "show scores"; + case TSDB_MNODE_TABLE_GRANTS: return "show grants"; + case TSDB_MNODE_TABLE_VNODES: return "show vnodes"; default: return "undefined"; } } -static void mgmtProcessShowMsg(SMnodeMsg *pMsg) { +static void mnodeProcessShowMsg(SMnodeMsg *pMsg) { SCMShowMsg *pShowMsg = pMsg->pCont; - if (pShowMsg->type >= TSDB_MGMT_TABLE_MAX) { + if (pShowMsg->type >= TSDB_MNODE_TABLE_MAX) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_MSG_TYPE); return; } if (!tsMnodeShowMetaFp[pShowMsg->type] || !tsMnodeShowRetrieveFp[pShowMsg->type]) { - mError("show type:%s is not support", mgmtGetShowTypeStr(pShowMsg->type)); + mError("show type:%s is not support", mnodeGetShowType(pShowMsg->type)); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_OPS_NOT_SUPPORT); return; } @@ -141,7 +130,7 @@ static void mgmtProcessShowMsg(SMnodeMsg *pMsg) { pShow = mgmtSaveQhandle(pShow, showObjSize); pShowRsp->qhandle = htobe64((uint64_t) pShow); - mTrace("show:%p, type:%s, start to get meta", pShow, mgmtGetShowTypeStr(pShowMsg->type)); + mTrace("show:%p, type:%s, start to get meta", pShow, mnodeGetShowType(pShowMsg->type)); int32_t code = (*tsMnodeShowMetaFp[pShowMsg->type])(&pShowRsp->tableMeta, pShow, pMsg->thandle); if (code == 0) { SRpcMsg rpcRsp = { @@ -152,7 +141,7 @@ static void mgmtProcessShowMsg(SMnodeMsg *pMsg) { }; rpcSendResponse(&rpcRsp); } else { - mError("show:%p, type:%s, failed to get meta, reason:%s", pShow, mgmtGetShowTypeStr(pShowMsg->type), tstrerror(code)); + mError("show:%p, type:%s, failed to get meta, reason:%s", pShow, mnodeGetShowType(pShowMsg->type), tstrerror(code)); mgmtFreeQhandle(pShow, false); SRpcMsg rpcRsp = { .handle = pMsg->thandle, @@ -162,7 +151,7 @@ static void mgmtProcessShowMsg(SMnodeMsg *pMsg) { } } -static void mgmtProcessRetrieveMsg(SMnodeMsg *pMsg) { +static void mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) { int32_t rowsToRead = 0; int32_t size = 0; int32_t rowsRead = 0; @@ -180,7 +169,7 @@ static void mgmtProcessRetrieveMsg(SMnodeMsg *pMsg) { } SShowObj *pShow = (SShowObj *)pRetrieve->qhandle; - mTrace("show:%p, type:%s, retrieve data", pShow, mgmtGetShowTypeStr(pShow->type)); + mTrace("show:%p, type:%s, retrieve data", pShow, mnodeGetShowType(pShow->type)); if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) { rowsToRead = pShow->numOfRows - pShow->numOfReads; @@ -228,7 +217,7 @@ static void mgmtProcessRetrieveMsg(SMnodeMsg *pMsg) { } } -static void mgmtProcessHeartBeatMsg(SMnodeMsg *pMsg) { +static void mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) { SCMHeartBeatRsp *pHBRsp = (SCMHeartBeatRsp *) rpcMallocCont(sizeof(SCMHeartBeatRsp)); if (pHBRsp == NULL) { mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); @@ -257,7 +246,7 @@ static void mgmtProcessHeartBeatMsg(SMnodeMsg *pMsg) { rpcSendResponse(&rpcRsp); } -static void mgmtProcessConnectMsg(SMnodeMsg *pMsg) { +static void mnodeProcessConnectMsg(SMnodeMsg *pMsg) { SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; SCMConnectMsg *pConnectMsg = pMsg->pCont; @@ -317,7 +306,7 @@ connect_over: rpcSendResponse(&rpcRsp); } -static void mgmtProcessUseMsg(SMnodeMsg *pMsg) { +static void mnodeProcessUseMsg(SMnodeMsg *pMsg) { SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; SCMUseDbMsg *pUseDbMsg = pMsg->pCont; @@ -413,7 +402,7 @@ void* mgmtSaveQhandle(void *qhandle, int32_t size) { return NULL; } -static void mgmtFreeShowObj(void *data) { +static void mnodeFreeShowObj(void *data) { SShowObj *pShow = data; sdbFreeIter(pShow->pIter); mTrace("show:%p, is destroyed", pShow); diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 609be0f542..51161372fb 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -26,19 +26,19 @@ #include "tglobal.h" #include "hash.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtDb.h" -#include "mgmtDnode.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeDb.h" +#include "mnodeDnode.h" #include "tgrant.h" -#include "mgmtMnode.h" -#include "mgmtProfile.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtTable.h" -#include "mgmtUser.h" -#include "mgmtVgroup.h" +#include "mnodeMnode.h" +#include "mnodeProfile.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeTable.h" +#include "mnodeUser.h" +#include "mnodeVgroup.h" #include "tcompare.h" #include "tdataformat.h" @@ -559,10 +559,10 @@ int32_t mgmtInitTables() { dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_TABLE, mgmtProcessTableCfgMsg); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_TABLE, mgmtGetShowTableMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_TABLE, mgmtRetrieveShowTables); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_METRIC, mgmtGetShowSuperTableMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_METRIC, mgmtRetrieveShowSuperTables); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_TABLE, mgmtGetShowTableMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_TABLE, mgmtRetrieveShowTables); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_METRIC, mgmtGetShowSuperTableMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_METRIC, mgmtRetrieveShowSuperTables); return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c index e346d804c2..2a686d05ee 100644 --- a/src/mnode/src/mnodeUser.c +++ b/src/mnode/src/mnodeUser.c @@ -22,13 +22,13 @@ #include "tgrant.h" #include "tdataformat.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtAcct.h" -#include "mgmtMnode.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtUser.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeAcct.h" +#include "mnodeMnode.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeUser.h" static void * tsUserSdb = NULL; static int32_t tsUserUpdateSize = 0; @@ -139,8 +139,8 @@ int32_t mgmtInitUsers() { mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_USER, mgmtProcessCreateUserMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_USER, mgmtProcessAlterUserMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg); - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_USER, mgmtGetUserMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mgmtRetrieveUsers); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_USER, mgmtGetUserMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_USER, mgmtRetrieveUsers); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mgmtProcessAuthMsg); mTrace("table:%s, hash is created", tableDesc.tableName); diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index ffc5487a42..74753142aa 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -25,16 +25,16 @@ #include "tglobal.h" #include "dnode.h" #include "tdataformat.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtDb.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtProfile.h" -#include "mgmtSdb.h" -#include "mgmtShell.h" -#include "mgmtTable.h" -#include "mgmtVgroup.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeDb.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeProfile.h" +#include "mnodeSdb.h" +#include "mnodeShell.h" +#include "mnodeTable.h" +#include "mnodeVgroup.h" static void *tsVgroupSdb = NULL; static int32_t tsVgUpdateSize = 0; @@ -220,8 +220,8 @@ int32_t mgmtInitVgroups() { return -1; } - mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VGROUP, mgmtGetVgroupMeta); - mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mgmtRetrieveVgroups); + mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_VGROUP, mgmtGetVgroupMeta); + mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_VGROUP, mgmtRetrieveVgroups); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mgmtProcessCreateVnodeRsp); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mgmtProcessDropVnodeRsp); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mgmtProcessVnodeCfgMsg); diff --git a/src/mnode/src/mnodeWrite.c b/src/mnode/src/mnodeWrite.c index 0fb4cf3d49..69a4a53077 100644 --- a/src/mnode/src/mnodeWrite.c +++ b/src/mnode/src/mnodeWrite.c @@ -22,18 +22,18 @@ #include "ttimer.h" #include "tglobal.h" #include "dnode.h" -#include "mgmtDef.h" -#include "mgmtInt.h" -#include "mgmtServer.h" -#include "mgmtAcct.h" -#include "mgmtDnode.h" -#include "mgmtMnode.h" -#include "mgmtDb.h" -#include "mgmtSdb.h" -#include "mgmtVgroup.h" -#include "mgmtUser.h" -#include "mgmtTable.h" -#include "mgmtShell.h" +#include "mnodeDef.h" +#include "mnodeInt.h" +#include "mnodeServer.h" +#include "mnodeAcct.h" +#include "mnodeDnode.h" +#include "mnodeMnode.h" +#include "mnodeDb.h" +#include "mnodeSdb.h" +#include "mnodeVgroup.h" +#include "mnodeUser.h" +#include "mnodeTable.h" +#include "mnodeShell.h" static void (*tsMnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *);