[TD-335] rename some defs

This commit is contained in:
Shengliang Guan 2020-05-26 12:20:58 +00:00
parent 3b54b74554
commit 7ac821f218
25 changed files with 227 additions and 238 deletions

View File

@ -2175,7 +2175,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
*/ */
SShowInfo* pShowInfo = &pInfo->pDCLInfo->showOpt; SShowInfo* pShowInfo = &pInfo->pDCLInfo->showOpt;
int16_t showType = pShowInfo->showType; 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 // db prefix in tagCond, show table conds in payload
SSQLToken* pDbPrefixToken = &pShowInfo->prefix; SSQLToken* pDbPrefixToken = &pShowInfo->prefix;
if (pDbPrefixToken->type != 0) { if (pDbPrefixToken->type != 0) {
@ -2212,7 +2212,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
} }
} else if (showType == TSDB_MGMT_TABLE_VNODES) { } else if (showType == TSDB_MNODE_TABLE_VNODES) {
if (pShowInfo->prefix.type == 0) { if (pShowInfo->prefix.type == 0) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "No specified ip of dnode"); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "No specified ip of dnode");
} }

View File

@ -1116,7 +1116,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SShowInfo *pShowInfo = &pInfo->pDCLInfo->showOpt; SShowInfo *pShowInfo = &pInfo->pDCLInfo->showOpt;
pShowMsg->type = pShowInfo->showType; pShowMsg->type = pShowInfo->showType;
if (pShowInfo->showType != TSDB_MGMT_TABLE_VNODES) { if (pShowInfo->showType != TSDB_MNODE_TABLE_VNODES) {
SSQLToken *pPattern = &pShowInfo->pattern; SSQLToken *pPattern = &pShowInfo->pattern;
if (pPattern->type > 0) { // only show tables support wildcard query if (pPattern->type > 0) { // only show tables support wildcard query
strncpy(pShowMsg->payload, pPattern->z, pPattern->n); strncpy(pShowMsg->payload, pPattern->z, pPattern->n);

View File

@ -121,23 +121,23 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY14, "dummy14" )
#define TSDB_IE_TYPE_DNODE_STATE 7 #define TSDB_IE_TYPE_DNODE_STATE 7
enum _mgmt_table { enum _mgmt_table {
TSDB_MGMT_TABLE_ACCT, TSDB_MNODE_TABLE_ACCT,
TSDB_MGMT_TABLE_USER, TSDB_MNODE_TABLE_USER,
TSDB_MGMT_TABLE_DB, TSDB_MNODE_TABLE_DB,
TSDB_MGMT_TABLE_TABLE, TSDB_MNODE_TABLE_TABLE,
TSDB_MGMT_TABLE_DNODE, TSDB_MNODE_TABLE_DNODE,
TSDB_MGMT_TABLE_MNODE, TSDB_MNODE_TABLE_MNODE,
TSDB_MGMT_TABLE_VGROUP, TSDB_MNODE_TABLE_VGROUP,
TSDB_MGMT_TABLE_METRIC, TSDB_MNODE_TABLE_METRIC,
TSDB_MGMT_TABLE_MODULE, TSDB_MNODE_TABLE_MODULE,
TSDB_MGMT_TABLE_QUERIES, TSDB_MNODE_TABLE_QUERIES,
TSDB_MGMT_TABLE_STREAMS, TSDB_MNODE_TABLE_STREAMS,
TSDB_MGMT_TABLE_CONFIGS, TSDB_MNODE_TABLE_CONFIGS,
TSDB_MGMT_TABLE_CONNS, TSDB_MNODE_TABLE_CONNS,
TSDB_MGMT_TABLE_SCORES, TSDB_MNODE_TABLE_SCORES,
TSDB_MGMT_TABLE_GRANTS, TSDB_MNODE_TABLE_GRANTS,
TSDB_MGMT_TABLE_VNODES, TSDB_MNODE_TABLE_VNODES,
TSDB_MGMT_TABLE_MAX, TSDB_MNODE_TABLE_MAX,
}; };
#define TSDB_ALTER_TABLE_ADD_TAG_COLUMN 1 #define TSDB_ALTER_TABLE_ADD_TAG_COLUMN 1

View File

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
enum _TSDB_DB_STATUS { enum _TSDB_DB_STATUS {
TSDB_DB_STATUS_READY, TSDB_DB_STATUS_READY,

View File

@ -19,7 +19,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
int32_t mgmtInitProfile(); int32_t mgmtInitProfile();
void mgmtCleanUpProfile(); void mgmtCleanUpProfile();

View File

@ -19,7 +19,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
int32_t mgmtInitShell(); int32_t mgmtInitShell();
void mgmtCleanUpShell(); void mgmtCleanUpShell();

View File

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
int32_t mgmtInitTables(); int32_t mgmtInitTables();
void mgmtCleanUpTables(); void mgmtCleanUpTables();

View File

@ -19,7 +19,7 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
int32_t mgmtInitUsers(); int32_t mgmtInitUsers();
void mgmtCleanUpUsers(); void mgmtCleanUpUsers();

View File

@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#include "mgmtDef.h" #include "mnodeDef.h"
int32_t mgmtInitVgroups(); int32_t mgmtInitVgroups();
void mgmtCleanUpVgroups(); void mgmtCleanUpVgroups();

View File

@ -19,12 +19,12 @@
#include "ttime.h" #include "ttime.h"
#include "tutil.h" #include "tutil.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtUser.h" #include "mnodeUser.h"
void * tsAcctSdb = NULL; void * tsAcctSdb = NULL;
static int32_t tsAcctUpdateSize; static int32_t tsAcctUpdateSize;

View File

@ -18,12 +18,12 @@
#include "trpc.h" #include "trpc.h"
#include "tbalance.h" #include "tbalance.h"
#include "tglobal.h" #include "tglobal.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
#ifndef _SYNC #ifndef _SYNC

View File

@ -24,18 +24,18 @@
#include "tname.h" #include "tname.h"
#include "tbalance.h" #include "tbalance.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
static void * tsDbSdb = NULL; static void * tsDbSdb = NULL;
static int32_t tsDbUpdateSize; static int32_t tsDbUpdateSize;
@ -150,8 +150,8 @@ int32_t mgmtInitDbs() {
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DB, mgmtProcessCreateDbMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_DB, mgmtProcessCreateDbMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_DB, mgmtProcessAlterDbMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_DB, mgmtProcessAlterDbMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_DB, mgmtProcessDropDbMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_DB, mgmtProcessDropDbMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DB, mgmtGetDbMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_DB, mgmtGetDbMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DB, mgmtRetrieveDbs); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_DB, mgmtRetrieveDbs);
mTrace("table:dbs table is created"); mTrace("table:dbs table is created");
return 0; return 0;

View File

@ -26,14 +26,14 @@
#include "tsync.h" #include "tsync.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
int32_t tsAccessSquence = 0; int32_t tsAccessSquence = 0;
static void *tsDnodeSdb = NULL; static void *tsDnodeSdb = NULL;
@ -153,14 +153,14 @@ int32_t mgmtInitDnodes() {
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mgmtProcessCfgDnodeMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mgmtProcessCfgDnodeMsg);
dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp);
dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mgmtProcessDnodeStatusMsg); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_STATUS, mgmtProcessDnodeStatusMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MODULE, mgmtGetModuleMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_MODULE, mgmtGetModuleMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MODULE, mgmtRetrieveModules); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_MODULE, mgmtRetrieveModules);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONFIGS, mgmtGetConfigMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_CONFIGS, mgmtGetConfigMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONFIGS, mgmtRetrieveConfigs); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_CONFIGS, mgmtRetrieveConfigs);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mgmtGetVnodeMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_VNODES, mgmtGetVnodeMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mgmtRetrieveVnodes); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_VNODES, mgmtRetrieveVnodes);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_DNODE, mgmtGetDnodeMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_DNODE, mgmtGetDnodeMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_DNODE, mgmtRetrieveDnodes); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_DNODE, mgmtRetrieveDnodes);
mTrace("table:dnodes table is created"); mTrace("table:dnodes table is created");
return 0; return 0;

