Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c1f25f3a
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看板
提交
c1f25f3a
编写于
3月 24, 2022
作者:
P
plum-lihui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[add check tmq consume result]
上级
af560c84
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
13 deletion
+34
-13
tests/script/tsim/insert/null.sim
tests/script/tsim/insert/null.sim
+0
-2
tests/script/tsim/tmq/basic.sim
tests/script/tsim/tmq/basic.sim
+7
-3
tests/test/c/tmqDemo.c
tests/test/c/tmqDemo.c
+27
-8
未找到文件。
tests/script/tsim/insert/null.sim
浏览文件 @
c1f25f3a
...
@@ -244,8 +244,6 @@ endi
...
@@ -244,8 +244,6 @@ endi
# return -1
# return -1
#endi
#endi
return
#===================================================================
#===================================================================
#===================================================================
#===================================================================
...
...
tests/script/tsim/tmq/basic.sim
浏览文件 @
c1f25f3a
...
@@ -47,9 +47,12 @@ sql drop database useless_db
...
@@ -47,9 +47,12 @@ sql drop database useless_db
# -m startTimestamp, default is 1640966400000 [2022-01-01 00:00:00]
# -m startTimestamp, default is 1640966400000 [2022-01-01 00:00:00]
# -g showMsgFlag, default is 0
# -g showMsgFlag, default is 0
#
#
#system_content ../../debug/tests/test/c/tmq_demo -c ../../sim/tsim/cfg
print cmd===> system_content ../../debug/tests/test/c/tmq_demo -sim 1 -b 100 -c ../../sim/tsim/cfg -w ../../sim/dnode1/data/vnode/vnode4/wal
system ../../debug/tests/test/c/tmq_demo -c ../../sim/tsim/cfg
system_content ../../debug/tests/test/c/tmq_demo -sim 1 -b 100 -c ../../sim/tsim/cfg -w ../../sim/dnode1/data/vnode/vnode4/wal
print result-> $system_content
print cmd result----> $system_content
if $system_content != @{consume success: 100}@ then
print not match in pos000
endi
sql show databases
sql show databases
print ===> $rows $data00 $data01 $data02 $data03
print ===> $rows $data00 $data01 $data02 $data03
...
@@ -78,4 +81,5 @@ endi
...
@@ -78,4 +81,5 @@ endi
if $data00 != 10000 then
if $data00 != 10000 then
return -1
return -1
endi
endi
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/test/c/tmqDemo.c
浏览文件 @
c1f25f3a
...
@@ -58,6 +58,7 @@ typedef struct {
...
@@ -58,6 +58,7 @@ typedef struct {
int32_t
totalRowsOfPerTbl
;
int32_t
totalRowsOfPerTbl
;
int64_t
startTimestamp
;
int64_t
startTimestamp
;
int32_t
showMsgFlag
;
int32_t
showMsgFlag
;
int32_t
simCase
;
int32_t
totalRowsOfT2
;
int32_t
totalRowsOfT2
;
}
SConfInfo
;
}
SConfInfo
;
...
@@ -66,7 +67,7 @@ static SConfInfo g_stConfInfo = {
...
@@ -66,7 +67,7 @@ static SConfInfo g_stConfInfo = {
"tmqdb"
,
"tmqdb"
,
"stb"
,
"stb"
,
"./tmqResult.txt"
,
// output_file
"./tmqResult.txt"
,
// output_file
"/data2/dnode/data/vnode
s
/vnode2/wal"
,
"/data2/dnode/data/vnode/vnode2/wal"
,
1
,
// threads
1
,
// threads
1
,
// tables
1
,
// tables
1
,
// vgroups
1
,
// vgroups
...
@@ -77,6 +78,7 @@ static SConfInfo g_stConfInfo = {
...
@@ -77,6 +78,7 @@ static SConfInfo g_stConfInfo = {
10000
,
// total rows for per table
10000
,
// total rows for per table
0
,
// 2020-01-01 00:00:00.000
0
,
// 2020-01-01 00:00:00.000
0
,
// show consume msg switch
0
,
// show consume msg switch
0
,
// if run in sim case
10000
,
10000
,
};
};
...
@@ -117,6 +119,8 @@ static void printHelp() {
...
@@ -117,6 +119,8 @@ static void printHelp() {
printf
(
"%s%s%s%"
PRId64
"
\n
"
,
indent
,
indent
,
"startTimestamp, default is "
,
g_stConfInfo
.
startTimestamp
);
printf
(
"%s%s%s%"
PRId64
"
\n
"
,
indent
,
indent
,
"startTimestamp, default is "
,
g_stConfInfo
.
startTimestamp
);
printf
(
"%s%s
\n
"
,
indent
,
"-g"
);
printf
(
"%s%s
\n
"
,
indent
,
"-g"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"showMsgFlag, default is "
,
g_stConfInfo
.
showMsgFlag
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"showMsgFlag, default is "
,
g_stConfInfo
.
showMsgFlag
);
printf
(
"%s%s
\n
"
,
indent
,
"-sim"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"simCase, default is "
,
g_stConfInfo
.
simCase
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
...
@@ -160,14 +164,17 @@ void parseArgument(int32_t argc, char *argv[]) {
...
@@ -160,14 +164,17 @@ void parseArgument(int32_t argc, char *argv[]) {
g_stConfInfo
.
startTimestamp
=
atol
(
argv
[
++
i
]);
g_stConfInfo
.
startTimestamp
=
atol
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-g"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-g"
)
==
0
)
{
g_stConfInfo
.
showMsgFlag
=
atol
(
argv
[
++
i
]);
g_stConfInfo
.
showMsgFlag
=
atol
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-sim"
)
==
0
)
{
g_stConfInfo
.
simCase
=
atol
(
argv
[
++
i
]);
}
else
{
}
else
{
p
Print
(
"%s unknow para: %s %s"
,
GREEN
,
argv
[
++
i
],
NC
);
p
rintf
(
"%s unknow para: %s %s"
,
GREEN
,
argv
[
++
i
],
NC
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
g_stConfInfo
.
totalRowsOfT2
=
g_stConfInfo
.
totalRowsOfPerTbl
*
g_stConfInfo
.
ratio
;
g_stConfInfo
.
totalRowsOfT2
=
g_stConfInfo
.
totalRowsOfPerTbl
*
g_stConfInfo
.
ratio
;
#if 0
pPrint("%s configDir:%s %s", GREEN, configDir, NC);
pPrint("%s configDir:%s %s", GREEN, configDir, NC);
pPrint("%s dbName:%s %s", GREEN, g_stConfInfo.dbName, NC);
pPrint("%s dbName:%s %s", GREEN, g_stConfInfo.dbName, NC);
pPrint("%s stbName:%s %s", GREEN, g_stConfInfo.stbName, NC);
pPrint("%s stbName:%s %s", GREEN, g_stConfInfo.stbName, NC);
...
@@ -184,6 +191,7 @@ void parseArgument(int32_t argc, char *argv[]) {
...
@@ -184,6 +191,7 @@ void parseArgument(int32_t argc, char *argv[]) {
pPrint("%s totalRowsOfT2:%d %s", GREEN, g_stConfInfo.totalRowsOfT2, NC);
pPrint("%s totalRowsOfT2:%d %s", GREEN, g_stConfInfo.totalRowsOfT2, NC);
pPrint("%s startTimestamp:%" PRId64" %s", GREEN, g_stConfInfo.startTimestamp, NC);
pPrint("%s startTimestamp:%" PRId64" %s", GREEN, g_stConfInfo.startTimestamp, NC);
pPrint("%s showMsgFlag:%d %s", GREEN, g_stConfInfo.showMsgFlag, NC);
pPrint("%s showMsgFlag:%d %s", GREEN, g_stConfInfo.showMsgFlag, NC);
#endif
}
}
static
int
running
=
1
;
static
int
running
=
1
;
...
@@ -429,15 +437,21 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog
...
@@ -429,15 +437,21 @@ void perf_loop(tmq_t* tmq, tmq_list_t* topics, int32_t totalMsgs, int64_t walLog
double
consumeTime
=
(
double
)(
endTime
-
startTime
)
/
1000000
;
double
consumeTime
=
(
double
)(
endTime
-
startTime
)
/
1000000
;
if
(
batchCnt
!=
totalMsgs
)
{
if
(
batchCnt
!=
totalMsgs
)
{
pPrint
(
"%s inserted msgs: %d and consume msgs: %d mismatch %s"
,
GREEN
,
totalMsgs
,
batchCnt
,
NC
);
printf
(
"%s inserted msgs: %d and consume msgs: %d mismatch %s"
,
GREEN
,
totalMsgs
,
batchCnt
,
NC
);
exit
(
-
1
);
}
}
pPrint
(
"consume result: msgs: %d, skip log cnt: %d, time used:%.3f second
\n
"
,
batchCnt
,
skipLogNum
,
consumeTime
);
if
(
0
==
g_stConfInfo
.
simCase
)
{
printf
(
"consume result: msgs: %d, skip log cnt: %d, time used:%.3f second
\n
"
,
batchCnt
,
skipLogNum
,
consumeTime
);
}
else
{
printf
(
"{consume success: %d}"
,
totalMsgs
);
}
taosFprintfFile
(
g_fp
,
"|%10d | %10.3f | %8.2f | %10.2f| %10.2f |
\n
"
,
batchCnt
,
consumeTime
,
(
double
)
batchCnt
/
consumeTime
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
)
/
consumeTime
,
(
double
)
walLogSize
/
1024
.
0
/
batchCnt
);
taosFprintfFile
(
g_fp
,
"|%10d | %10.3f | %8.2f | %10.2f| %10.2f |
\n
"
,
batchCnt
,
consumeTime
,
(
double
)
batchCnt
/
consumeTime
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
)
/
consumeTime
,
(
double
)
walLogSize
/
1024
.
0
/
batchCnt
);
err
=
tmq_consumer_close
(
tmq
);
err
=
tmq_consumer_close
(
tmq
);
if
(
err
)
{
if
(
err
)
{
fprintf
(
stderr
,
"%% Failed to close consumer: %s
\n
"
,
tmq_err2str
(
err
));
fprintf
(
stderr
,
"%% Failed to close consumer: %s
\n
"
,
tmq_err2str
(
err
));
exit
(
-
1
);
}
}
}
}
...
@@ -679,12 +693,17 @@ int main(int32_t argc, char *argv[]) {
...
@@ -679,12 +693,17 @@ int main(int32_t argc, char *argv[]) {
walLogSize
=
getDirectorySize
(
g_stConfInfo
.
vnodeWalPath
);
walLogSize
=
getDirectorySize
(
g_stConfInfo
.
vnodeWalPath
);
if
(
walLogSize
<=
0
)
{
if
(
walLogSize
<=
0
)
{
pError
(
"vnode2/wal size incorrect!"
);
printf
(
"vnode2/wal size incorrect!"
);
exit
(
-
1
);
}
else
{
}
else
{
pPrint
(
".log file size in vnode2/wal: %.3f MBytes
\n
"
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
));
if
(
0
==
g_stConfInfo
.
simCase
)
{
pPrint
(
".log file size in vnode2/wal: %.3f MBytes
\n
"
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
));
}
}
}
pPrint
(
"insert result: %d rows, %d msgs, time:%.3f sec, speed:%.1f rows/second, %.1f msgs/second
\n
"
,
totalRows
,
totalMsgs
,
seconds
,
rowsSpeed
,
msgsSpeed
);
if
(
0
==
g_stConfInfo
.
simCase
)
{
pPrint
(
"insert result: %d rows, %d msgs, time:%.3f sec, speed:%.1f rows/second, %.1f msgs/second
\n
"
,
totalRows
,
totalMsgs
,
seconds
,
rowsSpeed
,
msgsSpeed
);
}
taosFprintfFile
(
g_fp
,
"|%10d | %10.3f | %8.2f | %10.3f "
,
totalMsgs
,
seconds
,
msgsSpeed
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
));
taosFprintfFile
(
g_fp
,
"|%10d | %10.3f | %8.2f | %10.3f "
,
totalMsgs
,
seconds
,
msgsSpeed
,
(
double
)
walLogSize
/
(
1024
*
1024
.
0
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录