Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
563d2ec6
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
563d2ec6
编写于
4月 06, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc test
上级
16382206
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
5 deletion
+65
-5
source/dnode/mgmt/main/dndExec.c
source/dnode/mgmt/main/dndExec.c
+1
-0
source/util/src/tprocess.c
source/util/src/tprocess.c
+1
-0
source/util/test/procTest.cpp
source/util/test/procTest.cpp
+63
-5
未找到文件。
source/dnode/mgmt/main/dndExec.c
浏览文件 @
563d2ec6
...
...
@@ -89,6 +89,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, ENodeType n) {
}
static
void
dndProcessProcHandle
(
void
*
handle
)
{
dInfo
(
"handle:%p, the child process dies and send an offline rsp"
,
handle
);
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_DND_OFFLINE
};
rpcSendResponse
(
&
rpcMsg
);
}
...
...
source/util/src/tprocess.c
浏览文件 @
563d2ec6
...
...
@@ -476,6 +476,7 @@ void taosProcCloseHandles(SProcObj *pProc, void (*HandleFp)(void *handle)) {
while
(
h
!=
NULL
)
{
void
*
handle
=
*
((
void
**
)
h
);
(
*
HandleFp
)(
handle
);
h
=
taosHashIterate
(
pProc
->
hash
,
h
);
}
taosThreadMutexUnlock
(
&
pProc
->
pChildQueue
->
mutex
);
}
...
...
source/util/test/procTest.cpp
浏览文件 @
563d2ec6
...
...
@@ -103,7 +103,7 @@ TEST_F(UtilTesProc, 01_Push_Pop_Child) {
.
parentFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
shm
=
shm
,
.
parent
=
(
void
*
)((
int64_t
)
1235
),
.
name
=
"
child_queue
"
};
.
name
=
"
1235_c
"
};
SProcObj
*
cproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
cproc
,
nullptr
);
...
...
@@ -123,7 +123,7 @@ TEST_F(UtilTesProc, 01_Push_Pop_Child) {
ASSERT_NE
(
taosProcPutToChildQ
(
cproc
,
&
head
,
sizeof
(
SRpcMsg
),
body
,
i
,
0
,
PROC_REQ
),
0
);
cfg
.
isChild
=
true
;
cfg
.
name
=
"
child_queue
"
;
cfg
.
name
=
"
1235_p
"
;
SProcObj
*
pproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
pproc
,
nullptr
);
taosProcRun
(
pproc
);
...
...
@@ -160,12 +160,12 @@ TEST_F(UtilTesProc, 02_Push_Pop_Parent) {
.
parentMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
parentFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
shm
=
shm
,
.
parent
=
(
void
*
)((
int64_t
)
123
5
),
.
name
=
"
child_queue
"
};
.
parent
=
(
void
*
)((
int64_t
)
123
6
),
.
name
=
"
1236_c
"
};
SProcObj
*
cproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
cproc
,
nullptr
);
cfg
.
name
=
"
parent_queue
"
;
cfg
.
name
=
"
1236_p
"
;
cfg
.
isChild
=
true
;
SProcObj
*
pproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
pproc
,
nullptr
);
...
...
@@ -184,3 +184,61 @@ TEST_F(UtilTesProc, 02_Push_Pop_Parent) {
taosProcCleanup
(
cproc
);
taosDropShm
(
&
shm
);
}
void
ConsumeChild3
(
void
*
parent
,
void
*
pHead
,
int16_t
headLen
,
void
*
pBody
,
int32_t
bodyLen
,
ProcFuncType
ftype
)
{
SRpcMsg
msg
;
memcpy
(
&
msg
,
pHead
,
headLen
);
char
body
[
2000
]
=
{
0
};
memcpy
(
body
,
pBody
,
bodyLen
);
uDebug
(
"====> parent:%"
PRId64
" ftype:%d, headLen:%d bodyLen:%d handle:%"
PRId64
" body:%s <===="
,
(
int64_t
)
parent
,
ftype
,
headLen
,
bodyLen
,
(
int64_t
)
msg
.
handle
,
body
);
rpcFreeCont
(
pBody
);
taosFreeQitem
(
pHead
);
}
void
processHandle
(
void
*
handle
)
{
uDebug
(
"----> remove handle:%"
PRId64
" <----"
,
(
int64_t
)
handle
);
}
TEST_F
(
UtilTesProc
,
03
_Handle
)
{
// uDebugFlag = 207;
shm
.
size
=
3000
;
ASSERT_EQ
(
taosCreateShm
(
&
shm
,
1237
,
shm
.
size
),
0
);
SProcCfg
cfg
=
{.
childConsumeFp
=
(
ProcConsumeFp
)
ConsumeChild3
,
.
childMallocHeadFp
=
(
ProcMallocFp
)
taosAllocateQitem
,
.
childFreeHeadFp
=
(
ProcFreeFp
)
taosFreeQitem
,
.
childMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
childFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
parentConsumeFp
=
(
ProcConsumeFp
)
NULL
,
.
parentMallocHeadFp
=
(
ProcMallocFp
)
taosMemoryMalloc
,
.
parentFreeHeadFp
=
(
ProcFreeFp
)
taosMemoryFree
,
.
parentMallocBodyFp
=
(
ProcMallocFp
)
rpcMallocCont
,
.
parentFreeBodyFp
=
(
ProcFreeFp
)
rpcFreeCont
,
.
shm
=
shm
,
.
parent
=
(
void
*
)((
int64_t
)
1235
),
.
name
=
"1237_p"
};
SProcObj
*
cproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
cproc
,
nullptr
);
for
(
int32_t
j
=
0
;
j
<
1
;
j
++
)
{
int32_t
i
=
0
;
for
(
i
=
0
;
i
<
20
;
++
i
)
{
head
.
handle
=
(
void
*
)((
int64_t
)
i
);
ASSERT_EQ
(
taosProcPutToChildQ
(
cproc
,
&
head
,
sizeof
(
SRpcMsg
),
body
,
i
,
(
void
*
)((
int64_t
)
i
),
PROC_REQ
),
0
);
}
cfg
.
isChild
=
true
;
cfg
.
name
=
"child_queue"
;
SProcObj
*
pproc
=
taosProcInit
(
&
cfg
);
ASSERT_NE
(
pproc
,
nullptr
);
taosProcRun
(
pproc
);
taosProcCleanup
(
pproc
);
taosProcRemoveHandle
(
cproc
,
(
void
*
)((
int64_t
)
3
));
taosProcRemoveHandle
(
cproc
,
(
void
*
)((
int64_t
)
5
));
taosProcRemoveHandle
(
cproc
,
(
void
*
)((
int64_t
)
6
));
taosProcCloseHandles
(
cproc
,
processHandle
);
}
taosProcCleanup
(
cproc
);
taosDropShm
(
&
shm
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录