View File

@ -18,7 +18,7 @@
#include "os.h" #include "os.h"
#include "taoserror.h" #include "taoserror.h"
#include "tgrant.h" #include "tgrant.h"
#include "mgmtInt.h" #include "mnodeInt.h"
int32_t grantInit() { return TSDB_CODE_SUCCESS; } int32_t grantInit() { return TSDB_CODE_SUCCESS; }
void grantCleanUp() {} void grantCleanUp() {}

View File

@ -22,18 +22,18 @@
#include "ttimer.h" #include "ttimer.h"
#include "tglobal.h" #include "tglobal.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtServer.h" #include "mnodeServer.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtShell.h" #include "mnodeShell.h"
static void *tsMgmtTmr; static void *tsMgmtTmr;
static bool tsMgmtIsRunning = false; static bool tsMgmtIsRunning = false;

View File

@ -24,15 +24,15 @@
#include "tbalance.h" #include "tbalance.h"
#include "tglobal.h" #include "tglobal.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
static void (*tsMnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *); static void (*tsMnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *);

View File

@ -23,13 +23,13 @@
#include "ttime.h" #include "ttime.h"
#include "tsocket.h" #include "tsocket.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtUser.h" #include "mnodeUser.h"
static void * tsMnodeSdb = NULL; static void * tsMnodeSdb = NULL;
static int32_t tsMnodeUpdateSize = 0; static int32_t tsMnodeUpdateSize = 0;
@ -154,8 +154,8 @@ int32_t mgmtInitMnodes() {
return -1; return -1;
} }
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_MNODE, mgmtGetMnodeMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_MNODE, mgmtGetMnodeMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_MNODE, mgmtRetrieveMnodes); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_MNODE, mgmtRetrieveMnodes);
mTrace("table:mnodes table is created"); mTrace("table:mnodes table is created");
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;

