Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
97281931
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
97281931
编写于
8月 20, 2021
作者:
sangshuduo
提交者:
GitHub
8月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6219]<fix>: remove few taosdemo macros. (#7469)
上级
41154369
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
0 addition
and
62 deletion
+0
-62
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+0
-62
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
97281931
...
@@ -53,14 +53,6 @@
...
@@ -53,14 +53,6 @@
#include "taoserror.h"
#include "taoserror.h"
#include "tutil.h"
#include "tutil.h"
#define STMT_IFACE_ENABLED 1
#define NANO_SECOND_ENABLED 1
#define SET_THREADNAME_ENABLED 1
#if SET_THREADNAME_ENABLED == 0
#define setThreadName(name)
#endif
#define REQ_EXTRA_BUF_LEN 1024
#define REQ_EXTRA_BUF_LEN 1024
#define RESP_BUF_LEN 4096
#define RESP_BUF_LEN 4096
...
@@ -295,9 +287,7 @@ typedef struct SSuperTable_S {
...
@@ -295,9 +287,7 @@ typedef struct SSuperTable_S {
uint64_t
lenOfTagOfOneRow
;
uint64_t
lenOfTagOfOneRow
;
char
*
sampleDataBuf
;
char
*
sampleDataBuf
;
#if STMT_IFACE_ENABLED == 1
char
*
sampleBindArray
;
char
*
sampleBindArray
;
#endif
//int sampleRowCount;
//int sampleRowCount;
//int sampleUsePos;
//int sampleUsePos;
...
@@ -733,11 +723,7 @@ static void printHelp() {
...
@@ -733,11 +723,7 @@ static void printHelp() {
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-P"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-P"
,
indent
,
"The TCP/IP port number to use for the connection. Default is 0."
);
"The TCP/IP port number to use for the connection. Default is 0."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
#if STMT_IFACE_ENABLED == 1
"The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'."
);
"The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'."
);
#else
"The interface (taosc, rest) taosdemo uses. Default is 'taosc'."
);
#endif
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-d"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-d"
,
indent
,
"Destination database. Default is 'test'."
);
"Destination database. Default is 'test'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-a"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-a"
,
indent
,
...
@@ -850,10 +836,8 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -850,10 +836,8 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
arguments
->
iface
=
TAOSC_IFACE
;
arguments
->
iface
=
TAOSC_IFACE
;
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"rest"
))
{
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"rest"
))
{
arguments
->
iface
=
REST_IFACE
;
arguments
->
iface
=
REST_IFACE
;
#if STMT_IFACE_ENABLED == 1
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"stmt"
))
{
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"stmt"
))
{
arguments
->
iface
=
STMT_IFACE
;
arguments
->
iface
=
STMT_IFACE
;
#endif
}
else
{
}
else
{
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
@@ -1695,9 +1679,7 @@ static int printfInsertMeta() {
...
@@ -1695,9 +1679,7 @@ static int printfInsertMeta() {
}
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
[
0
]
!=
0
)
{
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
[
0
]
!=
0
)
{
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
#if NANO_SECOND_ENABLED == 1
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
))
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
))
#endif
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ns"
,
2
)))
{
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ns"
,
2
)))
{
printf
(
" precision:
\033
[33m%s
\033
[0m
\n
"
,
printf
(
" precision:
\033
[33m%s
\033
[0m
\n
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
...
@@ -1888,9 +1870,7 @@ static void printfInsertMetaToFile(FILE* fp) {
...
@@ -1888,9 +1870,7 @@ static void printfInsertMetaToFile(FILE* fp) {
}
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
[
0
]
!=
0
)
{
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
[
0
]
!=
0
)
{
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
#if NANO_SECOND_ENABLED == 1
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ns"
,
2
))
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ns"
,
2
))
#endif
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
)))
{
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
)))
{
fprintf
(
fp
,
" precision: %s
\n
"
,
fprintf
(
fp
,
" precision: %s
\n
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
...
@@ -2093,10 +2073,8 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -2093,10 +2073,8 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
time_t
tt
;
time_t
tt
;
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
tt
=
(
time_t
)(
val
/
1000000
);
tt
=
(
time_t
)(
val
/
1000000
);
#if NANO_SECOND_ENABLED == 1
}
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
}
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
tt
=
(
time_t
)(
val
/
1000000000
);
tt
=
(
time_t
)(
val
/
1000000000
);
#endif
}
else
{
}
else
{
tt
=
(
time_t
)(
val
/
1000
);
tt
=
(
time_t
)(
val
/
1000
);
}
}
...
@@ -2118,10 +2096,8 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -2118,10 +2096,8 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
sprintf
(
buf
+
pos
,
".%06d"
,
(
int
)(
val
%
1000000
));
sprintf
(
buf
+
pos
,
".%06d"
,
(
int
)(
val
%
1000000
));
#if NANO_SECOND_ENABLED == 1
}
else
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
}
else
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
sprintf
(
buf
+
pos
,
".%09d"
,
(
int
)(
val
%
1000000000
));
sprintf
(
buf
+
pos
,
".%09d"
,
(
int
)(
val
%
1000000000
));
#endif
}
else
{
}
else
{
sprintf
(
buf
+
pos
,
".%03d"
,
(
int
)(
val
%
1000
));
sprintf
(
buf
+
pos
,
".%03d"
,
(
int
)(
val
%
1000
));
}
}
...
@@ -3182,10 +3158,8 @@ int createDatabasesAndStables(char *command) {
...
@@ -3182,10 +3158,8 @@ int createDatabasesAndStables(char *command) {
" fsync %d"
,
g_Dbs
.
db
[
i
].
dbCfg
.
fsync
);
" fsync %d"
,
g_Dbs
.
db
[
i
].
dbCfg
.
fsync
);
}
}
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
#if NANO_SECOND_ENABLED == 1
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ns"
,
2
))
"ns"
,
2
))
#endif
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
)))
{
"us"
,
2
)))
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
...
@@ -4264,10 +4238,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -4264,10 +4238,8 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
TAOSC_IFACE
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
TAOSC_IFACE
;
}
else
if
(
0
==
strcasecmp
(
stbIface
->
valuestring
,
"rest"
))
{
}
else
if
(
0
==
strcasecmp
(
stbIface
->
valuestring
,
"rest"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
REST_IFACE
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
REST_IFACE
;
#if STMT_IFACE_ENABLED == 1
}
else
if
(
0
==
strcasecmp
(
stbIface
->
valuestring
,
"stmt"
))
{
}
else
if
(
0
==
strcasecmp
(
stbIface
->
valuestring
,
"stmt"
))
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
STMT_IFACE
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
iface
=
STMT_IFACE
;
#endif
}
else
{
}
else
{
errorPrint
(
"%s() LN%d, failed to read json, insert_mode %s not recognized
\n
"
,
errorPrint
(
"%s() LN%d, failed to read json, insert_mode %s not recognized
\n
"
,
__func__
,
__LINE__
,
stbIface
->
valuestring
);
__func__
,
__LINE__
,
stbIface
->
valuestring
);
...
@@ -5076,7 +5048,6 @@ static void postFreeResource() {
...
@@ -5076,7 +5048,6 @@ static void postFreeResource() {
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
);
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
);
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
=
NULL
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
=
NULL
;
}
}
#if STMT_IFACE_ENABLED == 1
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleBindArray
)
{
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleBindArray
)
{
for
(
int
k
=
0
;
k
<
MAX_SAMPLES_ONCE_FROM_FILE
;
k
++
)
{
for
(
int
k
=
0
;
k
<
MAX_SAMPLES_ONCE_FROM_FILE
;
k
++
)
{
uintptr_t
*
tmp
=
(
uintptr_t
*
)(
*
(
uintptr_t
*
)(
uintptr_t
*
tmp
=
(
uintptr_t
*
)(
*
(
uintptr_t
*
)(
...
@@ -5091,7 +5062,6 @@ static void postFreeResource() {
...
@@ -5091,7 +5062,6 @@ static void postFreeResource() {
}
}
}
}
tmfree
((
char
*
)
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleBindArray
);
tmfree
((
char
*
)
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleBindArray
);
#endif
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
)
{
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
)
{
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
);
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
);
...
@@ -5384,7 +5354,6 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k)
...
@@ -5384,7 +5354,6 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k)
}
}
break
;
break
;
#if STMT_IFACE_ENABLED == 1
case
STMT_IFACE
:
case
STMT_IFACE
:
debugPrint
(
"%s() LN%d, stmt=%p"
,
debugPrint
(
"%s() LN%d, stmt=%p"
,
__func__
,
__LINE__
,
pThreadInfo
->
stmt
);
__func__
,
__LINE__
,
pThreadInfo
->
stmt
);
...
@@ -5397,7 +5366,6 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k)
...
@@ -5397,7 +5366,6 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k)
}
}
affectedRows
=
k
;
affectedRows
=
k
;
break
;
break
;
#endif
default:
default:
errorPrint
(
"%s() LN%d: unknown insert mode: %d
\n
"
,
errorPrint
(
"%s() LN%d: unknown insert mode: %d
\n
"
,
...
@@ -5770,7 +5738,6 @@ static int64_t generateInterlaceDataWithoutStb(
...
@@ -5770,7 +5738,6 @@ static int64_t generateInterlaceDataWithoutStb(
return
k
;
return
k
;
}
}
#if STMT_IFACE_ENABLED == 1
static
int32_t
prepareStmtBindArrayByType
(
static
int32_t
prepareStmtBindArrayByType
(
TAOS_BIND
*
bind
,
TAOS_BIND
*
bind
,
char
*
dataType
,
int32_t
dataLen
,
char
*
dataType
,
int32_t
dataLen
,
...
@@ -6605,7 +6572,6 @@ static int32_t prepareStbStmtWithSample(
...
@@ -6605,7 +6572,6 @@ static int32_t prepareStbStmtWithSample(
return
k
;
return
k
;
}
}
#endif
static
int32_t
generateStbProgressiveData
(
static
int32_t
generateStbProgressiveData
(
SSuperTable
*
stbInfo
,
SSuperTable
*
stbInfo
,
...
@@ -6806,7 +6772,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
...
@@ -6806,7 +6772,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
int32_t
generated
;
int32_t
generated
;
if
(
stbInfo
)
{
if
(
stbInfo
)
{
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
#if STMT_IFACE_ENABLED == 1
if
(
sourceRand
)
{
if
(
sourceRand
)
{
generated
=
prepareStbStmtRand
(
generated
=
prepareStbStmtRand
(
pThreadInfo
,
pThreadInfo
,
...
@@ -6826,9 +6791,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
...
@@ -6826,9 +6791,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
startTime
,
startTime
,
&
(
pThreadInfo
->
samplePos
));
&
(
pThreadInfo
->
samplePos
));
}
}
#else
generated
=
-
1
;
#endif
}
else
{
}
else
{
generated
=
generateStbInterlaceData
(
generated
=
generateStbInterlaceData
(
pThreadInfo
,
pThreadInfo
,
...
@@ -6846,16 +6808,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
...
@@ -6846,16 +6808,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pThreadInfo
->
threadID
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
__func__
,
__LINE__
,
tableName
,
batchPerTbl
,
startTime
);
tableName
,
batchPerTbl
,
startTime
);
#if STMT_IFACE_ENABLED == 1
generated
=
prepareStmtWithoutStb
(
generated
=
prepareStmtWithoutStb
(
pThreadInfo
,
pThreadInfo
,
tableName
,
tableName
,
batchPerTbl
,
batchPerTbl
,
insertRows
,
i
,
insertRows
,
i
,
startTime
);
startTime
);
#else
generated
=
-
1
;
#endif
}
else
{
}
else
{
generated
=
generateInterlaceDataWithoutStb
(
generated
=
generateInterlaceDataWithoutStb
(
tableName
,
batchPerTbl
,
tableName
,
batchPerTbl
,
...
@@ -7068,7 +7026,6 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
...
@@ -7068,7 +7026,6 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
int32_t
generated
;
int32_t
generated
;
if
(
stbInfo
)
{
if
(
stbInfo
)
{
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
if
(
stbInfo
->
iface
==
STMT_IFACE
)
{
#if STMT_IFACE_ENABLED == 1
if
(
sourceRand
)
{
if
(
sourceRand
)
{
generated
=
prepareStbStmtRand
(
generated
=
prepareStbStmtRand
(
pThreadInfo
,
pThreadInfo
,
...
@@ -7087,9 +7044,6 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
...
@@ -7087,9 +7044,6 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
insertRows
,
i
,
start_time
,
insertRows
,
i
,
start_time
,
&
(
pThreadInfo
->
samplePos
));
&
(
pThreadInfo
->
samplePos
));
}
}
#else
generated
=
-
1
;
#endif
}
else
{
}
else
{
generated
=
generateStbProgressiveData
(
generated
=
generateStbProgressiveData
(
stbInfo
,
stbInfo
,
...
@@ -7101,16 +7055,12 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
...
@@ -7101,16 +7055,12 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
}
}
}
else
{
}
else
{
if
(
g_args
.
iface
==
STMT_IFACE
)
{
if
(
g_args
.
iface
==
STMT_IFACE
)
{
#if STMT_IFACE_ENABLED == 1
generated
=
prepareStmtWithoutStb
(
generated
=
prepareStmtWithoutStb
(
pThreadInfo
,
pThreadInfo
,
tableName
,
tableName
,
g_args
.
num_of_RPR
,
g_args
.
num_of_RPR
,
insertRows
,
i
,
insertRows
,
i
,
start_time
);
start_time
);
#else
generated
=
-
1
;
#endif
}
else
{
}
else
{
generated
=
generateProgressiveDataWithoutStb
(
generated
=
generateProgressiveDataWithoutStb
(
tableName
,
tableName
,
...
@@ -7330,7 +7280,6 @@ static int convertHostToServAddr(char *host, uint16_t port, struct sockaddr_in *
...
@@ -7330,7 +7280,6 @@ static int convertHostToServAddr(char *host, uint16_t port, struct sockaddr_in *
return
0
;
return
0
;
}
}
#if STMT_IFACE_ENABLED == 1
static
int
parseSampleFileToStmt
(
SSuperTable
*
stbInfo
,
uint32_t
timePrec
)
static
int
parseSampleFileToStmt
(
SSuperTable
*
stbInfo
,
uint32_t
timePrec
)
{
{
stbInfo
->
sampleBindArray
=
calloc
(
1
,
sizeof
(
char
*
)
*
MAX_SAMPLES_ONCE_FROM_FILE
);
stbInfo
->
sampleBindArray
=
calloc
(
1
,
sizeof
(
char
*
)
*
MAX_SAMPLES_ONCE_FROM_FILE
);
...
@@ -7401,7 +7350,6 @@ static int parseSampleFileToStmt(SSuperTable *stbInfo, uint32_t timePrec)
...
@@ -7401,7 +7350,6 @@ static int parseSampleFileToStmt(SSuperTable *stbInfo, uint32_t timePrec)
return
0
;
return
0
;
}
}
#endif
static
void
startMultiThreadInsertData
(
int
threads
,
char
*
db_name
,
static
void
startMultiThreadInsertData
(
int
threads
,
char
*
db_name
,
char
*
precision
,
SSuperTable
*
stbInfo
)
{
char
*
precision
,
SSuperTable
*
stbInfo
)
{
...
@@ -7412,10 +7360,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7412,10 +7360,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
timePrec
=
TSDB_TIME_PRECISION_MILLI
;
timePrec
=
TSDB_TIME_PRECISION_MILLI
;
}
else
if
(
0
==
strncasecmp
(
precision
,
"us"
,
2
))
{
}
else
if
(
0
==
strncasecmp
(
precision
,
"us"
,
2
))
{
timePrec
=
TSDB_TIME_PRECISION_MICRO
;
timePrec
=
TSDB_TIME_PRECISION_MICRO
;
#if NANO_SECOND_ENABLED == 1
}
else
if
(
0
==
strncasecmp
(
precision
,
"ns"
,
2
))
{
}
else
if
(
0
==
strncasecmp
(
precision
,
"ns"
,
2
))
{
timePrec
=
TSDB_TIME_PRECISION_NANO
;
timePrec
=
TSDB_TIME_PRECISION_NANO
;
#endif
}
else
{
}
else
{
errorPrint
(
"Not support precision: %s
\n
"
,
precision
);
errorPrint
(
"Not support precision: %s
\n
"
,
precision
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
@@ -7558,7 +7504,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7558,7 +7504,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
#if STMT_IFACE_ENABLED == 1
char
*
stmtBuffer
=
calloc
(
1
,
BUFFER_SIZE
);
char
*
stmtBuffer
=
calloc
(
1
,
BUFFER_SIZE
);
assert
(
stmtBuffer
);
assert
(
stmtBuffer
);
if
((
g_args
.
iface
==
STMT_IFACE
)
if
((
g_args
.
iface
==
STMT_IFACE
)
...
@@ -7599,7 +7544,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7599,7 +7544,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
parseSampleFileToStmt
(
stbInfo
,
timePrec
);
parseSampleFileToStmt
(
stbInfo
,
timePrec
);
}
}
}
}
#endif
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
pThreadInfo
=
infos
+
i
;
threadInfo
*
pThreadInfo
=
infos
+
i
;
...
@@ -7627,7 +7571,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7627,7 +7571,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
#if STMT_IFACE_ENABLED == 1
if
((
g_args
.
iface
==
STMT_IFACE
)
if
((
g_args
.
iface
==
STMT_IFACE
)
||
((
stbInfo
)
||
((
stbInfo
)
&&
(
stbInfo
->
iface
==
STMT_IFACE
)))
{
&&
(
stbInfo
->
iface
==
STMT_IFACE
)))
{
...
@@ -7655,7 +7598,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7655,7 +7598,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
pThreadInfo
->
bind_ts
=
malloc
(
sizeof
(
int64_t
));
pThreadInfo
->
bind_ts
=
malloc
(
sizeof
(
int64_t
));
}
}
#endif
}
else
{
}
else
{
pThreadInfo
->
taos
=
NULL
;
pThreadInfo
->
taos
=
NULL
;
}
}
...
@@ -7681,9 +7623,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7681,9 +7623,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
}
}
#if STMT_IFACE_ENABLED == 1
free
(
stmtBuffer
);
free
(
stmtBuffer
);
#endif
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
pthread_join
(
pids
[
i
],
NULL
);
pthread_join
(
pids
[
i
],
NULL
);
...
@@ -7698,12 +7638,10 @@ static void startMultiThreadInsertData(int threads, char* db_name,
...
@@ -7698,12 +7638,10 @@ static void startMultiThreadInsertData(int threads, char* db_name,
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
pThreadInfo
=
infos
+
i
;
threadInfo
*
pThreadInfo
=
infos
+
i
;
#if STMT_IFACE_ENABLED == 1
if
(
pThreadInfo
->
stmt
)
{
if
(
pThreadInfo
->
stmt
)
{
taos_stmt_close
(
pThreadInfo
->
stmt
);
taos_stmt_close
(
pThreadInfo
->
stmt
);
tmfree
((
char
*
)
pThreadInfo
->
bind_ts
);
tmfree
((
char
*
)
pThreadInfo
->
bind_ts
);
}
}
#endif
tsem_destroy
(
&
(
pThreadInfo
->
lock_sem
));
tsem_destroy
(
&
(
pThreadInfo
->
lock_sem
));
taos_close
(
pThreadInfo
->
taos
);
taos_close
(
pThreadInfo
->
taos
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录