Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
25562295
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看板
提交
25562295
编写于
11月 15, 2021
作者:
Z
zhaoyanggh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix type convert warning
上级
92ab9d9d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
58 deletion
+63
-58
src/kit/taosdemo/inc/demo.h
src/kit/taosdemo/inc/demo.h
+1
-1
src/kit/taosdemo/src/demoInsert.c
src/kit/taosdemo/src/demoInsert.c
+62
-57
未找到文件。
src/kit/taosdemo/inc/demo.h
浏览文件 @
25562295
...
@@ -569,7 +569,7 @@ typedef struct SThreadInfo_S {
...
@@ -569,7 +569,7 @@ typedef struct SThreadInfo_S {
TAOS_SUB
*
tsub
;
TAOS_SUB
*
tsub
;
char
**
lines
;
char
**
lines
;
int
sockfd
;
SOCKET
sockfd
;
}
threadInfo
;
}
threadInfo
;
/* ************ Global variables ************ */
/* ************ Global variables ************ */
...
...
src/kit/taosdemo/src/demoInsert.c
浏览文件 @
25562295
...
@@ -1037,7 +1037,7 @@ int startMultiThreadCreateChildTable(char *cols, int threads,
...
@@ -1037,7 +1037,7 @@ int startMultiThreadCreateChildTable(char *cols, int threads,
int64_t
a
=
ntables
/
threads
;
int64_t
a
=
ntables
/
threads
;
if
(
a
<
1
)
{
if
(
a
<
1
)
{
threads
=
ntables
;
threads
=
(
int
)
ntables
;
a
=
1
;
a
=
1
;
}
}
...
@@ -1046,7 +1046,7 @@ int startMultiThreadCreateChildTable(char *cols, int threads,
...
@@ -1046,7 +1046,7 @@ int startMultiThreadCreateChildTable(char *cols, int threads,
for
(
int64_t
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
pThreadInfo
=
infos
+
i
;
threadInfo
*
pThreadInfo
=
infos
+
i
;
pThreadInfo
->
threadID
=
i
;
pThreadInfo
->
threadID
=
(
int
)
i
;
tstrncpy
(
pThreadInfo
->
db_name
,
db_name
,
TSDB_DB_NAME_LEN
);
tstrncpy
(
pThreadInfo
->
db_name
,
db_name
,
TSDB_DB_NAME_LEN
);
pThreadInfo
->
stbInfo
=
stbInfo
;
pThreadInfo
->
stbInfo
=
stbInfo
;
verbosePrint
(
"%s() %d db_name: %s
\n
"
,
__func__
,
__LINE__
,
db_name
);
verbosePrint
(
"%s() %d db_name: %s
\n
"
,
__func__
,
__LINE__
,
db_name
);
...
@@ -1097,7 +1097,7 @@ int createChildTables() {
...
@@ -1097,7 +1097,7 @@ int createChildTables() {
"creating %"
PRId64
" table(s) with %d thread(s)
\n\n
"
,
"creating %"
PRId64
" table(s) with %d thread(s)
\n\n
"
,
g_totalChildTables
,
g_Dbs
.
threadCountForCreateTbl
);
g_totalChildTables
,
g_Dbs
.
threadCountForCreateTbl
);
}
}
double
start
=
taosGetTimestampMs
();
double
start
=
(
double
)
taosGetTimestampMs
();
char
tblColsBuf
[
TSDB_MAX_BYTES_PER_ROW
];
char
tblColsBuf
[
TSDB_MAX_BYTES_PER_ROW
];
int
len
;
int
len
;
...
@@ -1151,7 +1151,7 @@ int createChildTables() {
...
@@ -1151,7 +1151,7 @@ int createChildTables() {
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
",C%d %s"
,
j
,
g_args
.
dataType
[
j
]);
",C%d %s"
,
j
,
g_args
.
dataType
[
j
]);
}
}
len
=
strlen
(
tblColsBuf
);
len
=
(
int
)
strlen
(
tblColsBuf
);
}
}
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
")"
);
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
")"
);
...
@@ -1172,7 +1172,7 @@ int createChildTables() {
...
@@ -1172,7 +1172,7 @@ int createChildTables() {
}
}
}
}
}
}
double
end
=
taosGetTimestampMs
();
double
end
=
(
double
)
taosGetTimestampMs
();
fprintf
(
stderr
,
fprintf
(
stderr
,
"
\n
Spent %.4f seconds to create %"
PRId64
"
\n
Spent %.4f seconds to create %"
PRId64
" table(s) with %d thread(s), actual %"
PRId64
" table(s) with %d thread(s), actual %"
PRId64
...
@@ -1233,8 +1233,9 @@ static int readTagFromCsvFileToMem(SSuperTable *stbInfo) {
...
@@ -1233,8 +1233,9 @@ static int readTagFromCsvFileToMem(SSuperTable *stbInfo) {
count
++
;
count
++
;
if
(
count
>=
tagCount
-
1
)
{
if
(
count
>=
tagCount
-
1
)
{
char
*
tmp
=
realloc
(
char
*
tmp
=
tagDataBuf
,
(
size_t
)
tagCount
*
1
.
5
*
stbInfo
->
lenOfTagOfOneRow
);
realloc
(
tagDataBuf
,
(
size_t
)(
tagCount
*
1
.
5
*
stbInfo
->
lenOfTagOfOneRow
));
if
(
tmp
!=
NULL
)
{
if
(
tmp
!=
NULL
)
{
tagDataBuf
=
tmp
;
tagDataBuf
=
tmp
;
tagCount
=
(
int
)(
tagCount
*
1
.
5
);
tagCount
=
(
int
)(
tagCount
*
1
.
5
);
...
@@ -1275,7 +1276,7 @@ static void getAndSetRowsFromCsvFile(SSuperTable *stbInfo) {
...
@@ -1275,7 +1276,7 @@ static void getAndSetRowsFromCsvFile(SSuperTable *stbInfo) {
return
;
return
;
}
}
while
(
fgets
(
buf
,
stbInfo
->
maxSqlLen
,
fp
))
{
while
(
fgets
(
buf
,
(
int
)
stbInfo
->
maxSqlLen
,
fp
))
{
line_count
++
;
line_count
++
;
}
}
fclose
(
fp
);
fclose
(
fp
);
...
@@ -1484,28 +1485,28 @@ static int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
...
@@ -1484,28 +1485,28 @@ static int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
}
else
{
}
else
{
tmp
=
rand_int_str
();
tmp
=
rand_int_str
();
}
}
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
INT_BUFF_LEN
));
min
(
tmpLen
+
1
,
INT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_UINT
:
tmp
=
rand_uint_str
();
tmp
=
rand_uint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
INT_BUFF_LEN
));
min
(
tmpLen
+
1
,
INT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
tmp
=
rand_bigint_str
();
tmp
=
rand_bigint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
tmp
=
rand_ubigint_str
();
tmp
=
rand_ubigint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
break
;
break
;
...
@@ -1520,56 +1521,56 @@ static int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
...
@@ -1520,56 +1521,56 @@ static int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
}
else
{
}
else
{
tmp
=
rand_float_str
();
tmp
=
rand_float_str
();
}
}
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
FLOAT_BUFF_LEN
));
min
(
tmpLen
+
1
,
FLOAT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_DOUBLE
:
tmp
=
rand_double_str
();
tmp
=
rand_double_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
DOUBLE_BUFF_LEN
));
min
(
tmpLen
+
1
,
DOUBLE_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
tmp
=
rand_smallint_str
();
tmp
=
rand_smallint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
tmp
=
rand_usmallint_str
();
tmp
=
rand_usmallint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
tmp
=
rand_tinyint_str
();
tmp
=
rand_tinyint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
TINYINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
TINYINT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
tmp
=
rand_utinyint_str
();
tmp
=
rand_utinyint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
TINYINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
TINYINT_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
tmp
=
rand_bool_str
();
tmp
=
rand_bool_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BOOL_BUFF_LEN
));
min
(
tmpLen
+
1
,
BOOL_BUFF_LEN
));
break
;
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
tmp
=
rand_bigint_str
();
tmp
=
rand_bigint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
(
int
)
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
min
(
tmpLen
+
1
,
BIGINT_BUFF_LEN
));
break
;
break
;
...
@@ -2180,7 +2181,7 @@ static int32_t generateStbInterlaceData(threadInfo *pThreadInfo,
...
@@ -2180,7 +2181,7 @@ static int32_t generateStbInterlaceData(threadInfo *pThreadInfo,
SSuperTable
*
stbInfo
=
pThreadInfo
->
stbInfo
;
SSuperTable
*
stbInfo
=
pThreadInfo
->
stbInfo
;
int
headLen
=
int
headLen
=
generateStbSQLHead
(
stbInfo
,
tableName
,
tableSeq
,
pThreadInfo
->
db_name
,
generateStbSQLHead
(
stbInfo
,
tableName
,
tableSeq
,
pThreadInfo
->
db_name
,
pstr
,
*
pRemainderBufLen
);
pstr
,
(
int
)(
*
pRemainderBufLen
)
);
if
(
headLen
<=
0
)
{
if
(
headLen
<=
0
)
{
return
0
;
return
0
;
...
@@ -2230,8 +2231,8 @@ static int64_t generateInterlaceDataWithoutStb(char *tableName, uint32_t batch,
...
@@ -2230,8 +2231,8 @@ static int64_t generateInterlaceDataWithoutStb(char *tableName, uint32_t batch,
uint64_t
*
pRemainderBufLen
)
{
uint64_t
*
pRemainderBufLen
)
{
char
*
pstr
=
buffer
;
char
*
pstr
=
buffer
;
int
headLen
=
int
headLen
=
generateSQLHeadWithoutStb
(
tableName
,
dbName
,
pstr
,
generateSQLHeadWithoutStb
(
tableName
,
dbName
,
pstr
,
*
pRemainderBufLen
);
(
int
)(
*
pRemainderBufLen
)
);
if
(
headLen
<=
0
)
{
if
(
headLen
<=
0
)
{
return
0
;
return
0
;
...
@@ -2506,9 +2507,9 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, char data_type,
...
@@ -2506,9 +2507,9 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, char data_type,
i
++
;
i
++
;
}
}
int64_t
tmpEpoch
;
int64_t
tmpEpoch
;
if
(
TSDB_CODE_SUCCESS
!=
taosParseTime
(
value
,
&
tmpEpoch
,
if
(
TSDB_CODE_SUCCESS
!=
strlen
(
value
),
taosParseTime
(
value
,
&
tmpEpoch
,
(
int32_t
)
strlen
(
value
),
timePrec
,
0
))
{
timePrec
,
0
))
{
free
(
bind_ts2
);
free
(
bind_ts2
);
errorPrint
(
"Input %s, time format error!
\n
"
,
value
);
errorPrint
(
"Input %s, time format error!
\n
"
,
value
);
return
-
1
;
return
-
1
;
...
@@ -2641,7 +2642,7 @@ static int execStbBindParamBatch(threadInfo *pThreadInfo, char *tableName,
...
@@ -2641,7 +2642,7 @@ static int execStbBindParamBatch(threadInfo *pThreadInfo, char *tableName,
uint32_t
columnCount
=
pThreadInfo
->
stbInfo
->
columnCount
;
uint32_t
columnCount
=
pThreadInfo
->
stbInfo
->
columnCount
;
uint32_t
thisBatch
=
MAX_SAMPLES
-
(
*
pSamplePos
);
uint32_t
thisBatch
=
(
uint32_t
)(
MAX_SAMPLES
-
(
*
pSamplePos
)
);
if
(
thisBatch
>
batch
)
{
if
(
thisBatch
>
batch
)
{
thisBatch
=
batch
;
thisBatch
=
batch
;
...
@@ -2814,10 +2815,10 @@ static int execStbBindParamBatch(threadInfo *pThreadInfo, char *tableName,
...
@@ -2814,10 +2815,10 @@ static int execStbBindParamBatch(threadInfo *pThreadInfo, char *tableName,
for
(
int
b
=
0
;
b
<
thisBatch
;
b
++
)
{
for
(
int
b
=
0
;
b
<
thisBatch
;
b
++
)
{
if
(
param
->
buffer_type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
param
->
buffer_type
==
TSDB_DATA_TYPE_NCHAR
)
{
param
->
length
[
b
]
=
strlen
((
char
*
)
param
->
buffer
+
param
->
length
[
b
]
=
(
int32_t
)
strlen
(
b
*
stbInfo
->
columns
[
c
].
dataLen
);
(
char
*
)
param
->
buffer
+
b
*
stbInfo
->
columns
[
c
].
dataLen
);
}
else
{
}
else
{
param
->
length
[
b
]
=
param
->
buffer_length
;
param
->
length
[
b
]
=
(
int32_t
)
param
->
buffer_length
;
}
}
}
}
param
->
is_null
=
pThreadInfo
->
is_null
;
param
->
is_null
=
pThreadInfo
->
is_null
;
...
@@ -2977,7 +2978,7 @@ static int parseSamplefileToStmtBatch(SSuperTable *stbInfo) {
...
@@ -2977,7 +2978,7 @@ static int parseSamplefileToStmtBatch(SSuperTable *stbInfo) {
char
data_type
=
char
data_type
=
(
stbInfo
)
?
stbInfo
->
columns
[
c
].
data_type
:
g_args
.
data_type
[
c
];
(
stbInfo
)
?
stbInfo
->
columns
[
c
].
data_type
:
g_args
.
data_type
[
c
];
char
*
restStr
=
sampleDataBuf
+
lenOfOneRow
*
i
+
cursor
;
char
*
restStr
=
sampleDataBuf
+
lenOfOneRow
*
i
+
cursor
;
int
lengthOfRest
=
strlen
(
restStr
);
int
lengthOfRest
=
(
int
)
strlen
(
restStr
);
int
index
=
0
;
int
index
=
0
;
for
(
index
=
0
;
index
<
lengthOfRest
;
index
++
)
{
for
(
index
=
0
;
index
<
lengthOfRest
;
index
++
)
{
...
@@ -3183,7 +3184,7 @@ int32_t generateStbProgressiveData(SSuperTable *stbInfo, char *tableName,
...
@@ -3183,7 +3184,7 @@ int32_t generateStbProgressiveData(SSuperTable *stbInfo, char *tableName,
memset
(
pstr
,
0
,
*
pRemainderBufLen
);
memset
(
pstr
,
0
,
*
pRemainderBufLen
);
int64_t
headLen
=
generateStbSQLHead
(
stbInfo
,
tableName
,
tableSeq
,
dbName
,
int64_t
headLen
=
generateStbSQLHead
(
stbInfo
,
tableName
,
tableSeq
,
dbName
,
buffer
,
*
pRemainderBufLen
);
buffer
,
(
int
)(
*
pRemainderBufLen
)
);
if
(
headLen
<=
0
)
{
if
(
headLen
<=
0
)
{
return
0
;
return
0
;
...
@@ -3209,8 +3210,8 @@ int32_t generateProgressiveDataWithoutStb(char *tableName,
...
@@ -3209,8 +3210,8 @@ int32_t generateProgressiveDataWithoutStb(char *tableName,
memset
(
buffer
,
0
,
*
pRemainderBufLen
);
memset
(
buffer
,
0
,
*
pRemainderBufLen
);
int64_t
headLen
=
generateSQLHeadWithoutStb
(
tableName
,
pThreadInfo
->
db_name
,
int64_t
headLen
=
generateSQLHeadWithoutStb
(
buffer
,
*
pRemainderBufLen
);
tableName
,
pThreadInfo
->
db_name
,
buffer
,
(
int
)(
*
pRemainderBufLen
)
);
if
(
headLen
<=
0
)
{
if
(
headLen
<=
0
)
{
return
0
;
return
0
;
...
@@ -3316,7 +3317,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
...
@@ -3316,7 +3317,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
if
(
remainPerInterlace
>
precalcBatch
)
{
if
(
remainPerInterlace
>
precalcBatch
)
{
batch
=
precalcBatch
;
batch
=
precalcBatch
;
}
else
{
}
else
{
batch
=
remainPerInterlace
;
batch
=
(
uint32_t
)
remainPerInterlace
;
}
}
debugPrint
(
debugPrint
(
"[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"
PRId64
"[%d] %s() LN%d, tableName:%s, batch:%d startTime:%"
PRId64
...
@@ -3356,7 +3357,8 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
...
@@ -3356,7 +3357,8 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
startTs
=
taosGetTimestampUs
();
startTs
=
taosGetTimestampUs
();
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
generated
);
int64_t
affectedRows
=
execInsert
(
pThreadInfo
,
(
uint32_t
)
generated
);
endTs
=
taosGetTimestampUs
();
endTs
=
taosGetTimestampUs
();
uint64_t
delay
=
endTs
-
startTs
;
uint64_t
delay
=
endTs
-
startTs
;
...
@@ -3385,7 +3387,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
...
@@ -3385,7 +3387,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
(
int
)(
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
)
;
if
(
currentPercent
>
percentComplete
)
{
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
currentPercent
);
...
@@ -3420,7 +3422,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
...
@@ -3420,7 +3422,7 @@ static void *syncWriteInterlaceStmtBatch(threadInfo *pThreadInfo,
performancePrint
(
"%s() LN%d sleep: %"
PRId64
performancePrint
(
"%s() LN%d sleep: %"
PRId64
" ms for insert interval
\n
"
,
" ms for insert interval
\n
"
,
__func__
,
__LINE__
,
sleepTime
);
__func__
,
__LINE__
,
sleepTime
);
taosMsleep
(
sleepTime
);
// ms
taosMsleep
(
(
int32_t
)
sleepTime
);
// ms
sleepTimeTotal
+=
insert_interval
;
sleepTimeTotal
+=
insert_interval
;
}
}
}
}
...
@@ -3535,7 +3537,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
...
@@ -3535,7 +3537,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
pThreadInfo
,
tableName
,
batchPerTbl
,
i
,
batchPerTblTimes
,
pThreadInfo
,
tableName
,
batchPerTbl
,
i
,
batchPerTblTimes
,
tableSeq
,
pstr
,
insertRows
,
startTime
,
&
remainderBufLen
);
tableSeq
,
pstr
,
insertRows
,
startTime
,
&
remainderBufLen
);
}
else
{
}
else
{
generated
=
generateInterlaceDataWithoutStb
(
generated
=
(
int32_t
)
generateInterlaceDataWithoutStb
(
tableName
,
batchPerTbl
,
tableSeq
,
pThreadInfo
->
db_name
,
tableName
,
batchPerTbl
,
tableSeq
,
pThreadInfo
->
db_name
,
pstr
,
insertRows
,
startTime
,
&
remainderBufLen
);
pstr
,
insertRows
,
startTime
,
&
remainderBufLen
);
}
}
...
@@ -3575,7 +3577,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
...
@@ -3575,7 +3577,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
int64_t
remainRows
=
insertRows
-
generatedRecPerTbl
;
int64_t
remainRows
=
insertRows
-
generatedRecPerTbl
;
if
((
remainRows
>
0
)
&&
(
batchPerTbl
>
remainRows
))
if
((
remainRows
>
0
)
&&
(
batchPerTbl
>
remainRows
))
batchPerTbl
=
remainRows
;
batchPerTbl
=
(
uint32_t
)
remainRows
;
if
(
pThreadInfo
->
ntables
*
batchPerTbl
<
g_args
.
reqPerReq
)
if
(
pThreadInfo
->
ntables
*
batchPerTbl
<
g_args
.
reqPerReq
)
break
;
break
;
...
@@ -3637,7 +3639,8 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
...
@@ -3637,7 +3639,8 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
int
currentPercent
=
(
int
)(
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
);
if
(
currentPercent
>
percentComplete
)
{
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
percentComplete
=
currentPercent
;
percentComplete
=
currentPercent
;
...
@@ -3659,7 +3662,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
...
@@ -3659,7 +3662,7 @@ void *syncWriteInterlace(threadInfo *pThreadInfo, uint32_t interlaceRows) {
performancePrint
(
"%s() LN%d sleep: %"
PRId64
performancePrint
(
"%s() LN%d sleep: %"
PRId64
" ms for insert interval
\n
"
,
" ms for insert interval
\n
"
,
__func__
,
__LINE__
,
sleepTime
);
__func__
,
__LINE__
,
sleepTime
);
taosMsleep
(
sleepTime
);
// ms
taosMsleep
(
(
int32_t
)
sleepTime
);
// ms
sleepTimeTotal
+=
insert_interval
;
sleepTimeTotal
+=
insert_interval
;
}
}
}
}
...
@@ -3718,9 +3721,9 @@ void *syncWriteProgressiveStmt(threadInfo *pThreadInfo) {
...
@@ -3718,9 +3721,9 @@ void *syncWriteProgressiveStmt(threadInfo *pThreadInfo) {
if
(
stbInfo
)
{
if
(
stbInfo
)
{
generated
=
prepareStbStmt
(
generated
=
prepareStbStmt
(
pThreadInfo
,
tableName
,
tableSeq
,
pThreadInfo
,
tableName
,
tableSeq
,
(
g_args
.
reqPerReq
>
stbInfo
->
insertRows
)
(
uint32_t
)((
g_args
.
reqPerReq
>
stbInfo
->
insertRows
)
?
stbInfo
->
insertRows
?
stbInfo
->
insertRows
:
g_args
.
reqPerReq
,
:
g_args
.
reqPerReq
)
,
insertRows
,
i
,
start_time
,
&
(
pThreadInfo
->
samplePos
));
insertRows
,
i
,
start_time
,
&
(
pThreadInfo
->
samplePos
));
}
else
{
}
else
{
generated
=
prepareStmtWithoutStb
(
pThreadInfo
,
tableName
,
generated
=
prepareStmtWithoutStb
(
pThreadInfo
,
tableName
,
...
@@ -3765,7 +3768,7 @@ void *syncWriteProgressiveStmt(threadInfo *pThreadInfo) {
...
@@ -3765,7 +3768,7 @@ void *syncWriteProgressiveStmt(threadInfo *pThreadInfo) {
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
(
int
)(
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
)
;
if
(
currentPercent
>
percentComplete
)
{
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
percentComplete
=
currentPercent
;
percentComplete
=
currentPercent
;
...
@@ -3864,9 +3867,9 @@ void *syncWriteProgressive(threadInfo *pThreadInfo) {
...
@@ -3864,9 +3867,9 @@ void *syncWriteProgressive(threadInfo *pThreadInfo) {
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
generated
=
prepareStbStmt
(
generated
=
prepareStbStmt
(
pThreadInfo
,
tableName
,
tableSeq
,
pThreadInfo
,
tableName
,
tableSeq
,
(
g_args
.
reqPerReq
>
stbInfo
->
insertRows
)
(
uint32_t
)((
g_args
.
reqPerReq
>
stbInfo
->
insertRows
)
?
stbInfo
->
insertRows
?
stbInfo
->
insertRows
:
g_args
.
reqPerReq
,
:
g_args
.
reqPerReq
)
,
insertRows
,
i
,
start_time
,
&
(
pThreadInfo
->
samplePos
));
insertRows
,
i
,
start_time
,
&
(
pThreadInfo
->
samplePos
));
}
else
{
}
else
{
generated
=
generateStbProgressiveData
(
generated
=
generateStbProgressiveData
(
...
@@ -3926,7 +3929,7 @@ void *syncWriteProgressive(threadInfo *pThreadInfo) {
...
@@ -3926,7 +3929,7 @@ void *syncWriteProgressive(threadInfo *pThreadInfo) {
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
pThreadInfo
->
totalAffectedRows
+=
affectedRows
;
int
currentPercent
=
int
currentPercent
=
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
;
(
int
)(
pThreadInfo
->
totalAffectedRows
*
100
/
totalRows
)
;
if
(
currentPercent
>
percentComplete
)
{
if
(
currentPercent
>
percentComplete
)
{
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
printf
(
"[%d]:%d%%
\n
"
,
pThreadInfo
->
threadID
,
currentPercent
);
percentComplete
=
currentPercent
;
percentComplete
=
currentPercent
;
...
@@ -4005,12 +4008,12 @@ void callBack(void *param, TAOS_RES *res, int code) {
...
@@ -4005,12 +4008,12 @@ void callBack(void *param, TAOS_RES *res, int code) {
SSuperTable
*
stbInfo
=
pThreadInfo
->
stbInfo
;
SSuperTable
*
stbInfo
=
pThreadInfo
->
stbInfo
;
int
insert_interval
=
int
insert_interval
=
stbInfo
?
stbInfo
->
insertInterval
:
g_args
.
insert_interval
;
(
int
)(
stbInfo
?
stbInfo
->
insertInterval
:
g_args
.
insert_interval
)
;
if
(
insert_interval
)
{
if
(
insert_interval
)
{
pThreadInfo
->
et
=
taosGetTimestampMs
();
pThreadInfo
->
et
=
taosGetTimestampMs
();
if
((
pThreadInfo
->
et
-
pThreadInfo
->
st
)
<
insert_interval
)
{
if
((
pThreadInfo
->
et
-
pThreadInfo
->
st
)
<
insert_interval
)
{
taosMsleep
(
insert_interval
-
taosMsleep
(
insert_interval
-
(
pThreadInfo
->
et
-
pThreadInfo
->
st
));
// ms
(
int32_t
)(
pThreadInfo
->
et
-
pThreadInfo
->
st
));
// ms
}
}
}
}
...
@@ -4072,7 +4075,7 @@ void *asyncWrite(void *sarg) {
...
@@ -4072,7 +4075,7 @@ void *asyncWrite(void *sarg) {
pThreadInfo
->
lastTs
=
pThreadInfo
->
start_time
;
pThreadInfo
->
lastTs
=
pThreadInfo
->
start_time
;
int
insert_interval
=
int
insert_interval
=
stbInfo
?
stbInfo
->
insertInterval
:
g_args
.
insert_interval
;
(
int
)(
stbInfo
?
stbInfo
->
insertInterval
:
g_args
.
insert_interval
)
;
if
(
insert_interval
)
{
if
(
insert_interval
)
{
pThreadInfo
->
st
=
taosGetTimestampMs
();
pThreadInfo
->
st
=
taosGetTimestampMs
();
}
}
...
@@ -4106,7 +4109,8 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
...
@@ -4106,7 +4109,8 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
}
else
{
}
else
{
if
(
TSDB_CODE_SUCCESS
!=
if
(
TSDB_CODE_SUCCESS
!=
taosParseTime
(
stbInfo
->
startTimestamp
,
&
startTime
,
taosParseTime
(
stbInfo
->
startTimestamp
,
&
startTime
,
strlen
(
stbInfo
->
startTimestamp
),
timePrec
,
0
))
{
(
int32_t
)
strlen
(
stbInfo
->
startTimestamp
),
timePrec
,
0
))
{
errorPrint
(
"failed to parse time %s
\n
"
,
errorPrint
(
"failed to parse time %s
\n
"
,
stbInfo
->
startTimestamp
);
stbInfo
->
startTimestamp
);
return
-
1
;
return
-
1
;
...
@@ -4220,7 +4224,7 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
...
@@ -4220,7 +4224,7 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
int64_t
a
=
ntables
/
threads
;
int64_t
a
=
ntables
/
threads
;
if
(
a
<
1
)
{
if
(
a
<
1
)
{
threads
=
ntables
;
threads
=
(
int
)
ntables
;
a
=
1
;
a
=
1
;
}
}
...
@@ -4272,8 +4276,9 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
...
@@ -4272,8 +4276,9 @@ int startMultiThreadInsertData(int threads, char *db_name, char *precision,
if
(
interlaceRows
>
0
)
{
if
(
interlaceRows
>
0
)
{
batch
=
interlaceRows
;
batch
=
interlaceRows
;
}
else
{
}
else
{
batch
=
(
g_args
.
reqPerReq
>
g_args
.
insertRows
)
?
g_args
.
insertRows
batch
=
(
uint32_t
)((
g_args
.
reqPerReq
>
g_args
.
insertRows
)
:
g_args
.
reqPerReq
;
?
g_args
.
insertRows
:
g_args
.
reqPerReq
);
}
}
if
((
g_args
.
iface
==
STMT_IFACE
)
||
if
((
g_args
.
iface
==
STMT_IFACE
)
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录