Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
809301d7
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
809301d7
编写于
1月 06, 2021
作者:
H
huili
提交者:
GitHub
1月 06, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4818 from taosdata/hotfix/test
[TD-2658]<fix> memory overflow
上级
db60b2b5
70d19489
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
39 addition
and
14 deletion
+39
-14
src/kit/taosdemox/query.json
src/kit/taosdemox/query.json
+5
-5
src/kit/taosdemox/taosdemox.c
src/kit/taosdemox/taosdemox.c
+34
-9
未找到文件。
src/kit/taosdemox/query.json
浏览文件 @
809301d7
...
...
@@ -6,12 +6,12 @@
"user"
:
"root"
,
"password"
:
"taosdata"
,
"databases"
:
"db01"
,
"s
uper
_table_query"
:
{
"
rate
"
:
1
,
"concurrent"
:
1
,
"s
pecified
_table_query"
:
{
"
query_interval
"
:
1
,
"concurrent"
:
1
,
"sqls"
:
[{
"sql"
:
"select count(*) from stb01"
,
"result"
:
"./query_res0.txt"
}]
},
"su
b
_table_query"
:
{
"stblname"
:
"stb01"
,
"
rate
"
:
1
,
"threads"
:
1
,
"su
per
_table_query"
:
{
"stblname"
:
"stb01"
,
"
query_interval
"
:
1
,
"threads"
:
1
,
"sqls"
:
[{
"sql"
:
"select count(*) from xxxx"
,
"result"
:
"./query_res1.txt"
}]
}
}
src/kit/taosdemox/taosdemox.c
浏览文件 @
809301d7
...
...
@@ -1441,11 +1441,12 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
strncpy
(
pTblName
,
(
char
*
)
row
[
0
],
TSDB_TABLE_NAME_LEN
);
//printf("==== sub table name: %s\n", pTblName);
count
++
;
if
(
count
==
childTblCount
)
{
char
*
tmp
=
realloc
(
childTblName
,
(
size_t
)
c
ount
*
1
.
5
*
TSDB_TABLE_NAME_LEN
);
if
(
count
>=
childTblCount
-
1
)
{
char
*
tmp
=
realloc
(
childTblName
,
(
size_t
)
c
hildTblCount
*
1
.
5
*
TSDB_TABLE_NAME_LEN
+
1
);
if
(
tmp
!=
NULL
)
{
childTblName
=
tmp
;
memset
(
childTblName
+
count
*
TSDB_TABLE_NAME_LEN
,
0
,
(
size_t
)(
count
*
0
.
5
*
TSDB_TABLE_NAME_LEN
));
childTblCount
=
(
int
)(
childTblCount
*
1
.
5
);
memset
(
childTblName
+
count
*
TSDB_TABLE_NAME_LEN
,
0
,
(
size_t
)((
childTblCount
-
count
)
*
TSDB_TABLE_NAME_LEN
));
}
else
{
// exit, if allocate more memory failed
printf
(
"realloc fail for save child table name of %s.%s
\n
"
,
dbName
,
sTblName
);
...
...
@@ -3960,7 +3961,11 @@ void *superQueryProcess(void *sarg) {
for
(
int
i
=
0
;
i
<
g_queryInfo
.
superQueryInfo
.
sqlCount
;
i
++
)
{
if
(
0
==
strncasecmp
(
g_queryInfo
.
queryMode
,
"taosc"
,
5
))
{
int64_t
t1
=
taosGetTimestampUs
();
selectAndGetResult
(
winfo
->
taos
,
g_queryInfo
.
superQueryInfo
.
sql
[
i
],
g_queryInfo
.
superQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
superQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
superQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
selectAndGetResult
(
winfo
->
taos
,
g_queryInfo
.
superQueryInfo
.
sql
[
i
],
tmpFile
);
int64_t
t2
=
taosGetTimestampUs
();
printf
(
"taosc select sql return, Spent %f s
\n
"
,
(
t2
-
t1
)
/
1000000
.
0
);
}
else
{
...
...
@@ -4019,7 +4024,11 @@ void *subQueryProcess(void *sarg) {
for
(
int
i
=
0
;
i
<
g_queryInfo
.
subQueryInfo
.
sqlCount
;
i
++
)
{
memset
(
sqlstr
,
0
,
sizeof
(
sqlstr
));
replaceSubTblName
(
g_queryInfo
.
subQueryInfo
.
sql
[
i
],
sqlstr
,
i
);
selectAndGetResult
(
winfo
->
taos
,
sqlstr
,
g_queryInfo
.
subQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
subQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
subQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
selectAndGetResult
(
winfo
->
taos
,
sqlstr
,
tmpFile
);
}
}
et
=
taosGetTimestampMs
();
...
...
@@ -4193,7 +4202,11 @@ void *subSubscribeProcess(void *sarg) {
sprintf
(
topic
,
"taosdemo-subscribe-%d"
,
i
);
memset
(
subSqlstr
,
0
,
sizeof
(
subSqlstr
));
replaceSubTblName
(
g_queryInfo
.
subQueryInfo
.
sql
[
i
],
subSqlstr
,
i
);
g_queryInfo
.
subQueryInfo
.
tsub
[
i
]
=
subscribeImpl
(
winfo
->
taos
,
subSqlstr
,
topic
,
g_queryInfo
.
subQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
subQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
subQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
g_queryInfo
.
subQueryInfo
.
tsub
[
i
]
=
subscribeImpl
(
winfo
->
taos
,
subSqlstr
,
topic
,
tmpFile
);
if
(
NULL
==
g_queryInfo
.
subQueryInfo
.
tsub
[
i
])
{
return
NULL
;
}
...
...
@@ -4211,7 +4224,11 @@ void *subSubscribeProcess(void *sarg) {
TAOS_RES
*
res
=
taos_consume
(
g_queryInfo
.
subQueryInfo
.
tsub
[
i
]);
if
(
res
)
{
getResult
(
res
,
g_queryInfo
.
subQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
subQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
subQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
getResult
(
res
,
tmpFile
);
taos_free_result
(
res
);
}
}
...
...
@@ -4244,7 +4261,11 @@ void *superSubscribeProcess(void *sarg) {
char
topic
[
32
]
=
{
0
};
for
(
int
i
=
0
;
i
<
g_queryInfo
.
superQueryInfo
.
sqlCount
;
i
++
)
{
sprintf
(
topic
,
"taosdemo-subscribe-%d"
,
i
);
g_queryInfo
.
superQueryInfo
.
tsub
[
i
]
=
subscribeImpl
(
winfo
->
taos
,
g_queryInfo
.
superQueryInfo
.
sql
[
i
],
topic
,
g_queryInfo
.
superQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
subQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
superQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
g_queryInfo
.
superQueryInfo
.
tsub
[
i
]
=
subscribeImpl
(
winfo
->
taos
,
g_queryInfo
.
superQueryInfo
.
sql
[
i
],
topic
,
tmpFile
);
if
(
NULL
==
g_queryInfo
.
superQueryInfo
.
tsub
[
i
])
{
return
NULL
;
}
...
...
@@ -4262,7 +4283,11 @@ void *superSubscribeProcess(void *sarg) {
TAOS_RES
*
res
=
taos_consume
(
g_queryInfo
.
superQueryInfo
.
tsub
[
i
]);
if
(
res
)
{
getResult
(
res
,
g_queryInfo
.
superQueryInfo
.
result
[
i
]);
char
tmpFile
[
MAX_FILE_NAME_LEN
*
2
]
=
{
0
};
if
(
g_queryInfo
.
superQueryInfo
.
result
[
i
][
0
]
!=
0
)
{
sprintf
(
tmpFile
,
"%s-%d"
,
g_queryInfo
.
superQueryInfo
.
result
[
i
],
winfo
->
threadID
);
}
getResult
(
res
,
tmpFile
);
taos_free_result
(
res
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录