Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7babfaff
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看板
提交
7babfaff
编写于
3月 11, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
f9c67813
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
43 deletion
+42
-43
include/util/tprocess.h
include/util/tprocess.h
+4
-1
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
+2
-2
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
+26
-26
source/util/src/tprocess.c
source/util/src/tprocess.c
+10
-14
未找到文件。
include/util/tprocess.h
浏览文件 @
7babfaff
...
...
@@ -32,6 +32,8 @@ typedef void *(*ProcFp)(void *parent, SBlockItem *pItem);
typedef
struct
SProcQueue
SProcQueue
;
typedef
struct
{
void
*
pParent
;
bool
testFlag
;
int32_t
childQueueSize
;
int32_t
parentQueueSize
;
ProcFp
childFp
;
...
...
@@ -40,11 +42,12 @@ typedef struct {
typedef
struct
{
int32_t
pid
;
SProcCfg
cfg
;
SProcQueue
*
pChildQueue
;
SProcQueue
*
pParentQueue
;
pthread_t
childThread
;
pthread_t
parentThread
;
ProcFp
childFp
;
ProcFp
parentFp
;
void
*
pParent
;
bool
stopFlag
;
bool
testFlag
;
...
...
source/dnode/mgmt/impl/mnodeMgmt/src/mmMgmt.c
浏览文件 @
7babfaff
...
...
@@ -129,14 +129,14 @@ int32_t mmOpen(SDnode *pDnode, SMnodeOpt *pOption) {
cfg
.
parentFp
=
(
ProcFp
)
mmConsumeParentQueue
;
cfg
.
childQueueSize
=
1024
*
1024
;
cfg
.
parentQueueSize
=
1024
*
1024
;
cfg
.
testFlag
=
true
;
cfg
.
pParent
=
pDnode
;
pMgmt
->
pProcess
=
taosProcInit
(
&
cfg
);
if
(
pMgmt
->
pProcess
==
NULL
)
{
return
-
1
;
}
pMgmt
->
pProcess
->
pParent
=
pDnode
;
pMgmt
->
pProcess
->
testFlag
=
true
;
return
taosProcStart
(
pMgmt
->
pProcess
);
}
...
...
source/dnode/mgmt/impl/mnodeMgmt/src/mmWorker.c
浏览文件 @
7babfaff
...
...
@@ -24,7 +24,7 @@ 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
*
p
Msg
);
static
int32_t
mmPutRpcMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
p
Rpc
);
static
void
mmConsumeQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
);
int32_t
mmStartWorker
(
SDnode
*
pDnode
)
{
...
...
@@ -139,7 +139,7 @@ void mmInitMsgFp(SMnodeMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_VND_DROP_STB_RSP
)]
=
mmProcessWriteMsg
;
}
static
int32_t
m
nd
BuildMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
static
int32_t
m
m
BuildMsg
(
SMnodeMsg
*
pMsg
,
SRpcMsg
*
pRpc
)
{
SRpcConnInfo
connInfo
=
{
0
};
if
((
pRpc
->
msgType
&
1U
)
&&
rpcGetConnInfo
(
pRpc
->
handle
,
&
connInfo
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
...
...
@@ -178,7 +178,7 @@ void mmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
goto
_OVER
;
}
if
(
m
nd
BuildMsg
(
pMsg
,
pRpc
)
!=
0
)
{
if
(
m
m
BuildMsg
(
pMsg
,
pRpc
)
!=
0
)
{
goto
_OVER
;
}
...
...
@@ -211,52 +211,52 @@ _OVER:
rpcFreeCont
(
pRpc
->
pCont
);
}
int32_t
mmProcessWriteMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
writeWorker
,
pM
nodeM
sg
);
int32_t
mmProcessWriteMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
writeWorker
,
pMsg
);
}
int32_t
mmProcessSyncMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
syncWorker
,
pM
nodeM
sg
);
int32_t
mmProcessSyncMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
syncWorker
,
pMsg
);
}
int32_t
mmProcessReadMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pM
nodeM
sg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
readWorker
,
pM
nodeM
sg
);
int32_t
mmProcessReadMsg
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
return
mmPutMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
readWorker
,
pMsg
);
}
int32_t
mmPutMsgToWriteQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
Msg
)
{
return
mmPutRpcMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
writeWorker
,
pRpc
Msg
);
int32_t
mmPutMsgToWriteQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
)
{
return
mmPutRpcMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
writeWorker
,
pRpc
);
}
int32_t
mmPutMsgToReadQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
Msg
)
{
return
mmPutRpcMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
readWorker
,
pRpc
Msg
);
int32_t
mmPutMsgToReadQueue
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpc
)
{
return
mmPutRpcMsgToWorker
(
pDnode
,
&
pDnode
->
mmgmt
.
readWorker
,
pRpc
);
}
static
int32_t
mmPutMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SMnodeMsg
*
pM
nodeM
sg
)
{
static
int32_t
mmPutMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
mmAcquire
(
pDnode
);
if
(
pMnode
==
NULL
)
return
-
1
;
pM
nodeM
sg
->
pMnode
=
pMnode
;
int32_t
code
=
dndWriteMsgToWorker
(
pWorker
,
pM
nodeM
sg
,
0
);
pMsg
->
pMnode
=
pMnode
;
int32_t
code
=
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
0
);
mmRelease
(
pDnode
,
pMnode
);
return
code
;
}
static
int32_t
mmPutRpcMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
pRpc
Msg
)
{
int32_t
contLen
=
sizeof
(
SMnodeMsg
)
+
pRpc
Msg
->
contLen
;
SMnodeMsg
*
pM
nodeM
sg
=
taosAllocateQitem
(
contLen
);
if
(
pM
nodeM
sg
==
NULL
)
{
static
int32_t
mmPutRpcMsgToWorker
(
SDnode
*
pDnode
,
SDnodeWorker
*
pWorker
,
SRpcMsg
*
pRpc
)
{
int32_t
contLen
=
sizeof
(
SMnodeMsg
)
+
pRpc
->
contLen
;
SMnodeMsg
*
pMsg
=
taosAllocateQitem
(
contLen
);
if
(
pMsg
==
NULL
)
{
return
-
1
;
}
pM
nodeMsg
->
contLen
=
pRpcMsg
->
contLen
;
pM
nodeMsg
->
pCont
=
(
char
*
)
pMnode
Msg
+
sizeof
(
SMnodeMsg
);
memcpy
(
pM
nodeMsg
->
pCont
,
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
);
rpcFreeCont
(
pRpc
Msg
->
pCont
);
pM
sg
->
contLen
=
pRpc
->
contLen
;
pM
sg
->
pCont
=
(
char
*
)
p
Msg
+
sizeof
(
SMnodeMsg
);
memcpy
(
pM
sg
->
pCont
,
pRpc
->
pCont
,
pRpc
->
contLen
);
rpcFreeCont
(
pRpc
->
pCont
);
int32_t
code
=
mmPutMsgToWorker
(
pDnode
,
pWorker
,
pM
nodeM
sg
);
int32_t
code
=
mmPutMsgToWorker
(
pDnode
,
pWorker
,
pMsg
);
if
(
code
!=
0
)
{
taosFreeQitem
(
pM
nodeM
sg
);
taosFreeQitem
(
pMsg
);
}
return
code
;
...
...
source/util/src/tprocess.c
浏览文件 @
7babfaff
...
...
@@ -33,6 +33,8 @@ typedef struct SProcQueue {
}
SProcQueue
;
static
SProcQueue
*
taosProcQueueInit
(
int32_t
size
)
{
if
(
size
<=
0
)
size
=
SHM_DEFAULT_SIZE
;
int32_t
bufSize
=
CEIL4
(
size
);
int32_t
headSize
=
CEIL4
(
sizeof
(
SProcQueue
));
...
...
@@ -180,18 +182,12 @@ SProcObj *taosProcInit(const SProcCfg *pCfg) {
return
NULL
;
}
pProc
->
cfg
=
*
pCfg
;
if
(
pProc
->
cfg
.
childQueueSize
<=
0
)
{
pProc
->
cfg
.
childQueueSize
=
SHM_DEFAULT_SIZE
;
}
if
(
pProc
->
cfg
.
parentQueueSize
<=
0
)
{
pProc
->
cfg
.
parentQueueSize
=
SHM_DEFAULT_SIZE
;
}
pProc
->
pChildQueue
=
taosProcQueueInit
(
pProc
->
cfg
.
childQueueSize
);
pProc
->
pParentQueue
=
taosProcQueueInit
(
pProc
->
cfg
.
parentQueueSize
);
pProc
->
pParent
=
pCfg
->
pParent
;
pProc
->
childFp
=
pCfg
->
childFp
;
pProc
->
parentFp
=
pCfg
->
parentFp
;
pProc
->
testFlag
=
pCfg
->
testFlag
;
pProc
->
pChildQueue
=
taosProcQueueInit
(
pCfg
->
childQueueSize
);
pProc
->
pParentQueue
=
taosProcQueueInit
(
pCfg
->
parentQueueSize
);
return
pProc
;
}
...
...
@@ -218,13 +214,13 @@ static void taosProcThreadLoop(SProcQueue *pQueue, ProcFp procFp, void *pParent)
static
void
*
taosProcThreadChildLoop
(
void
*
param
)
{
SProcObj
*
pProc
=
param
;
taosProcThreadLoop
(
pProc
->
pChildQueue
,
pProc
->
c
fg
.
c
hildFp
,
pProc
->
pParent
);
taosProcThreadLoop
(
pProc
->
pChildQueue
,
pProc
->
childFp
,
pProc
->
pParent
);
return
NULL
;
}
static
void
*
taosProcThreadParentLoop
(
void
*
param
)
{
SProcObj
*
pProc
=
param
;
taosProcThreadLoop
(
pProc
->
pParentQueue
,
pProc
->
cfg
.
parentFp
,
pProc
->
pParent
);
taosProcThreadLoop
(
pProc
->
pParentQueue
,
pProc
->
parentFp
,
pProc
->
pParent
);
return
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录