Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d80a5f70
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看板
未验证
提交
d80a5f70
编写于
9月 24, 2021
作者:
sangshuduo
提交者:
GitHub
9月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6473]<fix>: taosdump verify input arguments. (#8048)
上级
8da7318a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
87 addition
and
73 deletion
+87
-73
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+87
-73
未找到文件。
src/kit/taosdump/taosdump.c
浏览文件 @
d80a5f70
...
...
@@ -493,23 +493,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
errorPrint
(
"Invalid path %s
\n
"
,
arg
);
return
-
1
;
}
tstrncpy
(
g_args
.
outpath
,
full_path
.
we_wordv
[
0
],
MAX_FILE_NAME_LEN
);
wordfree
(
&
full_path
);
if
(
full_path
.
we_wordv
[
0
])
{
tstrncpy
(
g_args
.
outpath
,
full_path
.
we_wordv
[
0
],
MAX_FILE_NAME_LEN
);
wordfree
(
&
full_path
);
}
else
{
errorPrintReqArg3
(
"taosdump"
,
"-o or --outpath"
);
exit
(
EXIT_FAILURE
);
}
break
;
case
'g'
:
g_args
.
debug_print
=
true
;
break
;
case
'i'
:
g_args
.
isDumpIn
=
true
;
if
(
wordexp
(
arg
,
&
full_path
,
0
)
!=
0
)
{
errorPrint
(
"Invalid path %s
\n
"
,
arg
);
return
-
1
;
}
tstrncpy
(
g_args
.
inpath
,
full_path
.
we_wordv
[
0
],
MAX_FILE_NAME_LEN
);
wordfree
(
&
full_path
);
if
(
full_path
.
we_wordv
[
0
])
{
tstrncpy
(
g_args
.
inpath
,
full_path
.
we_wordv
[
0
],
MAX_FILE_NAME_LEN
);
wordfree
(
&
full_path
);
}
else
{
errorPrintReqArg3
(
"taosdump"
,
"-i or --inpath"
);
exit
(
EXIT_FAILURE
);
}
break
;
case
'r'
:
g_args
.
resultFile
=
arg
;
break
;
...
...
@@ -2776,41 +2791,41 @@ int main(int argc, char *argv[]) {
}
printf
(
"====== arguments config ======
\n
"
);
{
printf
(
"host: %s
\n
"
,
g_args
.
host
);
printf
(
"user: %s
\n
"
,
g_args
.
user
);
printf
(
"password: %s
\n
"
,
g_args
.
password
);
printf
(
"port: %u
\n
"
,
g_args
.
port
);
printf
(
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
printf
(
"outpath: %s
\n
"
,
g_args
.
outpath
);
printf
(
"inpath: %s
\n
"
,
g_args
.
inpath
);
printf
(
"resultFile: %s
\n
"
,
g_args
.
resultFile
);
printf
(
"encode: %s
\n
"
,
g_args
.
encode
);
printf
(
"all_databases: %s
\n
"
,
g_args
.
all_databases
?
"true"
:
"false"
);
printf
(
"databases: %d
\n
"
,
g_args
.
databases
);
printf
(
"databasesSeq: %s
\n
"
,
g_args
.
databasesSeq
);
printf
(
"schemaonly: %s
\n
"
,
g_args
.
schemaonly
?
"true"
:
"false"
);
printf
(
"with_property: %s
\n
"
,
g_args
.
with_property
?
"true"
:
"false"
);
printf
(
"avro format: %s
\n
"
,
g_args
.
avro
?
"true"
:
"false"
);
printf
(
"start_time: %"
PRId64
"
\n
"
,
g_args
.
start_time
);
printf
(
"human readable start time: %s
\n
"
,
g_args
.
humanStartTime
);
printf
(
"end_time: %"
PRId64
"
\n
"
,
g_args
.
end_time
);
printf
(
"human readable end time: %s
\n
"
,
g_args
.
humanEndTime
);
printf
(
"precision: %s
\n
"
,
g_args
.
precision
);
printf
(
"data_batch: %d
\n
"
,
g_args
.
data_batch
);
printf
(
"max_sql_len: %d
\n
"
,
g_args
.
max_sql_len
);
printf
(
"table_batch: %d
\n
"
,
g_args
.
table_batch
);
printf
(
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
printf
(
"allow_sys: %d
\n
"
,
g_args
.
allow_sys
);
printf
(
"abort: %d
\n
"
,
g_args
.
abort
);
printf
(
"isDumpIn: %d
\n
"
,
g_args
.
isDumpIn
);
printf
(
"arg_list_len: %d
\n
"
,
g_args
.
arg_list_len
);
printf
(
"debug_print: %d
\n
"
,
g_args
.
debug_print
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
printf
(
"host: %s
\n
"
,
g_args
.
host
);
printf
(
"user: %s
\n
"
,
g_args
.
user
);
printf
(
"password: %s
\n
"
,
g_args
.
password
);
printf
(
"port: %u
\n
"
,
g_args
.
port
);
printf
(
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
printf
(
"outpath: %s
\n
"
,
g_args
.
outpath
);
printf
(
"inpath: %s
\n
"
,
g_args
.
inpath
);
printf
(
"resultFile: %s
\n
"
,
g_args
.
resultFile
);
printf
(
"encode: %s
\n
"
,
g_args
.
encode
);
printf
(
"all_databases: %s
\n
"
,
g_args
.
all_databases
?
"true"
:
"false"
);
printf
(
"databases: %d
\n
"
,
g_args
.
databases
);
printf
(
"databasesSeq: %s
\n
"
,
g_args
.
databasesSeq
);
printf
(
"schemaonly: %s
\n
"
,
g_args
.
schemaonly
?
"true"
:
"false"
);
printf
(
"with_property: %s
\n
"
,
g_args
.
with_property
?
"true"
:
"false"
);
printf
(
"avro format: %s
\n
"
,
g_args
.
avro
?
"true"
:
"false"
);
printf
(
"start_time: %"
PRId64
"
\n
"
,
g_args
.
start_time
);
printf
(
"human readable start time: %s
\n
"
,
g_args
.
humanStartTime
);
printf
(
"end_time: %"
PRId64
"
\n
"
,
g_args
.
end_time
);
printf
(
"human readable end time: %s
\n
"
,
g_args
.
humanEndTime
);
printf
(
"precision: %s
\n
"
,
g_args
.
precision
);
printf
(
"data_batch: %d
\n
"
,
g_args
.
data_batch
);
printf
(
"max_sql_len: %d
\n
"
,
g_args
.
max_sql_len
);
printf
(
"table_batch: %d
\n
"
,
g_args
.
table_batch
);
printf
(
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
printf
(
"allow_sys: %d
\n
"
,
g_args
.
allow_sys
);
printf
(
"abort: %d
\n
"
,
g_args
.
abort
);
printf
(
"isDumpIn: %d
\n
"
,
g_args
.
isDumpIn
);
printf
(
"arg_list_len: %d
\n
"
,
g_args
.
arg_list_len
);
printf
(
"debug_print: %d
\n
"
,
g_args
.
debug_print
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
printf
(
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
printf
(
"==============================
\n
"
);
if
(
checkParam
(
&
g_args
)
<
0
)
{
exit
(
EXIT_FAILURE
);
...
...
@@ -2824,39 +2839,38 @@ int main(int argc, char *argv[]) {
fprintf
(
g_fpOfResult
,
"#############################################################################
\n
"
);
fprintf
(
g_fpOfResult
,
"============================== arguments config =============================
\n
"
);
{
fprintf
(
g_fpOfResult
,
"host: %s
\n
"
,
g_args
.
host
);
fprintf
(
g_fpOfResult
,
"user: %s
\n
"
,
g_args
.
user
);
fprintf
(
g_fpOfResult
,
"password: %s
\n
"
,
g_args
.
password
);
fprintf
(
g_fpOfResult
,
"port: %u
\n
"
,
g_args
.
port
);
fprintf
(
g_fpOfResult
,
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
fprintf
(
g_fpOfResult
,
"outpath: %s
\n
"
,
g_args
.
outpath
);
fprintf
(
g_fpOfResult
,
"inpath: %s
\n
"
,
g_args
.
inpath
);
fprintf
(
g_fpOfResult
,
"resultFile: %s
\n
"
,
g_args
.
resultFile
);
fprintf
(
g_fpOfResult
,
"encode: %s
\n
"
,
g_args
.
encode
);
fprintf
(
g_fpOfResult
,
"all_databases: %s
\n
"
,
g_args
.
all_databases
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"databases: %d
\n
"
,
g_args
.
databases
);
fprintf
(
g_fpOfResult
,
"databasesSeq: %s
\n
"
,
g_args
.
databasesSeq
);
fprintf
(
g_fpOfResult
,
"schemaonly: %s
\n
"
,
g_args
.
schemaonly
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"with_property: %s
\n
"
,
g_args
.
with_property
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"avro format: %s
\n
"
,
g_args
.
avro
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"start_time: %"
PRId64
"
\n
"
,
g_args
.
start_time
);
fprintf
(
g_fpOfResult
,
"human readable start time: %s
\n
"
,
g_args
.
humanStartTime
);
fprintf
(
g_fpOfResult
,
"end_time: %"
PRId64
"
\n
"
,
g_args
.
end_time
);
fprintf
(
g_fpOfResult
,
"human readable end time: %s
\n
"
,
g_args
.
humanEndTime
);
fprintf
(
g_fpOfResult
,
"precision: %s
\n
"
,
g_args
.
precision
);
fprintf
(
g_fpOfResult
,
"data_batch: %d
\n
"
,
g_args
.
data_batch
);
fprintf
(
g_fpOfResult
,
"max_sql_len: %d
\n
"
,
g_args
.
max_sql_len
);
fprintf
(
g_fpOfResult
,
"table_batch: %d
\n
"
,
g_args
.
table_batch
);
fprintf
(
g_fpOfResult
,
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
fprintf
(
g_fpOfResult
,
"allow_sys: %d
\n
"
,
g_args
.
allow_sys
);
fprintf
(
g_fpOfResult
,
"abort: %d
\n
"
,
g_args
.
abort
);
fprintf
(
g_fpOfResult
,
"isDumpIn: %d
\n
"
,
g_args
.
isDumpIn
);
fprintf
(
g_fpOfResult
,
"arg_list_len: %d
\n
"
,
g_args
.
arg_list_len
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
fprintf
(
g_fpOfResult
,
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
fprintf
(
g_fpOfResult
,
"host: %s
\n
"
,
g_args
.
host
);
fprintf
(
g_fpOfResult
,
"user: %s
\n
"
,
g_args
.
user
);
fprintf
(
g_fpOfResult
,
"password: %s
\n
"
,
g_args
.
password
);
fprintf
(
g_fpOfResult
,
"port: %u
\n
"
,
g_args
.
port
);
fprintf
(
g_fpOfResult
,
"mysqlFlag: %d
\n
"
,
g_args
.
mysqlFlag
);
fprintf
(
g_fpOfResult
,
"outpath: %s
\n
"
,
g_args
.
outpath
);
fprintf
(
g_fpOfResult
,
"inpath: %s
\n
"
,
g_args
.
inpath
);
fprintf
(
g_fpOfResult
,
"resultFile: %s
\n
"
,
g_args
.
resultFile
);
fprintf
(
g_fpOfResult
,
"encode: %s
\n
"
,
g_args
.
encode
);
fprintf
(
g_fpOfResult
,
"all_databases: %s
\n
"
,
g_args
.
all_databases
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"databases: %d
\n
"
,
g_args
.
databases
);
fprintf
(
g_fpOfResult
,
"databasesSeq: %s
\n
"
,
g_args
.
databasesSeq
);
fprintf
(
g_fpOfResult
,
"schemaonly: %s
\n
"
,
g_args
.
schemaonly
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"with_property: %s
\n
"
,
g_args
.
with_property
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"avro format: %s
\n
"
,
g_args
.
avro
?
"true"
:
"false"
);
fprintf
(
g_fpOfResult
,
"start_time: %"
PRId64
"
\n
"
,
g_args
.
start_time
);
fprintf
(
g_fpOfResult
,
"human readable start time: %s
\n
"
,
g_args
.
humanStartTime
);
fprintf
(
g_fpOfResult
,
"end_time: %"
PRId64
"
\n
"
,
g_args
.
end_time
);
fprintf
(
g_fpOfResult
,
"human readable end time: %s
\n
"
,
g_args
.
humanEndTime
);
fprintf
(
g_fpOfResult
,
"precision: %s
\n
"
,
g_args
.
precision
);
fprintf
(
g_fpOfResult
,
"data_batch: %d
\n
"
,
g_args
.
data_batch
);
fprintf
(
g_fpOfResult
,
"max_sql_len: %d
\n
"
,
g_args
.
max_sql_len
);
fprintf
(
g_fpOfResult
,
"table_batch: %d
\n
"
,
g_args
.
table_batch
);
fprintf
(
g_fpOfResult
,
"thread_num: %d
\n
"
,
g_args
.
thread_num
);
fprintf
(
g_fpOfResult
,
"allow_sys: %d
\n
"
,
g_args
.
allow_sys
);
fprintf
(
g_fpOfResult
,
"abort: %d
\n
"
,
g_args
.
abort
);
fprintf
(
g_fpOfResult
,
"isDumpIn: %d
\n
"
,
g_args
.
isDumpIn
);
fprintf
(
g_fpOfResult
,
"arg_list_len: %d
\n
"
,
g_args
.
arg_list_len
);
for
(
int32_t
i
=
0
;
i
<
g_args
.
arg_list_len
;
i
++
)
{
fprintf
(
g_fpOfResult
,
"arg_list[%d]: %s
\n
"
,
i
,
g_args
.
arg_list
[
i
]);
}
g_numOfCores
=
(
int32_t
)
sysconf
(
_SC_NPROCESSORS_ONLN
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录