Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Cherenkov effect
TDengine
提交
8fc096e3
T
TDengine
项目概览
Cherenkov effect
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8fc096e3
编写于
3月 03, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sort out mgmt account
上级
14ecbb0f
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
220 addition
and
911 deletion
+220
-911
src/inc/.fuse_hidden0000e2ae00000244
src/inc/.fuse_hidden0000e2ae00000244
+0
-816
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-2
src/mnode/inc/mgmtAcct.h
src/mnode/inc/mgmtAcct.h
+13
-11
src/mnode/inc/mgmtBalance.h
src/mnode/inc/mgmtBalance.h
+1
-1
src/mnode/inc/mgmtShell.h
src/mnode/inc/mgmtShell.h
+0
-3
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+11
-12
src/mnode/src/mgmtBalance.c
src/mnode/src/mgmtBalance.c
+30
-25
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+1
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+161
-35
src/mnode/src/mgmtSystem.c
src/mnode/src/mgmtSystem.c
+1
-5
未找到文件。
src/inc/.fuse_hidden0000e2ae00000244
已删除
100644 → 0
浏览文件 @
14ecbb0f
此差异已折叠。
点击以展开。
src/inc/taosmsg.h
浏览文件 @
8fc096e3
...
...
@@ -309,8 +309,8 @@ typedef struct {
}
SAcctCfg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
char
user
[
TSDB_USER_LEN
+
1
];
char
pass
[
TSDB_KEY_LEN
+
1
];
SAcctCfg
cfg
;
}
SCreateAcctMsg
,
SAlterAcctMsg
;
...
...
src/mnode/inc/mgmtAcct.h
浏览文件 @
8fc096e3
...
...
@@ -22,22 +22,24 @@ extern "C" {
#include "mnode.h"
int32_t
mgmtInitAccts
();
void
mgmtCleanUpAccts
();
SAcctObj
*
mgmtGetAcct
(
char
*
acctName
);
int32_t
mgmtCheckUserLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckDbLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
,
int32_t
numOfTimeSeries
);
int32_t
mgmtGetAcctMeta
(
STableMeta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveAccts
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
int32_t
mgmtAddDbIntoAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
mgmtRemoveDbFromAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
);
int32_t
mgmtAddUserIntoAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
mgmtRemoveUserFromAcct
(
SAcctObj
*
pAcct
,
SUserObj
*
pUser
);
int32_t
mgmtInitAccts
();
void
mgmtCleanUpAccts
();
SAcctObj
*
mgmtGetAcct
(
char
*
acctName
);
int32_t
mgmtCheckUserLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckDbLimit
(
SAcctObj
*
pAcct
);
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
,
SCreateTableMsg
*
pCreate
);
int32_t
mgmtGetAcctMeta
(
STableMeta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveAccts
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
void
mgmtDoStatistic
(
void
*
handle
,
void
*
tmrId
);
extern
int32_t
(
*
mgmtCreateAcctFp
)(
char
*
name
,
char
*
pass
,
SAcctCfg
*
pCfg
);
extern
int32_t
(
*
mgmtDropAcctFp
)(
char
*
name
);
extern
int32_t
(
*
mgmtAlterAcctFp
)(
char
*
name
,
char
*
pass
,
SAcctCfg
*
pCfg
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtBalance.h
浏览文件 @
8fc096e3
...
...
@@ -32,7 +32,7 @@ extern char* (*mgmtGetVnodeStatus)(SVgObj *pVgroup, SVnodeGid *pVnode);
extern
bool
(
*
mgmtCheckVnodeReady
)(
SDnodeObj
*
pDnode
,
SVgObj
*
pVgroup
,
SVnodeGid
*
pVnode
);
extern
void
(
*
mgmtUpdateDnodeState
)(
SDnodeObj
*
pDnode
,
int
lbStatus
);
extern
void
(
*
mgmtUpdateVgroupState
)(
SVgObj
*
pVgroup
,
int
lbStatus
,
int
srcIp
);
extern
bool
(
*
mgmtAddVnode
)
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
);
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
);
#ifdef __cplusplus
}
...
...
src/mnode/inc/mgmtShell.h
浏览文件 @
8fc096e3
...
...
@@ -28,13 +28,10 @@ int32_t mgmtInitShell();
void
mgmtCleanUpShell
();
extern
int32_t
(
*
mgmtCheckRedirectMsg
)(
void
*
pConn
);
extern
void
(
*
mgmtProcessAlterAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessCreateDnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessCfgMnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessDropMnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessDropDnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessDropAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
extern
void
(
*
mgmtProcessCreateAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
/*
* If table not exist, will create it
...
...
src/mnode/src/mgmtAcct.c
浏览文件 @
8fc096e3
...
...
@@ -28,13 +28,17 @@ static SAcctObj tsAcctObj;
int32_t
(
*
mgmtInitAcctsFp
)()
=
NULL
;
void
(
*
mgmtCleanUpAcctsFp
)()
=
NULL
;
int32_t
(
*
mgmtCreateAcctFp
)(
char
*
name
,
char
*
pass
,
SAcctCfg
*
pCfg
)
=
NULL
;
int32_t
(
*
mgmtDropAcctFp
)(
char
*
name
)
=
NULL
;
int32_t
(
*
mgmtAlterAcctFp
)(
char
*
name
,
char
*
pass
,
SAcctCfg
*
pCfg
)
=
NULL
;
int32_t
(
*
mgmtGetAcctMetaFp
)(
STableMeta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
NULL
;
int32_t
(
*
mgmtRetrieveAcctsFp
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
=
NULL
;
SAcctObj
*
(
*
mgmtGetAcctFp
)(
char
*
acctName
)
=
NULL
;
int32_t
(
*
mgmtCheckUserLimitFp
)(
SAcctObj
*
pAcct
)
=
NULL
;
int32_t
(
*
mgmtCheckDbLimitFp
)(
SAcctObj
*
pAcct
)
=
NULL
;
int32_t
(
*
mgmtCheckTableLimitFp
)(
SAcctObj
*
pAcct
,
SCreateTableMsg
*
pCreate
)
=
NULL
;
int32_t
(
*
mgmtGetAcctMetaFp
)(
STableMeta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
NULL
;
int32_t
(
*
mgmtRetrieveAcctsFp
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
=
NULL
;
void
(
*
mgmtDoStatisticFp
)(
void
*
handle
,
void
*
tmrId
)
=
NULL
;
int32_t
(
*
mgmtCheckTimeSeriesLimitFp
)(
SAcctObj
*
pAcct
,
int32_t
numOfTimeSeries
)
=
NULL
;
int32_t
mgmtAddDbIntoAcct
(
SAcctObj
*
pAcct
,
SDbObj
*
pDb
)
{
pthread_mutex_lock
(
&
pAcct
->
mutex
);
...
...
@@ -152,9 +156,9 @@ int32_t mgmtCheckDbLimit(SAcctObj *pAcct) {
}
}
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
,
SCreateTableMsg
*
pCreate
)
{
if
(
mgmtCheckT
able
LimitFp
)
{
return
mgmtCheckT
ableLimitFp
(
pAcct
,
pCreate
);
int32_t
mgmtCheckTableLimit
(
SAcctObj
*
pAcct
,
int32_t
numOfTimeSeries
)
{
if
(
mgmtCheckT
imeSeries
LimitFp
)
{
return
mgmtCheckT
imeSeriesLimitFp
(
pAcct
,
numOfTimeSeries
);
}
else
{
return
0
;
}
...
...
@@ -194,8 +198,3 @@ SAcctObj *mgmtGetAcctFromConn(void *pConn) {
return
NULL
;
}
void
mgmtDoStatistic
(
void
*
handle
,
void
*
tmrId
)
{
if
(
mgmtDoStatisticFp
)
{
mgmtDoStatisticFp
(
handle
,
tmrId
);
}
}
\ No newline at end of file
src/mnode/src/mgmtBalance.c
浏览文件 @
8fc096e3
...
...
@@ -31,27 +31,28 @@ void mgmtCleanupBalanceImp() {}
void
(
*
mgmtCleanupBalance
)()
=
mgmtCleanupBalanceImp
;
int32_t
mgmtAllocVnodesImp
(
SVgObj
*
pVgroup
)
{
int
selectedVnode
=
-
1
;
int
lastAllocVode
=
pDnode
->
lastAllocVnode
;
for
(
int
i
=
0
;
i
<
pDnode
->
numOfVnodes
;
i
++
)
{
int
vnode
=
(
i
+
lastAllocVode
)
%
pDnode
->
numOfVnodes
;
if
(
pDnode
->
vload
[
vnode
].
vgId
==
0
&&
pDnode
->
vload
[
vnode
].
status
==
TSDB_VN_STATUS_OFFLINE
)
{
selectedVnode
=
vnode
;
break
;
}
}
if
(
selectedVnode
==
-
1
)
{
mError
(
"vgroup:%d alloc vnode failed, free vnodes:%d"
,
pVgroup
->
vgId
,
pDnode
->
numOfFreeVnodes
);
return
-
1
;
}
else
{
mTrace
(
"vgroup:%d allocate vnode:%d, last allocated vnode:%d"
,
pVgroup
->
vgId
,
selectedVnode
,
lastAllocVode
);
pVgroup
->
vnodeGid
[
0
].
vnode
=
selectedVnode
;
pDnode
->
lastAllocVnode
=
selectedVnode
+
1
;
if
(
pDnode
->
lastAllocVnode
>=
pDnode
->
numOfVnodes
)
pDnode
->
lastAllocVnode
=
0
;
return
0
;
}
// int selectedVnode = -1;
// int lastAllocVode = pDnode->lastAllocVnode;
//
// for (int i = 0; i < pDnode->numOfVnodes; i++) {
// int vnode = (i + lastAllocVode) % pDnode->numOfVnodes;
// if (pDnode->vload[vnode].vgId == 0 && pDnode->vload[vnode].status == TSDB_VN_STATUS_OFFLINE) {
// selectedVnode = vnode;
// break;
// }
// }
//
// if (selectedVnode == -1) {
// mError("vgroup:%d alloc vnode failed, free vnodes:%d", pVgroup->vgId, pDnode->numOfFreeVnodes);
// return -1;
// } else {
// mTrace("vgroup:%d allocate vnode:%d, last allocated vnode:%d", pVgroup->vgId, selectedVnode, lastAllocVode);
// pVgroup->vnodeGid[0].vnode = selectedVnode;
// pDnode->lastAllocVnode = selectedVnode + 1;
// if (pDnode->lastAllocVnode >= pDnode->numOfVnodes) pDnode->lastAllocVnode = 0;
// return 0;
// }
return
0
;
}
int32_t
(
*
mgmtAllocVnodes
)(
SVgObj
*
pVgroup
)
=
mgmtAllocVnodesImp
;
...
...
@@ -83,9 +84,13 @@ void mgmtUpdateVgroupStateImp(SVgObj *pVgroup, int lbStatus, int srcIp) {
void
(
*
mgmtUpdateVgroupState
)(
SVgObj
*
pVgroup
,
int
lbStatus
,
int
srcIp
)
=
mgmtUpdateVgroupStateImp
;
bool
mgmtAddVnodeImp
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
{
return
false
;
}
bool
(
*
mgmtAddVnode
)(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
=
mgmtAddVnodeImp
;
bool
(
*
mgmtAddVnodeFp
)(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
=
NULL
;
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
{
if
(
mgmtAddVnodeFp
)
{
return
mgmtAddVnodeFp
(
pVgroup
,
pSrcDnode
,
pDestDnode
);
}
else
{
return
false
;
}
}
src/mnode/src/mgmtMnode.c
浏览文件 @
8fc096e3
...
...
@@ -137,7 +137,7 @@ static void *mgmtGetNextMnode(SShowObj *pShow, SSdbPeer **pMnode) {
return
mgmtGetNextMnodeFp
(
pShow
,
pMnode
);
}
else
{
if
(
*
pMnode
==
NULL
)
{
*
pMnode
=
&
tsMnodeObj
;
*
pMnode
=
NULL
;
}
else
{
*
pMnode
=
NULL
;
}
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
8fc096e3
...
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taosmsg.h"
#include "taoserror.h"
#include "tlog.h"
#include "trpc.h"
#include "tstatus.h"
...
...
@@ -1048,38 +1049,6 @@ static void mgmtProcessMsgFromShell(char type, void *pCont, int contLen, void *a
// rpcFreeCont(pCont);
}
void
mgmtInitProcessShellMsg
()
{
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CONNECT
]
=
mgmtProcessConnectMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_HEARTBEAT
]
=
mgmtProcessHeartBeatMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_DB
]
=
mgmtProcessCreateDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_DB
]
=
mgmtProcessAlterDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_DB
]
=
mgmtProcessDropDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_USE_DB
]
=
mgmtProcessUnSupportMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_USER
]
=
mgmtProcessCreateUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_USER
]
=
mgmtProcessAlterUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_USER
]
=
mgmtProcessDropUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_ACCT
]
=
mgmtProcessCreateAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_ACCT
]
=
mgmtProcessDropAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_ACCT
]
=
mgmtProcessAlterAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_TABLE
]
=
mgmtProcessCreateTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_TABLE
]
=
mgmtProcessDropTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_TABLE
]
=
mgmtProcessAlterTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_DNODE
]
=
mgmtProcessCreateDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_DNODE
]
=
mgmtProcessDropDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DNODE_CFG
]
=
mgmtProcessCfgDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_MNODE
]
=
mgmtProcessUnSupportMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_MNODE
]
=
mgmtProcessDropMnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CFG_MNODE
]
=
mgmtProcessCfgMnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_QUERY
]
=
mgmtProcessKillQueryMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_STREAM
]
=
mgmtProcessKillStreamMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_CONNECTION
]
=
mgmtProcessKillConnectionMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_SHOW
]
=
mgmtProcessShowMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_RETRIEVE
]
=
mgmtProcessRetrieveMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
mgmtProcessTableMetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_MULTI_TABLE_META
]
=
mgmtProcessMultiTableMetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_STABLE_META
]
=
mgmtProcessSuperTableMetaMsg
;
}
void
mgmtProcessCreateVgroup
(
SCreateTableMsg
*
pCreate
,
int32_t
contLen
,
void
*
thandle
,
bool
isGetMeta
)
{
SDbObj
*
pDb
=
mgmtGetDb
(
pCreate
->
db
);
if
(
pDb
==
NULL
)
{
...
...
@@ -1195,10 +1164,167 @@ static void mgmtProcessUnSupportMsg(void *pCont, int32_t contLen, void *ahandle)
rpcSendResponse
(
ahandle
,
TSDB_CODE_OPS_NOT_SUPPORT
,
NULL
,
0
);
}
void
(
*
mgmtProcessAlterAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessCreateDnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessCfgMnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessDropMnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessDropDnodeMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessDropAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
void
(
*
mgmtProcessCreateAcctMsg
)(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
=
mgmtProcessUnSupportMsg
;
\ No newline at end of file
static
void
mgmtProcessAlterAcctMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
if
(
!
mgmtAlterAcctFp
)
{
rpcSendResponse
(
ahandle
,
TSDB_CODE_OPS_NOT_SUPPORT
,
NULL
,
0
);
return
;
}
SAlterAcctMsg
*
pAlter
=
pCont
;
pAlter
->
cfg
.
maxUsers
=
htonl
(
pAlter
->
cfg
.
maxUsers
);
pAlter
->
cfg
.
maxDbs
=
htonl
(
pAlter
->
cfg
.
maxDbs
);
pAlter
->
cfg
.
maxTimeSeries
=
htonl
(
pAlter
->
cfg
.
maxTimeSeries
);
pAlter
->
cfg
.
maxConnections
=
htonl
(
pAlter
->
cfg
.
maxConnections
);
pAlter
->
cfg
.
maxStreams
=
htonl
(
pAlter
->
cfg
.
maxStreams
);
pAlter
->
cfg
.
maxPointsPerSecond
=
htonl
(
pAlter
->
cfg
.
maxPointsPerSecond
);
pAlter
->
cfg
.
maxStorage
=
htobe64
(
pAlter
->
cfg
.
maxStorage
);
pAlter
->
cfg
.
maxQueryTime
=
htobe64
(
pAlter
->
cfg
.
maxQueryTime
);
pAlter
->
cfg
.
maxInbound
=
htobe64
(
pAlter
->
cfg
.
maxInbound
);
pAlter
->
cfg
.
maxOutbound
=
htobe64
(
pAlter
->
cfg
.
maxOutbound
);
if
(
mgmtCheckRedirectMsg
(
ahandle
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"account:%s, failed to alter account, need redirect message"
,
pAlter
->
user
);
return
;
}
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
ahandle
);
if
(
pUser
==
NULL
)
{
mError
(
"account:%s, failed to alter account, invalid user"
,
pAlter
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_USER
,
NULL
,
0
);
return
;
}
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mError
(
"account:%s, failed to alter account, no rights"
,
pAlter
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_NO_RIGHTS
,
NULL
,
0
);
return
;
}
int32_t
code
=
mgmtAlterAcctFp
(
pAlter
->
user
,
pAlter
->
pass
,
&
(
pAlter
->
cfg
));;
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"account:%s is altered by %s"
,
pAlter
->
user
,
pUser
->
user
);
}
else
{
mError
(
"account:%s, failed to alter account, reason:%s"
,
pAlter
->
user
,
tstrerror
(
code
));
}
rpcSendResponse
(
ahandle
,
code
,
NULL
,
0
);
}
static
void
mgmtProcessDropAcctMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
if
(
!
mgmtDropAcctFp
)
{
rpcSendResponse
(
ahandle
,
TSDB_CODE_OPS_NOT_SUPPORT
,
NULL
,
0
);
return
;
}
SDropAcctMsg
*
pDrop
=
(
SDropAcctMsg
*
)
pCont
;
if
(
mgmtCheckRedirectMsg
(
ahandle
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"account:%s, failed to drop account, need redirect message"
,
pDrop
->
user
);
return
;
}
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
ahandle
);
if
(
pUser
==
NULL
)
{
mError
(
"account:%s, failed to drop account, invalid user"
,
pDrop
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_USER
,
NULL
,
0
);
return
;
}
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mError
(
"account:%s, failed to drop account, no rights"
,
pDrop
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_NO_RIGHTS
,
NULL
,
0
);
return
;
}
int32_t
code
=
mgmtDropAcctFp
(
pDrop
->
user
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"account:%s is dropped by %s"
,
pDrop
->
user
,
pUser
->
user
);
}
else
{
mError
(
"account:%s, failed to drop account, reason:%s"
,
pDrop
->
user
,
tstrerror
(
code
));
}
rpcSendResponse
(
ahandle
,
code
,
NULL
,
0
);
}
static
void
mgmtProcessCreateAcctMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
if
(
!
mgmtCreateAcctFp
)
{
rpcSendResponse
(
ahandle
,
TSDB_CODE_OPS_NOT_SUPPORT
,
NULL
,
0
);
return
;
}
SCreateAcctMsg
*
pCreate
=
(
SCreateAcctMsg
*
)
pCont
;
pCreate
->
cfg
.
maxUsers
=
htonl
(
pCreate
->
cfg
.
maxUsers
);
pCreate
->
cfg
.
maxDbs
=
htonl
(
pCreate
->
cfg
.
maxDbs
);
pCreate
->
cfg
.
maxTimeSeries
=
htonl
(
pCreate
->
cfg
.
maxTimeSeries
);
pCreate
->
cfg
.
maxConnections
=
htonl
(
pCreate
->
cfg
.
maxConnections
);
pCreate
->
cfg
.
maxStreams
=
htonl
(
pCreate
->
cfg
.
maxStreams
);
pCreate
->
cfg
.
maxPointsPerSecond
=
htonl
(
pCreate
->
cfg
.
maxPointsPerSecond
);
pCreate
->
cfg
.
maxStorage
=
htobe64
(
pCreate
->
cfg
.
maxStorage
);
pCreate
->
cfg
.
maxQueryTime
=
htobe64
(
pCreate
->
cfg
.
maxQueryTime
);
pCreate
->
cfg
.
maxInbound
=
htobe64
(
pCreate
->
cfg
.
maxInbound
);
pCreate
->
cfg
.
maxOutbound
=
htobe64
(
pCreate
->
cfg
.
maxOutbound
);
if
(
mgmtCheckRedirectMsg
(
ahandle
)
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"account:%s, failed to create account, need redirect message"
,
pCreate
->
user
);
return
;
}
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
ahandle
);
if
(
pUser
==
NULL
)
{
mError
(
"account:%s, failed to create account, invalid user"
,
pCreate
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_INVALID_USER
,
NULL
,
0
);
return
;
}
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mError
(
"account:%s, failed to create account, no rights"
,
pCreate
->
user
);
rpcSendResponse
(
ahandle
,
TSDB_CODE_NO_RIGHTS
,
NULL
,
0
);
return
;
}
int32_t
code
=
mgmtCreateAcctFp
(
pCreate
->
user
,
pCreate
->
pass
,
&
(
pCreate
->
cfg
));
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"account:%s is created by %s"
,
pCreate
->
user
,
pUser
->
user
);
}
else
{
mError
(
"account:%s, failed to create account, reason:%s"
,
pCreate
->
user
,
tstrerror
(
code
));
}
rpcSendResponse
(
ahandle
,
code
,
NULL
,
0
);
}
void
mgmtInitProcessShellMsg
()
{
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CONNECT
]
=
mgmtProcessConnectMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_HEARTBEAT
]
=
mgmtProcessHeartBeatMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_DB
]
=
mgmtProcessCreateDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_DB
]
=
mgmtProcessAlterDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_DB
]
=
mgmtProcessDropDbMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_USE_DB
]
=
mgmtProcessUnSupportMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_USER
]
=
mgmtProcessCreateUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_USER
]
=
mgmtProcessAlterUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_USER
]
=
mgmtProcessDropUserMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_ACCT
]
=
mgmtProcessCreateAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_ACCT
]
=
mgmtProcessDropAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_ACCT
]
=
mgmtProcessAlterAcctMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_TABLE
]
=
mgmtProcessCreateTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_TABLE
]
=
mgmtProcessDropTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_ALTER_TABLE
]
=
mgmtProcessAlterTableMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_DNODE
]
=
mgmtProcessCreateDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_DNODE
]
=
mgmtProcessDropDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DNODE_CFG
]
=
mgmtProcessCfgDnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CREATE_MNODE
]
=
mgmtProcessUnSupportMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_DROP_MNODE
]
=
mgmtProcessDropMnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_CFG_MNODE
]
=
mgmtProcessCfgMnodeMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_QUERY
]
=
mgmtProcessKillQueryMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_STREAM
]
=
mgmtProcessKillStreamMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_CONNECTION
]
=
mgmtProcessKillConnectionMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_SHOW
]
=
mgmtProcessShowMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_RETRIEVE
]
=
mgmtProcessRetrieveMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
mgmtProcessTableMetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_MULTI_TABLE_META
]
=
mgmtProcessMultiTableMetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_STABLE_META
]
=
mgmtProcessSuperTableMetaMsg
;
}
src/mnode/src/mgmtSystem.c
浏览文件 @
8fc096e3
...
...
@@ -33,12 +33,11 @@
char
tsMgmtDirectory
[
128
]
=
{
0
};
void
*
tsMgmtTmr
=
NULL
;
void
*
tsMgmtTranQhandle
=
NULL
;
void
*
tsMgmtStatisTimer
=
NULL
;
void
mgmtCleanUpSystem
()
{
mPrint
(
"starting to clean up mgmt"
);
taosTmrStopA
(
&
tsMgmtStatisTimer
);
mgmtCleanUpRedirect
();
sdbCleanUpPeers
();
mgmtCleanupBalance
();
...
...
@@ -140,9 +139,6 @@ int32_t mgmtStartSystem() {
mError
(
"failed to init dnode balance"
)
}
if
(
mgmtDoStatistic
)
{
taosTmrReset
(
mgmtDoStatistic
,
tsStatusInterval
*
30000
,
NULL
,
tsMgmtTmr
,
&
tsMgmtStatisTimer
);
}
mPrint
(
"TDengine mgmt is initialized successfully"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录