Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5015a6a7
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5015a6a7
编写于
4月 01, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
44311425
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
49 addition
and
42 deletion
+49
-42
include/util/tprocess.h
include/util/tprocess.h
+2
-2
source/dnode/mgmt/bm/src/bmInt.c
source/dnode/mgmt/bm/src/bmInt.c
+1
-5
source/dnode/mgmt/main/inc/dnd.h
source/dnode/mgmt/main/inc/dnd.h
+1
-1
source/dnode/mgmt/main/src/dndExec.c
source/dnode/mgmt/main/src/dndExec.c
+9
-4
source/dnode/mgmt/main/src/dndTransport.c
source/dnode/mgmt/main/src/dndTransport.c
+31
-27
source/util/src/tprocess.c
source/util/src/tprocess.c
+5
-3
未找到文件。
include/util/tprocess.h
浏览文件 @
5015a6a7
...
...
@@ -22,7 +22,7 @@
extern
"C"
{
#endif
typedef
enum
{
PROC_
REQ
,
PROC_RSP
,
PROC_REG
,
PROC_RELEASE
}
ProcFuncType
;
typedef
enum
{
PROC_
QUEUE
,
PROC_REQ
,
PROC_RSP
,
PROC_REGIST
,
PROC_RELEASE
}
ProcFuncType
;
typedef
struct
SProcQueue
SProcQueue
;
typedef
struct
SProcObj
SProcObj
;
...
...
@@ -53,7 +53,7 @@ void taosProcCleanup(SProcObj *pProc);
int32_t
taosProcRun
(
SProcObj
*
pProc
);
int32_t
taosProcPutToChildQ
(
SProcObj
*
pProc
,
const
void
*
pHead
,
int16_t
headLen
,
const
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
);
int32_t
taosProcPutToParentQ
(
SProcObj
*
pProc
,
const
void
*
pHead
,
int16_t
headLen
,
const
void
*
pBody
,
int32_t
bodyLen
,
void
taosProcPutToParentQ
(
SProcObj
*
pProc
,
const
void
*
pHead
,
int16_t
headLen
,
const
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
);
#ifdef __cplusplus
...
...
source/dnode/mgmt/bm/src/bmInt.c
浏览文件 @
5015a6a7
...
...
@@ -19,11 +19,7 @@
static
int32_t
bmRequire
(
SMgmtWrapper
*
pWrapper
,
bool
*
required
)
{
return
dndReadFile
(
pWrapper
,
required
);
}
static
void
bmInitOption
(
SBnodeMgmt
*
pMgmt
,
SBnodeOpt
*
pOption
)
{
SMsgCb
msgCb
=
{
0
};
msgCb
.
pWrapper
=
pMgmt
->
pWrapper
;
msgCb
.
sendReqFp
=
dndSendReqToDnode
;
msgCb
.
sendRspFp
=
dndSendRsp
;
msgCb
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
;
SMsgCb
msgCb
=
dndCreateMsgcb
(
pMgmt
->
pWrapper
);
pOption
->
msgCb
=
msgCb
;
}
...
...
source/dnode/mgmt/main/inc/dnd.h
浏览文件 @
5015a6a7
...
...
@@ -149,7 +149,7 @@ int32_t dndInitClient(SDnode *pDnode);
void
dndCleanupClient
(
SDnode
*
pDnode
);
int32_t
dndProcessNodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
int32_t
dndSendReqToMnode
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dndSendReq
ToDnode
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
int32_t
dndSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
);
void
dndRegisterBrokenLinkArg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
...
...
source/dnode/mgmt/main/src/dndExec.c
浏览文件 @
5015a6a7
...
...
@@ -90,10 +90,10 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t
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 queue,
handle:%p app:%p"
,
pMsg
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dTrace
(
"msg:%p, get from parent queue,
ftype:%d handle:%p, app:%p"
,
pMsg
,
ftype
,
pMsg
->
handle
,
pMsg
->
ahandle
);
switch
(
ftype
)
{
case
PROC_REG
:
case
PROC_REG
IST
:
rpcRegisterBrokenLinkArg
(
pMsg
);
break
;
case
PROC_RELEASE
:
...
...
@@ -101,11 +101,14 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t
rpcFreeCont
(
pCont
);
break
;
case
PROC_REQ
:
// todo send to dnode
dndSendReqToMnode
(
pWrapper
,
pMsg
);
default:
// dndSendReq(pWrapper, (const SEpSet *)((char *)pMsg + sizeof(SRpcMsg)), pMsg);
break
;
case
PROC_RSP
:
dndSendRpcRsp
(
pWrapper
,
pMsg
);
break
;
default:
break
;
}
taosMemoryFree
(
pMsg
);
}
...
...
@@ -325,6 +328,8 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) {
}
}
dndSetStatus
(
pDnode
,
DND_STAT_RUNNING
);
if
(
taosProcRun
(
pWrapper
->
pProc
)
!=
0
)
{
dError
(
"node:%s, failed to run proc since %s"
,
pWrapper
->
name
,
terrstr
());
return
-
1
;
...
...
source/dnode/mgmt/main/src/dndTransport.c
浏览文件 @
5015a6a7
...
...
@@ -319,22 +319,6 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p
return
0
;
}
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
if
(
dndGetStatus
(
pDnode
)
!=
DND_STAT_RUNNING
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
return
-
1
;
}
return
dndSendRpcReq
(
&
pDnode
->
trans
,
pEpSet
,
pReq
);
}
else
{
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pReq
,
sizeof
(
SRpcMsg
),
pReq
->
pCont
,
pReq
->
contLen
,
PROC_REQ
)
!=
0
)
{
taosMsleep
(
1
);
}
}
}
int32_t
dndSendReqToMnode
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pReq
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
STransMgmt
*
pTrans
=
&
pDnode
->
trans
;
...
...
@@ -362,13 +346,37 @@ void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
}
}
int32_t
dndSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
if
(
dndGetStatus
(
pDnode
)
!=
DND_STAT_RUNNING
)
{
terrno
=
TSDB_CODE_DND_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
return
-
1
;
}
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
return
dndSendRpcReq
(
&
pDnode
->
trans
,
pEpSet
,
pReq
);
}
else
{
int32_t
headLen
=
sizeof
(
SRpcMsg
)
+
sizeof
(
SEpSet
);
char
*
pHead
=
taosMemoryMalloc
(
headLen
);
if
(
pHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
pHead
,
pReq
,
sizeof
(
SRpcMsg
));
memcpy
(
pHead
+
sizeof
(
SRpcMsg
),
pEpSet
,
sizeof
(
SEpSet
));
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pReq
,
headLen
,
pReq
->
pCont
,
pReq
->
contLen
,
PROC_REQ
);
taosMemoryFree
(
pHead
);
return
0
;
}
}
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
)
{
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
dndSendRpcRsp
(
pWrapper
,
pRsp
);
}
else
{
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
PROC_RSP
)
!=
0
)
{
taosMsleep
(
1
);
}
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
PROC_RSP
);
}
}
...
...
@@ -376,9 +384,7 @@ void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) {
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
rpcRegisterBrokenLinkArg
(
pMsg
);
}
else
{
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SRpcMsg
),
pMsg
->
pCont
,
pMsg
->
contLen
,
PROC_REG
)
!=
0
)
{
taosMsleep
(
1
);
}
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SRpcMsg
),
pMsg
->
pCont
,
pMsg
->
contLen
,
PROC_REGIST
);
}
}
...
...
@@ -387,19 +393,17 @@ static void dndReleaseHandle(SMgmtWrapper *pWrapper, void *handle, int8_t type)
rpcReleaseHandle
(
handle
,
type
);
}
else
{
SRpcMsg
msg
=
{.
handle
=
handle
,
.
code
=
type
};
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
&
msg
,
sizeof
(
SRpcMsg
),
NULL
,
0
,
PROC_RELEASE
)
!=
0
)
{
taosMsleep
(
1
);
}
taosProcPutToParentQ
(
pWrapper
->
pProc
,
&
msg
,
sizeof
(
SRpcMsg
),
NULL
,
0
,
PROC_RELEASE
);
}
}
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
)
{
SMsgCb
msgCb
=
{
.
pWrapper
=
pWrapper
,
.
sendReqFp
=
dndSendReq
,
.
sendRspFp
=
dndSendRsp
,
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
,
.
releaseHandleFp
=
dndReleaseHandle
,
.
sendReqFp
=
dndSendReqToDnode
,
.
sendRspFp
=
dndSendRsp
,
};
return
msgCb
;
}
\ No newline at end of file
source/util/src/tprocess.c
浏览文件 @
5015a6a7
...
...
@@ -434,7 +434,9 @@ int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen,
return
taosProcQueuePush
(
pProc
->
pChildQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
ftype
);
}
int32_t
taosProcPutToParentQ
(
SProcObj
*
pProc
,
const
void
*
pHead
,
int16_t
headLen
,
const
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
)
{
return
taosProcQueuePush
(
pProc
->
pParentQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
ftype
);
void
taosProcPutToParentQ
(
SProcObj
*
pProc
,
const
void
*
pHead
,
int16_t
headLen
,
const
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
)
{
while
(
taosProcQueuePush
(
pProc
->
pParentQueue
,
pHead
,
headLen
,
pBody
,
bodyLen
,
ftype
)
!=
0
)
{
taosMsleep
(
1
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录