Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7688f8ed
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
未验证
提交
7688f8ed
编写于
8月 18, 2022
作者:
H
Hui Li
提交者:
GitHub
8月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16204 from taosdata/feature/stream
fix(mnode): memory leak
上级
6de1ce0f
a2757eb4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
7 deletion
+43
-7
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/inc/mndStb.h
source/dnode/mnode/impl/inc/mndStb.h
+1
-0
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+19
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+10
-6
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+12
-1
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
7688f8ed
...
...
@@ -636,6 +636,7 @@ typedef struct {
int32_t
tEncodeSStreamObj
(
SEncoder
*
pEncoder
,
const
SStreamObj
*
pObj
);
int32_t
tDecodeSStreamObj
(
SDecoder
*
pDecoder
,
SStreamObj
*
pObj
);
void
tFreeStreamObj
(
SStreamObj
*
pObj
);
typedef
struct
{
char
streamName
[
TSDB_STREAM_FNAME_LEN
];
...
...
source/dnode/mnode/impl/inc/mndStb.h
浏览文件 @
7688f8ed
...
...
@@ -34,6 +34,7 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate);
SDbObj
*
mndAcquireDbByStb
(
SMnode
*
pMnode
,
const
char
*
stbName
);
int32_t
mndBuildStbFromReq
(
SMnode
*
pMnode
,
SStbObj
*
pDst
,
SMCreateStbReq
*
pCreate
,
SDbObj
*
pDb
);
int32_t
mndAddStbToTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
);
void
mndFreeStb
(
SStbObj
*
pStb
);
void
mndExtractDbNameFromStbFullName
(
const
char
*
stbFullName
,
char
*
dst
);
void
mndExtractTbNameFromStbFullName
(
const
char
*
stbFullName
,
char
*
dst
,
int32_t
dstSize
);
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
7688f8ed
...
...
@@ -116,6 +116,25 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj) {
return
0
;
}
void
tFreeStreamObj
(
SStreamObj
*
pStream
)
{
taosMemoryFree
(
pStream
->
sql
);
taosMemoryFree
(
pStream
->
ast
);
taosMemoryFree
(
pStream
->
physicalPlan
);
if
(
pStream
->
outputSchema
.
nCols
)
taosMemoryFree
(
pStream
->
outputSchema
.
pSchema
);
int32_t
sz
=
taosArrayGetSize
(
pStream
->
tasks
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SArray
*
pLevel
=
taosArrayGetP
(
pStream
->
tasks
,
i
);
int32_t
taskSz
=
taosArrayGetSize
(
pLevel
);
for
(
int32_t
j
=
0
;
j
<
taskSz
;
j
++
)
{
SStreamTask
*
pTask
=
taosArrayGetP
(
pLevel
,
j
);
tFreeSStreamTask
(
pTask
);
}
taosArrayDestroy
(
pLevel
);
}
taosArrayDestroy
(
pStream
->
tasks
);
}
SMqVgEp
*
tCloneSMqVgEp
(
const
SMqVgEp
*
pVgEp
)
{
SMqVgEp
*
pVgEpNew
=
taosMemoryMalloc
(
sizeof
(
SMqVgEp
));
if
(
pVgEpNew
==
NULL
)
return
NULL
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
7688f8ed
...
...
@@ -266,6 +266,15 @@ _OVER:
return
pRow
;
}
void
mndFreeStb
(
SStbObj
*
pStb
)
{
taosArrayDestroy
(
pStb
->
pFuncs
);
taosMemoryFreeClear
(
pStb
->
pColumns
);
taosMemoryFreeClear
(
pStb
->
pTags
);
taosMemoryFreeClear
(
pStb
->
comment
);
taosMemoryFreeClear
(
pStb
->
pAst1
);
taosMemoryFreeClear
(
pStb
->
pAst2
);
}
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
)
{
mTrace
(
"stb:%s, perform insert action, row:%p"
,
pStb
->
name
,
pStb
);
return
0
;
...
...
@@ -273,12 +282,7 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb) {
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
)
{
mTrace
(
"stb:%s, perform delete action, row:%p"
,
pStb
->
name
,
pStb
);
taosArrayDestroy
(
pStb
->
pFuncs
);
taosMemoryFreeClear
(
pStb
->
pColumns
);
taosMemoryFreeClear
(
pStb
->
pTags
);
taosMemoryFreeClear
(
pStb
->
comment
);
taosMemoryFreeClear
(
pStb
->
pAst1
);
taosMemoryFreeClear
(
pStb
->
pAst2
);
mndFreeStb
(
pStb
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
7688f8ed
...
...
@@ -167,6 +167,9 @@ static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream) {
static
int32_t
mndStreamActionDelete
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
)
{
mTrace
(
"stream:%s, perform delete action"
,
pStream
->
name
);
taosWLockLatch
(
&
pStream
->
lock
);
tFreeStreamObj
(
pStream
);
taosWUnLockLatch
(
&
pStream
->
lock
);
return
0
;
}
...
...
@@ -493,10 +496,17 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
stbObj
.
uid
=
pStream
->
targetStbUid
;
if
(
mndAddStbToTrans
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
<
0
)
goto
_OVER
;
if
(
mndAddStbToTrans
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
<
0
)
{
mndFreeStb
(
&
stbObj
);
goto
_OVER
;
}
tFreeSMCreateStbReq
(
&
createReq
);
mndFreeStb
(
&
stbObj
);
return
0
;
_OVER:
tFreeSMCreateStbReq
(
&
createReq
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
return
-
1
;
...
...
@@ -715,6 +725,7 @@ _OVER:
mndReleaseDb
(
pMnode
,
pDb
);
tFreeSCMCreateStreamReq
(
&
createStreamReq
);
tFreeStreamObj
(
&
streamObj
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录