View File

@ -18,17 +18,17 @@
#include "taosmsg.h" #include "taosmsg.h"
#include "taoserror.h" #include "taoserror.h"
#include "tutil.h" #include "tutil.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg); int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg);
@ -745,12 +745,12 @@ void mgmtProcessKillConnectionMsg(SMnodeMsg *pMsg) {
} }
int32_t mgmtInitProfile() { int32_t mgmtInitProfile() {
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_QUERIES, mgmtGetQueryMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_QUERIES, mgmtGetQueryMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_QUERIES, mgmtRetrieveQueries); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_QUERIES, mgmtRetrieveQueries);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_CONNS, mgmtGetConnsMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_CONNS, mgmtGetConnsMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_CONNS, mgmtRetrieveConns); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_CONNS, mgmtRetrieveConns);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_STREAMS, mgmtGetStreamMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_STREAMS, mgmtGetStreamMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_STREAMS, mgmtRetrieveStreams); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_STREAMS, mgmtRetrieveStreams);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_QUERY, mgmtProcessKillQueryMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_QUERY, mgmtProcessKillQueryMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_STREAM, mgmtProcessKillStreamMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_STREAM, mgmtProcessKillStreamMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_CONN, mgmtProcessKillConnectionMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_KILL_CONN, mgmtProcessKillConnectionMsg);

View File

@ -23,13 +23,13 @@
#include "tglobal.h" #include "tglobal.h"
#include "mnode.h" #include "mnode.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mgmtInt.h"
#include "mgmtServer.h" #include "mgmtServer.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDnode.h" #include "mgmtDnode.h"
#include "mgmtMnode.h" #include "mgmtMnode.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtSdb.h" #include "mgmtSdb.h"
#include "mgmtVgroup.h" #include "mgmtVgroup.h"
#include "mgmtUser.h" #include "mgmtUser.h"

View File

