Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f9c67813
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
f9c67813
编写于
3月 11, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
7912d662
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
53 deletion
+46
-53
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+0
-9
source/dnode/mgmt/impl/inc/dndEnv.h
source/dnode/mgmt/impl/inc/dndEnv.h
+1
-0
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
+2
-1
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
+43
-21
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+0
-22
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
f9c67813
...
...
@@ -116,15 +116,6 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
*/
int32_t
mndRetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
/**
* @brief Initialize mnode msg.
*
* @param pMnode The mnode object.
* @param pMsg The request rpc msg.
* @return int32_t The created mnode msg.
*/
int32_t
mndBuildMsg
(
SMnodeMsg
*
pMnodeMsg
,
SRpcMsg
*
pRpcMsg
);
/**
* @brief Cleanup mnode msg.
*
...
...
source/dnode/mgmt/impl/inc/dndEnv.h
浏览文件 @
f9c67813
...
...
@@ -82,6 +82,7 @@ typedef struct {
SProcObj
*
pProcess
;
bool
singleProc
;
bool
isChild
;
bool
testFlag
;
}
SMnodeMgmt
;
typedef
struct
{
...
...
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
浏览文件 @
f9c67813
...
...
@@ -117,8 +117,9 @@ void mmRelease(SDnode *pDnode, SMnode *pMnode) {
int32_t
mmOpen
(
SDnode
*
pDnode
,
SMnodeOpt
*
pOption
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
pMgmt
->
singleProc
=
tru
e
;
pMgmt
->
singleProc
=
fals
e
;
pMgmt
->
isChild
=
false
;
pMgmt
->
testFlag
=
true
;
int32_t
code
=
mmOpenImp
(
pDnode
,
pOption
);
...
...
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
浏览文件 @
f9c67813
...
...
@@ -20,11 +20,11 @@
#include "dndTransport.h"
#include "dndWorker.h"
static
int32_t
mmProcessWriteMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
);
static
int32_t
mmProcessSyncMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
);
static
int32_t
mmProcessReadMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
);
static
int32_t
mmPutMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SMnodeMsg
*
pM
nodeM
sg
);
static
int32_t
mmPutRpcMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
p
Rpc
Msg
);
static
int32_t
mmProcessWriteMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
static
int32_t
mmProcessSyncMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
static
int32_t
mmProcessReadMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
static
int32_t
mmPutMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SMnodeMsg
*
pMsg
);
static
int32_t
mmPutRpcMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
pMsg
);
static
void
mmConsumeQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
int32_t
mmStartWorker
(
SDnode
*
pDnode
)
{
...
...
@@ -139,54 +139,76 @@ void mmInitMsgFp(SMnodeMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_DROP_STB_RSP
)]
=
mmProcessWriteMsg
;
}
void
mmProcessRpcMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
,
SEpSet
*
pEpSet
)
{
static
int32_t
mndBuildMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
((
pRpc
->
msgType
&
1U
)
&&
rpcGetConnInfo
(
pRpc
->
handle
,
&
connInfo
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
dError
(
"failed to create 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
;
pMsg
->
createdTime
=
taosGetTimestampSec
();
char
*
pCont
=
(
char
*
)
pMsg
+
sizeof
(
SMnodeMsg
);
memcpy
(
pCont
,
pRpc
->
pCont
,
pRpc
->
contLen
);
pMsg
->
rpcMsg
=
*
pRpc
;
pMsg
->
rpcMsg
.
pCont
=
pCont
;
pMsg
->
createdTime
=
taosGetTimestampSec
();
dTrace
(
"msg:%p, is created, app:%p RPC:%p user:%s"
,
pMsg
,
pRpc
->
ahandle
,
pRpc
->
handle
,
pMsg
->
user
);
return
0
;
}
void
mmProcessRpcMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
,
SEpSet
*
pEpSet
)
{
SMnodeMgmt
*
pMgmt
=
&
pDnode
->
mmgmt
;
int32_t
code
=
-
1
;
SMnodeMsg
*
pM
nodeM
sg
=
NULL
;
SMnodeMsg
*
pMsg
=
NULL
;
MndMsgFp
msgFp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
pRpc
Msg
->
msgType
)];
MndMsgFp
msgFp
=
pMgmt
->
msgFp
[
TMSG_INDEX
(
pRpc
->
msgType
)];
if
(
msgFp
==
NULL
)
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
goto
_OVER
;
}
int32_t
contLen
=
sizeof
(
SMnodeMsg
)
+
pRpc
Msg
->
contLen
;
pM
nodeM
sg
=
taosAllocateQitem
(
contLen
);
if
(
pM
nodeM
sg
==
NULL
)
{
int32_t
contLen
=
sizeof
(
SMnodeMsg
)
+
pRpc
->
contLen
;
pMsg
=
taosAllocateQitem
(
contLen
);
if
(
pMsg
==
NULL
)
{
goto
_OVER
;
}
if
(
mndBuildMsg
(
pM
nodeMsg
,
pRpcMsg
)
!=
0
)
{
if
(
mndBuildMsg
(
pM
sg
,
pRpc
)
!=
0
)
{
goto
_OVER
;
}
if
(
pMgmt
->
singleProc
)
{
code
=
(
*
msgFp
)(
pDnode
,
pM
nodeM
sg
);
code
=
(
*
msgFp
)(
pDnode
,
pMsg
);
}
else
{
code
=
taosProcPushChild
(
pMgmt
->
pProcess
,
pM
nodeM
sg
,
contLen
);
code
=
taosProcPushChild
(
pMgmt
->
pProcess
,
pMsg
,
contLen
);
}
_OVER:
if
(
code
==
0
)
{
if
(
!
pMgmt
->
singleProc
)
{
taosFreeQitem
(
pM
nodeM
sg
);
taosFreeQitem
(
pMsg
);
}
}
else
{
bool
isReq
=
(
pRpc
Msg
->
msgType
&
1U
);
bool
isReq
=
(
pRpc
->
msgType
&
1U
);
if
(
isReq
)
{
if
(
terrno
==
TSDB_CODE_DND_MNODE_NOT_DEPLOYED
||
terrno
==
TSDB_CODE_APP_NOT_READY
)
{
dndSendRedirectRsp
(
pDnode
,
pRpc
Msg
);
dndSendRedirectRsp
(
pDnode
,
pRpc
);
}
else
{
SRpcMsg
rsp
=
{.
handle
=
pRpc
Msg
->
handle
,
.
ahandle
=
pRpcMsg
->
ahandle
,
.
code
=
terrno
};
SRpcMsg
rsp
=
{.
handle
=
pRpc
->
handle
,
.
ahandle
=
pRpc
->
ahandle
,
.
code
=
terrno
};
rpcSendResponse
(
&
rsp
);
}
}
taosFreeQitem
(
pM
nodeM
sg
);
taosFreeQitem
(
pMsg
);
}
rpcFreeCont
(
pRpc
Msg
->
pCont
);
rpcFreeCont
(
pRpc
->
pCont
);
}
int32_t
mmProcessWriteMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMnodeMsg
)
{
...
...
@@ -261,5 +283,5 @@ static void mmConsumeQueue(SDnode *pDnode, SMnodeMsg *pMsg) {
mndSendRsp
(
pMsg
,
terrno
);
}
// mndCleanupMsg
(pMsg);
taosFreeQitem
(
pMsg
);
}
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
f9c67813
...
...
@@ -390,28 +390,6 @@ void mndDestroy(const char *path) {
mDebug
(
"mnode is destroyed"
);
}
int32_t
mndBuildMsg
(
SMnodeMsg
*
pMnodeMsg
,
SRpcMsg
*
pRpcMsg
)
{
if
(
pRpcMsg
->
msgType
!=
TDMT_MND_TRANS_TIMER
&&
pRpcMsg
->
msgType
!=
TDMT_MND_MQ_TIMER
&&
pRpcMsg
->
msgType
!=
TDMT_MND_MQ_DO_REBALANCE
&&
pRpcMsg
->
msgType
!=
TDMT_MND_TELEM_TIMER
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
((
pRpcMsg
->
msgType
&
1U
)
&&
rpcGetConnInfo
(
pRpcMsg
->
handle
,
&
connInfo
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
mError
(
"failed to create msg since %s, app:%p RPC:%p"
,
terrstr
(),
pRpcMsg
->
ahandle
,
pRpcMsg
->
handle
);
return
-
1
;
}
memcpy
(
pMnodeMsg
->
user
,
connInfo
.
user
,
TSDB_USER_LEN
);
}
pMnodeMsg
->
rpcMsg
=
*
pRpcMsg
;
pMnodeMsg
->
createdTime
=
taosGetTimestampSec
();
pMnodeMsg
->
pCont
=
(
char
*
)
pMnodeMsg
+
sizeof
(
pMnodeMsg
);
if
(
pRpcMsg
!=
NULL
)
{
mTrace
(
"msg:%p, is created, app:%p RPC:%p user:%s"
,
pMnodeMsg
,
pRpcMsg
->
ahandle
,
pRpcMsg
->
handle
,
pMnodeMsg
->
user
);
}
return
0
;
}
void
mndSendRsp
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
code
=
code
};
rpcSendResponse
(
&
rpcRsp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录