Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
148af69b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
148af69b
编写于
3月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
43cf0a99
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
41 deletion
+46
-41
source/dnode/mgmt/container/src/dndNode.c
source/dnode/mgmt/container/src/dndNode.c
+3
-3
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+4
-3
source/dnode/mgmt/dnode/inc/dm.h
source/dnode/mgmt/dnode/inc/dm.h
+6
-4
source/dnode/mgmt/dnode/src/dmInt.c
source/dnode/mgmt/dnode/src/dmInt.c
+6
-12
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+27
-19
未找到文件。
source/dnode/mgmt/container/src/dndNode.c
浏览文件 @
148af69b
...
...
@@ -202,7 +202,7 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) {
}
SMgmtWrapper
*
pWrapper
=
dndGetWrapper
(
pDnode
,
DNODE
);
if
(
dmStart
(
pWrapper
)
!=
0
)
{
if
(
dmStart
(
pWrapper
->
pMgmt
)
!=
0
)
{
dError
(
"failed to start dnode worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -372,7 +372,7 @@ static int32_t dndBuildMsg(SNodeMsg *pMsg, SRpcMsg *pRpc, SEpSet *pEpSet) {
void
dndProcessRpcMsg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
if
(
pEpSet
&&
pEpSet
->
numOfEps
>
0
&&
pRpc
->
msgType
==
TDMT_MND_STATUS_RSP
)
{
dmUpdateMnodeEpSet
(
dndGetWrapper
(
pWrapper
->
pDnode
,
DNODE
),
pEpSet
);
dmUpdateMnodeEpSet
(
dndGetWrapper
(
pWrapper
->
pDnode
,
DNODE
)
->
pMgmt
,
pEpSet
);
}
int32_t
code
=
-
1
;
...
...
@@ -396,7 +396,7 @@ void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpSet) {
dTrace
(
"msg:%p, is created, app:%p user:%s"
,
pMsg
,
pRpc
->
ahandle
,
pMsg
->
user
);
if
(
pWrapper
->
procType
==
PROC_SINGLE
)
{
code
=
(
*
msgFp
)(
pWrapper
,
pMsg
);
code
=
(
*
msgFp
)(
pWrapper
->
pMgmt
,
pMsg
);
}
else
if
(
pWrapper
->
procType
==
PROC_PARENT
)
{
code
=
taosProcPutToChildQueue
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SNodeMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
);
}
else
{
...
...
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
148af69b
...
...
@@ -131,7 +131,7 @@ static void dndSendMsgToMnodeRecv(SDnode *pDnode, SRpcMsg *pRpcMsg, SRpcMsg *pRp
STransMgmt
*
pMgmt
=
&
pDnode
->
trans
;
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
dndGetWrapper
(
pDnode
,
DNODE
),
&
epSet
);
dmGetMnodeEpSet
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
&
epSet
);
rpcSendRecv
(
pMgmt
->
clientRpc
,
&
epSet
,
pRpcMsg
,
pRpcRsp
);
}
...
...
@@ -297,14 +297,15 @@ int32_t dndSendReqToMnode(void *wrapper, SRpcMsg *pReq) {
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
STransMgmt
*
pTrans
=
&
pDnode
->
trans
;
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
dndGetWrapper
(
pDnode
,
DNODE
),
&
epSet
);
dmGetMnodeEpSet
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
&
epSet
);
return
dndSendRpcReq
(
pTrans
,
&
epSet
,
pReq
);
}
}
void
dndSendRpcRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
)
{
if
(
pRsp
->
code
==
TSDB_CODE_DND_MNODE_NOT_DEPLOYED
||
pRsp
->
code
==
TSDB_CODE_APP_NOT_READY
)
{
dmSendRedirectRsp
(
dndGetWrapper
(
pWrapper
->
pDnode
,
DNODE
),
pRsp
);
SMgmtWrapper
*
pDnodeWrapper
=
dndGetWrapper
(
pWrapper
->
pDnode
,
DNODE
);
dmSendRedirectRsp
(
pDnodeWrapper
->
pMgmt
,
pRsp
);
}
else
{
rpcSendResponse
(
pRsp
);
}
...
...
source/dnode/mgmt/dnode/inc/dm.h
浏览文件 @
148af69b
...
...
@@ -22,13 +22,15 @@
extern
"C"
{
#endif
typedef
struct
SDnodeMgmt
SDnodeMgmt
;
void
dmGetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
dmInitMsgHandles
(
SMgmtWrapper
*
pWrapper
);
void
dmGetMnodeEpSet
(
S
MgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
S
MgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
S
MgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dmStart
(
S
MgmtWrapper
*
pWrapper
);
void
dmGetMnodeEpSet
(
S
DnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmUpdateMnodeEpSet
(
S
DnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
S
DnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmStart
(
S
DnodeMgmt
*
pMgmt
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/src/dmInt.c
浏览文件 @
148af69b
...
...
@@ -16,19 +16,16 @@
#define _DEFAULT_SOURCE
#include "dmInt.h"
void
dmGetMnodeEpSet
(
SMgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
void
dmGetMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
)
{
taosRLockLatch
(
&
pMgmt
->
latch
);
*
pEpSet
=
pMgmt
->
mnodeEpSet
;
taosRUnLockLatch
(
&
pMgmt
->
latch
);
}
void
dmUpdateMnodeEpSet
(
S
MgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
)
{
void
dmUpdateMnodeEpSet
(
S
DnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
)
{
dInfo
(
"mnode is changed, num:%d use:%d"
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
);
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
taosWLockLatch
(
&
pMgmt
->
latch
);
pMgmt
->
mnodeEpSet
=
*
pEpSet
;
for
(
int32_t
i
=
0
;
i
<
pEpSet
->
numOfEps
;
++
i
)
{
dInfo
(
"mnode index:%d %s:%u"
,
i
,
pEpSet
->
eps
[
i
].
fqdn
,
pEpSet
->
eps
[
i
].
port
);
...
...
@@ -57,11 +54,11 @@ void dmGetDnodeEp(SMgmtWrapper *pWrapper, int32_t dnodeId, char *pEp, char *pFqd
taosRUnLockLatch
(
&
pMgmt
->
latch
);
}
void
dmSendRedirectRsp
(
S
MgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
)
{
SDnode
*
pDnode
=
p
Wrapper
->
pDnode
;
void
dmSendRedirectRsp
(
S
DnodeMgmt
*
pMgmt
,
SRpcMsg
*
pReq
)
{
SDnode
*
pDnode
=
p
Mgmt
->
pDnode
;
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
p
Wrapper
,
&
epSet
);
dmGetMnodeEpSet
(
p
Mgmt
,
&
epSet
);
dDebug
(
"RPC %p, req is redirected, num:%d use:%d"
,
pReq
->
handle
,
epSet
.
numOfEps
,
epSet
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
.
numOfEps
;
++
i
)
{
...
...
@@ -76,10 +73,7 @@ void dmSendRedirectRsp(SMgmtWrapper *pWrapper, SRpcMsg *pReq) {
rpcSendRedirectRsp
(
pReq
->
handle
,
&
epSet
);
}
int32_t
dmStart
(
SMgmtWrapper
*
pWrapper
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
return
dmStartWorker
(
pMgmt
);
}
int32_t
dmStart
(
SDnodeMgmt
*
pMgmt
)
{
return
dmStartWorker
(
pMgmt
);
}
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
148af69b
...
...
@@ -52,47 +52,57 @@ static void *dmThreadRoutine(void *param) {
}
}
static
void
dmProcessQueue
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
static
void
dmProcessQueue
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
SDnode
*
pDnode
=
pMgmt
->
pDnode
;
SMgmtWrapper
*
pWrapper
=
NULL
;
dTrace
(
"msg:%p, will be processed"
,
pMsg
);
switch
(
msgType
)
{
case
TDMT_DND_CREATE_MNODE
:
code
=
mmProcessCreateReq
(
dndGetWrapper
(
pDnode
,
MNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
MNODE
);
code
=
mmProcessCreateReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_DROP_MNODE
:
code
=
mmProcessDropReq
(
dndGetWrapper
(
pDnode
,
MNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
MNODE
);
code
=
mmProcessDropReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_CREATE_QNODE
:
code
=
qmProcessCreateReq
(
dndGetWrapper
(
pDnode
,
QNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
QNODE
);
code
=
qmProcessCreateReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_DROP_QNODE
:
code
=
qmProcessDropReq
(
dndGetWrapper
(
pDnode
,
QNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
QNODE
);
code
=
qmProcessDropReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_CREATE_SNODE
:
code
=
smProcessCreateReq
(
dndGetWrapper
(
pDnode
,
SNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
SNODE
);
code
=
smProcessCreateReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_DROP_SNODE
:
code
=
smProcessDropReq
(
dndGetWrapper
(
pDnode
,
SNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
SNODE
);
code
=
smProcessDropReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_CREATE_BNODE
:
code
=
bmProcessCreateReq
(
dndGetWrapper
(
pDnode
,
BNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
BNODE
);
code
=
bmProcessCreateReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_DROP_BNODE
:
code
=
bmProcessDropReq
(
dndGetWrapper
(
pDnode
,
BNODE
)
->
pMgmt
,
pMsg
);
pWrapper
=
dndGetWrapper
(
pDnode
,
BNODE
);
code
=
bmProcessDropReq
(
pWrapper
->
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_CONFIG_DNODE
:
code
=
dmProcessConfigReq
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
pMsg
);
code
=
dmProcessConfigReq
(
pMgmt
,
pMsg
);
break
;
case
TDMT_MND_STATUS_RSP
:
code
=
dmProcessStatusRsp
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
pMsg
);
code
=
dmProcessStatusRsp
(
pMgmt
,
pMsg
);
break
;
case
TDMT_MND_AUTH_RSP
:
code
=
dmProcessAuthRsp
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
pMsg
);
code
=
dmProcessAuthRsp
(
pMgmt
,
pMsg
);
break
;
case
TDMT_MND_GRANT_RSP
:
code
=
dmProcessGrantRsp
(
dndGetWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
pMsg
);
code
=
dmProcessGrantRsp
(
pMgmt
,
pMsg
);
break
;
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
...
...
@@ -114,14 +124,12 @@ static void dmProcessQueue(SDnode *pDnode, SNodeMsg *pMsg) {
}
int32_t
dmStartWorker
(
SDnodeMgmt
*
pMgmt
)
{
SDnode
*
pDnode
=
pMgmt
->
pDnode
;
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
mgmtWorker
,
DND_WORKER_SINGLE
,
"dnode-mgmt"
,
1
,
1
,
dmProcessQueue
)
!=
0
)
{
if
(
dndInitWorker
(
pMgmt
,
&
pMgmt
->
mgmtWorker
,
DND_WORKER_SINGLE
,
"dnode-mgmt"
,
1
,
1
,
dmProcessQueue
)
!=
0
)
{
dError
(
"failed to start dnode mgmt worker since %s"
,
terrstr
());
return
-
1
;
}
if
(
dndInitWorker
(
p
Dnode
,
&
pMgmt
->
statusWorker
,
DND_WORKER_SINGLE
,
"dnode-status"
,
1
,
1
,
dmProcessQueue
)
!=
0
)
{
if
(
dndInitWorker
(
p
Mgmt
,
&
pMgmt
->
statusWorker
,
DND_WORKER_SINGLE
,
"dnode-status"
,
1
,
1
,
dmProcessQueue
)
!=
0
)
{
dError
(
"failed to start dnode mgmt worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录