Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
86402cc9
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看板
提交
86402cc9
编写于
2月 26, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
conection from mgmt to dnode
上级
ce906917
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
93 addition
and
61 deletion
+93
-61
src/dnode/inc/dnodeMgmt.h
src/dnode/inc/dnodeMgmt.h
+8
-3
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+74
-47
src/inc/dnode.h
src/inc/dnode.h
+0
-6
src/inc/taosmsg.h
src/inc/taosmsg.h
+5
-0
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+2
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+1
-1
src/util/inc/tglobalcfg.h
src/util/inc/tglobalcfg.h
+1
-1
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+2
-2
未找到文件。
src/dnode/inc/dnodeMgmt.h
浏览文件 @
86402cc9
...
...
@@ -23,12 +23,17 @@ extern "C" {
#include <stdint.h>
#include <stdbool.h>
void
dnodeProcessMsgFromMgmt
(
int8_t
*
pCont
,
int32_t
contLen
,
int32_t
msgType
,
void
*
pConn
);
int32_t
dnodeInitMgmt
();
void
dnodeInitMgmtIp
();
void
dnodeProcessMsgFromMgmt
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
pConn
,
int32_t
code
);
void
dnodeSendMsgToMnode
(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
);
void
dnodeSendRspToMnode
(
void
*
pConn
,
int8_t
msgType
,
int32_t
code
,
void
*
pCont
,
int32_t
contLen
);
void
dnodeSendVpeerCfgMsg
(
int32_t
vnode
);
void
dnodeSendMeterCfgMsg
(
int32_t
vnode
,
int32_t
sid
);
extern
int32_t
(
*
dnodeSendMsgToMnode
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
);
extern
int32_t
(
*
dnodeSendSimpleRspToMnode
)(
void
*
pConn
,
int32_t
msgType
,
int32_t
code
);
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
86402cc9
...
...
@@ -27,10 +27,15 @@
#include "dnodeWrite.h"
#include "dnodeVnodeMgmt.h"
static
int32_t
(
*
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_MAX
])(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
);
void
(
*
dnodeInitMgmtIpFp
)()
=
NULL
;
int32_t
(
*
dnodeInitMgmtFp
)()
=
NULL
;
void
(
*
dnodeProcessStatusRspFp
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
)
=
NULL
;
void
(
*
dnodeSendMsgToMnodeFp
)(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
)
=
NULL
;
static
int32_t
(
*
dnodeProcessMgmtMsgFp
[
TSDB_MSG_TYPE_MAX
])(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
);
static
void
dnodeInitProcessShellMsg
();
void
dnodeSendMsgToMnodeImp
Fp
(
SSchedMsg
*
sched
)
{
static
void
dnodeSendMsgToMnodeQueue
Fp
(
SSchedMsg
*
sched
)
{
int8_t
msgType
=
*
(
int8_t
*
)
(
sched
->
msg
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
));
int32_t
contLen
=
*
(
int32_t
*
)
(
sched
->
msg
-
sizeof
(
int8_t
));
int8_t
*
pCont
=
sched
->
msg
;
...
...
@@ -40,49 +45,58 @@ void dnodeSendMsgToMnodeImpFp(SSchedMsg *sched) {
rpcFreeCont
(
sched
->
msg
);
}
int32_t
dnodeSendMsgToMnodeImp
(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
)
{
void
dnodeSendMsgToMnode
(
int8_t
msgType
,
void
*
pCont
,
int32_t
contLen
)
{
dTrace
(
"msg:%s is sent to mnode"
,
taosMsg
[
msgType
]);
*
(
int8_t
*
)
(
pCont
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
))
=
msgType
;
*
(
int32_t
*
)
(
pCont
-
sizeof
(
int8_t
))
=
contLen
;
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
dnodeSendMsgToMnodeImp
Fp
;
schedMsg
.
msg
=
pCont
;
taosScheduleTask
(
tsDnodeMgmtQhandle
,
&
schedMsg
)
;
return
TSDB_CODE_SUCCESS
;
if
(
dnodeSendMsgToMnodeFp
)
{
dnodeSendMsgToMnodeFp
(
msgType
,
pCont
,
contLen
)
;
}
else
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
dnodeSendMsgToMnodeQueue
Fp
;
schedMsg
.
msg
=
pCont
;
*
(
int8_t
*
)
(
pCont
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
))
=
msgType
;
*
(
int32_t
*
)
(
pCont
-
sizeof
(
int8_t
))
=
contLen
;
taosScheduleTask
(
tsDnodeMgmtQhandle
,
&
schedMsg
);
}
}
int32_t
(
*
dnodeSendMsgToMnode
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
)
=
dnodeSendMsgToMnodeImp
;
int32_t
dnodeSendSimpleRspToMnodeImp
(
void
*
pConn
,
int32_t
msgType
,
int32_t
code
)
{
int8_t
*
pCont
=
rpcMallocCont
(
sizeof
(
int32_t
));
*
(
int32_t
*
)
pCont
=
code
;
dnodeSendMsgToMnodeImp
(
pCont
,
sizeof
(
int32_t
),
msgType
);
return
TSDB_CODE_SUCCESS
;
void
dnodeSendRspToMnode
(
void
*
pConn
,
int8_t
msgType
,
int32_t
code
,
void
*
pCont
,
int32_t
contLen
)
{
dTrace
(
"rsp:%s is sent to mnode"
,
taosMsg
[
msgType
]);
if
(
tsIsCluster
)
{
rpcSendResponse
(
pConn
,
code
,
pCont
,
contLen
);
}
else
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
dnodeSendMsgToMnodeFp
;
schedMsg
.
msg
=
pCont
;
*
(
int8_t
*
)
(
pCont
-
sizeof
(
int32_t
)
-
sizeof
(
int8_t
))
=
msgType
;
*
(
int32_t
*
)
(
pCont
-
sizeof
(
int8_t
))
=
contLen
;
taosScheduleTask
(
tsDnodeMgmtQhandle
,
&
schedMsg
);
}
}
int32_t
(
*
dnodeSendSimpleRspToMnode
)(
void
*
pConn
,
int32_t
msgType
,
int32_t
code
)
=
dnodeSendSimpleRspToMnodeImp
;
int32_t
dnodeInitMgmt
()
{
if
(
dnodeInitMgmtFp
)
{
dnodeInitMgmtFp
();
}
int32_t
dnodeInitMgmtImp
()
{
dnodeInitProcessShellMsg
();
return
0
;
}
int32_t
(
*
dnodeInitMgmt
)()
=
dnodeInitMgmtImp
;
void
dnodeInitMgmtIpImp
()
{}
void
(
*
dnodeInitMgmtIp
)()
=
dnodeInitMgmtIpImp
;
void
dnodeInitMgmtIp
()
{
if
(
dnodeInitMgmtIpFp
)
{
dnodeInitMgmtIpFp
();
}
}
void
dnodeProcessMsgFromMgmt
(
int8_t
*
pCont
,
int32_t
contLen
,
int32_t
msgType
,
void
*
pConn
)
{
void
dnodeProcessMsgFromMgmt
(
char
msgType
,
void
*
pCont
,
int
contLen
,
void
*
pConn
,
int32_t
code
)
{
if
(
msgType
<
0
||
msgType
>=
TSDB_MSG_TYPE_MAX
)
{
dError
(
"invalid msg type:%d"
,
msgType
);
}
else
{
if
(
dnodeProcessShellMsgFp
[
msgType
])
{
(
*
dnodeProcessShellMsgFp
[
msgType
])(
pCont
,
contLen
,
msgType
,
pConn
);
if
(
msgType
==
TSDB_MSG_TYPE_STATUS_RSP
&&
dnodeProcessStatusRspFp
!=
NULL
)
{
dnodeProcessStatusRspFp
(
pCont
,
contLen
,
msgType
,
pConn
);
}
if
(
dnodeProcessMgmtMsgFp
[
msgType
])
{
(
*
dnodeProcessMgmtMsgFp
[
msgType
])(
pCont
,
contLen
,
msgType
,
pConn
);
}
else
{
dError
(
"%s is not processed"
,
taosMsg
[
msgType
]);
}
...
...
@@ -109,16 +123,29 @@ int32_t dnodeProcessTableCfgRsp(int8_t *pCont, int32_t contLen, int8_t msgType,
}
int32_t
dnodeProcessCreateTableRequest
(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
)
{
SDCreateTableMsg
*
table
=
(
SDCreateTableMsg
*
)
pCont
;
int32_t
code
=
dnodeCreateTable
(
table
);
dnodeSendSimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
SDCreateTableMsg
*
pTable
=
(
SDCreateTableMsg
*
)
pCont
;
pTable
->
vnode
=
htonl
(
pTable
->
vnode
);
pTable
->
sid
=
htonl
(
pTable
->
sid
);
pTable
->
uid
=
htobe64
(
pTable
->
uid
);
pTable
->
superTableUid
=
htobe64
(
pTable
->
superTableUid
);
pTable
->
tableType
=
htonl
(
pTable
->
tableType
);
pTable
->
sversion
=
htonl
(
pTable
->
sversion
);
pTable
->
numOfColumns
=
htons
(
pTable
->
numOfColumns
);
pTable
->
numOfTags
=
htons
(
pTable
->
numOfTags
);
pTable
->
tagDataLen
=
htonl
(
pTable
->
tagDataLen
);
pTable
->
sqlDataLen
=
htonl
(
pTable
->
sqlDataLen
);
pTable
->
createdTime
=
htobe64
(
pTable
->
createdTime
);
int32_t
code
=
dnodeCreateTable
(
pTable
);
dnodeSendRspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
int32_t
dnodeProcessAlterStreamRequest
(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
)
{
SAlterStreamMsg
*
stream
=
(
SAlterStreamMsg
*
)
pCont
;
int32_t
code
=
dnodeCreateStream
(
stream
);
dnodeSend
SimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
dnodeSend
RspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -130,7 +157,7 @@ int32_t dnodeProcessRemoveTableRequest(int8_t *pCont, int32_t contLen, int8_t ms
dPrint
(
"vnode:%d, sid:%d table is not configured, remove it"
,
vnode
,
sid
);
int32_t
code
=
dnodeDropTable
(
vnode
,
sid
,
uid
);
dnodeSend
SimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
dnodeSend
RspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -159,7 +186,7 @@ int32_t dnodeProcessVPeersMsg(int8_t *pCont, int32_t contLen, int8_t msgType, vo
dPrint
(
"vnode:%d, start to config"
,
vnode
);
int32_t
code
=
dnodeCreateVnode
(
vnode
,
vpeer
);
dnodeSend
SimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
dnodeSend
RspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -170,7 +197,7 @@ int32_t dnodeProcessFreeVnodeRequest(int8_t *pCont, int32_t contLen, int8_t msgT
dPrint
(
"vnode:%d, remove it"
,
vnode
);
int32_t
code
=
dnodeDropVnode
(
vnode
);
dnodeSend
SimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
dnodeSend
RspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -178,7 +205,7 @@ int32_t dnodeProcessFreeVnodeRequest(int8_t *pCont, int32_t contLen, int8_t msgT
int32_t
dnodeProcessDnodeCfgRequest
(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
,
void
*
pConn
)
{
SCfgDnodeMsg
*
pCfg
=
(
SCfgDnodeMsg
*
)
pCont
;
int32_t
code
=
tsCfgDynamicOptions
(
pCfg
->
config
);
dnodeSend
SimpleRspToMnode
(
pConn
,
msgType
+
1
,
code
);
dnodeSend
RspToMnode
(
pConn
,
msgType
+
1
,
code
,
NULL
,
0
);
return
code
;
}
...
...
@@ -203,12 +230,12 @@ void dnodeSendMeterCfgMsg(int32_t vnode, int32_t sid) {
}
void
dnodeInitProcessShellMsg
()
{
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_DNODE_CREATE_TABLE
]
=
dnodeProcessCreateTableRequest
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_DNODE_REMOVE_TABLE
]
=
dnodeProcessRemoveTableRequest
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_DNODE_VPEERS
]
=
dnodeProcessVPeersMsg
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_DNODE_FREE_VNODE
]
=
dnodeProcessFreeVnodeRequest
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_DNODE_CFG
]
=
dnodeProcessDnodeCfgRequest
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_ALTER_STREAM
]
=
dnodeProcessAlterStreamRequest
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_VNODE_CFG_RSP
]
=
dnodeProcessVPeerCfgRsp
;
dnodeProcess
Shell
MsgFp
[
TSDB_MSG_TYPE_TABLE_CFG_RSP
]
=
dnodeProcessTableCfgRsp
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_DNODE_CREATE_TABLE
]
=
dnodeProcessCreateTableRequest
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_DNODE_REMOVE_TABLE
]
=
dnodeProcessRemoveTableRequest
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_DNODE_VPEERS
]
=
dnodeProcessVPeersMsg
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_DNODE_FREE_VNODE
]
=
dnodeProcessFreeVnodeRequest
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_DNODE_CFG
]
=
dnodeProcessDnodeCfgRequest
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_ALTER_STREAM
]
=
dnodeProcessAlterStreamRequest
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_VNODE_CFG_RSP
]
=
dnodeProcessVPeerCfgRsp
;
dnodeProcess
Mgmt
MsgFp
[
TSDB_MSG_TYPE_TABLE_CFG_RSP
]
=
dnodeProcessTableCfgRsp
;
}
\ No newline at end of file
src/inc/dnode.h
浏览文件 @
86402cc9
...
...
@@ -44,13 +44,7 @@ extern uint32_t tsRebootTime;
extern
void
(
*
dnodeStartModules
)();
extern
void
(
*
dnodeParseParameterK
)();
extern
int32_t
(
*
dnodeCheckSystem
)();
extern
void
(
*
dnodeInitMgmtIp
)();
extern
int
(
*
dnodeInitMgmt
)();
// dnodeMgmt
void
dnodeProcessMsgFromMgmt
(
int8_t
*
pCont
,
int32_t
contLen
,
int32_t
msgType
,
void
*
pConn
);
extern
int32_t
(
*
dnodeSendMsgToMnode
)(
int8_t
*
pCont
,
int32_t
contLen
,
int8_t
msgType
);
extern
int32_t
(
*
dnodeSendSimpleRspToMnode
)(
void
*
pConn
,
int32_t
msgType
,
int32_t
code
);
// dnodeModule
extern
void
(
*
dnodeStartModules
)();
...
...
src/inc/taosmsg.h
浏览文件 @
86402cc9
...
...
@@ -572,6 +572,11 @@ typedef struct {
SVnodeLoad
load
[];
}
SStatusMsg
;
typedef
struct
{
int32_t
code
;
SRpcIpSet
ipList
;
}
SStatusRsp
;
typedef
struct
{
uint32_t
moduleStatus
;
uint32_t
createdTime
;
...
...
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
86402cc9
...
...
@@ -46,7 +46,7 @@ void mgmtSendMsgToDnodeImpFp(SSchedMsg *sched) {
int8_t
*
pCont
=
sched
->
msg
;
void
*
pConn
=
NULL
;
dnodeProcessMsgFromMgmt
(
pCont
,
contLen
,
msgType
,
pConn
);
dnodeProcessMsgFromMgmt
(
msgType
,
pCont
,
contLen
,
pConn
,
TSDB_CODE_SUCCESS
);
rpcFreeCont
(
sched
->
msg
);
}
...
...
@@ -187,6 +187,7 @@ int mgmtProcessVPeersRsp(int8_t *pCont, int32_t contLen, void *pConn) {
return
0
;
}
void
mgmtProcessMsgFromDnode
(
int8_t
*
pCont
,
int32_t
contLen
,
int32_t
msgType
,
void
*
pConn
)
{
if
(
msgType
==
TSDB_MSG_TYPE_TABLE_CFG
)
{
mgmtProcessMeterCfgMsg
(
pCont
,
contLen
,
pConn
);
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
86402cc9
...
...
@@ -91,7 +91,7 @@ int32_t mgmtInitShell() {
}
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localIp
=
tsAnyIp
?
"0.0.0.0"
:
tsPrivateIp
;
;
rpcInit
.
localIp
=
tsAnyIp
?
"0.0.0.0"
:
tsPrivateIp
;
rpcInit
.
localPort
=
tsMgmtShellPort
;
rpcInit
.
label
=
"MND-shell"
;
rpcInit
.
numOfThreads
=
numOfThreads
;
...
...
src/util/inc/tglobalcfg.h
浏览文件 @
86402cc9
...
...
@@ -58,7 +58,7 @@ extern char osName[];
extern
char
tsMasterIp
[];
extern
char
tsSecondIp
[];
extern
uint16_t
tsMgmt
V
nodePort
;
extern
uint16_t
tsMgmt
D
nodePort
;
extern
uint16_t
tsMgmtShellPort
;
extern
uint16_t
tsVnodeShellPort
;
extern
uint16_t
tsVnodeVnodePort
;
...
...
src/util/src/tglobalcfg.c
浏览文件 @
86402cc9
...
...
@@ -60,7 +60,7 @@ char tsMasterIp[TSDB_IPv4ADDR_LEN] = {0};
char
tsSecondIp
[
TSDB_IPv4ADDR_LEN
]
=
{
0
};
uint16_t
tsMgmtShellPort
=
6030
;
// udp[6030-6034] tcp[6030]
uint16_t
tsVnodeShellPort
=
6035
;
// udp[6035-6039] tcp[6035]
uint16_t
tsMgmt
V
nodePort
=
6040
;
// udp[6040-6044] tcp[6040]
uint16_t
tsMgmt
D
nodePort
=
6040
;
// udp[6040-6044] tcp[6040]
uint16_t
tsVnodeVnodePort
=
6045
;
// tcp[6045]
uint16_t
tsMgmtMgmtPort
=
6050
;
// udp, numOfVnodes fixed to 1, range udp[6050]
uint16_t
tsMgmtSyncPort
=
6050
;
// tcp, range tcp[6050]
...
...
@@ -494,7 +494,7 @@ static void doInitGlobalConfig() {
tsInitConfigOption
(
cfg
++
,
"vnodeShellPort"
,
&
tsVnodeShellPort
,
TSDB_CFG_VTYPE_SHORT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLIENT
,
1
,
65535
,
0
,
TSDB_CFG_UTYPE_NONE
);
tsInitConfigOption
(
cfg
++
,
"mgmtVnodePort"
,
&
tsMgmt
V
nodePort
,
TSDB_CFG_VTYPE_SHORT
,
tsInitConfigOption
(
cfg
++
,
"mgmtVnodePort"
,
&
tsMgmt
D
nodePort
,
TSDB_CFG_VTYPE_SHORT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLUSTER
,
1
,
65535
,
0
,
TSDB_CFG_UTYPE_NONE
);
tsInitConfigOption
(
cfg
++
,
"vnodeVnodePort"
,
&
tsVnodeVnodePort
,
TSDB_CFG_VTYPE_SHORT
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录