Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cb708619
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看板
提交
cb708619
编写于
8月 22, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: memory leak issue
上级
fe4e4564
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
21 deletion
+38
-21
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+2
-2
source/libs/executor/src/dataDeleter.c
source/libs/executor/src/dataDeleter.c
+2
-0
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+7
-2
source/libs/executor/src/dataInserter.c
source/libs/executor/src/dataInserter.c
+15
-9
source/libs/executor/src/dataSinkMgt.c
source/libs/executor/src/dataSinkMgt.c
+3
-0
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+9
-8
未找到文件。
include/libs/executor/dataSinkMgt.h
浏览文件 @
cb708619
...
...
@@ -59,7 +59,7 @@ typedef struct SDataSinkMgtCfg {
uint32_t
maxDataBlockNumPerQuery
;
}
SDataSinkMgtCfg
;
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
,
SStorageAPI
*
pAPI
);
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
,
SStorageAPI
*
pAPI
,
void
**
ppSinkManager
);
typedef
struct
SInputData
{
const
struct
SSDataBlock
*
pData
;
...
...
@@ -83,7 +83,7 @@ typedef struct SOutputData {
* @param pHandle output
* @return error code
*/
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
,
const
char
*
id
);
int32_t
dsCreateDataSinker
(
void
*
pSinkManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
,
const
char
*
id
);
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
);
...
...
source/libs/executor/src/dataDeleter.c
浏览文件 @
cb708619
...
...
@@ -281,6 +281,8 @@ _end:
if
(
deleter
!=
NULL
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
deleter
);
taosMemoryFree
(
deleter
);
}
else
{
taosMemoryFree
(
pManager
);
}
return
code
;
}
source/libs/executor/src/dataDispatcher.c
浏览文件 @
cb708619
...
...
@@ -241,7 +241,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
SDataDispatchHandle
*
dispatcher
=
taosMemoryCalloc
(
1
,
sizeof
(
SDataDispatchHandle
));
if
(
NULL
==
dispatcher
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
dispatcher
->
sink
.
fPut
=
putDataBlock
;
dispatcher
->
sink
.
fEndPut
=
endPut
;
...
...
@@ -258,8 +258,13 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
if
(
NULL
==
dispatcher
->
pDataBlocks
)
{
taosMemoryFree
(
dispatcher
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
*
pHandle
=
dispatcher
;
return
TSDB_CODE_SUCCESS
;
_return:
taosMemoryFree
(
pManager
);
return
terrno
;
}
source/libs/executor/src/dataInserter.c
浏览文件 @
cb708619
...
...
@@ -413,7 +413,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
if
(
NULL
==
inserter
)
{
taosMemoryFree
(
pParam
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
goto
_return
;
}
SQueryInserterNode
*
pInserterNode
=
(
SQueryInserterNode
*
)
pDataSink
;
...
...
@@ -433,23 +433,18 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
int64_t
suid
=
0
;
int32_t
code
=
pManager
->
pAPI
->
metaFn
.
getTableSchema
(
inserter
->
pParam
->
readHandle
->
vnode
,
pInserterNode
->
tableId
,
&
inserter
->
pSchema
,
&
suid
);
if
(
code
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
inserter
);
taosMemoryFree
(
inserter
);
return
code
;
terrno
=
code
;
goto
_return
;
}
if
(
pInserterNode
->
stableId
!=
suid
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
inserter
);
taosMemoryFree
(
inserter
);
terrno
=
TSDB_CODE_TDB_INVALID_TABLE_ID
;
return
terrno
;
goto
_return
;
}
inserter
->
pDataBlocks
=
taosArrayInit
(
1
,
POINTER_BYTES
);
taosThreadMutexInit
(
&
inserter
->
mutex
,
NULL
);
if
(
NULL
==
inserter
->
pDataBlocks
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
inserter
);
taosMemoryFree
(
inserter
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -473,4 +468,15 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
*
pHandle
=
inserter
;
return
TSDB_CODE_SUCCESS
;
_return:
if
(
inserter
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
inserter
);
taosMemoryFree
(
inserter
);
}
else
{
taosMemoryFree
(
pManager
);
}
return
terrno
;
}
source/libs/executor/src/dataSinkMgt.c
浏览文件 @
cb708619
...
...
@@ -49,8 +49,11 @@ int32_t dsCreateDataSinker(void* pSinkManager, const SDataSinkNode* pDataSink, D
case
QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT
:
{
return
createDataInserter
(
pManager
,
pDataSink
,
pHandle
,
pParam
);
}
default:
break
;
}
taosMemoryFree
(
pSinkManager
);
qError
(
"invalid input node type:%d, %s"
,
nodeType
(
pDataSink
),
id
);
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
...
...
source/libs/executor/src/executor.c
浏览文件 @
cb708619
...
...
@@ -511,19 +511,20 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
goto
_error
;
}
SDataSinkMgtCfg
cfg
=
{.
maxDataBlockNum
=
500
,
.
maxDataBlockNumPerQuery
=
50
};
void
*
pSinkManager
=
NULL
;
code
=
dsDataSinkMgtInit
(
&
cfg
,
&
(
*
pTask
)
->
storageAPI
,
&
pSinkManager
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to dsDataSinkMgtInit, code:%s, %s"
,
tstrerror
(
code
),
(
*
pTask
)
->
id
.
str
);
goto
_error
;
}
if
(
handle
)
{
SDataSinkMgtCfg
cfg
=
{.
maxDataBlockNum
=
500
,
.
maxDataBlockNumPerQuery
=
50
};
void
*
pSinkManager
=
NULL
;
code
=
dsDataSinkMgtInit
(
&
cfg
,
&
(
*
pTask
)
->
storageAPI
,
&
pSinkManager
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to dsDataSinkMgtInit, code:%s, %s"
,
tstrerror
(
code
),
(
*
pTask
)
->
id
.
str
);
goto
_error
;
}
void
*
pSinkParam
=
NULL
;
code
=
createDataSinkParam
(
pSubplan
->
pDataSink
,
&
pSinkParam
,
(
*
pTask
),
readHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to createDataSinkParam, vgId:%d, code:%s, %s"
,
vgId
,
tstrerror
(
code
),
(
*
pTask
)
->
id
.
str
);
taosMemoryFree
(
pSinkManager
);
goto
_error
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录