Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
adminstrot
TDengine
提交
e891ecc8
TDengine
项目概览
adminstrot
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e891ecc8
编写于
3月 03, 2021
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3147] <fix>: change insert rate to insert interval.
上级
069b9888
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
25 deletion
+23
-25
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+23
-25
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
e891ecc8
...
...
@@ -266,7 +266,7 @@ typedef struct SSuperTable_S {
char
childTblPrefix
[
MAX_TB_NAME_SIZE
];
char
dataSource
[
MAX_TB_NAME_SIZE
];
// rand_gen or sample
char
insertMode
[
MAX_TB_NAME_SIZE
];
// taosc, restful
int
insert
Rate
;
// 0: unlimit > 0 rows/s
int
insert
Interval
;
// interval time between insert twice
int
multiThreadWriteOneTbl
;
// 0: no, 1: yes
int
numberOfTblInOneSql
;
// 0/1: one table, > 1: number of tbl
...
...
@@ -1015,7 +1015,7 @@ static int printfInsertMeta() {
printf
(
" childTblPrefix:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblPrefix
);
printf
(
" dataSource:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
dataSource
);
printf
(
" insertMode:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
);
printf
(
" insert
Rate:
\033
[33m%d
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRate
);
printf
(
" insert
Interval:
\033
[33m%d
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertInterval
);
printf
(
" insertRows:
\033
[33m%"
PRId64
"
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRows
);
if
(
0
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
multiThreadWriteOneTbl
)
{
...
...
@@ -1153,7 +1153,7 @@ static void printfInsertMetaToFile(FILE* fp) {
fprintf
(
fp
,
" childTblPrefix: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblPrefix
);
fprintf
(
fp
,
" dataSource: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
dataSource
);
fprintf
(
fp
,
" insertMode: %s
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertMode
);
fprintf
(
fp
,
" insert
Rate: %d
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRate
);
fprintf
(
fp
,
" insert
Interval: %d
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertInterval
);
fprintf
(
fp
,
" insertRows: %"
PRId64
"
\n
"
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insertRows
);
if
(
0
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
multiThreadWriteOneTbl
)
{
...
...
@@ -2997,11 +2997,11 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
}
cJSON
*
insert
Rate
=
cJSON_GetObjectItem
(
stbInfo
,
"insert_rate
"
);
if
(
insert
Rate
&&
insertRate
->
type
==
cJSON_Number
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insert
Rate
=
insertRate
->
valueint
;
}
else
if
(
!
insert
Rate
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insert
Rate
=
0
;
cJSON
*
insert
Interval
=
cJSON_GetObjectItem
(
stbInfo
,
"insert_interval
"
);
if
(
insert
Interval
&&
insertInterval
->
type
==
cJSON_Number
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insert
Interval
=
insertInterval
->
valueint
;
}
else
if
(
!
insert
Interval
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
insert
Interval
=
0
;
}
else
{
printf
(
"failed to read json, insert_rate not found"
);
goto
PARSE_OVER
;
...
...
@@ -3558,12 +3558,11 @@ void syncWriteForNumberOfTblInOneSql(threadInfo *winfo, FILE *fp, char* sampleDa
int64_t
st
=
0
;
int64_t
et
=
0
;
for
(
int
i
=
0
;
i
<
superTblInfo
->
insertRows
;)
{
if
(
superTblInfo
->
insertRate
&&
(
et
-
st
)
<
1000
)
{
taosMsleep
(
1000
-
(
et
-
st
));
// ms
//printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id);
if
(
superTblInfo
->
insertInterval
&&
(
superTblInfo
->
insertInterval
>
(
et
-
st
)))
{
taosMsleep
(
superTblInfo
->
insertInterval
-
(
et
-
st
));
// ms
}
if
(
superTblInfo
->
insert
Rate
)
{
if
(
superTblInfo
->
insert
Interval
)
{
st
=
taosGetTimestampMs
();
}
...
...
@@ -3709,7 +3708,7 @@ void syncWriteForNumberOfTblInOneSql(threadInfo *winfo, FILE *fp, char* sampleDa
}
}
if
(
superTblInfo
->
insert
Rate
)
{
if
(
superTblInfo
->
insert
Interval
)
{
et
=
taosGetTimestampMs
();
}
//printf("========loop %d childTables duration:%"PRId64 "========inserted rows:%d\n", winfo->end_table_id - winfo->start_table_id, et - st, i);
...
...
@@ -3817,12 +3816,11 @@ void *syncWrite(void *sarg) {
int64_t
st
=
0
;
int64_t
et
=
0
;
for
(
int
i
=
0
;
i
<
superTblInfo
->
insertRows
;)
{
if
(
superTblInfo
->
insertRate
&&
(
et
-
st
)
<
1000
)
{
taosMsleep
(
1000
-
(
et
-
st
));
// ms
//printf("========sleep duration:%"PRId64 "========inserted rows:%d, table range:%d - %d\n", (1000 - (et - st)), i, winfo->start_table_id, winfo->end_table_id);
if
(
superTblInfo
->
insertInterval
&&
(
superTblInfo
->
insertInterval
>
(
et
-
st
)
))
{
taosMsleep
(
superTblInfo
->
insertInterval
-
(
et
-
st
));
// ms
}
if
(
superTblInfo
->
insert
Rate
)
{
if
(
superTblInfo
->
insert
Interval
)
{
st
=
taosGetTimestampMs
();
}
...
...
@@ -3950,7 +3948,7 @@ void *syncWrite(void *sarg) {
}
}
if
(
superTblInfo
->
insert
Rate
)
{
if
(
superTblInfo
->
insert
Interval
)
{
et
=
taosGetTimestampMs
();
}
//printf("========loop %d childTables duration:%"PRId64 "========inserted rows:%d\n", winfo->end_table_id - winfo->start_table_id, et - st, i);
...
...
@@ -3971,7 +3969,7 @@ void *syncWrite(void *sarg) {
void
callBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
)
{
threadInfo
*
winfo
=
(
threadInfo
*
)
param
;
if
(
winfo
->
superTblInfo
->
insert
Rate
)
{
if
(
winfo
->
superTblInfo
->
insert
Interval
)
{
winfo
->
et
=
taosGetTimestampMs
();
if
(
winfo
->
et
-
winfo
->
st
<
1000
)
{
taosMsleep
(
1000
-
(
winfo
->
et
-
winfo
->
st
));
// ms
...
...
@@ -4013,7 +4011,7 @@ void callBack(void *param, TAOS_RES *res, int code) {
}
}
if
(
winfo
->
superTblInfo
->
insert
Rate
)
{
if
(
winfo
->
superTblInfo
->
insert
Interval
)
{
winfo
->
st
=
taosGetTimestampMs
();
}
taos_query_a
(
winfo
->
taos
,
buffer
,
callBack
,
winfo
);
...
...
@@ -4033,9 +4031,9 @@ void *asyncWrite(void *sarg) {
// winfo->nrecords_per_request = (winfo->superTblInfo->maxSqlLen - 1280) / winfo->superTblInfo->lenOfOneRow;
//}
if
(
0
!=
winfo
->
superTblInfo
->
insert
Rate
)
{
if
(
winfo
->
nrecords_per_request
>=
winfo
->
superTblInfo
->
insert
Rate
)
{
winfo
->
nrecords_per_request
=
winfo
->
superTblInfo
->
insert
Rate
;
if
(
0
!=
winfo
->
superTblInfo
->
insert
Interval
)
{
if
(
winfo
->
nrecords_per_request
>=
winfo
->
superTblInfo
->
insert
Interval
)
{
winfo
->
nrecords_per_request
=
winfo
->
superTblInfo
->
insert
Interval
;
}
}
...
...
@@ -4055,7 +4053,7 @@ void *asyncWrite(void *sarg) {
winfo
->
et
=
0
;
winfo
->
lastTs
=
winfo
->
start_time
;
if
(
winfo
->
superTblInfo
->
insert
Rate
)
{
if
(
winfo
->
superTblInfo
->
insert
Interval
)
{
winfo
->
st
=
taosGetTimestampMs
();
}
taos_query_a
(
winfo
->
taos
,
"show databases"
,
callBack
,
winfo
);
...
...
@@ -4951,7 +4949,7 @@ void setParaFromArg(){
g_Dbs
.
db
[
0
].
superTbls
[
0
].
autoCreateTable
=
PRE_CREATE_SUBTBL
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
superTblExists
=
TBL_NO_EXISTS
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
childTblExists
=
TBL_NO_EXISTS
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
insert
Rate
=
0
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
insert
Interval
=
0
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
disorderRange
=
g_args
.
disorderRange
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
disorderRatio
=
g_args
.
disorderRatio
;
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
childTblPrefix
,
g_args
.
tb_prefix
,
MAX_TB_NAME_SIZE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录