Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9ef8f245
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看板
提交
9ef8f245
编写于
11月 12, 2021
作者:
Z
zhaoyanggh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change error print message
上级
ddb147c6
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
227 addition
and
409 deletion
+227
-409
src/kit/taosdemo/src/demoCommandOpt.c
src/kit/taosdemo/src/demoCommandOpt.c
+3
-4
src/kit/taosdemo/src/demoInsert.c
src/kit/taosdemo/src/demoInsert.c
+196
-352
src/kit/taosdemo/src/demoJsonOpt.c
src/kit/taosdemo/src/demoJsonOpt.c
+3
-5
src/kit/taosdemo/src/demoOutput.c
src/kit/taosdemo/src/demoOutput.c
+4
-9
src/kit/taosdemo/src/demoQuery.c
src/kit/taosdemo/src/demoQuery.c
+3
-4
src/kit/taosdemo/src/demoSubscribe.c
src/kit/taosdemo/src/demoSubscribe.c
+6
-13
src/kit/taosdemo/src/demoUtil.c
src/kit/taosdemo/src/demoUtil.c
+12
-22
未找到文件。
src/kit/taosdemo/src/demoCommandOpt.c
浏览文件 @
9ef8f245
...
...
@@ -1471,7 +1471,7 @@ void setParaFromArg() {
TSDB_DATA_TYPE_INT
;
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
columns
[
i
].
dataType
,
"INT"
,
min
(
DATATYPE_BUFF_LEN
,
strlen
(
"INT"
)
+
1
));
g_Dbs
.
db
[
0
].
superTbls
[
0
].
columns
[
i
].
dataLen
=
0
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
columns
[
i
].
dataLen
=
sizeof
(
int32_t
)
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
columnCount
++
;
}
}
...
...
@@ -1479,7 +1479,7 @@ void setParaFromArg() {
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tags
[
0
].
dataType
,
"INT"
,
min
(
DATATYPE_BUFF_LEN
,
strlen
(
"INT"
)
+
1
));
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tags
[
0
].
data_type
=
TSDB_DATA_TYPE_INT
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tags
[
0
].
dataLen
=
0
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tags
[
0
].
dataLen
=
sizeof
(
int32_t
)
;
tstrncpy
(
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tags
[
1
].
dataType
,
"BINARY"
,
min
(
DATATYPE_BUFF_LEN
,
strlen
(
"BINARY"
)
+
1
));
...
...
@@ -1524,8 +1524,7 @@ void querySqlFile(TAOS *taos, char *sqlFile) {
memcpy
(
cmd
+
cmd_len
,
line
,
read_len
);
if
(
0
!=
queryDbExec
(
taos
,
cmd
,
NO_INSERT_TYPE
,
false
))
{
errorPrint
(
"%s() LN%d, queryDbExec %s failed!
\n
"
,
__func__
,
__LINE__
,
cmd
);
errorPrint
(
"queryDbExec %s failed!
\n
"
,
cmd
);
tmfree
(
cmd
);
tmfree
(
line
);
tmfclose
(
fp
);
...
...
src/kit/taosdemo/src/demoInsert.c
浏览文件 @
9ef8f245
此差异已折叠。
点击以展开。
src/kit/taosdemo/src/demoJsonOpt.c
浏览文件 @
9ef8f245
...
...
@@ -446,8 +446,7 @@ int getMetaFromInsertJsonFile(cJSON *root) {
}
else
if
(
!
prepareRand
)
{
g_args
.
prepared_rand
=
DEFAULT_PREPARED_RAND
;
}
else
{
errorPrint
(
"%s() LN%d, failed to read json, prepared_rand not found
\n
"
,
__func__
,
__LINE__
);
errorPrint
(
"%s"
,
"failed to read json, prepared_rand not found
\n
"
);
goto
PARSE_OVER
;
}
...
...
@@ -1222,7 +1221,7 @@ int getMetaFromQueryJsonFile(cJSON *root) {
cJSON
*
gQueryTimes
=
cJSON_GetObjectItem
(
root
,
"query_times"
);
if
(
gQueryTimes
&&
gQueryTimes
->
type
==
cJSON_Number
)
{
if
(
gQueryTimes
->
valueint
<=
0
)
{
errorPrint
(
"%s
()
"
,
errorPrint
(
"%s"
,
"failed to read json, query_times input mistake
\n
"
);
goto
PARSE_OVER
;
}
...
...
@@ -1740,8 +1739,7 @@ int testMetaFile() {
}
return
subscribeTestProcess
();
}
else
{
errorPrint
(
"%s() LN%d, unsupport test mode (%d)
\n
"
,
__func__
,
__LINE__
,
g_args
.
test_mode
);
errorPrint
(
"unsupport test mode (%d)
\n
"
,
g_args
.
test_mode
);
return
-
1
;
}
return
0
;
...
...
src/kit/taosdemo/src/demoOutput.c
浏览文件 @
9ef8f245
...
...
@@ -115,8 +115,8 @@ int getDbFromServer(TAOS *taos, SDbInfo **dbInfos) {
count
++
;
if
(
count
>
MAX_DATABASE_COUNT
)
{
errorPrint
(
"
%s() LN%d,
The database count overflow than %d
\n
"
,
__func__
,
__LINE__
,
MAX_DATABASE_COUNT
);
errorPrint
(
"The database count overflow than %d
\n
"
,
MAX_DATABASE_COUNT
);
break
;
}
}
...
...
@@ -202,8 +202,7 @@ int xDumpResultToFile(const char *fname, TAOS_RES *tres) {
FILE
*
fp
=
fopen
(
fname
,
"at"
);
if
(
fp
==
NULL
)
{
errorPrint
(
"%s() LN%d, failed to open file: %s
\n
"
,
__func__
,
__LINE__
,
fname
);
errorPrint
(
"failed to open file: %s
\n
"
,
fname
);
return
-
1
;
}
...
...
@@ -983,11 +982,7 @@ void printfQuerySystemInfo(TAOS *taos) {
res
=
taos_query
(
taos
,
"show databases;"
);
SDbInfo
**
dbInfos
=
(
SDbInfo
**
)
calloc
(
MAX_DATABASE_COUNT
,
sizeof
(
SDbInfo
*
));
if
(
dbInfos
==
NULL
)
{
errorPrint
(
"%s() LN%d, failed to allocate memory
\n
"
,
__func__
,
__LINE__
);
return
;
}
assert
(
dbInfos
);
int
dbCount
=
getDbFromServer
(
taos
,
dbInfos
);
if
(
dbCount
<=
0
)
{
free
(
dbInfos
);
...
...
src/kit/taosdemo/src/demoQuery.c
浏览文件 @
9ef8f245
...
...
@@ -19,8 +19,8 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) {
if
(
0
==
strncasecmp
(
g_queryInfo
.
queryMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
TAOS_RES
*
res
=
taos_query
(
pThreadInfo
->
taos
,
command
);
if
(
res
==
NULL
||
taos_errno
(
res
)
!=
0
)
{
errorPrint
(
"
%s() LN%d, failed to execute sql:%s, reason:%s
\n
"
,
__func__
,
__LINE__
,
command
,
taos_errstr
(
res
));
errorPrint
(
"
failed to execute sql:%s, reason:%s
\n
"
,
command
,
taos_errstr
(
res
));
taos_free_result
(
res
);
return
;
}
...
...
@@ -38,8 +38,7 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) {
}
}
else
{
errorPrint
(
"%s() LN%d, unknown query mode: %s
\n
"
,
__func__
,
__LINE__
,
g_queryInfo
.
queryMode
);
errorPrint
(
"unknown query mode: %s
\n
"
,
g_queryInfo
.
queryMode
);
}
}
...
...
src/kit/taosdemo/src/demoSubscribe.c
浏览文件 @
9ef8f245
...
...
@@ -380,22 +380,19 @@ int subscribeTestProcess() {
__LINE__
,
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
);
}
else
{
if
(
g_queryInfo
.
specifiedQueryInfo
.
concurrent
<=
0
)
{
errorPrint
(
"
%s() LN%d, specified query sqlCount %d.
\n
"
,
__func__
,
__LINE__
,
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
);
errorPrint
(
"
specified query sqlCount %d.
\n
"
,
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
);
exit
(
EXIT_FAILURE
);
}
pids
=
calloc
(
1
,
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
*
g_queryInfo
.
specifiedQueryInfo
.
concurrent
*
sizeof
(
pthread_t
));
assert
(
pids
);
infos
=
calloc
(
1
,
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
*
g_queryInfo
.
specifiedQueryInfo
.
concurrent
*
sizeof
(
threadInfo
));
if
((
NULL
==
pids
)
||
(
NULL
==
infos
))
{
errorPrint
(
"%s() LN%d, malloc failed for create threads
\n
"
,
__func__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
assert
(
infos
);
for
(
int
i
=
0
;
i
<
g_queryInfo
.
specifiedQueryInfo
.
sqlCount
;
i
++
)
{
for
(
int
j
=
0
;
j
<
g_queryInfo
.
specifiedQueryInfo
.
concurrent
;
...
...
@@ -423,15 +420,11 @@ int subscribeTestProcess() {
pidsOfStable
=
calloc
(
1
,
g_queryInfo
.
superQueryInfo
.
sqlCount
*
g_queryInfo
.
superQueryInfo
.
threadCnt
*
sizeof
(
pthread_t
));
assert
(
pidsOfStable
);
infosOfStable
=
calloc
(
1
,
g_queryInfo
.
superQueryInfo
.
sqlCount
*
g_queryInfo
.
superQueryInfo
.
threadCnt
*
sizeof
(
threadInfo
));
if
((
NULL
==
pidsOfStable
)
||
(
NULL
==
infosOfStable
))
{
errorPrint
(
"%s() LN%d, malloc failed for create threads
\n
"
,
__func__
,
__LINE__
);
// taos_close(taos);
exit
(
EXIT_FAILURE
);
}
assert
(
infosOfStable
);
int64_t
ntables
=
g_queryInfo
.
superQueryInfo
.
childTblCount
;
int
threads
=
g_queryInfo
.
superQueryInfo
.
threadCnt
;
...
...
src/kit/taosdemo/src/demoUtil.c
浏览文件 @
9ef8f245
...
...
@@ -202,8 +202,14 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName,
TAOS_RES
*
res
;
TAOS_ROW
row
=
NULL
;
char
*
childTblName
=
*
childTblNameOfSuperTbl
;
int64_t
childTblCount
=
(
limit
<
0
)
?
DEFAULT_CHILDTABLES
:
limit
;
int64_t
count
=
0
;
char
*
childTblName
=
*
childTblNameOfSuperTbl
;
char
*
pTblName
=
childTblName
;
if
(
childTblName
==
NULL
)
{
childTblName
=
(
char
*
)
calloc
(
1
,
childTblCount
*
TSDB_TABLE_NAME_LEN
);
assert
(
childTblName
);
}
snprintf
(
limitBuf
,
100
,
" limit %"
PRId64
" offset %"
PRIu64
""
,
limit
,
offset
);
...
...
@@ -219,31 +225,16 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName,
if
(
code
!=
0
)
{
taos_free_result
(
res
);
taos_close
(
taos
);
errorPrint
(
"
%s() LN%d, failed to run command %s, reason: %s
\n
"
,
__func__
,
__LINE__
,
command
,
taos_errstr
(
res
));
errorPrint
(
"
failed to run command %s, reason: %s
\n
"
,
command
,
taos_errstr
(
res
));
exit
(
EXIT_FAILURE
);
}
int64_t
childTblCount
=
(
limit
<
0
)
?
DEFAULT_CHILDTABLES
:
limit
;
int64_t
count
=
0
;
if
(
childTblName
==
NULL
)
{
childTblName
=
(
char
*
)
calloc
(
1
,
childTblCount
*
TSDB_TABLE_NAME_LEN
);
if
(
NULL
==
childTblName
)
{
taos_free_result
(
res
);
taos_close
(
taos
);
errorPrint
(
"%s() LN%d, failed to allocate memory!
\n
"
,
__func__
,
__LINE__
);
exit
(
EXIT_FAILURE
);
}
}
char
*
pTblName
=
childTblName
;
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
int32_t
*
len
=
taos_fetch_lengths
(
res
);
if
(
0
==
strlen
((
char
*
)
row
[
0
]))
{
errorPrint
(
"%s() LN%d, No.%"
PRId64
" table return empty name
\n
"
,
__func__
,
__LINE__
,
count
);
errorPrint
(
"No.%"
PRId64
" table return empty name
\n
"
,
count
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -577,8 +568,7 @@ int postProceSql(char *host, uint16_t port, char *sqlstr,
free
(
request_buf
);
if
(
NULL
==
strstr
(
response_buf
,
resHttpOk
))
{
errorPrint
(
"%s() LN%d, Response:
\n
%s
\n
"
,
__func__
,
__LINE__
,
response_buf
);
errorPrint
(
"Response:
\n
%s
\n
"
,
response_buf
);
return
-
1
;
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录