Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b765f21e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
b765f21e
编写于
5月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: adjust SRpcMsg
上级
7729ce2e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
33 addition
and
50 deletion
+33
-50
include/common/tmsgcb.h
include/common/tmsgcb.h
+1
-3
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+2
-14
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+4
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+4
-30
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+2
-0
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+18
-0
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+2
-2
未找到文件。
include/common/tmsgcb.h
浏览文件 @
b765f21e
...
...
@@ -42,8 +42,7 @@ typedef int32_t (*GetQueueSizeFp)(void *pMgmt, int32_t vgId, EQueueType qtype);
typedef
int32_t
(
*
SendReqFp
)(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
epSet
,
SRpcMsg
*
pReq
);
typedef
int32_t
(
*
SendMnodeReqFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
);
typedef
void
(
*
SendRspFp
)(
const
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendMnodeRecvFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendRedirectRspFp
)(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
);
typedef
void
(
*
SendRedirectRspFp
)(
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
);
typedef
void
(
*
RegisterBrokenLinkArgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
typedef
void
(
*
ReleaseHandleFp
)(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
);
typedef
void
(
*
ReportStartup
)(
SMgmtWrapper
*
pWrapper
,
const
char
*
name
,
const
char
*
desc
);
...
...
@@ -56,7 +55,6 @@ typedef struct {
GetQueueSizeFp
qsizeFp
;
SendReqFp
sendReqFp
;
SendRspFp
sendRspFp
;
SendMnodeRecvFp
sendMnodeRecvFp
;
SendRedirectRspFp
sendRedirectRspFp
;
RegisterBrokenLinkArgFp
registerBrokenLinkArgFp
;
ReleaseHandleFp
releaseHandleFp
;
...
...
source/common/src/tmsgcb.c
浏览文件 @
b765f21e
...
...
@@ -46,21 +46,9 @@ void tmsgSendRsp(SRpcMsg* pRsp) {
}
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
)
{
// cannot be empty, but not checked for faster detect
SendRedirectRspFp
fp
=
tsDefaultMsgCb
.
sendRedirectRspFp
;
if
(
fp
!=
NULL
)
{
(
*
fp
)(
tsDefaultMsgCb
.
pWrapper
,
pRsp
,
pNewEpSet
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
}
}
void
tmsgSendMnodeRecv
(
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
)
{
SendMnodeRecvFp
fp
=
tsDefaultMsgCb
.
sendMnodeRecvFp
;
if
(
fp
!=
NULL
)
{
(
*
fp
)(
tsDefaultMsgCb
.
pWrapper
,
pReq
,
pRsp
);
}
else
{
terrno
=
TSDB_CODE_INVALID_PTR
;
}
(
*
fp
)(
pRsp
,
pNewEpSet
);
}
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
)
{
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
b765f21e
...
...
@@ -87,7 +87,10 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SRpcMsg
rpcRsp
=
{
0
};
dTrace
(
"send status msg to mnode, app:%p"
,
rpcMsg
.
info
.
ahandle
);
tmsgSendMnodeRecv
(
&
rpcMsg
,
&
rpcRsp
);
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pMgmt
->
pData
,
&
epSet
);
rpcSendRecv
(
pMgmt
->
msgCb
.
clientRpc
,
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
dmProcessStatusRsp
(
pMgmt
,
&
rpcRsp
);
}
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
b765f21e
...
...
@@ -21,26 +21,6 @@
#define INTERNAL_CKEY "_key"
#define INTERNAL_SECRET "_pwd"
static
void
dmGetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
)
{
SDnodeData
*
pData
=
&
pDnode
->
data
;
taosRLockLatch
(
&
pData
->
latch
);
*
pEpSet
=
pData
->
mnodeEps
;
taosRUnLockLatch
(
&
pData
->
latch
);
}
static
void
dmSetMnodeEpSet
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
)
{
dInfo
(
"mnode is changed, num:%d use:%d"
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
);
SDnodeData
*
pData
=
&
pDnode
->
data
;
taosWLockLatch
(
&
pData
->
latch
);
pData
->
mnodeEps
=
*
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
);
}
taosWUnLockLatch
(
&
pData
->
latch
);
}
static
inline
int32_t
dmBuildNodeMsg
(
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
(
IsReq
(
pRpc
)
&&
rpcGetConnInfo
(
pRpc
->
info
.
handle
,
&
connInfo
)
!=
0
)
{
...
...
@@ -214,7 +194,7 @@ int32_t dmInitMsgHandle(SDnode *pDnode) {
static
void
dmSendRpcRedirectRsp
(
SDnode
*
pDnode
,
const
SRpcMsg
*
pReq
)
{
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pDnode
,
&
epSet
);
dmGetMnodeEpSet
(
&
pDnode
->
data
,
&
epSet
);
dDebug
(
"RPC %p, req is redirected, num:%d use:%d"
,
pReq
->
info
.
handle
,
epSet
.
numOfEps
,
epSet
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
.
numOfEps
;
++
i
)
{
...
...
@@ -257,12 +237,6 @@ static inline void dmSendRecv(SDnode *pDnode, SEpSet *pEpSet, SRpcMsg *pReq, SRp
}
}
static
inline
void
dmSendToMnodeRecv
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
)
{
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
pWrapper
->
pDnode
,
&
epSet
);
dmSendRecv
(
pWrapper
->
pDnode
,
&
epSet
,
pReq
,
pRsp
);
}
static
inline
int32_t
dmSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
if
(
pDnode
->
status
!=
DND_STAT_RUNNING
||
pDnode
->
trans
.
clientRpc
==
NULL
)
{
...
...
@@ -286,7 +260,8 @@ static inline void dmSendRsp(const SRpcMsg *pRsp) {
}
}
static
inline
void
dmSendRedirectRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
)
{
static
inline
void
dmSendRedirectRsp
(
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
)
{
SMgmtWrapper
*
pWrapper
=
pRsp
->
info
.
wrapper
;
if
(
InChildProc
(
pWrapper
->
proc
.
ptype
))
{
dmPutToProcPQueue
(
&
pWrapper
->
proc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
DND_FUNC_RSP
);
}
else
{
...
...
@@ -407,7 +382,7 @@ static inline int32_t dmRetrieveUserAuthInfo(SDnode *pDnode, char *user, char *s
SRpcMsg
rpcRsp
=
{
0
};
SEpSet
epSet
=
{
0
};
dTrace
(
"user:%s, send user auth req to other mnodes, spi:%d encrypt:%d"
,
user
,
authReq
.
spi
,
authReq
.
encrypt
);
dmGetMnodeEpSet
(
pDnode
,
&
epSet
);
dmGetMnodeEpSet
(
&
pDnode
->
data
,
&
epSet
);
dmSendRecv
(
pDnode
,
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
)
{
...
...
@@ -469,7 +444,6 @@ SMsgCb dmGetMsgcb(SMgmtWrapper *pWrapper) {
.
clientRpc
=
pWrapper
->
pDnode
->
trans
.
clientRpc
,
.
sendReqFp
=
dmSendReq
,
.
sendRspFp
=
dmSendRsp
,
.
sendMnodeRecvFp
=
dmSendToMnodeRecv
,
.
sendRedirectRspFp
=
dmSendRedirectRsp
,
.
registerBrokenLinkArgFp
=
dmRegisterBrokenLinkArg
,
.
releaseHandleFp
=
dmReleaseHandle
,
...
...
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
b765f21e
...
...
@@ -179,6 +179,8 @@ int32_t dmWriteShmFile(const char *path, const char *name, const SShm *pShm);
int32_t
dmReadEps
(
SDnodeData
*
pData
);
int32_t
dmWriteEps
(
SDnodeData
*
pData
);
void
dmUpdateEps
(
SDnodeData
*
pData
,
SArray
*
pDnodeEps
);
void
dmGetMnodeEpSet
(
SDnodeData
*
pData
,
SEpSet
*
pEpSet
);
void
dmSetMnodeEpSet
(
SDnodeData
*
pData
,
SEpSet
*
pEpSet
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
b765f21e
...
...
@@ -307,3 +307,21 @@ static bool dmIsEpChanged(SDnodeData *pData, int32_t dnodeId, const char *ep) {
taosRUnLockLatch
(
&
pData
->
latch
);
return
changed
;
}
void
dmGetMnodeEpSet
(
SDnodeData
*
pData
,
SEpSet
*
pEpSet
)
{
taosRLockLatch
(
&
pData
->
latch
);
*
pEpSet
=
pData
->
mnodeEps
;
taosRUnLockLatch
(
&
pData
->
latch
);
}
void
dmSetMnodeEpSet
(
SDnodeData
*
pData
,
SEpSet
*
pEpSet
)
{
dInfo
(
"mnode is changed, num:%d use:%d"
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
);
taosWLockLatch
(
&
pData
->
latch
);
pData
->
mnodeEps
=
*
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
);
}
taosWUnLockLatch
(
&
pData
->
latch
);
}
source/libs/transport/src/transSrv.c
浏览文件 @
b765f21e
...
...
@@ -440,9 +440,9 @@ static void uvPrepareSendData(SSrvMsg* smsg, uv_buf_t* wb) {
char
*
msg
=
(
char
*
)
pHead
;
int32_t
len
=
transMsgLenFromCont
(
pMsg
->
contLen
);
tDebug
(
"server conn %p %s is sent to %s:%d, local info: %s:%d"
,
pConn
,
TMSG_INFO
(
pHead
->
msgType
),
tDebug
(
"server conn %p %s is sent to %s:%d, local info: %s:%d
msglen:%d
"
,
pConn
,
TMSG_INFO
(
pHead
->
msgType
),
taosInetNtoa
(
pConn
->
addr
.
sin_addr
),
ntohs
(
pConn
->
addr
.
sin_port
),
taosInetNtoa
(
pConn
->
locaddr
.
sin_addr
),
ntohs
(
pConn
->
locaddr
.
sin_port
));
ntohs
(
pConn
->
locaddr
.
sin_port
)
,
len
);
pHead
->
msgLen
=
htonl
(
len
);
wb
->
base
=
msg
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录