Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
143a3113
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
143a3113
编写于
3月 15, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
bd660a5b
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
88 addition
and
45 deletion
+88
-45
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+0
-1
source/dnode/mgmt/container/inc/dndInt.h
source/dnode/mgmt/container/inc/dndInt.h
+3
-5
source/dnode/mgmt/container/src/dndInt.c
source/dnode/mgmt/container/src/dndInt.c
+1
-5
source/dnode/mgmt/container/src/dndNode.c
source/dnode/mgmt/container/src/dndNode.c
+59
-2
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+8
-8
source/dnode/mgmt/dnode/inc/dmWorker.h
source/dnode/mgmt/dnode/inc/dmWorker.h
+1
-1
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+2
-9
source/dnode/mgmt/mnode/inc/mmWorker.h
source/dnode/mgmt/mnode/inc/mmWorker.h
+3
-3
source/dnode/mgmt/mnode/src/mmWorker.c
source/dnode/mgmt/mnode/src/mmWorker.c
+3
-3
source/dnode/mgmt/vnode/inc/vmWorker.h
source/dnode/mgmt/vnode/inc/vmWorker.h
+4
-4
source/dnode/mgmt/vnode/src/vmWorker.c
source/dnode/mgmt/vnode/src/vmWorker.c
+4
-4
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
143a3113
...
...
@@ -49,7 +49,6 @@ typedef struct SRpcMsg {
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
SRpcMsg
rpcMsg
;
SEpSet
rpcEpSet
;
int32_t
rspLen
;
void
*
pRsp
;
}
SNodeMsg
;
...
...
source/dnode/mgmt/container/inc/dndInt.h
浏览文件 @
143a3113
...
...
@@ -72,15 +72,13 @@ typedef struct SQnodeMgmt SQnodeMgmt;
typedef
struct
SSnodeMgmt
SSnodeMgmt
;
typedef
struct
SBnodeMgmt
SBnodeMgmt
;
typedef
void
(
*
RpcMsgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEps
);
typedef
void
(
*
NodeMsgFp
)(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
NodeMsgFp
)(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
typedef
int32_t
(
*
OpenNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
void
(
*
CloseNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
bool
(
*
RequireNodeFp
)(
SMgmtWrapper
*
pWrapper
);
typedef
struct
SMsgHandle
{
RpcMsgFp
rpcMsgFp
;
NodeMsgFp
nodeMsgFp
;
NodeMsgFp
msgFp
;
SMgmtWrapper
*
pWrapper
;
}
SMsgHandle
;
...
...
@@ -98,7 +96,7 @@ typedef struct SMgmtWrapper {
SProcObj
*
pProc
;
void
*
pMgmt
;
SDnode
*
pDnode
;
SMsgHandle
msgHandle
s
[
TDMT_MAX
];
NodeMsgFp
msgFp
s
[
TDMT_MAX
];
SMgmtFp
fp
;
}
SMgmtWrapper
;
...
...
source/dnode/mgmt/container/src/dndInt.c
浏览文件 @
143a3113
...
...
@@ -65,11 +65,7 @@ void dndCleanup() {
SMgmtWrapper
*
dndGetWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
)
{
return
&
pDnode
->
wrappers
[
nodeType
];
}
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgType
,
NodeMsgFp
nodeMsgFp
)
{
SMsgHandle
*
pHandle
=
&
pWrapper
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
pHandle
->
pWrapper
=
pWrapper
;
pHandle
->
nodeMsgFp
=
nodeMsgFp
;
pHandle
->
rpcMsgFp
=
dndProcessRpcMsg
;
pWrapper
->
msgFps
[
TMSG_INDEX
(
msgType
)]
=
nodeMsgFp
;
}
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
)
{
return
pDnode
->
status
;
}
...
...
source/dnode/mgmt/container/src/dndNode.c
浏览文件 @
143a3113
...
...
@@ -257,8 +257,65 @@ void dndeHandleEvent(SDnode *pDnode, EDndEvent event) {
pDnode
->
event
=
event
;
}
void
dndProcessRpcMsg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
if
(
pEpSet
&&
pEpSet
->
numOfEps
>
0
&&
pMsg
->
msgType
==
TDMT_MND_STATUS_RSP
)
{
static
int32_t
dndBuildMsg
(
SNodeMsg
*
pMsg
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
((
pRpc
->
msgType
&
1U
)
&&
rpcGetConnInfo
(
pRpc
->
handle
,
&
connInfo
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
dError
(
"failed to build msg since %s, app:%p RPC:%p"
,
terrstr
(),
pRpc
->
ahandle
,
pRpc
->
handle
);
return
-
1
;
}
memcpy
(
pMsg
->
user
,
connInfo
.
user
,
TSDB_USER_LEN
);
pMsg
->
rpcMsg
=
*
pRpc
;
return
0
;
}
static
void
dndSendRpcRsp
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
)
{
if
(
pRpc
->
code
==
TSDB_CODE_APP_NOT_READY
)
{
dmSendRedirectRsp
(
pDnode
,
pRpc
);
}
else
{
rpcSendResponse
(
pRpc
);
}
}
void
dndProcessRpcMsg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
if
(
pEpSet
&&
pEpSet
->
numOfEps
>
0
&&
pRpc
->
msgType
==
TDMT_MND_STATUS_RSP
)
{
dmUpdateMnodeEpSet
(
pWrapper
->
pDnode
,
pEpSet
);
}
int32_t
code
=
-
1
;
SNodeMsg
*
pMsg
=
NULL
;
NodeMsgFp
msgFp
=
pWrapper
->
msgFps
[
TMSG_INDEX
(
pRpc
->
msgType
)];
if
(
msgFp
==
NULL
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
goto
_OVER
;
}
pMsg
=
taosAllocateQitem
(
sizeof
(
SNodeMsg
));
if
(
pMsg
==
NULL
)
{
goto
_OVER
;
}
if
(
dndBuildMsg
(
pMsg
,
pRpc
,
pEpSet
)
!=
0
)
{
goto
_OVER
;
}
dTrace
(
"msg:%p, is created, app:%p RPC:%p user:%s, processd by %s"
,
pMsg
,
pRpc
->
ahandle
,
pRpc
->
handle
,
pMsg
->
user
,
pWrapper
->
name
);
code
=
(
*
msgFp
)(
pWrapper
,
pMsg
);
_OVER:
if
(
code
!=
0
)
{
bool
isReq
=
(
pRpc
->
msgType
&
1U
);
if
(
isReq
)
{
SRpcMsg
rsp
=
{.
handle
=
pRpc
->
handle
,
.
ahandle
=
pRpc
->
ahandle
,
.
code
=
terrno
};
dndSendRpcRsp
(
pWrapper
->
pDnode
,
&
rsp
);
}
dTrace
(
"msg:%p, is freed"
,
pMsg
);
taosFreeQitem
(
pMsg
);
rpcFreeCont
(
pRpc
->
pCont
);
}
}
\ No newline at end of file
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
143a3113
...
...
@@ -36,10 +36,10 @@ static void dndProcessResponse(void *parent, SRpcMsg *pRsp, SEpSet *pEpSet) {
}
SMsgHandle
*
pHandle
=
&
pMgmt
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
if
(
pHandle
->
rpcM
sgFp
!=
NULL
)
{
if
(
pHandle
->
m
sgFp
!=
NULL
)
{
dTrace
(
"RPC %p, rsp:%s will be processed by %s, code:0x%x app:%p"
,
pRsp
->
handle
,
TMSG_INFO
(
msgType
),
pHandle
->
pWrapper
->
name
,
pRsp
->
code
&
0XFFFF
,
pRsp
->
ahandle
);
(
*
pHandle
->
rpcMsgFp
)
(
pHandle
->
pWrapper
,
pRsp
,
pEpSet
);
dndProcessRpcMsg
(
pHandle
->
pWrapper
,
pRsp
,
pEpSet
);
}
else
{
dError
(
"RPC %p, rsp:%s not processed, app:%p"
,
pRsp
->
handle
,
TMSG_INFO
(
msgType
),
pRsp
->
ahandle
);
rpcFreeCont
(
pRsp
->
pCont
);
...
...
@@ -118,10 +118,10 @@ static void dndProcessRequest(void *param, SRpcMsg *pReq, SEpSet *pEpSet) {
}
SMsgHandle
*
pHandle
=
&
pMgmt
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
if
(
pHandle
->
rpcM
sgFp
!=
NULL
)
{
if
(
pHandle
->
m
sgFp
!=
NULL
)
{
dTrace
(
"RPC %p, req:%s will be processed by %s, app:%p"
,
pReq
->
handle
,
TMSG_INFO
(
msgType
),
pHandle
->
pWrapper
->
name
,
pReq
->
ahandle
);
(
*
pHandle
->
rpcMsgFp
)
(
pHandle
->
pWrapper
,
pReq
,
pEpSet
);
dndProcessRpcMsg
(
pHandle
->
pWrapper
,
pReq
,
pEpSet
);
}
else
{
dError
(
"RPC %p, req:%s not processed since no handle, app:%p"
,
pReq
->
handle
,
TMSG_INFO
(
msgType
),
pReq
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
pReq
->
handle
,
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
,
.
ahandle
=
pReq
->
ahandle
};
...
...
@@ -253,17 +253,17 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
nodeType
];
for
(
int32_t
msgIndex
=
0
;
msgIndex
<
TDMT_MAX
;
++
msgIndex
)
{
SMsgHandle
msgHandle
=
pWrapper
->
msgHandle
s
[
msgIndex
];
if
(
msg
Handle
.
rpcMsg
Fp
==
NULL
)
continue
;
NodeMsgFp
msgFp
=
pWrapper
->
msgFp
s
[
msgIndex
];
if
(
msgFp
==
NULL
)
continue
;
SMsgHandle
*
pHandle
=
&
pMgmt
->
msgHandles
[
msgIndex
];
if
(
pHandle
->
rpcM
sgFp
!=
NULL
)
{
if
(
pHandle
->
m
sgFp
!=
NULL
)
{
dError
(
"msg:%s, has multiple process nodes, prev node:%s, curr node:%s"
,
tMsgInfo
[
msgIndex
],
pHandle
->
pWrapper
->
name
,
pWrapper
->
name
);
return
-
1
;
}
else
{
dDebug
(
"msg:%s, will be processed by node:%s"
,
tMsgInfo
[
msgIndex
],
pWrapper
->
name
);
*
pHandle
=
msgHandle
;
pHandle
->
msgFp
=
msgFp
;
}
}
}
...
...
source/dnode/mgmt/dnode/inc/dmWorker.h
浏览文件 @
143a3113
...
...
@@ -24,7 +24,7 @@ extern "C" {
int32_t
dmStartWorker
();
void
dmStopWorker
();
void
dmProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
143a3113
...
...
@@ -161,7 +161,7 @@ void dmStopWorker(SDnodeMgmt *pMgmt) {
}
}
void
dmProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
dmProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SDnodeWorker
*
pWorker
=
&
pMgmt
->
mgmtWorker
;
...
...
@@ -169,12 +169,5 @@ void dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
pWorker
=
&
pMgmt
->
statusWorker
;
}
if
(
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
sizeof
(
SNodeMsg
))
!=
0
)
{
if
(
pMsg
->
rpcMsg
.
msgType
&
1u
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
code
=
TSDB_CODE_OUT_OF_MEMORY
};
rpcSendResponse
(
&
rsp
);
}
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
taosFreeQitem
(
pMsg
);
}
return
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
sizeof
(
SNodeMsg
));
}
\ No newline at end of file
source/dnode/mgmt/mnode/inc/mmWorker.h
浏览文件 @
143a3113
...
...
@@ -31,9 +31,9 @@ int32_t mmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg);
void
mmConsumeChildQueue
(
SDnode
*
pDnode
,
SMndMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
void
mmConsumeParentQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
void
mmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
void
mmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
void
mmProcessReadMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessReadMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/mnode/src/mmWorker.c
浏览文件 @
143a3113
...
...
@@ -268,6 +268,6 @@ static void mmConsumeMsgQueue(SDnode *pDnode, SMndMsg *pMsg) {
#endif
void
mmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{}
void
mmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{}
void
mmProcessReadMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{}
\ No newline at end of file
int32_t
mmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
return
0
;}
int32_t
mmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
return
0
;}
int32_t
mmProcessReadMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
return
0
;}
\ No newline at end of file
source/dnode/mgmt/vnode/inc/vmWorker.h
浏览文件 @
143a3113
...
...
@@ -31,10 +31,10 @@ int32_t vmPutMsgToReadQueue(SDnode *pDnode, SRpcMsg *pRpcMsg);
void
vmConsumeChildQueue
(
SDnode
*
pDnode
,
SMndMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
void
vmConsumeParentQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
);
void
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
void
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
void
vmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
void
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/vnode/src/vmWorker.c
浏览文件 @
143a3113
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "vmWorker.h"
void
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
void
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
void
vmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
void
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){}
\ No newline at end of file
int32_t
vmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){
return
0
;}
int32_t
vmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){
return
0
;}
int32_t
vmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){
return
0
;}
int32_t
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
){
return
0
;}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录