Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0322fdc1
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看板
提交
0322fdc1
编写于
6月 24, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix memory leak.
上级
a8de3694
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
16 deletion
+34
-16
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-2
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+33
-14
未找到文件。
source/common/src/tdatablock.c
浏览文件 @
0322fdc1
...
...
@@ -1185,8 +1185,7 @@ void blockDataFreeRes(SSDataBlock* pBlock) {
colDataDestroy
(
pColInfoData
);
}
taosArrayDestroy
(
pBlock
->
pDataBlock
);
pBlock
->
pDataBlock
=
NULL
;
pBlock
->
pDataBlock
=
taosArrayDestroy
(
pBlock
->
pDataBlock
);
taosMemoryFreeClear
(
pBlock
->
pBlockAgg
);
memset
(
&
pBlock
->
info
,
0
,
sizeof
(
SDataBlockInfo
));
}
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
0322fdc1
...
...
@@ -16,7 +16,9 @@
#include "ttimer.h"
#include "streamInc.h"
#define MAX_BLOCK_NAME_NUM 1024
#define MAX_BLOCK_NAME_NUM 1024
#define DISPATCH_RETRY_INTERVAL_MS 300
#define MAX_CONTINUE_RETRY_COUNT 5
typedef
struct
SBlockName
{
uint32_t
hashValue
;
...
...
@@ -324,7 +326,10 @@ int32_t doSendDispatchMsg(SStreamTask* pTask, const SStreamDispatchReq* pReq, in
// serialize
int32_t
tlen
;
tEncodeSize
(
tEncodeStreamDispatchReq
,
pReq
,
tlen
,
code
);
if
(
code
<
0
)
goto
FAIL
;
if
(
code
<
0
)
{
goto
FAIL
;
}
code
=
-
1
;
buf
=
rpcMallocCont
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
...
...
@@ -346,13 +351,13 @@ int32_t doSendDispatchMsg(SStreamTask* pTask, const SStreamDispatchReq* pReq, in
msg
.
msgType
=
pTask
->
msgInfo
.
msgType
;
qDebug
(
"s-task:%s dispatch msg to taskId:0x%x vgId:%d data msg"
,
pTask
->
id
.
idStr
,
pReq
->
taskId
,
vgId
);
tmsgSendReq
(
pEpSet
,
&
msg
);
code
=
0
;
return
0
;
return
tmsgSendReq
(
pEpSet
,
&
msg
);
FAIL:
if
(
buf
)
rpcFreeCont
(
buf
);
if
(
buf
)
{
rpcFreeCont
(
buf
);
}
return
code
;
}
...
...
@@ -403,13 +408,16 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S
for
(
j
=
0
;
j
<
vgSz
;
j
++
)
{
SVgroupInfo
*
pVgInfo
=
taosArrayGet
(
vgInfo
,
j
);
ASSERT
(
pVgInfo
->
vgId
>
0
);
if
(
hashValue
>=
pVgInfo
->
hashBegin
&&
hashValue
<=
pVgInfo
->
hashEnd
)
{
if
(
streamAddBlockIntoDispatchMsg
(
pDataBlock
,
&
pReqs
[
j
])
<
0
)
{
return
-
1
;
}
if
(
pReqs
[
j
].
blockNum
==
0
)
{
atomic_add_fetch_32
(
&
pTask
->
shuffleDispatcher
.
waitingRspCnt
,
1
);
}
pReqs
[
j
].
blockNum
++
;
found
=
true
;
break
;
...
...
@@ -510,7 +518,8 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
qDebug
(
"s-task:%s (child taskId:%d) shuffle-dispatch blocks:%d to vgId:%d"
,
pTask
->
id
.
idStr
,
pTask
->
info
.
selfChildId
,
pReqs
[
i
].
blockNum
,
pVgInfo
->
vgId
);
if
(
doSendDispatchMsg
(
pTask
,
&
pReqs
[
i
],
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
)
<
0
)
{
code
=
doSendDispatchMsg
(
pTask
,
&
pReqs
[
i
],
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
if
(
code
<
0
)
{
goto
FAIL_SHUFFLE_DISPATCH
;
}
}
...
...
@@ -536,7 +545,9 @@ static void doRetryDispatchData(void* param, void* tmrId) {
int32_t
code
=
streamDispatchAllBlocks
(
pTask
,
pTask
->
msgInfo
.
pData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
streamRetryDispatchStreamBlock
(
pTask
,
300
);
qDebug
(
"s-task:%s reset the waitRspCnt to be 0 before launch retry dispatch"
,
pTask
->
id
.
idStr
);
atomic_store_32
(
&
pTask
->
shuffleDispatcher
.
waitingRspCnt
,
0
);
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
}
}
...
...
@@ -584,12 +595,20 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
}
qDebug
(
"s-task:%s failed to dispatch msg to downstream, code:%s, output status:%d, retry cnt:%d"
,
pTask
->
id
.
idStr
,
tstrerror
(
code
),
pTask
->
outputStatus
,
retryCount
);
tstrerror
(
terrno
),
pTask
->
outputStatus
,
retryCount
);
// todo deal with only partially success dispatch case
atomic_store_32
(
&
pTask
->
shuffleDispatcher
.
waitingRspCnt
,
0
);
if
(
terrno
==
TSDB_CODE_APP_IS_STOPPING
)
{
// in case of this error, do not retry anymore
destroyStreamDataBlock
(
pTask
->
msgInfo
.
pData
);
pTask
->
msgInfo
.
pData
=
NULL
;
return
code
;
}
if
(
++
retryCount
>
5
)
{
// add to timer to retry
qDebug
(
"s-task:%s failed to dispatch msg to downstream for %d times, code:%s, retry in %dms"
,
pTask
->
id
.
idStr
,
retryCount
,
tstrerror
(
code
),
300
);
streamRetryDispatchStreamBlock
(
pTask
,
300
);
if
(
++
retryCount
>
MAX_CONTINUE_RETRY_COUNT
)
{
// add to timer to retry
qDebug
(
"s-task:%s failed to dispatch msg to downstream for %d times, code:%s,
add timer to
retry in %dms"
,
pTask
->
id
.
idStr
,
retryCount
,
tstrerror
(
terrno
),
DISPATCH_RETRY_INTERVAL_MS
);
streamRetryDispatchStreamBlock
(
pTask
,
DISPATCH_RETRY_INTERVAL_MS
);
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录