Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
877cb761
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看板
提交
877cb761
编写于
6月 14, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: mnode worker
上级
65686df0
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
165 addition
and
169 deletion
+165
-169
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-0
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
+6
-8
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+113
-113
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
+2
-3
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
+43
-45
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
877cb761
...
...
@@ -83,6 +83,7 @@ int32_t mndGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
*/
int32_t
mndProcessRpcMsg
(
SRpcMsg
*
pMsg
);
int32_t
mndProcessSyncMsg
(
SRpcMsg
*
pMsg
);
int32_t
mndPreprocessQueryMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
/**
* @brief Generate machine code
...
...
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
浏览文件 @
877cb761
...
...
@@ -53,20 +53,18 @@ void mmRelease(SMnodeMgmt *pMgmt);
SArray
*
mmGetMsgHandles
();
int32_t
mmProcessCreateReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
);
int32_t
mmProcessDropReq
(
const
SMgmtInputOpt
*
pInput
,
SRpcMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmProcessGetMonitorInfoReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmProcessGetLoadsReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mndPreprocessQueryMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
// mmWorker.c
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
);
void
mmStopWorker
(
SMnodeMgmt
*
pMgmt
);
int32_t
mmPut
Node
MsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPut
Node
MsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPut
Node
MsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPut
Node
MsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPut
Node
MsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPut
Rpc
MsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
);
int32_t
mmPutMsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutMsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutMsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutMsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutMsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
877cb761
此差异已折叠。
点击以展开。
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
浏览文件 @
877cb761
...
...
@@ -43,7 +43,6 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, const SMgmtInputOpt *pInpu
pOption
->
deploy
=
true
;
pOption
->
msgCb
=
pMgmt
->
msgCb
;
pOption
->
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
pOption
->
replica
=
1
;
pOption
->
selfIndex
=
0
;
...
...
@@ -54,8 +53,8 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, const SMgmtInputOpt *pInpu
}
static
void
mmBuildOptionForOpen
(
SMnodeMgmt
*
pMgmt
,
SMnodeOpt
*
pOption
)
{
pOption
->
deploy
=
false
;
pOption
->
standby
=
false
;
pOption
->
deploy
=
false
;
pOption
->
msgCb
=
pMgmt
->
msgCb
;
pOption
->
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
...
...
@@ -105,7 +104,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
mmPut
Rpc
MsgToQueue
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
mmPutMsgToQueue
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
浏览文件 @
877cb761
...
...
@@ -26,7 +26,7 @@ static inline void mmSendRsp(SRpcMsg *pMsg, int32_t code) {
tmsgSendRsp
(
&
rsp
);
}
static
void
mmProcess
Queue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
mmProcess
RpcMsg
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SMnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from mnode queue"
,
pMsg
);
...
...
@@ -53,11 +53,10 @@ static void mmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
taosFreeQitem
(
pMsg
);
}
static
void
mmProcessSync
Queue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
mmProcessSync
Msg
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SMnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from mnode-sync queue"
,
pMsg
);
pMsg
->
info
.
node
=
pMgmt
->
pMnode
;
dTrace
(
"msg:%p, get from mnode-sync queue"
,
pMsg
);
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
contLen
=
ntohl
(
pHead
->
contLen
);
...
...
@@ -70,64 +69,63 @@ static void mmProcessSyncQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
taosFreeQitem
(
pMsg
);
}
static
int32_t
mmPutNodeMsgToWorker
(
SSingleWorker
*
pWorker
,
SRpcMsg
*
pMsg
)
{
dTrace
(
"msg:%p, put into %s queue, type:%s"
,
pMsg
,
pWorker
->
name
,
TMSG_INFO
(
pMsg
->
msgType
));
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
static
inline
int32_t
mmPutMsgToWorker
(
SMnodeMgmt
*
pMgmt
,
SSingleWorker
*
pWorker
,
SRpcMsg
*
pMsg
)
{
if
(
mmAcquire
(
pMgmt
)
==
0
)
{
dTrace
(
"msg:%p, put into %s queue, type:%s"
,
pMsg
,
pWorker
->
name
,
TMSG_INFO
(
pMsg
->
msgType
));
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
mmRelease
(
pMgmt
);
return
0
;
}
else
{
dTrace
(
"msg:%p, failed to put into %s queue since %s, type:%s"
,
pMsg
,
pWorker
->
name
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
));
return
-
1
;
}
}
in
t32_t
mmPutNode
MsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
NodeMsgToWorker
(
&
pMgmt
->
writeWorker
,
pMsg
);
in
line
int32_t
mmPut
MsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
MsgToWorker
(
pMgmt
,
&
pMgmt
->
writeWorker
,
pMsg
);
}
in
t32_t
mmPutNode
MsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
NodeMsgToWorker
(
&
pMgmt
->
syncWorker
,
pMsg
);
in
line
int32_t
mmPut
MsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
MsgToWorker
(
pMgmt
,
&
pMgmt
->
syncWorker
,
pMsg
);
}
in
t32_t
mmPutNode
MsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
NodeMsgToWorker
(
&
pMgmt
->
readWorker
,
pMsg
);
in
line
int32_t
mmPut
MsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
MsgToWorker
(
pMgmt
,
&
pMgmt
->
readWorker
,
pMsg
);
}
int32_t
mmPutNodeMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
mndPreprocessQueryMsg
(
pMgmt
->
pMnode
,
pMsg
);
return
mmPutNodeMsgToWorker
(
&
pMgmt
->
queryWorker
,
pMsg
);
inline
int32_t
mmPutMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
if
(
mndPreprocessQueryMsg
(
pMgmt
->
pMnode
,
pMsg
)
!=
0
)
{
dError
(
"msg:%p, failed to pre-process in mnode since %s, type:%s"
,
pMsg
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
));
return
-
1
;
}
return
mmPutMsgToWorker
(
pMgmt
,
&
pMgmt
->
queryWorker
,
pMsg
);
}
in
t32_t
mmPutNode
MsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
NodeMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
in
line
int32_t
mmPut
MsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
mmPut
MsgToWorker
(
pMgmt
,
&
pMgmt
->
monitorWorker
,
pMsg
);
}
in
t32_t
mmPutRpc
MsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
in
line
int32_t
mmPut
MsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
if
(
pMsg
==
NULL
)
return
-
1
;
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
)
);
dTrace
(
"msg:%p, is created"
,
pMsg
);
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
switch
(
qtype
)
{
case
WRITE_QUEUE
:
dTrace
(
"msg:%p, is created and will put into vnode-write queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
writeWorker
.
queue
,
pMsg
);
return
0
;
return
mmPutMsgToWorker
(
pMgmt
,
&
pMgmt
->
writeWorker
,
pMsg
);
case
QUERY_QUEUE
:
dTrace
(
"msg:%p, is created and will put into vnode-query queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
queryWorker
.
queue
,
pMsg
);
return
0
;
return
mmPutMsgToWorker
(
pMgmt
,
&
pMgmt
->
queryWorker
,
pMsg
);
case
READ_QUEUE
:
dTrace
(
"msg:%p, is created and will put into vnode-read queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
readWorker
.
queue
,
pMsg
);
return
0
;
return
mmPutMsgToWorker
(
pMgmt
,
&
pMgmt
->
readWorker
,
pMsg
);
case
SYNC_QUEUE
:
if
(
mmAcquire
(
pMgmt
)
==
0
)
{
dTrace
(
"msg:%p, is created and will put into vnode-sync queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
syncWorker
.
queue
,
pMsg
);
mmRelease
(
pMgmt
);
return
0
;
}
else
{
return
-
1
;
}
return
mmPutMsgToWorker
(
pMgmt
,
&
pMgmt
->
syncWorker
,
pMsg
);
default:
terrno
=
TSDB_CODE_INVALID_PARA
;
dTrace
(
"msg:%p, is freed"
,
pMsg
);
taosFreeQitem
(
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
-
1
;
}
}
...
...
@@ -137,7 +135,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.
min
=
tsNumOfMnodeQueryThreads
,
.
max
=
tsNumOfMnodeQueryThreads
,
.
name
=
"mnode-query"
,
.
fp
=
(
FItem
)
mmProcess
Queue
,
.
fp
=
(
FItem
)
mmProcess
RpcMsg
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
queryWorker
,
&
qCfg
)
!=
0
)
{
...
...
@@ -149,7 +147,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.
min
=
tsNumOfMnodeReadThreads
,
.
max
=
tsNumOfMnodeReadThreads
,
.
name
=
"mnode-read"
,
.
fp
=
(
FItem
)
mmProcess
Queue
,
.
fp
=
(
FItem
)
mmProcess
RpcMsg
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
readWorker
,
&
rCfg
)
!=
0
)
{
...
...
@@ -161,7 +159,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.
min
=
1
,
.
max
=
1
,
.
name
=
"mnode-write"
,
.
fp
=
(
FItem
)
mmProcess
Queue
,
.
fp
=
(
FItem
)
mmProcess
RpcMsg
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
writeWorker
,
&
wCfg
)
!=
0
)
{
...
...
@@ -173,7 +171,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.
min
=
1
,
.
max
=
1
,
.
name
=
"mnode-sync"
,
.
fp
=
(
FItem
)
mmProcessSync
Queue
,
.
fp
=
(
FItem
)
mmProcessSync
Msg
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
syncWorker
,
&
sCfg
)
!=
0
)
{
...
...
@@ -185,7 +183,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
.
min
=
1
,
.
max
=
1
,
.
name
=
"mnode-monitor"
,
.
fp
=
(
FItem
)
mmProcess
Queue
,
.
fp
=
(
FItem
)
mmProcess
RpcMsg
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录