Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
ceeb22d6
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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,发现更多精彩内容 >>
未验证
提交
ceeb22d6
编写于
8月 25, 2021
作者:
sangshuduo
提交者:
GitHub
8月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
better msg for create child table. (#7565)
上级
15362557
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
39 addition
and
19 deletion
+39
-19
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+39
-19
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
ceeb22d6
...
...
@@ -443,6 +443,7 @@ typedef struct SThreadInfo_S {
uint64_t
start_table_from
;
uint64_t
end_table_to
;
int64_t
ntables
;
int64_t
tables_created
;
uint64_t
data_of_rate
;
int64_t
start_time
;
char
*
cols
;
...
...
@@ -639,6 +640,7 @@ SArguments g_args = {
static
SDbs
g_Dbs
;
static
int64_t
g_totalChildTables
=
0
;
static
int64_t
g_actualChildTables
=
0
;
static
SQueryMetaInfo
g_queryInfo
;
static
FILE
*
g_fpOfInsertResult
=
NULL
;
...
...
@@ -964,6 +966,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
}
arguments
->
num_of_tables
=
atoi
(
argv
[
++
i
]);
g_totalChildTables
=
arguments
->
num_of_tables
;
}
else
if
(
strcmp
(
argv
[
i
],
"-n"
)
==
0
)
{
if
((
argc
==
i
+
1
)
||
(
!
isStringNumber
(
argv
[
i
+
1
])))
{
...
...
@@ -1134,7 +1137,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
}
}
else
if
((
strcmp
(
argv
[
i
],
"--version"
)
==
0
)
||
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
)){
(
strcmp
(
argv
[
i
],
"-V"
)
==
0
))
{
printVersion
();
exit
(
0
);
}
else
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
...
...
@@ -1345,14 +1348,14 @@ static void selectAndGetResult(
}
}
static
char
*
rand_bool_str
(){
static
char
*
rand_bool_str
()
{
static
int
cursor
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randbool_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
BOOL_BUFF_LEN
);
}
static
int32_t
rand_bool
(){
static
int32_t
rand_bool
()
{
static
int
cursor
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
...
...
@@ -1485,7 +1488,7 @@ static char *demo_phase_float_str() {
return
g_rand_phase_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
FLOAT_BUFF_LEN
);
}
static
float
UNUSED_FUNC
demo_phase_float
(){
static
float
UNUSED_FUNC
demo_phase_float
()
{
static
int
cursor
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
...
...
@@ -1564,7 +1567,7 @@ static void init_rand_data() {
g_randdouble_buff
=
calloc
(
1
,
DOUBLE_BUFF_LEN
*
MAX_PREPARED_RAND
);
assert
(
g_randdouble_buff
);
for
(
int
i
=
0
;
i
<
MAX_PREPARED_RAND
;
i
++
){
for
(
int
i
=
0
;
i
<
MAX_PREPARED_RAND
;
i
++
)
{
g_randint
[
i
]
=
(
int
)(
taosRandom
()
%
65535
);
sprintf
(
g_randint_buff
+
i
*
INT_BUFF_LEN
,
"%d"
,
g_randint
[
i
]);
...
...
@@ -3276,6 +3279,7 @@ static void* createTable(void *sarg)
pThreadInfo
->
db_name
,
g_args
.
tb_prefix
,
i
,
pThreadInfo
->
cols
);
batchNum
++
;
}
else
{
if
(
stbInfo
==
NULL
)
{
free
(
pThreadInfo
->
buffer
);
...
...
@@ -3325,13 +3329,14 @@ static void* createTable(void *sarg)
len
=
0
;
if
(
0
!=
queryDbExec
(
pThreadInfo
->
taos
,
pThreadInfo
->
buffer
,
NO_INSERT_TYPE
,
false
)){
NO_INSERT_TYPE
,
false
))
{
errorPrint2
(
"queryDbExec() failed. buffer:
\n
%s
\n
"
,
pThreadInfo
->
buffer
);
free
(
pThreadInfo
->
buffer
);
return
NULL
;
}
pThreadInfo
->
tables_created
+=
batchNum
;
uint64_t
currentPrintTime
=
taosGetTimestampMs
();
uint64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] already create %"
PRIu64
" - %"
PRIu64
" tables
\n
"
,
pThreadInfo
->
threadID
,
pThreadInfo
->
start_table_from
,
i
);
...
...
@@ -3401,6 +3406,7 @@ static int startMultiThreadCreateChildTable(
pThreadInfo
->
use_metric
=
true
;
pThreadInfo
->
cols
=
cols
;
pThreadInfo
->
minDelay
=
UINT64_MAX
;
pThreadInfo
->
tables_created
=
0
;
pthread_create
(
pids
+
i
,
NULL
,
createTable
,
pThreadInfo
);
}
...
...
@@ -3411,6 +3417,8 @@ static int startMultiThreadCreateChildTable(
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
pThreadInfo
=
infos
+
i
;
taos_close
(
pThreadInfo
->
taos
);
g_actualChildTables
+=
pThreadInfo
->
tables_created
;
}
free
(
pids
);
...
...
@@ -3437,7 +3445,6 @@ static void createChildTables() {
verbosePrint
(
"%s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreateChildTable
);
uint64_t
startFrom
=
0
;
g_totalChildTables
+=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
;
verbosePrint
(
"%s() LN%d: create %"
PRId64
" child tables from %"
PRIu64
"
\n
"
,
__func__
,
__LINE__
,
g_totalChildTables
,
startFrom
);
...
...
@@ -4232,6 +4239,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
}
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
=
count
->
valueint
;
g_totalChildTables
+=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
;
cJSON
*
dataSource
=
cJSON_GetObjectItem
(
stbInfo
,
"data_source"
);
if
(
dataSource
&&
dataSource
->
type
==
cJSON_String
...
...
@@ -4936,7 +4944,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON
*
result
=
cJSON_GetObjectItem
(
sql
,
"result"
);
if
(
result
!=
NULL
&&
result
->
type
==
cJSON_String
&&
result
->
valuestring
!=
NULL
){
&&
result
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_queryInfo
.
superQueryInfo
.
result
[
j
],
result
->
valuestring
,
MAX_FILE_NAME_LEN
);
}
else
if
(
NULL
==
result
)
{
...
...
@@ -7586,7 +7594,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
int
ret
=
taos_stmt_prepare
(
pThreadInfo
->
stmt
,
stmtBuffer
,
0
);
if
(
ret
!=
0
){
if
(
ret
!=
0
)
{
free
(
pids
);
free
(
infos
);
free
(
stmtBuffer
);
...
...
@@ -7932,18 +7940,30 @@ static int insertTestProcess() {
double
start
;
double
end
;
// create child tables
start
=
taosGetTimestampMs
();
createChildTables
();
end
=
taosGetTimestampMs
();
if
(
g_totalChildTables
>
0
)
{
fprintf
(
stderr
,
"Spent %.4f seconds to create %"
PRId64
" tables with %d thread(s)
\n\n
"
,
(
end
-
start
)
/
1000
.
0
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
);
fprintf
(
stderr
,
"creating %"
PRId64
" table(s) with %d thread(s)
\n\n
"
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
);
if
(
g_fpOfInsertResult
)
{
fprintf
(
g_fpOfInsertResult
,
"creating %"
PRId64
" table(s) with %d thread(s)
\n\n
"
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
);
}
// create child tables
start
=
taosGetTimestampMs
();
createChildTables
();
end
=
taosGetTimestampMs
();
fprintf
(
stderr
,
"Spent %.4f seconds to create %"
PRId64
" table(s) with %d thread(s), actual %"
PRId64
" table(s) created
\n\n
"
,
(
end
-
start
)
/
1000
.
0
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
,
g_actualChildTables
);
if
(
g_fpOfInsertResult
)
{
fprintf
(
g_fpOfInsertResult
,
"Spent %.4f seconds to create %"
PRId64
" tables with %d thread(s)
\n\n
"
,
(
end
-
start
)
/
1000
.
0
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
);
"Spent %.4f seconds to create %"
PRId64
" table(s) with %d thread(s), actual %"
PRId64
" table(s) created
\n\n
"
,
(
end
-
start
)
/
1000
.
0
,
g_totalChildTables
,
g_Dbs
.
threadCountByCreateTbl
,
g_actualChildTables
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录