@ -25,11 +25,11 @@
#include "tsync.h" #include "tsync.h"
#include "tglobal.h" #include "tglobal.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
typedef enum { typedef enum {
SDB_ACTION_INSERT, SDB_ACTION_INSERT,

View File

@ -25,41 +25,41 @@
#include "tglobal.h" #include "tglobal.h"
#include "tcache.h" #include "tcache.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn); typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static void mgmtProcessShowMsg(SMnodeMsg *queuedMsg); static void mnodeProcessShowMsg(SMnodeMsg *queuedMsg);
static void mgmtProcessRetrieveMsg(SMnodeMsg *queuedMsg); static void mnodeProcessRetrieveMsg(SMnodeMsg *queuedMsg);
static void mgmtProcessHeartBeatMsg(SMnodeMsg *queuedMsg); static void mnodeProcessHeartBeatMsg(SMnodeMsg *queuedMsg);
static void mgmtProcessConnectMsg(SMnodeMsg *queuedMsg); static void mnodeProcessConnectMsg(SMnodeMsg *queuedMsg);
static void mgmtProcessUseMsg(SMnodeMsg *queuedMsg); static void mnodeProcessUseMsg(SMnodeMsg *queuedMsg);
static void mgmtFreeShowObj(void *data); static void mnodeFreeShowObj(void *data);
static void *tsQhandleCache = NULL; static void *tsQhandleCache = NULL;
static SShowMetaFp tsMnodeShowMetaFp[TSDB_MGMT_TABLE_MAX] = {0}; static SShowMetaFp tsMnodeShowMetaFp[TSDB_MNODE_TABLE_MAX] = {0};
static SShowRetrieveFp tsMnodeShowRetrieveFp[TSDB_MGMT_TABLE_MAX] = {0}; static SShowRetrieveFp tsMnodeShowRetrieveFp[TSDB_MNODE_TABLE_MAX] = {0};
void mnodeInitShow() { void mnodeInitShow() {
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_SHOW, mgmtProcessShowMsg); mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_SHOW, mnodeProcessShowMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_RETRIEVE, mgmtProcessRetrieveMsg); mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_RETRIEVE, mnodeProcessRetrieveMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_HEARTBEAT, mgmtProcessHeartBeatMsg); mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_HEARTBEAT, mnodeProcessHeartBeatMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mgmtProcessConnectMsg); mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_CONNECT, mnodeProcessConnectMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mgmtProcessUseMsg); mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_USE_DB, mnodeProcessUseMsg);
tsQhandleCache = taosCacheInitWithCb(tsMgmtTmr, 10, mgmtFreeShowObj); tsQhandleCache = taosCacheInitWithCb(tsMgmtTmr, 10, mnodeFreeShowObj);
} }
void mnodeCleanUpShow() { void mnodeCleanUpShow() {
@ -77,48 +77,37 @@ void mnodeAddShowRetrieveHandle(uint8_t msgType, SShowRetrieveFp fp) {
tsMnodeShowRetrieveFp[msgType] = fp; tsMnodeShowRetrieveFp[msgType] = fp;
} }
int32_t mnodeProcessRead(int msgType, void *pCont, int32_t contLen, SRspRet *ret) { char *mnodeGetShowType(int32_t showType) {
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) {
switch (showType) { switch (showType) {
case TSDB_MGMT_TABLE_ACCT: return "show accounts"; case TSDB_MNODE_TABLE_ACCT: return "show accounts";
case TSDB_MGMT_TABLE_USER: return "show users"; case TSDB_MNODE_TABLE_USER: return "show users";
case TSDB_MGMT_TABLE_DB: return "show databases"; case TSDB_MNODE_TABLE_DB: return "show databases";
case TSDB_MGMT_TABLE_TABLE: return "show tables"; case TSDB_MNODE_TABLE_TABLE: return "show tables";
case TSDB_MGMT_TABLE_DNODE: return "show dnodes"; case TSDB_MNODE_TABLE_DNODE: return "show dnodes";
case TSDB_MGMT_TABLE_MNODE: return "show mnodes"; case TSDB_MNODE_TABLE_MNODE: return "show mnodes";
case TSDB_MGMT_TABLE_VGROUP: return "show vgroups"; case TSDB_MNODE_TABLE_VGROUP: return "show vgroups";
case TSDB_MGMT_TABLE_METRIC: return "show stables"; case TSDB_MNODE_TABLE_METRIC: return "show stables";
case TSDB_MGMT_TABLE_MODULE: return "show modules"; case TSDB_MNODE_TABLE_MODULE: return "show modules";
case TSDB_MGMT_TABLE_QUERIES: return "show queries"; case TSDB_MNODE_TABLE_QUERIES: return "show queries";
case TSDB_MGMT_TABLE_STREAMS: return "show streams"; case TSDB_MNODE_TABLE_STREAMS: return "show streams";
case TSDB_MGMT_TABLE_CONFIGS: return "show configs"; case TSDB_MNODE_TABLE_CONFIGS: return "show configs";
case TSDB_MGMT_TABLE_CONNS: return "show connections"; case TSDB_MNODE_TABLE_CONNS: return "show connections";
case TSDB_MGMT_TABLE_SCORES: return "show scores"; case TSDB_MNODE_TABLE_SCORES: return "show scores";
case TSDB_MGMT_TABLE_GRANTS: return "show grants"; case TSDB_MNODE_TABLE_GRANTS: return "show grants";
case TSDB_MGMT_TABLE_VNODES: return "show vnodes"; case TSDB_MNODE_TABLE_VNODES: return "show vnodes";
default: return "undefined"; default: return "undefined";
} }
} }
static void mgmtProcessShowMsg(SMnodeMsg *pMsg) { static void mnodeProcessShowMsg(SMnodeMsg *pMsg) {
SCMShowMsg *pShowMsg = pMsg->pCont; 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); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_MSG_TYPE);
return; return;
} }
if (!tsMnodeShowMetaFp[pShowMsg->type] || !tsMnodeShowRetrieveFp[pShowMsg->type]) { 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); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_OPS_NOT_SUPPORT);
return; return;
} }
@ -141,7 +130,7 @@ static void mgmtProcessShowMsg(SMnodeMsg *pMsg) {
pShow = mgmtSaveQhandle(pShow, showObjSize); pShow = mgmtSaveQhandle(pShow, showObjSize);
pShowRsp->qhandle = htobe64((uint64_t) pShow); 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); int32_t code = (*tsMnodeShowMetaFp[pShowMsg->type])(&pShowRsp->tableMeta, pShow, pMsg->thandle);
if (code == 0) { if (code == 0) {
SRpcMsg rpcRsp = { SRpcMsg rpcRsp = {
@ -152,7 +141,7 @@ static void mgmtProcessShowMsg(SMnodeMsg *pMsg) {
}; };
rpcSendResponse(&rpcRsp); rpcSendResponse(&rpcRsp);
} else { } 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); mgmtFreeQhandle(pShow, false);
SRpcMsg rpcRsp = { SRpcMsg rpcRsp = {
.handle = pMsg->thandle, .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 rowsToRead = 0;
int32_t size = 0; int32_t size = 0;
int32_t rowsRead = 0; int32_t rowsRead = 0;
@ -180,7 +169,7 @@ static void mgmtProcessRetrieveMsg(SMnodeMsg *pMsg) {
} }
SShowObj *pShow = (SShowObj *)pRetrieve->qhandle; 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) { if ((pRetrieve->free & TSDB_QUERY_TYPE_FREE_RESOURCE) != TSDB_QUERY_TYPE_FREE_RESOURCE) {
rowsToRead = pShow->numOfRows - pShow->numOfReads; 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)); SCMHeartBeatRsp *pHBRsp = (SCMHeartBeatRsp *) rpcMallocCont(sizeof(SCMHeartBeatRsp));
if (pHBRsp == NULL) { if (pHBRsp == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
@ -257,7 +246,7 @@ static void mgmtProcessHeartBeatMsg(SMnodeMsg *pMsg) {
rpcSendResponse(&rpcRsp); 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}; SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0};
SCMConnectMsg *pConnectMsg = pMsg->pCont; SCMConnectMsg *pConnectMsg = pMsg->pCont;
@ -317,7 +306,7 @@ connect_over:
rpcSendResponse(&rpcRsp); 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}; SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0};
SCMUseDbMsg *pUseDbMsg = pMsg->pCont; SCMUseDbMsg *pUseDbMsg = pMsg->pCont;
@ -413,7 +402,7 @@ void* mgmtSaveQhandle(void *qhandle, int32_t size) {
return NULL; return NULL;
} }
static void mgmtFreeShowObj(void *data) { static void mnodeFreeShowObj(void *data) {
SShowObj *pShow = data; SShowObj *pShow = data;
sdbFreeIter(pShow->pIter); sdbFreeIter(pShow->pIter);
mTrace("show:%p, is destroyed", pShow); mTrace("show:%p, is destroyed", pShow);

View File

@ -26,19 +26,19 @@
#include "tglobal.h" #include "tglobal.h"
#include "hash.h" #include "hash.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "tgrant.h" #include "tgrant.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
#include "tcompare.h" #include "tcompare.h"
#include "tdataformat.h" #include "tdataformat.h"
@ -559,10 +559,10 @@ int32_t mgmtInitTables() {
dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_TABLE, mgmtProcessTableCfgMsg); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_TABLE, mgmtProcessTableCfgMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_TABLE, mgmtGetShowTableMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_TABLE, mgmtGetShowTableMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_TABLE, mgmtRetrieveShowTables); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_TABLE, mgmtRetrieveShowTables);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_METRIC, mgmtGetShowSuperTableMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_METRIC, mgmtGetShowSuperTableMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_METRIC, mgmtRetrieveShowSuperTables); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_METRIC, mgmtRetrieveShowSuperTables);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -22,13 +22,13 @@
#include "tgrant.h" #include "tgrant.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtUser.h" #include "mnodeUser.h"
static void * tsUserSdb = NULL; static void * tsUserSdb = NULL;
static int32_t tsUserUpdateSize = 0; 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_CREATE_USER, mgmtProcessCreateUserMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_USER, mgmtProcessAlterUserMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_USER, mgmtProcessAlterUserMsg);
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg);
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_USER, mgmtGetUserMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_USER, mgmtGetUserMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mgmtRetrieveUsers); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_USER, mgmtRetrieveUsers);
dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mgmtProcessAuthMsg); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mgmtProcessAuthMsg);
mTrace("table:%s, hash is created", tableDesc.tableName); mTrace("table:%s, hash is created", tableDesc.tableName);

