Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac6b1213
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ac6b1213
编写于
3月 29, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shm
上级
182a5ee4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
57 addition
and
25 deletion
+57
-25
include/common/tmsgcb.h
include/common/tmsgcb.h
+2
-1
include/util/tprocess.h
include/util/tprocess.h
+1
-1
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+6
-2
source/dnode/mgmt/container/inc/dnd.h
source/dnode/mgmt/container/inc/dnd.h
+3
-0
source/dnode/mgmt/container/src/dndExec.c
source/dnode/mgmt/container/src/dndExec.c
+10
-1
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+33
-18
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+2
-2
未找到文件。
include/common/tmsgcb.h
浏览文件 @
ac6b1213
...
...
@@ -56,13 +56,14 @@ typedef struct {
ReleaseHandleFp
releaseHandleFp
;
}
SMsgCb
;
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
);
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgCb
,
EQueueType
qtype
,
SRpcMsg
*
pReq
);
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
pMsgCb
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
tmsgSendReq
(
const
SMsgCb
*
pMsgCb
,
const
SEpSet
*
epSet
,
SRpcMsg
*
pReq
);
int32_t
tmsgSendMnodeReq
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pReq
);
void
tmsgSendRsp
(
const
SMsgCb
*
pMsgCb
,
const
SRpcMsg
*
pRsp
);
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
);
void
tmsgReleaseHandle
(
const
SMsgCb
*
pMsgCb
,
void
*
handle
,
int8_t
type
);
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
);
#ifdef __cplusplus
}
...
...
include/util/tprocess.h
浏览文件 @
ac6b1213
...
...
@@ -22,7 +22,7 @@
extern
"C"
{
#endif
typedef
enum
{
PROC_REQ
,
PROC_RSP
,
PROC_REG
ISTER
}
ProcFuncType
;
typedef
enum
{
PROC_REQ
,
PROC_RSP
,
PROC_REG
,
PROC_RELEASE
}
ProcFuncType
;
typedef
struct
SProcQueue
SProcQueue
;
typedef
struct
SProcObj
SProcObj
;
...
...
source/common/src/tmsgcb.c
浏览文件 @
ac6b1213
...
...
@@ -16,6 +16,10 @@
#define _DEFAULT_SOURCE
#include "tmsgcb.h"
static
SMsgCb
tsDefaultMsgCb
;
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
)
{
tsDefaultMsgCb
=
*
pMsgCb
;
}
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
pMsgCb
,
EQueueType
qtype
,
SRpcMsg
*
pReq
)
{
return
(
*
pMsgCb
->
queueFps
[
qtype
])(
pMsgCb
->
pWrapper
,
pReq
);
}
...
...
@@ -38,6 +42,6 @@ void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) {
(
*
pMsgCb
->
registerBrokenLinkArgFp
)(
pMsgCb
->
pWrapper
,
pMsg
);
}
void
tmsgReleaseHandle
(
const
SMsgCb
*
pMsgCb
,
void
*
handle
,
int8_t
type
)
{
(
*
pMsgCb
->
releaseHandleFp
)(
pMsgCb
->
pWrapper
,
handle
,
type
);
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
)
{
(
*
tsDefaultMsgCb
.
releaseHandleFp
)(
tsDefaultMsgCb
.
pWrapper
,
handle
,
type
);
}
\ No newline at end of file
source/dnode/mgmt/container/inc/dnd.h
浏览文件 @
ac6b1213
...
...
@@ -33,6 +33,7 @@
#include "tthread.h"
#include "ttime.h"
#include "tworker.h"
#include "tmsgcb.h"
#include "dnode.h"
#include "monitor.h"
...
...
@@ -140,6 +141,8 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
);
void
dndRegisterBrokenLinkArg
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
void
dndReleaseHandle
(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
int32_t
dndProcessNodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
);
...
...
source/dnode/mgmt/container/src/dndExec.c
浏览文件 @
ac6b1213
...
...
@@ -77,6 +77,8 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) {
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
n
];
pWrapper
->
required
=
dndRequireNode
(
pWrapper
);
if
(
!
pWrapper
->
required
)
continue
;
SMsgCb
msgCb
=
dndCreateMsgcb
(
pWrapper
);
tmsgSetDefaultMsgCb
(
&
msgCb
);
if
(
taosMkDir
(
pWrapper
->
path
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
...
@@ -146,9 +148,13 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t
pMsg
->
ahandle
);
switch
(
ftype
)
{
case
PROC_REG
ISTER
:
case
PROC_REG
:
rpcRegisterBrokenLinkArg
(
pMsg
);
break
;
case
PROC_RELEASE
:
rpcReleaseHandle
(
pMsg
->
handle
,
(
int8_t
)
pMsg
->
code
);
rpcFreeCont
(
pCont
);
break
;
default:
dndSendRpcRsp
(
pWrapper
,
pMsg
);
break
;
...
...
@@ -164,6 +170,9 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) {
pWrapper
->
required
=
dndRequireNode
(
pWrapper
);
if
(
!
pWrapper
->
required
)
continue
;
SMsgCb
msgCb
=
dndCreateMsgcb
(
pWrapper
);
tmsgSetDefaultMsgCb
(
&
msgCb
);
if
(
taosMkDir
(
pWrapper
->
path
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to create dir:%s since %s"
,
pWrapper
->
path
,
terrstr
());
...
...
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
ac6b1213
...
...
@@ -363,29 +363,44 @@ void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
}
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
)
{
if
(
pWrapper
->
procType
==
PROC_CHILD
)
{
int32_t
code
=
-
1
;
do
{
code
=
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pRsp
,
sizeof
(
SRpcMsg
),
pRsp
->
pCont
,
pRsp
->
contLen
,
PROC_RSP
);
if
(
code
!=
0
)
{
taosMsleep
(
10
);
}
}
while
(
code
!=
0
);
}
else
{
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
);
}
}
}
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
{
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
rpcRegisterBrokenLinkArg
(
pMsg
);
}
else
{
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
pMsg
,
sizeof
(
SRpcMsg
),
pMsg
->
pCont
,
pMsg
->
contLen
,
PROC_REG
)
!=
0
)
{
taosMsleep
(
1
);
}
}
}
void
dndReleaseHandle
(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
)
{
if
(
pWrapper
->
procType
!=
PROC_CHILD
)
{
rpcReleaseHandle
(
handle
,
type
);
}
else
{
SRpcMsg
msg
=
{.
handle
=
handle
,
.
code
=
type
};
while
(
taosProcPutToParentQ
(
pWrapper
->
pProc
,
&
msg
,
sizeof
(
SRpcMsg
),
NULL
,
0
,
PROC_RELEASE
)
!=
0
)
{
taosMsleep
(
1
);
}
}
}
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
)
{
SMsgCb
msgCb
=
{
.
pWrapper
=
pWrapper
,
.
registerBrokenLinkArgFp
=
dndRegisterBrokenLinkArg
,
.
releaseHandleFp
=
dndReleaseHandle
,
.
sendMnodeReqFp
=
dndSendReqToMnode
,
.
sendReqFp
=
dndSendReqToDnode
,
.
sendRspFp
=
dndSendRsp
,
};
return
msgCb
;
}
\ No newline at end of file
source/libs/qworker/src/qworker.c
浏览文件 @
ac6b1213
...
...
@@ -432,7 +432,7 @@ int32_t qwKillTaskHandle(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
void
qwFreeTask
(
QW_FPARAMS_DEF
,
SQWTaskCtx
*
ctx
)
{
rpc
ReleaseHandle
(
ctx
->
connInfo
.
handle
,
TAOS_CONN_SERVER
);
tmsg
ReleaseHandle
(
ctx
->
connInfo
.
handle
,
TAOS_CONN_SERVER
);
ctx
->
connInfo
.
handle
=
NULL
;
qwFreeTaskHandle
(
QW_FPARAMS
(),
&
ctx
->
taskHandle
);
...
...
@@ -1282,7 +1282,7 @@ int32_t qwProcessHb(SQWorkerMgmt *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) {
QW_LOCK
(
QW_WRITE
,
&
sch
->
hbConnLock
);
if
(
sch
->
hbConnInfo
.
handle
)
{
rpc
ReleaseHandle
(
sch
->
hbConnInfo
.
handle
,
TAOS_CONN_SERVER
);
tmsg
ReleaseHandle
(
sch
->
hbConnInfo
.
handle
,
TAOS_CONN_SERVER
);
}
memcpy
(
&
sch
->
hbConnInfo
,
&
qwMsg
->
connInfo
,
sizeof
(
qwMsg
->
connInfo
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录