Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7bcca63e
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看板
提交
7bcca63e
编写于
3月 08, 2021
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3197] <fix>: fix taosdump and taosdemo coverity scan issue.
上级
bfc1b0df
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
15 deletion
+22
-15
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+20
-15
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+2
-0
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
7bcca63e
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#include "cJSON.h"
#include "cJSON.h"
#include "taos.h"
#include "taos.h"
#include "taoserror.h"
#include "tutil.h"
#include "tutil.h"
#define REQ_EXTRA_BUF_LEN 1024
#define REQ_EXTRA_BUF_LEN 1024
...
@@ -838,7 +839,8 @@ static void getResult(TAOS_RES *res, char* resultFileName) {
...
@@ -838,7 +839,8 @@ static void getResult(TAOS_RES *res, char* resultFileName) {
char
*
databuf
=
(
char
*
)
calloc
(
1
,
100
*
1024
*
1024
);
char
*
databuf
=
(
char
*
)
calloc
(
1
,
100
*
1024
*
1024
);
if
(
databuf
==
NULL
)
{
if
(
databuf
==
NULL
)
{
fprintf
(
stderr
,
"failed to malloc, warning: save result to file slowly!
\n
"
);
fprintf
(
stderr
,
"failed to malloc, warning: save result to file slowly!
\n
"
);
fclose
(
fp
);
if
(
fp
)
fclose
(
fp
);
return
;
return
;
}
}
...
@@ -1669,6 +1671,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1669,6 +1671,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
ERROR_EXIT
(
"ERROR storing complete response from socket"
);
ERROR_EXIT
(
"ERROR storing complete response from socket"
);
}
}
response_buf
[
RESP_BUF_LEN
-
1
]
=
'\0'
;
printf
(
"Response:
\n
%s
\n
"
,
response_buf
);
printf
(
"Response:
\n
%s
\n
"
,
response_buf
);
free
(
request_buf
);
free
(
request_buf
);
...
@@ -2290,6 +2293,8 @@ int startMultiThreadCreateChildTable(
...
@@ -2290,6 +2293,8 @@ int startMultiThreadCreateChildTable(
g_Dbs
.
port
);
g_Dbs
.
port
);
if
(
t_info
->
taos
==
NULL
)
{
if
(
t_info
->
taos
==
NULL
)
{
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
free
(
pids
);
free
(
infos
);
return
-
1
;
return
-
1
;
}
}
t_info
->
start_table_id
=
last
;
t_info
->
start_table_id
=
last
;
...
@@ -2342,8 +2347,8 @@ static void createChildTables() {
...
@@ -2342,8 +2347,8 @@ static void createChildTables() {
}
else
{
}
else
{
// normal table
// normal table
len
=
snprintf
(
tblColsBuf
,
MAX_SQL_SIZE
,
"(TS TIMESTAMP"
);
len
=
snprintf
(
tblColsBuf
,
MAX_SQL_SIZE
,
"(TS TIMESTAMP"
);
for
(
int
i
=
0
;
i
<
MAX_COLUMN_COUNT
;
i
++
)
{
int
i
=
0
;
if
(
g_args
.
datatype
[
i
])
{
while
(
g_args
.
datatype
[
i
])
{
if
((
strncasecmp
(
g_args
.
datatype
[
i
],
"BINARY"
,
strlen
(
"BINARY"
))
==
0
)
if
((
strncasecmp
(
g_args
.
datatype
[
i
],
"BINARY"
,
strlen
(
"BINARY"
))
==
0
)
||
(
strncasecmp
(
g_args
.
datatype
[
i
],
"NCHAR"
,
strlen
(
"NCHAR"
))
==
0
))
{
||
(
strncasecmp
(
g_args
.
datatype
[
i
],
"NCHAR"
,
strlen
(
"NCHAR"
))
==
0
))
{
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
,
", COL%d %s(60)"
,
i
,
g_args
.
datatype
[
i
]);
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
,
", COL%d %s(60)"
,
i
,
g_args
.
datatype
[
i
]);
...
@@ -2351,15 +2356,13 @@ static void createChildTables() {
...
@@ -2351,15 +2356,13 @@ static void createChildTables() {
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
,
", COL%d %s"
,
i
,
g_args
.
datatype
[
i
]);
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
,
", COL%d %s"
,
i
,
g_args
.
datatype
[
i
]);
}
}
len
=
strlen
(
tblColsBuf
);
len
=
strlen
(
tblColsBuf
);
}
else
{
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
,
")"
);
break
;
}
}
}
len
=
snprintf
(
tblColsBuf
+
len
,
MAX_SQL_SIZE
-
len
,
")"
);
debugPrint
(
"DEBUG - %s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
debugPrint
(
"DEBUG - %s() LN%d: %s
\n
"
,
__func__
,
__LINE__
,
tblColsBuf
);
tblColsBuf
);
startMultiThreadCreateChildTable
(
startMultiThreadCreateChildTable
(
tblColsBuf
,
tblColsBuf
,
g_Dbs
.
threadCountByCreateTbl
,
g_Dbs
.
threadCountByCreateTbl
,
g_args
.
num_of_DPT
,
g_args
.
num_of_DPT
,
...
@@ -4073,11 +4076,10 @@ static void* syncWrite(void *sarg) {
...
@@ -4073,11 +4076,10 @@ static void* syncWrite(void *sarg) {
int
len_of_binary
=
g_args
.
len_of_binary
;
int
len_of_binary
=
g_args
.
len_of_binary
;
int
ncols_per_record
=
1
;
// count first col ts
int
ncols_per_record
=
1
;
// count first col ts
for
(
int
i
=
0
;
i
<
MAX_COLUMN_COUNT
;
i
++
)
{
int
i
=
0
;
if
(
NULL
==
g_args
.
datatype
[
i
])
while
(
g_args
.
datatype
[
i
])
{
break
;
i
++
;
else
ncols_per_record
++
;
ncols_per_record
++
;
}
}
srand
((
uint32_t
)
time
(
NULL
));
srand
((
uint32_t
)
time
(
NULL
));
...
@@ -4558,11 +4560,14 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision,
...
@@ -4558,11 +4560,14 @@ void startMultiThreadInsertData(int threads, char* db_name, char* precision,
if
(
0
==
strncasecmp
(
superTblInfo
->
startTimestamp
,
"now"
,
3
))
{
if
(
0
==
strncasecmp
(
superTblInfo
->
startTimestamp
,
"now"
,
3
))
{
start_time
=
taosGetTimestamp
(
timePrec
);
start_time
=
taosGetTimestamp
(
timePrec
);
}
else
{
}
else
{
taosParseTime
(
if
(
TSDB_CODE_SUCCESS
!=
taosParseTime
(
superTblInfo
->
startTimestamp
,
superTblInfo
->
startTimestamp
,
&
start_time
,
&
start_time
,
strlen
(
superTblInfo
->
startTimestamp
),
strlen
(
superTblInfo
->
startTimestamp
),
timePrec
,
0
);
timePrec
,
0
))
{
printf
(
"ERROR to parse time!
\n
"
);
exit
(
-
1
);
}
}
}
}
else
{
}
else
{
start_time
=
1500000000000
;
start_time
=
1500000000000
;
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
7bcca63e
...
@@ -769,6 +769,7 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
...
@@ -769,6 +769,7 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
}
}
sprintf
(
tmpBuf
,
".select-tbname.tmp"
);
sprintf
(
tmpBuf
,
".select-tbname.tmp"
);
(
void
)
remove
(
tmpBuf
);
(
void
)
remove
(
tmpBuf
);
free
(
tblBuf
);
close
(
fd
);
close
(
fd
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1523,6 +1524,7 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
...
@@ -1523,6 +1524,7 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
}
}
sprintf
(
tmpBuf
,
".show-tables.tmp"
);
sprintf
(
tmpBuf
,
".show-tables.tmp"
);
(
void
)
remove
(
tmpBuf
);
(
void
)
remove
(
tmpBuf
);
free
(
tblBuf
);
close
(
fd
);
close
(
fd
);
return
-
1
;
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录