Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
74039b30
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
74039b30
编写于
2月 11, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#1177
上级
3b269e00
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
301 addition
and
156 deletion
+301
-156
src/inc/mnode.h
src/inc/mnode.h
+7
-88
src/mnode/inc/mgmtDb.h
src/mnode/inc/mgmtDb.h
+20
-5
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+5
-0
src/mnode/inc/mgmtDnodeInt.h
src/mnode/inc/mgmtDnodeInt.h
+2
-1
src/mnode/inc/mgmtMnode.h
src/mnode/inc/mgmtMnode.h
+16
-3
src/mnode/inc/mgmtShell.h
src/mnode/inc/mgmtShell.h
+44
-0
src/mnode/inc/mgmtSystem.h
src/mnode/inc/mgmtSystem.h
+9
-22
src/mnode/inc/mgmtTable.h
src/mnode/inc/mgmtTable.h
+19
-0
src/mnode/inc/mgmtUser.h
src/mnode/inc/mgmtUser.h
+40
-0
src/mnode/inc/mgmtVgroup.h
src/mnode/inc/mgmtVgroup.h
+40
-0
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+2
-0
src/mnode/src/mgmtBalance.c
src/mnode/src/mgmtBalance.c
+1
-0
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+3
-1
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+2
-2
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+2
-0
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+5
-20
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+44
-11
src/mnode/src/mgmtSystem.c
src/mnode/src/mgmtSystem.c
+32
-2
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+2
-0
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+3
-1
src/mnode/src/mgmtUtil.c
src/mnode/src/mgmtUtil.c
+1
-0
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+2
-0
未找到文件。
src/inc/mnode.h
浏览文件 @
74039b30
...
...
@@ -45,6 +45,12 @@ extern int mgmtShellConns;
extern
int
mgmtDnodeConns
;
extern
char
mgmtDirectory
[];
extern
int
tsAcctUpdateSize
;
extern
int
tsDbUpdateSize
;
extern
int
tsDnodeUpdateSize
;
extern
int
tsMnodeUpdateSize
;
extern
int
tsUserUpdateSize
;
extern
int
tsVgUpdateSize
;
typedef
struct
{
uint32_t
privateIp
;
...
...
@@ -256,96 +262,9 @@ typedef struct {
char
payload
[];
/* payload for wildcard match in show tables */
}
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
}
#endif
#endif
// TDENGINE_MGMT_H
#endif
src/mnode/inc/mgmtDb.h
浏览文件 @
74039b30
...
...
@@ -22,13 +22,28 @@ extern "C" {
#include "mnode.h"
int
mgmtInitDbs
();
int
mgmtUpdateDb
(
SDbObj
*
pDb
);
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
);
SDbObj
*
mgmtGetDb
(
char
*
db
);
SDbObj
*
mgmtGetDbByMeterId
(
char
*
db
);
int
mgmtCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
);
int
mgmtDropDbByName
(
SAcctObj
*
pAcct
,
char
*
name
,
short
ignoreNotExists
);
int
mgmtDropDb
(
SDbObj
*
pDb
);
int
mgmtCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
);
int
mgmtDropDbByName
(
SAcctObj
*
pAcct
,
char
*
name
,
short
ignoreNotExists
);
int
mgmtDropDb
(
SDbObj
*
pDb
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
74039b30
...
...
@@ -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
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
void
(
*
mgmtCleanUpDnodes
)();
extern
SDnodeObj
*
(
*
mgmtGetDnode
)(
uint32_t
ip
);
...
...
@@ -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
bool
(
*
mgmtCheckConfigShow
)(
SGlobalConfig
*
cfg
);
extern
SDnodeObj
dnodeObj
;
#ifdef __cplusplus
}
#endif
...
...
src/mnode/inc/mgmtDnodeInt.h
浏览文件 @
74039b30
...
...
@@ -24,7 +24,8 @@ extern "C" {
#include <stdbool.h>
#include "mnode.h"
// dnodeInt API
extern
void
*
mgmtStatusTimer
;
int
mgmtSendCreateMsgToVgroup
(
STabObj
*
pTable
,
SVgObj
*
pVgroup
);
int
mgmtSendRemoveMeterMsgToDnode
(
STabObj
*
pTable
,
SVgObj
*
pVgroup
);
int
mgmtSendVPeersMsg
(
SVgObj
*
pVgroup
);
...
...
src/mnode/
src/mgmtMnode.spec.c
→
src/mnode/
inc/mgmtMnode.h
浏览文件 @
74039b30
...
...
@@ -13,9 +13,22 @@
* 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"
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
src/mnode/
src/mgmtShell.spec.c
→
src/mnode/
inc/mgmtShell.h
浏览文件 @
74039b30
...
...
@@ -13,36 +13,32 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include <arpa/inet.h>
#include "mnode.h"
int
mgmtCheckRedirectMsg
(
SConnObj
*
pConn
,
int
msgType
)
{
return
0
;
}
#ifndef TDENGINE_MGMT_SHELL_H
#define TDENGINE_MGMT_SHELL_H
int
mgmtProcessAlterAcctMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_ALTER_ACCT_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
int
mgmtProcessCreateDnodeMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_CREATE_DNODE_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
#ifdef __cplusplus
extern
"C"
{
#endif
int
mgmtProcessCfgMnodeMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_CFG_MNODE_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
#include <stdint.h>
#include <stdbool.h>
#include "mnode.h"
int
mgmtProcessDropMnodeMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_DROP_MNODE_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
int
mgmtInitShell
();
void
mgmtCleanUpShell
(
);
int
mgmtRetriveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
uint8_t
*
secret
,
uint8_t
*
ckey
);
int
mgmtProcessDropDnodeMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_DROP_DNODE_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
extern
int32_t
(
*
mgmtCheckRedirectMsg
)(
SConnObj
*
pConn
,
int32_t
msgType
);
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
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_DROP_ACCT_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
#ifdef __cplusplus
}
#endif
int
mgmtProcessCreateAcctMsg
(
char
*
pMsg
,
int
msgLen
,
SConnObj
*
pConn
)
{
return
taosSendSimpleRsp
(
pConn
->
thandle
,
TSDB_MSG_TYPE_CREATE_ACCT_RSP
,
TSDB_CODE_OPS_NOT_SUPPORT
);
}
\ No newline at end of file
#endif
src/mnode/inc/mgmtSystem.h
浏览文件 @
74039b30
...
...
@@ -20,30 +20,17 @@
extern
"C"
{
#endif
int
mgmtInitRedirect
();
#include <stdint.h>
void
mgmtCleanUpRedirect
();
int32_t
mgmtStartSystem
();
void
mgmtCleanUpSystem
();
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
();
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
}
...
...
src/mnode/inc/mgmtTable.h
浏览文件 @
74039b30
...
...
@@ -25,8 +25,27 @@ extern "C" {
#include <stdint.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
);
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
}
#endif
...
...
src/mnode/inc/mgmtUser.h
0 → 100644
浏览文件 @
74039b30
/*
* 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
src/mnode/inc/mgmtVgroup.h
0 → 100644
浏览文件 @
74039b30
/*
* 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
src/mnode/src/mgmtAcct.c
浏览文件 @
74039b30
...
...
@@ -17,6 +17,8 @@
#include "os.h"
#include "mnode.h"
#include "mgmtAcct.h"
#include "mgmtTable.h"
#include "mgmtUser.h"
#include "tschemautil.h"
extern
void
*
userSdb
;
...
...
src/mnode/src/mgmtBalance.c
浏览文件 @
74039b30
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mgmtBalance.h"
#include "mgmtDnode.h"
#include "dnodeModule.h"
#include "tstatus.h"
#include "tglobalcfg.h"
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
74039b30
...
...
@@ -22,6 +22,8 @@
#include "mgmtBalance.h"
#include "mgmtDnodeInt.h"
#include "mgmtUtil.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tschemautil.h"
#include "tstatus.h"
#include "mnode.h"
...
...
@@ -73,7 +75,7 @@ void mgmtGetAcctStr(char *src, char *dest) {
*
dest
=
0
;
}
int
mgmtInitDbs
()
{
int
32_t
mgmtInitDbs
()
{
void
*
pNode
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SAcctObj
*
pAcct
=
NULL
;
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
74039b30
...
...
@@ -387,7 +387,7 @@ int mgmtRetrieveConfigs(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
return
numOfRows
;
}
int
mgmtGetVnodeMeta
(
SMeterMeta
*
pMeta
,
SShowObj
*
pShow
,
SConnObj
*
pConn
)
{
int
32_t
mgmtGetVnodeMeta
(
SMeterMeta
*
pMeta
,
SShowObj
*
pShow
,
SConnObj
*
pConn
)
{
int
cols
=
0
;
if
(
strcmp
(
pConn
->
pAcct
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
...
...
@@ -460,7 +460,7 @@ int mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, SConnObj *pConn) {
return
0
;
}
int
mgmtRetrieveVnodes
(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
SConnObj
*
pConn
)
{
int
32_t
mgmtRetrieveVnodes
(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
SConnObj
*
pConn
)
{
int
numOfRows
=
0
;
SDnodeObj
*
pDnode
=
NULL
;
char
*
pWrite
;
...
...
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
74039b30
...
...
@@ -22,6 +22,8 @@
#include "mgmtBalance.h"
#include "mgmtDnode.h"
#include "mgmtDb.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tutil.h"
#include "tstatus.h"
#include "tsystem.h"
...
...
src/mnode/src/mgmt
System.spec
.c
→
src/mnode/src/mgmt
Mnode
.c
浏览文件 @
74039b30
...
...
@@ -14,25 +14,10 @@
*/
#define _DEFAULT_SOURCE
#include
<arpa/inet.h>
#include
"mgmtMnode.h"
#include "dnodeSystem.h"
#include "mnode.h"
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
mgmtGetMnodeMetaImp
(
SMeterMeta
*
pMeta
,
SShowObj
*
pShow
,
SConnObj
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetMnodeMeta
)(
SMeterMeta
*
pMeta
,
SShowObj
*
pShow
,
SConnObj
*
pConn
)
=
mgmtGetMnodeMetaImp
;
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
;
src/mnode/src/mgmtShell.c
浏览文件 @
74039b30
...
...
@@ -24,9 +24,13 @@
#include "mgmtDb.h"
#include "mgmtDnode.h"
#include "mgmtGrant.h"
#include "mgmtMnode.h"
#include "mgmtProfile.h"
#include "mgmtShell.h"
#include "mgmtTable.h"
#include "mgmtUser.h"
#include "mgmtUtil.h"
#include "mgmtVgroup.h"
#include "taosmsg.h"
#include "tlog.h"
#include "tstatus.h"
...
...
@@ -48,17 +52,6 @@ void mgmtInitProcessShellMsg();
int
mgmtRedirectMsg
(
SConnObj
*
pConn
,
int
msgType
);
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
)
{
SIntMsg
*
pMsg
=
(
SIntMsg
*
)(
pSchedMsg
->
msg
);
SConnObj
*
pConn
=
(
SConnObj
*
)(
pSchedMsg
->
thandle
);
...
...
@@ -1537,3 +1530,43 @@ void mgmtInitProcessShellMsg() {
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_STREAM
]
=
mgmtProcessKillStreamMsg
;
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
src/mnode/src/mgmtSystem.c
浏览文件 @
74039b30
...
...
@@ -18,9 +18,18 @@
#include "dnodeSystem.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 "mgmtTable.h"
#include "mgmtShell.h"
#include "dnodeModule.h"
#include "tsdb.h"
// global, not configurable
char
mgmtDirectory
[
128
];
...
...
@@ -76,7 +85,7 @@ int mgmtStartSystem() {
mkdir
(
mgmtDirectory
,
0755
);
}
if
(
mgmt
Start
CheckMgmtRunning
()
!=
0
)
{
if
(
mgmtCheckMgmtRunning
()
!=
0
)
{
mPrint
(
"TDengine mgmt module already started..."
);
return
0
;
}
...
...
@@ -152,3 +161,24 @@ int mgmtStartSystem() {
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
;
src/mnode/src/mgmtTable.c
浏览文件 @
74039b30
...
...
@@ -22,7 +22,9 @@
#include "mgmtUtil.h"
#include "mgmtDb.h"
#include "mgmtDnodeInt.h"
#include "mgmtVgroup.h"
#include "mgmtSupertableQuery.h"
#include "mgmtTable.h"
#include "taosmsg.h"
#include "tast.h"
#include "textbuffer.h"
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
74039b30
...
...
@@ -17,8 +17,10 @@
#include "os.h"
#include "mnode.h"
#include "mgmtGrant.h"
#include "mgmtAcct.h"
#include "mgmtUser.h"
#include "mgmtGrant.h"
#include "mgmtTable.h"
#include "tschemautil.h"
#include "ttime.h"
...
...
src/mnode/src/mgmtUtil.c
浏览文件 @
74039b30
...
...
@@ -17,6 +17,7 @@
#include "os.h"
#include "mnode.h"
#include "mgmtUtil.h"
#include "mgmtTable.h"
#include "tschemautil.h"
bool
mgmtTableCreateFromSuperTable
(
STabObj
*
pTableObj
)
{
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
74039b30
...
...
@@ -21,6 +21,8 @@
#include "mgmtDb.h"
#include "mgmtDnode.h"
#include "mgmtDnodeInt.h"
#include "mgmtVgroup.h"
#include "mgmtTable.h"
#include "tschemautil.h"
#include "tlog.h"
#include "tstatus.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录