Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f82afcfe
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
f82afcfe
编写于
3月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
registerBrokenLinkArgFp
上级
dffa1a72
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
95 addition
and
42 deletion
+95
-42
include/common/tmsgcb.h
include/common/tmsgcb.h
+9
-6
include/util/tprocess.h
include/util/tprocess.h
+8
-4
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+4
-0
source/dnode/mgmt/bnode/src/bmInt.c
source/dnode/mgmt/bnode/src/bmInt.c
+1
-0
source/dnode/mgmt/container/inc/dnd.h
source/dnode/mgmt/container/inc/dnd.h
+1
-0
source/dnode/mgmt/container/inc/dndInt.h
source/dnode/mgmt/container/inc/dndInt.h
+1
-0
source/dnode/mgmt/container/src/dndExec.c
source/dnode/mgmt/container/src/dndExec.c
+18
-9
source/dnode/mgmt/container/src/dndMsg.c
source/dnode/mgmt/container/src/dndMsg.c
+1
-1
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+16
-2
source/dnode/mgmt/mnode/src/mmInt.c
source/dnode/mgmt/mnode/src/mmInt.c
+1
-0
source/dnode/mgmt/qnode/src/qmInt.c
source/dnode/mgmt/qnode/src/qmInt.c
+1
-0
source/dnode/mgmt/snode/src/smInt.c
source/dnode/mgmt/snode/src/smInt.c
+1
-0
source/dnode/mgmt/vnode/src/vmInt.c
source/dnode/mgmt/vnode/src/vmInt.c
+1
-0
source/dnode/mgmt/vnode/src/vmMsg.c
source/dnode/mgmt/vnode/src/vmMsg.c
+1
-0
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+1
-1
source/util/src/tprocess.c
source/util/src/tprocess.c
+30
-19
未找到文件。
include/common/tmsgcb.h
浏览文件 @
f82afcfe
...
...
@@ -41,14 +41,16 @@ typedef int32_t (*GetQueueSizeFp)(SMgmtWrapper* pWrapper, int32_t vgId, EQueueTy
typedef
int32_t
(
*
SendReqFp
)(
SMgmtWrapper
*
pWrapper
,
SEpSet
*
epSet
,
SRpcMsg
*
pReq
);
typedef
int32_t
(
*
SendMnodeReqFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
);
typedef
void
(
*
SendRspFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
);
typedef
void
(
*
RegisterBrokenLinkArgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
typedef
struct
{
SMgmtWrapper
*
pWrapper
;
PutToQueueFp
queueFps
[
QUEUE_MAX
];
GetQueueSizeFp
qsizeFp
;
SendReqFp
sendReqFp
;
SendMnodeReqFp
sendMnodeReqFp
;
SendRspFp
sendRspFp
;
SMgmtWrapper
*
pWrapper
;
PutToQueueFp
queueFps
[
QUEUE_MAX
];
GetQueueSizeFp
qsizeFp
;
SendReqFp
sendReqFp
;
SendMnodeReqFp
sendMnodeReqFp
;
SendRspFp
sendRspFp
;
RegisterBrokenLinkArgFp
registerBrokenLinkArgFp
;
}
SMsgCb
;
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgCb
,
EQueueType
qtype
,
SRpcMsg
*
pReq
);
...
...
@@ -56,6 +58,7 @@ int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype);
int32_t
tmsgSendReq
(
const
SMsgCb
*
pMsgCb
,
SEpSet
*
epSet
,
SRpcMsg
*
pReq
);
int32_t
tmsgSendMnodeReq
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pReq
);
void
tmsgSendRsp
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pRsp
);
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
include/util/tprocess.h
浏览文件 @
f82afcfe
...
...
@@ -22,11 +22,14 @@
extern
"C"
{
#endif
typedef
enum
{
PROC_REQ
,
PROC_RSP
,
PROC_REGISTER
}
ProcFuncType
;
typedef
struct
SProcQueue
SProcQueue
;
typedef
struct
SProcObj
SProcObj
;
typedef
void
*
(
*
ProcMallocFp
)(
int32_t
contLen
);
typedef
void
*
(
*
ProcFreeFp
)(
void
*
pCont
);
typedef
void
*
(
*
ProcConsumeFp
)(
void
*
pParent
,
void
*
pHead
,
int32_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
);
typedef
void
*
(
*
ProcConsumeFp
)(
void
*
pParent
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
);
typedef
struct
{
int32_t
childQueueSize
;
...
...
@@ -52,9 +55,10 @@ int32_t taosProcRun(SProcObj *pProc);
void
taosProcStop
(
SProcObj
*
pProc
);
bool
taosProcIsChild
(
SProcObj
*
pProc
);
int32_t
taosProcChildId
(
SProcObj
*
pProc
);
int32_t
taosProcPutToChildQueue
(
SProcObj
*
pProc
,
void
*
pHead
,
int32_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
);
int32_t
taosProcPutToParentQueue
(
SProcObj
*
pProc
,
void
*
pHead
,
int32_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
);
int32_t
taosProcPutToChildQ
(
SProcObj
*
pProc
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
);
int32_t
taosProcPutToParentQ
(
SProcObj
*
pProc
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
);
#ifdef __cplusplus
}
...
...
source/common/src/tmsgcb.c
浏览文件 @
f82afcfe
...
...
@@ -33,3 +33,7 @@ int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq) {
}
void
tmsgSendRsp
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pRsp
)
{
return
(
*
pMsgCb
->
sendRspFp
)(
pMsgCb
->
pWrapper
,
pRsp
);
}
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
)
{
(
*
pMsgCb
->
registerBrokenLinkArgFp
)(
pMsgCb
->
pWrapper
,
pMsg
);
}
\ No newline at end of file
source/dnode/mgmt/bnode/src/bmInt.c
浏览文件 @
f82afcfe
...
...
@@ -24,6 +24,7 @@ static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
pOption
->
msgCb
=
msgCb
;
}
...
...
source/dnode/mgmt/container/inc/dnd.h
浏览文件 @
f82afcfe
...
...
@@ -139,6 +139,7 @@ void dndSendMonitorReport(SDnode *pDnode);
int32_t
dndSendReqToMnode
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
);
void
dndRegisterBrokenLinkArg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dndProcessNodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
);
...
...
source/dnode/mgmt/container/inc/dndInt.h
浏览文件 @
f82afcfe
...
...
@@ -56,6 +56,7 @@ void dndCleanupServer(SDnode *pDnode);
int32_t
dndInitClient
(
SDnode
*
pDnode
);
void
dndCleanupClient
(
SDnode
*
pDnode
);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
void
dndSendRpcRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/container/src/dndExec.c
浏览文件 @
f82afcfe
...
...
@@ -116,11 +116,12 @@ static void dndClearNodesExecpt(SDnode *pDnode, ENodeType except) {
}
}
static
void
dndConsumeChildQueue
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
)
{
static
void
dndConsumeChildQueue
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
,
int16_t
msgLen
,
void
*
pCont
,
int32_t
contLen
,
ProcFuncType
ftype
)
{
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
pRpc
->
pCont
=
pCont
;
dTrace
(
"msg:%p, get from child process queue, type:%s handle:%p app:%p"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
),
pRpc
->
handle
,
pRpc
->
ahandle
);
dTrace
(
"msg:%p, get from child process queue, type:%s handle:%p app:%p"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
),
pRpc
->
handle
,
pRpc
->
ahandle
);
NodeMsgFp
msgFp
=
pWrapper
->
msgFps
[
TMSG_INDEX
(
pRpc
->
msgType
)];
int32_t
code
=
(
*
msgFp
)(
pWrapper
,
pMsg
);
...
...
@@ -138,13 +139,21 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t
}
}
static
void
dndConsumeParentQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
,
int32_t
msgLen
,
void
*
pCont
,
int32_t
contLen
)
{
pRpc
->
pCont
=
pCont
;
dTrace
(
"msg:%p, get from parent process queue, type:%s handle:%p app:%p"
,
pRpc
,
TMSG_INFO
(
pRpc
->
msgType
),
pRpc
->
handle
,
pRpc
->
ahandle
);
static
void
dndConsumeParentQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
,
int16_t
msgLen
,
void
*
pCont
,
int32_t
contLen
,
ProcFuncType
ftype
)
{
pMsg
->
pCont
=
pCont
;
dTrace
(
"msg:%p, get from parent process queue, type:%s handle:%p app:%p"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
),
pMsg
->
handle
,
pMsg
->
ahandle
);
dndSendRsp
(
pWrapper
,
pRpc
);
taosMemoryFree
(
pRpc
);
switch
(
ftype
)
{
case
PROC_REGISTER
:
rpcRegisterBrokenLinkArg
(
pMsg
);
break
;
default:
dndSendRpcRsp
(
pWrapper
,
pMsg
);
break
;
}
taosMemoryFree
(
pMsg
);
}
static
int32_t
dndRunInMultiProcess
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/container/src/dndMsg.c
浏览文件 @
f82afcfe
...
...
@@ -68,7 +68,7 @@ void dndProcessRpcMsg(SMgmtWrapper *pWrapper, SRpcMsg *pRpc, SEpSet *pEpSet) {
}
else
if
(
pWrapper
->
procType
==
PROC_PARENT
)
{
dTrace
(
"msg:%p, is created and will put into child queue, handle:%p app:%p user:%s"
,
pMsg
,
pRpc
->
handle
,
pRpc
->
ahandle
,
pMsg
->
user
);
code
=
taosProcPutToChildQ
ueue
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SNodeMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
);
code
=
taosProcPutToChildQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SNodeMsg
),
pRpc
->
pCont
,
pRpc
->
contLen
,
PROC_REQ
);
}
else
{
dTrace
(
"msg:%p, should not processed in child process, handle:%p app:%p user:%s"
,
pMsg
,
pRpc
->
handle
,
pRpc
->
ahandle
,
pMsg
->
user
);
...
...
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
f82afcfe
...
...
@@ -348,7 +348,7 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) {
}
}
static
void
dndSendRpcRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
)
{
void
dndSendRpcRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
)
{
if
(
pRsp
->
code
==
TSDB_CODE_APP_NOT_READY
)
{
SMgmtWrapper
*
pDnodeWrapper
=
dndAcquireWrapper
(
pWrapper
->
pDnode
,
DNODE
);
if
(
pDnodeWrapper
!=
NULL
)
{
...
...
@@ -366,7 +366,7 @@ void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) {
if
(
pWrapper
->
procType
==
PROC_CHILD
)
{
int32_t
code
=
-
1
;
do
{
code
=
taosProcPutToParentQ
ueue
(
pWrapper
->
pProc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
);
code
=
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
PROC_RSP
);
if
(
code
!=
0
)
{
taosMsleep
(
10
);
}
...
...
@@ -375,3 +375,17 @@ void dndSendRsp(SMgmtWrapper *pWrapper, SRpcMsg *pRsp) {
dndSendRpcRsp
(
pWrapper
,
pRsp
);
}
}
void
dndRegisterBrokenLinkArg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
)
{
if
(
pWrapper
->
procType
==
PROC_CHILD
)
{
int32_t
code
=
-
1
;
do
{
code
=
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SRpcMsg
),
pMsg
->
pCont
,
pMsg
->
contLen
,
PROC_REGISTER
);
if
(
code
!=
0
)
{
taosMsleep
(
10
);
}
}
while
(
code
!=
0
);
}
else
{
rpcRegisterBrokenLinkArg
(
pMsg
);
}
}
\ No newline at end of file
source/dnode/mgmt/mnode/src/mmInt.c
浏览文件 @
f82afcfe
...
...
@@ -52,6 +52,7 @@ static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
pOption
->
msgCb
=
msgCb
;
}
...
...
source/dnode/mgmt/qnode/src/qmInt.c
浏览文件 @
f82afcfe
...
...
@@ -27,6 +27,7 @@ static void qmInitOption(SQnodeMgmt *pMgmt, SQnodeOpt *pOption) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
pOption
->
msgCb
=
msgCb
;
}
...
...
source/dnode/mgmt/snode/src/smInt.c
浏览文件 @
f82afcfe
...
...
@@ -24,6 +24,7 @@ static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
pOption
->
msgCb
=
msgCb
;
}
...
...
source/dnode/mgmt/vnode/src/vmInt.c
浏览文件 @
f82afcfe
...
...
@@ -137,6 +137,7 @@ static void *vmOpenVnodeFunc(void *param) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
SVnodeCfg
cfg
=
{.
msgCb
=
msgCb
,
.
pTfs
=
pMgmt
->
pTfs
,
.
vgId
=
pCfg
->
vgId
,
.
dbId
=
pCfg
->
dbUid
};
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
&
cfg
);
if
(
pImpl
==
NULL
)
{
...
...
source/dnode/mgmt/vnode/src/vmMsg.c
浏览文件 @
f82afcfe
...
...
@@ -91,6 +91,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendMnodeReqFp
=
dndSendReqToMnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
vnodeCfg
.
msgCb
=
msgCb
;
vnodeCfg
.
pTfs
=
pMgmt
->
pTfs
;
...
...
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
f82afcfe
...
...
@@ -287,7 +287,7 @@ int32_t qwRegisterBrokenLinkArg(QW_FPARAMS_DEF, SQWConnInfo *pConn) {
.
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
,
};
rpcRegisterBrokenLinkArg
(
&
pMsg
);
tmsgRegisterBrokenLinkArg
(
&
mgmt
->
msgCb
,
&
pMsg
);
return
TSDB_CODE_SUCCESS
;
}
...
...
source/util/src/tprocess.c
浏览文件 @
f82afcfe
...
...
@@ -207,7 +207,8 @@ static void taosProcCleanupQueue(SProcQueue *pQueue) {
}
}
static
int32_t
taosProcQueuePush
(
SProcQueue
*
pQueue
,
char
*
pHead
,
int32_t
rawHeadLen
,
char
*
pBody
,
int32_t
rawBodyLen
)
{
static
int32_t
taosProcQueuePush
(
SProcQueue
*
pQueue
,
char
*
pHead
,
int16_t
rawHeadLen
,
char
*
pBody
,
int32_t
rawBodyLen
,
ProcFuncType
funcType
)
{
const
int32_t
headLen
=
CEIL8
(
rawHeadLen
);
const
int32_t
bodyLen
=
CEIL8
(
rawBodyLen
);
const
int32_t
fullLen
=
headLen
+
bodyLen
+
8
;
...
...
@@ -225,10 +226,12 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea
}
if
(
pQueue
->
tail
<
pQueue
->
total
)
{
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
)
=
headLen
;
*
(
int16_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
)
=
headLen
;
*
(
int8_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
+
2
)
=
(
int8_t
)
funcType
;
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
+
4
)
=
bodyLen
;
}
else
{
*
(
int32_t
*
)(
pQueue
->
pBuffer
)
=
headLen
;
*
(
int16_t
*
)(
pQueue
->
pBuffer
)
=
headLen
;
*
(
int8_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
+
2
)
=
(
int8_t
)
funcType
;
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
4
)
=
bodyLen
;
}
...
...
@@ -268,13 +271,13 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, char *pHead, int32_t rawHea
taosThreadMutexUnlock
(
pQueue
->
mutex
);
tsem_post
(
&
pQueue
->
sem
);
uTrace
(
"proc:%s, push msg to queue:%p remains:%d, head:%d:%p body:%d:%p"
,
pQueue
->
name
,
pQueue
,
pQueue
->
items
,
headLen
,
pHead
,
bodyLen
,
pBody
);
uTrace
(
"proc:%s, push msg to queue:%p remains:%d, head:%d:%p body:%d:%p
ftype:%d
"
,
pQueue
->
name
,
pQueue
,
pQueue
->
items
,
headLen
,
pHead
,
bodyLen
,
pBody
,
funcType
);
return
0
;
}
static
int32_t
taosProcQueuePop
(
SProcQueue
*
pQueue
,
void
**
ppHead
,
int
32
_t
*
pHeadLen
,
void
**
ppBody
,
int32_t
*
pBodyLen
)
{
static
int32_t
taosProcQueuePop
(
SProcQueue
*
pQueue
,
void
**
ppHead
,
int
16
_t
*
pHeadLen
,
void
**
ppBody
,
int32_t
*
pBodyLen
,
ProcFuncType
*
pFuncType
)
{
tsem_wait
(
&
pQueue
->
sem
);
taosThreadMutexLock
(
pQueue
->
mutex
);
...
...
@@ -285,13 +288,16 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea
return
0
;
}
int32_t
headLen
=
0
;
int16_t
headLen
=
0
;
int8_t
ftype
=
0
;
int32_t
bodyLen
=
0
;
if
(
pQueue
->
head
<
pQueue
->
total
)
{
headLen
=
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
);
headLen
=
*
(
int16_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
);
ftype
=
*
(
int8_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
+
2
);
bodyLen
=
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
pQueue
->
head
+
4
);
}
else
{
headLen
=
*
(
int32_t
*
)(
pQueue
->
pBuffer
);
headLen
=
*
(
int16_t
*
)(
pQueue
->
pBuffer
);
headLen
=
*
(
int8_t
*
)(
pQueue
->
pBuffer
+
2
);
bodyLen
=
*
(
int32_t
*
)(
pQueue
->
pBuffer
+
4
);
}
...
...
@@ -345,9 +351,10 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int32_t *pHea
*
ppBody
=
pBody
;
*
pHeadLen
=
headLen
;
*
pBodyLen
=
bodyLen
;
*
pFuncType
=
(
ProcFuncType
)
ftype
;
uTrace
(
"proc:%s, pop msg from queue:%p remains:%d, head:%d:%p body:%d:%p"
,
pQueue
->
name
,
pQueue
,
pQueue
->
items
,
headLen
,
pHead
,
bodyLen
,
pBody
);
uTrace
(
"proc:%s, pop msg from queue:%p remains:%d, head:%d:%p body:%d:%p
ftype:%d
"
,
pQueue
->
name
,
pQueue
,
pQueue
->
items
,
headLen
,
pHead
,
bodyLen
,
pBody
,
ftype
);
return
1
;
}
...
...
@@ -400,12 +407,14 @@ static void taosProcThreadLoop(SProcQueue *pQueue) {
ProcConsumeFp
consumeFp
=
pQueue
->
consumeFp
;
void
*
pParent
=
pQueue
->
pParent
;
void
*
pHead
,
*
pBody
;
int32_t
headLen
,
bodyLen
;
int16_t
headLen
;
ProcFuncType
ftype
;
int32_t
bodyLen
;
uDebug
(
"proc:%s, start to get msg from queue:%p"
,
pQueue
->
name
,
pQueue
);
while
(
1
)
{
int32_t
numOfMsgs
=
taosProcQueuePop
(
pQueue
,
&
pHead
,
&
headLen
,
&
pBody
,
&
bodyLen
);
int32_t
numOfMsgs
=
taosProcQueuePop
(
pQueue
,
&
pHead
,
&
headLen
,
&
pBody
,
&
bodyLen
,
&
ftype
);
if
(
numOfMsgs
==
0
)
{
uDebug
(
"proc:%s, get no msg from queue:%p and exit the proc thread"
,
pQueue
->
name
,
pQueue
);
break
;
...
...
@@ -414,7 +423,7 @@ static void taosProcThreadLoop(SProcQueue *pQueue) {
taosMsleep
(
1
);
continue
;
}
else
{
(
*
consumeFp
)(
pParent
,
pHead
,
headLen
,
pBody
,
bodyLen
);
(
*
consumeFp
)(
pParent
,
pHead
,
headLen
,
pBody
,
bodyLen
,
ftype
);
}
}
}
...
...
@@ -462,10 +471,12 @@ void taosProcCleanup(SProcObj *pProc) {
}
}
int32_t
taosProcPutToChildQueue
(
SProcObj
*
pProc
,
void
*
pHead
,
int32_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
)
{
return
taosProcQueuePush
(
pProc
->
pChildQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
);
int32_t
taosProcPutToChildQ
(
SProcObj
*
pProc
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
funcType
)
{
return
taosProcQueuePush
(
pProc
->
pChildQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
funcType
);
}
int32_t
taosProcPutToParentQueue
(
SProcObj
*
pProc
,
void
*
pHead
,
int32_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
)
{
return
taosProcQueuePush
(
pProc
->
pParentQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
);
int32_t
taosProcPutToParentQ
(
SProcObj
*
pProc
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
funcType
)
{
return
taosProcQueuePush
(
pProc
->
pParentQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
funcType
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录