Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
98f40325
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看板
提交
98f40325
编写于
8月 13, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix memory leak.
上级
a81cc9ae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
41 deletion
+7
-41
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+2
-0
source/libs/stream/src/streamData.c
source/libs/stream/src/streamData.c
+1
-40
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+1
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+3
-0
未找到文件。
source/dnode/snode/src/snode.c
浏览文件 @
98f40325
...
@@ -77,6 +77,8 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
...
@@ -77,6 +77,8 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
pTask
->
chkInfo
.
version
=
ver
;
pTask
->
chkInfo
.
version
=
ver
;
pTask
->
pMeta
=
pSnode
->
pMeta
;
pTask
->
pMeta
=
pSnode
->
pMeta
;
streamTaskOpenAllUpstreamInput
(
pTask
);
pTask
->
pState
=
streamStateOpen
(
pSnode
->
path
,
pTask
,
false
,
-
1
,
-
1
);
pTask
->
pState
=
streamStateOpen
(
pSnode
->
path
,
pTask
,
false
,
-
1
,
-
1
);
if
(
pTask
->
pState
==
NULL
)
{
if
(
pTask
->
pState
==
NULL
)
{
return
-
1
;
return
-
1
;
...
...
source/libs/stream/src/streamData.c
浏览文件 @
98f40325
...
@@ -15,45 +15,6 @@
...
@@ -15,45 +15,6 @@
#include "streamInt.h"
#include "streamInt.h"
SStreamDataBlock
*
createStreamBlockFromDispatchMsg
(
const
SStreamDispatchReq
*
pReq
,
int32_t
blockType
,
int32_t
srcVg
)
{
SStreamDataBlock
*
pData
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
,
pReq
->
totalLen
);
if
(
pData
==
NULL
)
{
return
NULL
;
}
pData
->
type
=
blockType
;
pData
->
srcVgId
=
srcVg
;
pData
->
srcTaskId
=
pReq
->
upstreamTaskId
;
int32_t
blockNum
=
pReq
->
blockNum
;
SArray
*
pArray
=
taosArrayInit_s
(
sizeof
(
SSDataBlock
),
blockNum
);
if
(
pArray
==
NULL
)
{
taosFreeQitem
(
pData
);
return
NULL
;
}
ASSERT
((
pReq
->
blockNum
==
taosArrayGetSize
(
pReq
->
data
))
&&
(
pReq
->
blockNum
==
taosArrayGetSize
(
pReq
->
dataLen
)));
for
(
int32_t
i
=
0
;
i
<
blockNum
;
i
++
)
{
SRetrieveTableRsp
*
pRetrieve
=
(
SRetrieveTableRsp
*
)
taosArrayGetP
(
pReq
->
data
,
i
);
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pArray
,
i
);
blockDecode
(
pDataBlock
,
pRetrieve
->
data
);
// TODO: refactor
pDataBlock
->
info
.
window
.
skey
=
be64toh
(
pRetrieve
->
skey
);
pDataBlock
->
info
.
window
.
ekey
=
be64toh
(
pRetrieve
->
ekey
);
pDataBlock
->
info
.
version
=
be64toh
(
pRetrieve
->
version
);
pDataBlock
->
info
.
watermark
=
be64toh
(
pRetrieve
->
watermark
);
memcpy
(
pDataBlock
->
info
.
parTbName
,
pRetrieve
->
parTbName
,
TSDB_TABLE_NAME_LEN
);
pDataBlock
->
info
.
type
=
pRetrieve
->
streamBlockType
;
pDataBlock
->
info
.
childId
=
pReq
->
upstreamChildId
;
}
pData
->
blocks
=
pArray
;
return
pData
;
}
SStreamDataBlock
*
createStreamDataFromDispatchMsg
(
const
SStreamDispatchReq
*
pReq
,
int32_t
blockType
,
int32_t
srcVg
)
{
SStreamDataBlock
*
createStreamDataFromDispatchMsg
(
const
SStreamDispatchReq
*
pReq
,
int32_t
blockType
,
int32_t
srcVg
)
{
SStreamDataBlock
*
pData
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
,
pReq
->
totalLen
);
SStreamDataBlock
*
pData
=
taosAllocateQitem
(
sizeof
(
SStreamDataBlock
),
DEF_QITEM
,
pReq
->
totalLen
);
if
(
pData
==
NULL
)
{
if
(
pData
==
NULL
)
{
...
@@ -243,7 +204,7 @@ void streamFreeQitem(SStreamQueueItem* data) {
...
@@ -243,7 +204,7 @@ void streamFreeQitem(SStreamQueueItem* data) {
if
(
type
==
STREAM_INPUT__GET_RES
)
{
if
(
type
==
STREAM_INPUT__GET_RES
)
{
blockDataDestroy
(((
SStreamTrigger
*
)
data
)
->
pBlock
);
blockDataDestroy
(((
SStreamTrigger
*
)
data
)
->
pBlock
);
taosFreeQitem
(
data
);
taosFreeQitem
(
data
);
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
||
type
==
STREAM_INPUT__DATA_RETRIEVE
)
{
}
else
if
(
type
==
STREAM_INPUT__DATA_BLOCK
||
type
==
STREAM_INPUT__DATA_RETRIEVE
||
type
==
STREAM_INPUT__TRANS_STATE
)
{
taosArrayDestroyEx
(((
SStreamDataBlock
*
)
data
)
->
blocks
,
(
FDelete
)
blockDataFreeRes
);
taosArrayDestroyEx
(((
SStreamDataBlock
*
)
data
)
->
blocks
,
(
FDelete
)
blockDataFreeRes
);
taosFreeQitem
(
data
);
taosFreeQitem
(
data
);
}
else
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
}
else
if
(
type
==
STREAM_INPUT__DATA_SUBMIT
)
{
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
98f40325
...
@@ -774,7 +774,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
...
@@ -774,7 +774,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
if
(
pRsp
->
inputStatus
==
TASK_INPUT_STATUS__BLOCKED
)
{
pTask
->
inputStatus
=
TASK_INPUT_STATUS__BLOCKED
;
// block the input of current task, to push pressure to upstream
pTask
->
inputStatus
=
TASK_INPUT_STATUS__BLOCKED
;
// block the input of current task, to push pressure to upstream
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
pTask
->
msgInfo
.
blockingTs
=
taosGetTimestampMs
();
// record the blocking start time
qError
(
"s-task:%s inputQ of downstream task:0x%x is full, time:%"
PRId64
"wait for %dms and retry dispatch data"
,
qError
(
"s-task:%s inputQ of downstream task:0x%x is full, time:%"
PRId64
"
wait for %dms and retry dispatch data"
,
id
,
pRsp
->
downstreamTaskId
,
pTask
->
msgInfo
.
blockingTs
,
DISPATCH_RETRY_INTERVAL_MS
);
id
,
pRsp
->
downstreamTaskId
,
pTask
->
msgInfo
.
blockingTs
,
DISPATCH_RETRY_INTERVAL_MS
);
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
}
else
{
// pipeline send data in output queue
}
else
{
// pipeline send data in output queue
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
98f40325
...
@@ -504,6 +504,7 @@ int32_t streamProcessTranstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock
...
@@ -504,6 +504,7 @@ int32_t streamProcessTranstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock
if
(
level
==
TASK_LEVEL__AGG
||
level
==
TASK_LEVEL__SINK
)
{
if
(
level
==
TASK_LEVEL__AGG
||
level
==
TASK_LEVEL__SINK
)
{
int32_t
remain
=
streamAlignTransferState
(
pTask
);
int32_t
remain
=
streamAlignTransferState
(
pTask
);
if
(
remain
>
0
)
{
if
(
remain
>
0
)
{
streamFreeQitem
((
SStreamQueueItem
*
)
pBlock
);
qDebug
(
"s-task:%s receive upstream transfer state msg, remain:%d"
,
id
,
remain
);
qDebug
(
"s-task:%s receive upstream transfer state msg, remain:%d"
,
id
,
remain
);
return
0
;
return
0
;
}
}
...
@@ -532,6 +533,8 @@ int32_t streamProcessTranstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock
...
@@ -532,6 +533,8 @@ int32_t streamProcessTranstateBlock(SStreamTask* pTask, SStreamDataBlock* pBlock
}
}
}
else
{
// non-dispatch task, do task state transfer directly
}
else
{
// non-dispatch task, do task state transfer directly
qDebug
(
"s-task:%s non-dispatch task, start to transfer state directly"
,
id
);
qDebug
(
"s-task:%s non-dispatch task, start to transfer state directly"
,
id
);
streamFreeQitem
((
SStreamQueueItem
*
)
pBlock
);
ASSERT
(
pTask
->
info
.
fillHistory
==
1
);
ASSERT
(
pTask
->
info
.
fillHistory
==
1
);
code
=
streamTransferStateToStreamTask
(
pTask
);
code
=
streamTransferStateToStreamTask
(
pTask
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录