Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f4c31418
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看板
提交
f4c31418
编写于
5月 21, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: rpc msg handler
上级
12d27bfd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
22 addition
and
39 deletion
+22
-39
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
+3
-5
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+3
-7
source/dnode/mgmt/mgmt_snode/src/smWorker.c
source/dnode/mgmt/mgmt_snode/src/smWorker.c
+3
-5
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+11
-12
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+0
-1
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+0
-5
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+2
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+0
-3
未找到文件。
source/dnode/mgmt/mgmt_bnode/src/bmWorker.c
浏览文件 @
f4c31418
...
...
@@ -47,10 +47,8 @@ static inline void bmSendRsp(SRpcMsg *pMsg, int32_t code) {
static
void
bmProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from bnode-monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
pMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
msgType
==
TDMT_MON_BM_INFO
)
{
code
=
bmProcessGetMonBmInfoReq
(
pMgmt
,
pMsg
);
...
...
@@ -58,13 +56,13 @@ static void bmProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
IsReq
(
pMsg
)
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
bmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
rpcFreeCont
(
p
Rpc
->
pCont
);
rpcFreeCont
(
p
Msg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
f4c31418
...
...
@@ -19,7 +19,6 @@
static
void
*
dmStatusThreadFp
(
void
*
param
)
{
SDnodeMgmt
*
pMgmt
=
param
;
int64_t
lastTime
=
taosGetTimestampMs
();
setThreadName
(
"dnode-status"
);
while
(
1
)
{
...
...
@@ -40,7 +39,6 @@ static void *dmStatusThreadFp(void *param) {
static
void
*
dmMonitorThreadFp
(
void
*
param
)
{
SDnodeMgmt
*
pMgmt
=
param
;
int64_t
lastTime
=
taosGetTimestampMs
();
setThreadName
(
"dnode-monitor"
);
while
(
1
)
{
...
...
@@ -103,11 +101,9 @@ void dmStopMonitorThread(SDnodeMgmt *pMgmt) {
static
void
dmProcessMgmtQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
msgType
;
bool
isRequest
=
msgType
&
1u
;
dTrace
(
"msg:%p, will be processed in dnode-mgmt queue, type:%s"
,
pMsg
,
TMSG_INFO
(
msgType
));
dTrace
(
"msg:%p, will be processed in dnode queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
switch
(
msgType
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_DND_CONFIG_DNODE
:
code
=
dmProcessConfigReq
(
pMgmt
,
pMsg
);
break
;
...
...
@@ -149,7 +145,7 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
break
;
}
if
(
isRequest
)
{
if
(
IsReq
(
pMsg
)
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
SRpcMsg
rsp
=
{
.
code
=
code
,
...
...
source/dnode/mgmt/mgmt_snode/src/smWorker.c
浏览文件 @
f4c31418
...
...
@@ -28,10 +28,8 @@ static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) {
static
void
smProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from snode-monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
pMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
smProcessGetMonitorInfoReq
(
pMgmt
,
pMsg
);
...
...
@@ -39,13 +37,13 @@ static void smProcessMonitorQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
IsReq
(
pMsg
)
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
smSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
rpcFreeCont
(
p
Rpc
->
pCont
);
rpcFreeCont
(
p
Msg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
f4c31418
...
...
@@ -29,7 +29,7 @@ static inline void vmSendRsp(SRpcMsg *pMsg, int32_t code) {
tmsgSendRsp
(
&
rsp
);
}
static
void
vmProcess
MgmtMonitor
Queue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
vmProcessQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from vnode queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
...
...
@@ -92,7 +92,7 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
if
(
pArray
==
NULL
)
{
dError
(
"failed to process %d msgs in write-queue since %s"
,
numOfMsgs
,
terrstr
());
return
;
...
...
@@ -222,8 +222,7 @@ static void vmProcessMergeQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
}
static
int32_t
vmPutNodeMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
,
EQueueType
qtype
)
{
SRpcMsg
*
pRpc
=
pMsg
;
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SMsgHead
*
pHead
=
pMsg
->
pCont
;
int32_t
code
=
0
;
pHead
->
contLen
=
ntohl
(
pHead
->
contLen
);
...
...
@@ -237,23 +236,23 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
switch
(
qtype
)
{
case
QUERY_QUEUE
:
dTrace
(
"msg:%p, put into vnode-query worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Rpc
->
msgType
));
dTrace
(
"msg:%p, put into vnode-query worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Msg
->
msgType
));
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
case
FETCH_QUEUE
:
dTrace
(
"msg:%p, put into vnode-fetch worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Rpc
->
msgType
));
dTrace
(
"msg:%p, put into vnode-fetch worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Msg
->
msgType
));
taosWriteQitem
(
pVnode
->
pFetchQ
,
pMsg
);
break
;
case
WRITE_QUEUE
:
dTrace
(
"msg:%p, put into vnode-write worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Rpc
->
msgType
));
dTrace
(
"msg:%p, put into vnode-write worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Msg
->
msgType
));
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
break
;
case
SYNC_QUEUE
:
dTrace
(
"msg:%p, put into vnode-sync worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Rpc
->
msgType
));
dTrace
(
"msg:%p, put into vnode-sync worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Msg
->
msgType
));
taosWriteQitem
(
pVnode
->
pSyncQ
,
pMsg
);
break
;
case
MERGE_QUEUE
:
dTrace
(
"msg:%p, put into vnode-merge worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Rpc
->
msgType
));
dTrace
(
"msg:%p, put into vnode-merge worker, type:%s"
,
pMsg
,
TMSG_INFO
(
p
Msg
->
msgType
));
taosWriteQitem
(
pVnode
->
pMergeQ
,
pMsg
);
break
;
default:
...
...
@@ -301,7 +300,7 @@ int32_t vmPutNodeMsgToMonitorQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
static
int32_t
vmPutRpcMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
,
EQueueType
qtype
)
{
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
...
...
@@ -469,7 +468,7 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
.
min
=
1
,
.
max
=
1
,
.
name
=
"vnode-mgmt"
,
.
fp
=
(
FItem
)
vmProcess
MgmtMonitor
Queue
,
.
fp
=
(
FItem
)
vmProcessQueue
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
mgmtWorker
,
&
cfg
)
!=
0
)
{
...
...
@@ -481,7 +480,7 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
.
min
=
1
,
.
max
=
1
,
.
name
=
"vnode-monitor"
,
.
fp
=
(
FItem
)
vmProcess
MgmtMonitor
Queue
,
.
fp
=
(
FItem
)
vmProcessQueue
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
...
...
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
浏览文件 @
f4c31418
...
...
@@ -137,7 +137,6 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper);
void
dmSetStatus
(
SDnode
*
pDnode
,
EDndRunStatus
stype
);
void
dmProcessServerStartupStatus
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmProcessNetTestReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmProcessFetchRsp
(
SRpcMsg
*
pMsg
);
// dmNodes.c
int32_t
dmOpenNode
(
SMgmtWrapper
*
pWrapper
);
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
f4c31418
...
...
@@ -314,8 +314,3 @@ void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg) {
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
}
void
dmProcessFetchRsp
(
SRpcMsg
*
pMsg
)
{
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pMsg
);
// rpcFreeCont(pMsg->pCont);
}
\ No newline at end of file
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
f4c31418
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "dmMgmt.h"
#include "qworker.h"
static
void
dmSendRedirectRsp
(
SRpcMsg
*
pMsg
,
const
SEpSet
*
pNewEpSet
);
static
void
dmSendRsp
(
SRpcMsg
*
pMsg
);
...
...
@@ -61,7 +62,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
dmProcessNetTestReq
(
pDnode
,
pRpc
);
return
;
}
else
if
(
pRpc
->
msgType
==
TDMT_MND_SYSTABLE_RETRIEVE_RSP
||
pRpc
->
msgType
==
TDMT_VND_FETCH_RSP
)
{
dmProcessFetchRsp
(
pRpc
);
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pRpc
);
return
;
}
else
{
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
f4c31418
...
...
@@ -147,9 +147,6 @@ _err:
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vTrace
(
"message in vnode query queue is processing"
);
#if 0
SReadHandle handle = {.reader = pVnode->pTsdb, .meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode, .pMsgCb = &pVnode->msgCb};
#endif
SReadHandle
handle
=
{.
meta
=
pVnode
->
pMeta
,
.
config
=
&
pVnode
->
config
,
.
vnode
=
pVnode
,
.
pMsgCb
=
&
pVnode
->
msgCb
};
switch
(
pMsg
->
msgType
)
{
case
TDMT_VND_QUERY
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录