Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d9042f5e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
d9042f5e
编写于
5月 25, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:memory leak
上级
f6fef3e9
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
64 addition
and
39 deletion
+64
-39
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+38
-31
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+12
-3
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+7
-1
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+4
-1
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
未找到文件。
source/client/inc/clientSml.h
浏览文件 @
d9042f5e
...
...
@@ -251,7 +251,7 @@ int32_t smlClearForRerun(SSmlHandle *info);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
void
clearColValArray
(
SArray
*
pCols
);
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
);
void
smlDestroyTableInfo
(
void
*
para
);
void
freeSSmlKv
(
void
*
data
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
...
...
source/client/src/clientSml.c
浏览文件 @
d9042f5e
...
...
@@ -230,6 +230,16 @@ void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tin
}
}
static
void
smlDestroySTableMeta
(
void
*
para
)
{
SSmlSTableMeta
*
meta
=
*
(
SSmlSTableMeta
**
)
para
;
taosHashCleanup
(
meta
->
tagHash
);
taosHashCleanup
(
meta
->
colHash
);
taosArrayDestroy
(
meta
->
tags
);
taosArrayDestroy
(
meta
->
cols
);
taosMemoryFree
(
meta
->
tableMeta
);
taosMemoryFree
(
meta
);
}
SSmlSTableMeta
*
smlBuildSTableMeta
(
bool
isDataFormat
)
{
SSmlSTableMeta
*
meta
=
(
SSmlSTableMeta
*
)
taosMemoryCalloc
(
sizeof
(
SSmlSTableMeta
),
1
);
if
(
!
meta
)
{
...
...
@@ -264,7 +274,7 @@ SSmlSTableMeta *smlBuildSTableMeta(bool isDataFormat) {
return
meta
;
cleanup:
taosMemoryFree
(
meta
);
smlDestroySTableMeta
(
meta
);
return
NULL
;
}
...
...
@@ -1093,15 +1103,6 @@ static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols) {
}
}
static
void
smlDestroySTableMeta
(
SSmlSTableMeta
*
meta
)
{
taosHashCleanup
(
meta
->
tagHash
);
taosHashCleanup
(
meta
->
colHash
);
taosArrayDestroy
(
meta
->
tags
);
taosArrayDestroy
(
meta
->
cols
);
taosMemoryFree
(
meta
->
tableMeta
);
taosMemoryFree
(
meta
);
}
static
int32_t
smlUpdateMeta
(
SHashObj
*
metaHash
,
SArray
*
metaArray
,
SArray
*
cols
,
bool
isTag
,
SSmlMsgBuf
*
msg
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
++
i
)
{
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosArrayGet
(
cols
,
i
);
...
...
@@ -1141,7 +1142,8 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
return
TSDB_CODE_SUCCESS
;
}
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
void
smlDestroyTableInfo
(
void
*
para
)
{
SSmlTableInfo
*
tag
=
*
(
SSmlTableInfo
**
)
para
;
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
tag
->
cols
);
i
++
)
{
SHashObj
*
kvHash
=
(
SHashObj
*
)
taosArrayGetP
(
tag
->
cols
,
i
);
taosHashCleanup
(
kvHash
);
...
...
@@ -1178,18 +1180,18 @@ void smlDestroyInfo(SSmlHandle *info) {
qDestroyQuery
(
info
->
pQuery
);
// destroy info->childTables
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
while
(
oneTable
)
{
smlDestroyTableInfo
(
info
,
*
oneTable
);
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
oneTable
);
}
//
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
//
while (oneTable) {
// smlDestroyTableInfo(
oneTable);
//
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
//
}
// destroy info->superTables
SSmlSTableMeta
**
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
while
(
oneSTable
)
{
smlDestroySTableMeta
(
*
oneSTable
);
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
oneSTable
);
}
//
SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL);
//
while (oneSTable) {
//
smlDestroySTableMeta(*oneSTable);
//
oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable);
//
}
// destroy info->pVgHash
taosHashCleanup
(
info
->
pVgHash
);
...
...
@@ -1248,6 +1250,8 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) {
info
->
childTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
tableUids
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
info
->
superTables
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_NO_LOCK
);
taosHashSetFreeFp
(
info
->
superTables
,
smlDestroySTableMeta
);
taosHashSetFreeFp
(
info
->
childTables
,
smlDestroyTableInfo
);
info
->
id
=
smlGenId
();
info
->
pQuery
=
smlInitHandle
();
...
...
@@ -1354,6 +1358,9 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
uDebug
(
"SML:0x%"
PRIx64
" smlParseLineBottom add meta, format:%d, linenum:%d"
,
info
->
id
,
info
->
dataFormat
,
info
->
lineNum
);
SSmlSTableMeta
*
meta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
meta
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
meta
,
POINTER_BYTES
);
terrno
=
0
;
smlInsertMeta
(
meta
->
tagHash
,
meta
->
tags
,
tinfo
->
tags
);
...
...
@@ -1473,18 +1480,18 @@ static void smlPrintStatisticInfo(SSmlHandle *info) {
int32_t
smlClearForRerun
(
SSmlHandle
*
info
)
{
info
->
reRun
=
false
;
// clear info->childTables
SSmlTableInfo
**
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
NULL
);
while
(
oneTable
)
{
smlDestroyTableInfo
(
info
,
*
oneTable
);
oneTable
=
(
SSmlTableInfo
**
)
taosHashIterate
(
info
->
childTables
,
oneTable
);
}
//
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
//
while (oneTable) {
//
smlDestroyTableInfo(info, *oneTable);
//
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
//
}
// clear info->superTables
SSmlSTableMeta
**
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
NULL
);
while
(
oneSTable
)
{
smlDestroySTableMeta
(
*
oneSTable
);
oneSTable
=
(
SSmlSTableMeta
**
)
taosHashIterate
(
info
->
superTables
,
oneSTable
);
}
//
SSmlSTableMeta **oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL);
//
while (oneSTable) {
//
smlDestroySTableMeta(*oneSTable);
//
oneSTable = (SSmlSTableMeta **)taosHashIterate(info->superTables, oneSTable);
//
}
taosHashClear
(
info
->
childTables
);
taosHashClear
(
info
->
superTables
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
d9042f5e
...
...
@@ -695,6 +695,9 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
return
TSDB_CODE_SUCCESS
;
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
...
...
@@ -784,7 +787,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
@@ -1048,12 +1051,18 @@ static int32_t smlParseJSONExt(SSmlHandle *info, char *payload) {
return
TSDB_CODE_TSC_INVALID_JSON
;
}
info
->
lineNum
=
payloadNum
;
info
->
dataFormat
=
true
;
if
(
unlikely
(
info
->
lines
!=
NULL
))
{
for
(
int
i
=
0
;
i
<
info
->
lineNum
;
i
++
)
{
taosArrayDestroyEx
(
info
->
lines
[
i
].
colArray
,
freeSSmlKv
);
if
(
info
->
lines
[
i
].
measureTagsLen
!=
0
)
taosMemoryFree
(
info
->
lines
[
i
].
measureTag
);
}
taosMemoryFree
(
info
->
lines
);
info
->
lines
=
NULL
;
}
info
->
lineNum
=
payloadNum
;
info
->
dataFormat
=
true
;
ret
=
smlClearForRerun
(
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
...
...
source/client/src/clientSmlLine.c
浏览文件 @
d9042f5e
...
...
@@ -168,6 +168,9 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
return
TSDB_CODE_SUCCESS
;
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
...
...
@@ -326,7 +329,7 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
info
->
currSTableMeta
->
uid
=
tinfo
->
uid
;
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
...
...
@@ -372,6 +375,9 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
return
TSDB_CODE_SUCCESS
;
}
*
tmp
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
*
tmp
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
tmp
)
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
tmp
,
POINTER_BYTES
);
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
d9042f5e
...
...
@@ -91,6 +91,9 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
return
TSDB_CODE_SUCCESS
;
}
sMeta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
if
(
sMeta
==
NULL
){
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sMeta
->
tableMeta
=
pTableMeta
;
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
sMeta
,
POINTER_BYTES
);
for
(
int
i
=
pTableMeta
->
tableInfo
.
numOfColumns
;
i
<
pTableMeta
->
tableInfo
.
numOfTags
+
pTableMeta
->
tableInfo
.
numOfColumns
;
i
++
){
...
...
@@ -212,7 +215,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
smlDestroyTableInfo
(
&
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
tests/parallel_test/cases.task
浏览文件 @
d9042f5e
...
...
@@ -571,7 +571,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_replica.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
#
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
...
...
@@ -1089,7 +1089,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/timetruncate.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/diff.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/Timediff.py -Q 4
#
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/json_tag.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/top.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/bottom.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/percentile.py -Q 4
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录