提交 74039b30 编写于 作者: S slguan

#1177

上级 3b269e00
...@@ -45,6 +45,12 @@ extern int mgmtShellConns; ...@@ -45,6 +45,12 @@ extern int mgmtShellConns;
extern int mgmtDnodeConns; extern int mgmtDnodeConns;
extern char mgmtDirectory[]; extern char mgmtDirectory[];
extern int tsAcctUpdateSize;
extern int tsDbUpdateSize;
extern int tsDnodeUpdateSize;
extern int tsMnodeUpdateSize;
extern int tsUserUpdateSize;
extern int tsVgUpdateSize;
typedef struct { typedef struct {
uint32_t privateIp; uint32_t privateIp;
...@@ -256,96 +262,9 @@ typedef struct { ...@@ -256,96 +262,9 @@ typedef struct {
char payload[]; /* payload for wildcard match in show tables */ char payload[]; /* payload for wildcard match in show tables */
} SShowObj; } SShowObj;
extern SAcctObj acctObj;
extern SDnodeObj dnodeObj;
// shell API
int mgmtInitShell();
void mgmtCleanUpShell();
int mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, uint8_t *secret, uint8_t *ckey);
// user API
int mgmtInitUsers();
SUserObj *mgmtGetUser(char *name);
int mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass);
int mgmtDropUser(SAcctObj *pAcct, char *name);
int mgmtUpdateUser(SUserObj *pUser);
int mgmtGetUserMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveUsers(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpUsers();
// metric API
int mgmtAddMeterIntoMetric(STabObj *pMetric, STabObj *pTable);
int mgmtRemoveMeterFromMetric(STabObj *pMetric, STabObj *pTable);
int mgmtGetMetricMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveMetrics(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
// DB API
/* void mgmtMonitorDbDrop(void *unused); */
void mgmtMonitorDbDrop(void *unused, void *unusedt);
int mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter);
int mgmtUseDb(SConnObj *pConn, char *name);
int mgmtAddVgroupIntoDb(SDbObj *pDb, SVgObj *pVgroup);
int mgmtAddVgroupIntoDbTail(SDbObj *pDb, SVgObj *pVgroup);
int mgmtRemoveVgroupFromDb(SDbObj *pDb, SVgObj *pVgroup);
int mgmtAddMetricIntoDb(SDbObj *pDb, STabObj *pMetric);
int mgmtRemoveMetricFromDb(SDbObj *pDb, STabObj *pMetric);
int mgmtMoveVgroupToTail(SDbObj *pDb, SVgObj *pVgroup);
int mgmtMoveVgroupToHead(SDbObj *pDb, SVgObj *pVgroup);
int mgmtGetDbMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveDbs(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpDbs();
// vGroup API
int mgmtInitVgroups();
SVgObj *mgmtGetVgroup(int vgId);
SVgObj *mgmtCreateVgroup(SDbObj *pDb);
int mgmtDropVgroup(SDbObj *pDb, SVgObj *pVgroup);
void mgmtSetVgroupIdPool();
int mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpVgroups();
// meter API
int mgmtInitMeters();
STabObj *mgmtGetTable(char *meterId);
STabObj *mgmtGetTableInfo(char *src, char *tags[]);
int mgmtRetrieveMetricMeta(SConnObj *pConn, char **pStart, SSuperTableMetaMsg *pInfo);
int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate);
int mgmtDropMeter(SDbObj *pDb, char *meterId, int ignore);
int mgmtAlterMeter(SDbObj *pDb, SAlterTableMsg *pAlter);
int mgmtGetTableMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveMeters(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpMeters();
SSchema *mgmtGetTableSchema(STabObj *pTable); // get schema for a meter
// dnode API
int mgmtGetMnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveMnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveVnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
int mgmtUnSetModuleInDnode(SDnodeObj *pDnode, int moduleType);
extern int tsDnodeUpdateSize;
extern int tsVgUpdateSize;
extern int tsDbUpdateSize;
extern int tsUserUpdateSize;
extern int tsAcctUpdateSize;
extern int tsMnodeUpdateSize;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // TDENGINE_MGMT_H #endif
...@@ -22,7 +22,22 @@ extern "C" { ...@@ -22,7 +22,22 @@ extern "C" {
#include "mnode.h" #include "mnode.h"
int mgmtInitDbs(); void mgmtMonitorDbDrop(void *unused, void *unusedt);
int mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter);
int mgmtUseDb(SConnObj *pConn, char *name);
int mgmtAddVgroupIntoDb(SDbObj *pDb, SVgObj *pVgroup);
int mgmtAddVgroupIntoDbTail(SDbObj *pDb, SVgObj *pVgroup);
int mgmtRemoveVgroupFromDb(SDbObj *pDb, SVgObj *pVgroup);
int mgmtAddMetricIntoDb(SDbObj *pDb, STabObj *pMetric);
int mgmtRemoveMetricFromDb(SDbObj *pDb, STabObj *pMetric);
int mgmtMoveVgroupToTail(SDbObj *pDb, SVgObj *pVgroup);
int mgmtMoveVgroupToHead(SDbObj *pDb, SVgObj *pVgroup);
int mgmtGetDbMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveDbs(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpDbs();
int32_t mgmtInitDbs();
int mgmtUpdateDb(SDbObj *pDb); int mgmtUpdateDb(SDbObj *pDb);
SDbObj *mgmtGetDb(char *db); SDbObj *mgmtGetDb(char *db);
SDbObj *mgmtGetDbByMeterId(char *db); SDbObj *mgmtGetDbByMeterId(char *db);
......
...@@ -41,6 +41,9 @@ int32_t mgmtRetrieveConfigs(SShowObj *pShow, char *data, int rows, SConnObj *pCo ...@@ -41,6 +41,9 @@ int32_t mgmtRetrieveConfigs(SShowObj *pShow, char *data, int rows, SConnObj *pCo
int32_t mgmtGetModuleMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn); int32_t mgmtGetModuleMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int32_t mgmtRetrieveModules(SShowObj *pShow, char *data, int rows, SConnObj *pConn); int32_t mgmtRetrieveModules(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
int32_t mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int32_t mgmtRetrieveVnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
extern int32_t (*mgmtInitDnodes)(); extern int32_t (*mgmtInitDnodes)();
extern void (*mgmtCleanUpDnodes)(); extern void (*mgmtCleanUpDnodes)();
extern SDnodeObj* (*mgmtGetDnode)(uint32_t ip); extern SDnodeObj* (*mgmtGetDnode)(uint32_t ip);
...@@ -52,6 +55,8 @@ extern int32_t (*mgmtGetScoresMeta)(SMeterMeta *pMeta, SShowObj *pShow, SConn ...@@ -52,6 +55,8 @@ extern int32_t (*mgmtGetScoresMeta)(SMeterMeta *pMeta, SShowObj *pShow, SConn
extern int32_t (*mgmtRetrieveScores)(SShowObj *pShow, char *data, int rows, SConnObj *pConn); extern int32_t (*mgmtRetrieveScores)(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
extern bool (*mgmtCheckConfigShow)(SGlobalConfig *cfg); extern bool (*mgmtCheckConfigShow)(SGlobalConfig *cfg);
extern SDnodeObj dnodeObj;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -24,7 +24,8 @@ extern "C" { ...@@ -24,7 +24,8 @@ extern "C" {
#include <stdbool.h> #include <stdbool.h>
#include "mnode.h" #include "mnode.h"
// dnodeInt API extern void *mgmtStatusTimer;
int mgmtSendCreateMsgToVgroup(STabObj *pTable, SVgObj *pVgroup); int mgmtSendCreateMsgToVgroup(STabObj *pTable, SVgObj *pVgroup);
int mgmtSendRemoveMeterMsgToDnode(STabObj *pTable, SVgObj *pVgroup); int mgmtSendRemoveMeterMsgToDnode(STabObj *pTable, SVgObj *pVgroup);
int mgmtSendVPeersMsg(SVgObj *pVgroup); int mgmtSendVPeersMsg(SVgObj *pVgroup);
......
...@@ -13,9 +13,22 @@ ...@@ -13,9 +13,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _DEFAULT_SOURCE #ifndef TDENGINE_MGMT_MNODE_H
#define TDENGINE_MGMT_MNODE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include "mnode.h" #include "mnode.h"
int mgmtGetMnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { return TSDB_CODE_OPS_NOT_SUPPORT; } extern int32_t (*mgmtGetMnodeMeta)(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
extern int32_t (*mgmtRetrieveMnodes)(SShowObj *pShow, char *data, int32_t rows, SConnObj *pConn);
#ifdef __cplusplus
}
#endif
int mgmtRetrieveMnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn) { return 0; } #endif
...@@ -13,36 +13,32 @@ ...@@ -13,36 +13,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _DEFAULT_SOURCE #ifndef TDENGINE_MGMT_SHELL_H
#include <arpa/inet.h> #define TDENGINE_MGMT_SHELL_H
#include "mnode.h"
int mgmtCheckRedirectMsg(SConnObj *pConn, int msgType) { return 0; }
int mgmtProcessAlterAcctMsg(char *pMsg, int msgLen, SConnObj *pConn) { #ifdef __cplusplus
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_ALTER_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT); extern "C" {
} #endif
int mgmtProcessCreateDnodeMsg(char *pMsg, int msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int mgmtProcessCfgMnodeMsg(char *pMsg, int msgLen, SConnObj *pConn) { #include <stdint.h>
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CFG_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT); #include <stdbool.h>
} #include "mnode.h"
int mgmtProcessDropMnodeMsg(char *pMsg, int msgLen, SConnObj *pConn) { int mgmtInitShell();
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT); void mgmtCleanUpShell();
} int mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, uint8_t *secret, uint8_t *ckey);
int mgmtProcessDropDnodeMsg(char *pMsg, int msgLen, SConnObj *pConn) { extern int32_t (*mgmtCheckRedirectMsg)(SConnObj *pConn, int32_t msgType);
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT); extern int32_t (*mgmtProcessAlterAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
} extern int32_t (*mgmtProcessCreateDnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
extern int32_t (*mgmtProcessCfgMnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
extern int32_t (*mgmtProcessDropMnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
extern int32_t (*mgmtProcessDropDnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
extern int32_t (*mgmtProcessDropAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
extern int32_t (*mgmtProcessCreateAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn);
int mgmtProcessDropAcctMsg(char *pMsg, int msgLen, SConnObj *pConn) { #ifdef __cplusplus
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
} }
#endif
int mgmtProcessCreateAcctMsg(char *pMsg, int msgLen, SConnObj *pConn) { #endif
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
\ No newline at end of file
...@@ -20,31 +20,18 @@ ...@@ -20,31 +20,18 @@
extern "C" { extern "C" {
#endif #endif
int mgmtInitRedirect(); #include <stdint.h>
void mgmtCleanUpRedirect();
void*mgmtRedirectAllMsgs(char *msg, void *ahandle, void *thandle);
void mgmtSdbWorkAsMasterCallback();
void mgmtSetDnodeOfflineOnSdbChanged();
void mgmtPrintSystemInfo();
int mgmtInitSystem();
int mgmtStartCheckMgmtRunning();
void mgmtDoStatistic(void *handle, void *tmrId);
void mgmtStartMgmtTimer();
int mgmtStartSystem();
void mgmtStopSystem();
int32_t mgmtStartSystem();
void mgmtCleanUpSystem(); void mgmtCleanUpSystem();
extern int32_t (*mgmtInitSystem)();
extern int32_t (*mgmtCheckMgmtRunning)();
extern void (*mgmtDoStatistic)(void *handle, void *tmrId);
extern void (*mgmtStartMgmtTimer)();
extern void (*mgmtStopSystem)();
extern void (*mgmtCleanUpRedirect)();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -25,8 +25,27 @@ extern "C" { ...@@ -25,8 +25,27 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include "mnode.h" #include "mnode.h"
int mgmtInitMeters();
STabObj *mgmtGetTable(char *meterId);
STabObj *mgmtGetTableInfo(char *src, char *tags[]);
int mgmtRetrieveMetricMeta(SConnObj *pConn, char **pStart, SSuperTableMetaMsg *pInfo);
int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate);
int mgmtDropMeter(SDbObj *pDb, char *meterId, int ignore);
int mgmtAlterMeter(SDbObj *pDb, SAlterTableMsg *pAlter);
int mgmtGetTableMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveMeters(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpMeters();
SSchema *mgmtGetTableSchema(STabObj *pTable); // get schema for a meter
int32_t mgmtFindTagCol(STabObj * pTable, const char * tagName); int32_t mgmtFindTagCol(STabObj * pTable, const char * tagName);
int mgmtAddMeterIntoMetric(STabObj *pMetric, STabObj *pTable);
int mgmtRemoveMeterFromMetric(STabObj *pMetric, STabObj *pTable);
int mgmtGetMetricMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveMetrics(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_MGMT_USER_H
#define TDENGINE_MGMT_USER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include "mnode.h"
int mgmtInitUsers();
SUserObj *mgmtGetUser(char *name);
int mgmtCreateUser(SAcctObj *pAcct, char *name, char *pass);
int mgmtDropUser(SAcctObj *pAcct, char *name);
int mgmtUpdateUser(SUserObj *pUser);
int mgmtGetUserMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveUsers(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpUsers();
#ifdef __cplusplus
}
#endif
#endif
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_MGMT_VGROUP_H
#define TDENGINE_MGMT_VGROUP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include "mnode.h"
int mgmtInitVgroups();
SVgObj *mgmtGetVgroup(int vgId);
SVgObj *mgmtCreateVgroup(SDbObj *pDb);
int mgmtDropVgroup(SDbObj *pDb, SVgObj *pVgroup);
void mgmtSetVgroupIdPool();
int mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn);
int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn);
void mgmtCleanUpVgroups();
#ifdef __cplusplus
}
#endif
#endif
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "os.h" #include "os.h"
#include "mnode.h" #include "mnode.h"
#include "mgmtAcct.h" #include "mgmtAcct.h"
#include "mgmtTable.h"
#include "mgmtUser.h"
#include "tschemautil.h" #include "tschemautil.h"
extern void *userSdb; extern void *userSdb;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "mgmtBalance.h" #include "mgmtBalance.h"
#include "mgmtDnode.h"
#include "dnodeModule.h" #include "dnodeModule.h"
#include "tstatus.h" #include "tstatus.h"
#include "tglobalcfg.h" #include "tglobalcfg.h"
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "mgmtBalance.h" #include "mgmtBalance.h"
#include "mgmtDnodeInt.h" #include "mgmtDnodeInt.h"
#include "mgmtUtil.h" #include "mgmtUtil.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tschemautil.h" #include "tschemautil.h"
#include "tstatus.h" #include "tstatus.h"
#include "mnode.h" #include "mnode.h"
...@@ -73,7 +75,7 @@ void mgmtGetAcctStr(char *src, char *dest) { ...@@ -73,7 +75,7 @@ void mgmtGetAcctStr(char *src, char *dest) {
*dest = 0; *dest = 0;
} }
int mgmtInitDbs() { int32_t mgmtInitDbs() {
void * pNode = NULL; void * pNode = NULL;
SDbObj * pDb = NULL; SDbObj * pDb = NULL;
SAcctObj *pAcct = NULL; SAcctObj *pAcct = NULL;
......
...@@ -387,7 +387,7 @@ int mgmtRetrieveConfigs(SShowObj *pShow, char *data, int rows, SConnObj *pConn) ...@@ -387,7 +387,7 @@ int mgmtRetrieveConfigs(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
return numOfRows; return numOfRows;
} }
int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { int32_t mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) {
int cols = 0; int cols = 0;
if (strcmp(pConn->pAcct->user, "root") != 0) return TSDB_CODE_NO_RIGHTS; if (strcmp(pConn->pAcct->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
...@@ -460,7 +460,7 @@ int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { ...@@ -460,7 +460,7 @@ int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) {
return 0; return 0;
} }
int mgmtRetrieveVnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn) { int32_t mgmtRetrieveVnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn) {
int numOfRows = 0; int numOfRows = 0;
SDnodeObj *pDnode = NULL; SDnodeObj *pDnode = NULL;
char * pWrite; char * pWrite;
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "mgmtBalance.h" #include "mgmtBalance.h"
#include "mgmtDnode.h" #include "mgmtDnode.h"
#include "mgmtDb.h" #include "mgmtDb.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tutil.h" #include "tutil.h"
#include "tstatus.h" #include "tstatus.h"
#include "tsystem.h" #include "tsystem.h"
......
...@@ -14,25 +14,10 @@ ...@@ -14,25 +14,10 @@
*/ */
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include <arpa/inet.h> #include "mgmtMnode.h"
#include "dnodeSystem.h" int32_t mgmtGetMnodeMetaImp(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) { return TSDB_CODE_OPS_NOT_SUPPORT; }
#include "mnode.h" int32_t (*mgmtGetMnodeMeta)(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) = mgmtGetMnodeMetaImp;
extern void *mgmtTmr;
extern void *mgmtStatusTimer;
void mgmtProcessDnodeStatus(void *handle, void *tmrId);
int mgmtInitSystem() { return mgmtStartSystem(); }
int32_t mgmtStartCheckMgmtRunning() { return 0; }
void mgmtDoStatistic(void *handle, void *tmrId) {}
void mgmtStartMgmtTimer() { taosTmrReset(mgmtProcessDnodeStatus, 500, NULL, mgmtTmr, &mgmtStatusTimer); }
void mgmtStopSystem() {}
void mgmtCleanUpRedirect() {}
int32_t mgmtRetrieveMnodesImp(SShowObj *pShow, char *data, int32_t rows, SConnObj *pConn) { return 0; }
int32_t (*mgmtRetrieveMnodes)(SShowObj *pShow, char *data, int32_t rows, SConnObj *pConn) = mgmtRetrieveMnodesImp;
...@@ -24,9 +24,13 @@ ...@@ -24,9 +24,13 @@
#include "mgmtDb.h" #include "mgmtDb.h"
#include "mgmtDnode.h" #include "mgmtDnode.h"
#include "mgmtGrant.h" #include "mgmtGrant.h"
#include "mgmtMnode.h"
#include "mgmtProfile.h" #include "mgmtProfile.h"
#include "mgmtShell.h"
#include "mgmtTable.h" #include "mgmtTable.h"
#include "mgmtUser.h"
#include "mgmtUtil.h" #include "mgmtUtil.h"
#include "mgmtVgroup.h"
#include "taosmsg.h" #include "taosmsg.h"
#include "tlog.h" #include "tlog.h"
#include "tstatus.h" #include "tstatus.h"
...@@ -48,17 +52,6 @@ void mgmtInitProcessShellMsg(); ...@@ -48,17 +52,6 @@ void mgmtInitProcessShellMsg();
int mgmtRedirectMsg(SConnObj *pConn, int msgType); int mgmtRedirectMsg(SConnObj *pConn, int msgType);
int mgmtKillQuery(char *queryId, SConnObj *pConn); int mgmtKillQuery(char *queryId, SConnObj *pConn);
int mgmtCheckRedirectMsg(SConnObj *pConn, int msgType);
int mgmtProcessAlterAcctMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessCreateMnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessCreateDnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessCfgMnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessDropMnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessDropDnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessDropAcctMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessCreateAcctMsg(char *pMsg, int msgLen, SConnObj *pConn);
int mgmtProcessCfgDnodeMsg(char *pMsg, int msgLen, SConnObj *pConn);
void mgmtProcessTranRequest(SSchedMsg *pSchedMsg) { void mgmtProcessTranRequest(SSchedMsg *pSchedMsg) {
SIntMsg * pMsg = (SIntMsg *)(pSchedMsg->msg); SIntMsg * pMsg = (SIntMsg *)(pSchedMsg->msg);
SConnObj *pConn = (SConnObj *)(pSchedMsg->thandle); SConnObj *pConn = (SConnObj *)(pSchedMsg->thandle);
...@@ -1537,3 +1530,43 @@ void mgmtInitProcessShellMsg() { ...@@ -1537,3 +1530,43 @@ void mgmtInitProcessShellMsg() {
mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_STREAM] = mgmtProcessKillStreamMsg; mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_STREAM] = mgmtProcessKillStreamMsg;
mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_CONNECTION] = mgmtProcessKillConnectionMsg; mgmtProcessShellMsg[TSDB_MSG_TYPE_KILL_CONNECTION] = mgmtProcessKillConnectionMsg;
} }
int32_t mgmtCheckRedirectMsgImp(SConnObj *pConn, int32_t msgType) {
return 0;
}
int32_t (*mgmtCheckRedirectMsg)(SConnObj *pConn, int32_t msgType) = mgmtCheckRedirectMsgImp;
int32_t mgmtProcessAlterAcctMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_ALTER_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessAlterAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessAlterAcctMsgImp;
int32_t mgmtProcessCreateDnodeMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessCreateDnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessCreateDnodeMsgImp;
int32_t mgmtProcessCfgMnodeMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CFG_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessCfgMnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessCfgMnodeMsgImp;
int32_t mgmtProcessDropMnodeMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_MNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessDropMnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessDropMnodeMsgImp;
int32_t mgmtProcessDropDnodeMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_DNODE_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessDropDnodeMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessDropDnodeMsgImp;
int32_t mgmtProcessDropAcctMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_DROP_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessDropAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessDropAcctMsgImp;
int32_t mgmtProcessCreateAcctMsgImp(char *pMsg, int32_t msgLen, SConnObj *pConn) {
return taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_CREATE_ACCT_RSP, TSDB_CODE_OPS_NOT_SUPPORT);
}
int32_t (*mgmtProcessCreateAcctMsg)(char *pMsg, int32_t msgLen, SConnObj *pConn) = mgmtProcessCreateAcctMsgImp;
\ No newline at end of file
...@@ -18,9 +18,18 @@ ...@@ -18,9 +18,18 @@
#include "dnodeSystem.h" #include "dnodeSystem.h"
#include "mnode.h" #include "mnode.h"
#include "tsdb.h" #include "mgmtAcct.h"
#include "mgmtBalance.h"
#include "mgmtDb.h"
#include "mgmtDnode.h"
#include "mgmtDnodeInt.h"
#include "mgmtVgroup.h"
#include "mgmtUser.h"
#include "mgmtSystem.h" #include "mgmtSystem.h"
#include "mgmtTable.h"
#include "mgmtShell.h"
#include "dnodeModule.h" #include "dnodeModule.h"
#include "tsdb.h"
// global, not configurable // global, not configurable
char mgmtDirectory[128]; char mgmtDirectory[128];
...@@ -76,7 +85,7 @@ int mgmtStartSystem() { ...@@ -76,7 +85,7 @@ int mgmtStartSystem() {
mkdir(mgmtDirectory, 0755); mkdir(mgmtDirectory, 0755);
} }
if (mgmtStartCheckMgmtRunning() != 0) { if (mgmtCheckMgmtRunning() != 0) {
mPrint("TDengine mgmt module already started..."); mPrint("TDengine mgmt module already started...");
return 0; return 0;
} }
...@@ -152,3 +161,24 @@ int mgmtStartSystem() { ...@@ -152,3 +161,24 @@ int mgmtStartSystem() {
return 0; return 0;
} }
int32_t mgmtInitSystemImp() { return mgmtStartSystem(); }
int32_t (*mgmtInitSystem)() = mgmtInitSystemImp;
int32_t mgmtCheckMgmtRunningImp() { return 0; }
int32_t (*mgmtCheckMgmtRunning)() = mgmtCheckMgmtRunningImp;
void mgmtDoStatisticImp(void *handle, void *tmrId) {}
void (*mgmtDoStatistic)(void *handle, void *tmrId) = mgmtDoStatisticImp;
void mgmtStartMgmtTimerImp() {
taosTmrReset(mgmtProcessDnodeStatus, 500, NULL, mgmtTmr, &mgmtStatusTimer);
}
void (*mgmtStartMgmtTimer)() = mgmtStartMgmtTimerImp;
void mgmtStopSystemImp() {}
void (*mgmtStopSystem)() = mgmtStopSystemImp;
void mgmtCleanUpRedirectImp() {}
void (*mgmtCleanUpRedirect)() = mgmtCleanUpRedirectImp;
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include "mgmtUtil.h" #include "mgmtUtil.h"
#include "mgmtDb.h" #include "mgmtDb.h"
#include "mgmtDnodeInt.h" #include "mgmtDnodeInt.h"
#include "mgmtVgroup.h"
#include "mgmtSupertableQuery.h" #include "mgmtSupertableQuery.h"
#include "mgmtTable.h"
#include "taosmsg.h" #include "taosmsg.h"
#include "tast.h" #include "tast.h"
#include "textbuffer.h" #include "textbuffer.h"
......
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
#include "os.h" #include "os.h"
#include "mnode.h" #include "mnode.h"
#include "mgmtGrant.h"
#include "mgmtAcct.h" #include "mgmtAcct.h"
#include "mgmtUser.h"
#include "mgmtGrant.h"
#include "mgmtTable.h"
#include "tschemautil.h" #include "tschemautil.h"
#include "ttime.h" #include "ttime.h"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "os.h" #include "os.h"
#include "mnode.h" #include "mnode.h"
#include "mgmtUtil.h" #include "mgmtUtil.h"
#include "mgmtTable.h"
#include "tschemautil.h" #include "tschemautil.h"
bool mgmtTableCreateFromSuperTable(STabObj* pTableObj) { bool mgmtTableCreateFromSuperTable(STabObj* pTableObj) {
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include "mgmtDb.h" #include "mgmtDb.h"
#include "mgmtDnode.h" #include "mgmtDnode.h"
#include "mgmtDnodeInt.h" #include "mgmtDnodeInt.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tschemautil.h" #include "tschemautil.h"
#include "tlog.h" #include "tlog.h"
#include "tstatus.h" #include "tstatus.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册