View File

@ -25,16 +25,16 @@
#include "tglobal.h" #include "tglobal.h"
#include "dnode.h" #include "dnode.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtProfile.h" #include "mnodeProfile.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtShell.h" #include "mnodeShell.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
static void *tsVgroupSdb = NULL; static void *tsVgroupSdb = NULL;
static int32_t tsVgUpdateSize = 0; static int32_t tsVgUpdateSize = 0;
@ -220,8 +220,8 @@ int32_t mgmtInitVgroups() {
return -1; return -1;
} }
mnodeAddShowMetaHandle(TSDB_MGMT_TABLE_VGROUP, mgmtGetVgroupMeta); mnodeAddShowMetaHandle(TSDB_MNODE_TABLE_VGROUP, mgmtGetVgroupMeta);
mnodeAddShowRetrieveHandle(TSDB_MGMT_TABLE_VGROUP, mgmtRetrieveVgroups); mnodeAddShowRetrieveHandle(TSDB_MNODE_TABLE_VGROUP, mgmtRetrieveVgroups);
dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mgmtProcessCreateVnodeRsp); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_CREATE_VNODE_RSP, mgmtProcessCreateVnodeRsp);
dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mgmtProcessDropVnodeRsp); dnodeAddClientRspHandle(TSDB_MSG_TYPE_MD_DROP_VNODE_RSP, mgmtProcessDropVnodeRsp);
dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mgmtProcessVnodeCfgMsg); dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_CONFIG_VNODE, mgmtProcessVnodeCfgMsg);

View File

@ -22,18 +22,18 @@
#include "ttimer.h" #include "ttimer.h"
#include "tglobal.h" #include "tglobal.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mnodeDef.h"
#include "mgmtInt.h" #include "mnodeInt.h"
#include "mgmtServer.h" #include "mnodeServer.h"
#include "mgmtAcct.h" #include "mnodeAcct.h"
#include "mgmtDnode.h" #include "mnodeDnode.h"
#include "mgmtMnode.h" #include "mnodeMnode.h"
#include "mgmtDb.h" #include "mnodeDb.h"
#include "mgmtSdb.h" #include "mnodeSdb.h"
#include "mgmtVgroup.h" #include "mnodeVgroup.h"
#include "mgmtUser.h" #include "mnodeUser.h"
#include "mgmtTable.h" #include "mnodeTable.h"
#include "mgmtShell.h" #include "mnodeShell.h"
static void (*tsMnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *); static void (*tsMnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SMnodeMsg *);