Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f038205
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3f038205
编写于
11月 15, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18156 from taosdata/fix/TD-20427
fix: memory leak of sync timer
上级
957b1fb6
b0ea0c0d
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
14 addition
and
27 deletion
+14
-27
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+1
-0
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+10
-24
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+2
-2
未找到文件。
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
3f038205
...
...
@@ -349,6 +349,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
}
rpcFreeCont
(
req
.
pCont
);
req
.
pCont
=
NULL
;
if
(
code
!=
0
)
{
mError
(
"trans:%d, failed to propose, code:0x%x"
,
pMgmt
->
transId
,
code
);
return
code
;
...
...
source/libs/sync/inc/syncInt.h
浏览文件 @
3f038205
...
...
@@ -70,7 +70,7 @@ typedef struct SSyncTimer {
uint64_t
counter
;
int32_t
timerMS
;
SRaftId
destId
;
void
*
p
Data
;
SSyncHbTimerData
hb
Data
;
}
SSyncTimer
;
typedef
struct
SElectTimer
{
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
3f038205
...
...
@@ -442,7 +442,9 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) {
pMsg
->
newLeaderId
.
vgId
=
pSyncNode
->
vgId
;
pMsg
->
newNodeInfo
=
newLeader
;
return
syncNodePropose
(
pSyncNode
,
&
rpcMsg
,
false
);
int32_t
ret
=
syncNodePropose
(
pSyncNode
,
&
rpcMsg
,
false
);
rpcFreeCont
(
rpcMsg
.
pCont
);
return
ret
;
}
SSyncState
syncGetState
(
int64_t
rid
)
{
...
...
@@ -645,13 +647,12 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa
static
int32_t
syncHbTimerStart
(
SSyncNode
*
pSyncNode
,
SSyncTimer
*
pSyncTimer
)
{
int32_t
ret
=
0
;
if
(
syncIsInit
())
{
SSyncHbTimerData
*
pData
=
taosMemoryMalloc
(
sizeof
(
SSyncHbTimerData
))
;
SSyncHbTimerData
*
pData
=
&
pSyncTimer
->
hbData
;
pData
->
pSyncNode
=
pSyncNode
;
pData
->
pTimer
=
pSyncTimer
;
pData
->
destId
=
pSyncTimer
->
destId
;
pData
->
logicClock
=
pSyncTimer
->
logicClock
;
pSyncTimer
->
pData
=
pData
;
taosTmrReset
(
pSyncTimer
->
timerCb
,
pSyncTimer
->
timerMS
,
pData
,
syncEnv
()
->
pTimerManager
,
&
pSyncTimer
->
pTimer
);
}
else
{
sError
(
"vgId:%d, start ctrl hb timer error, sync env is stop"
,
pSyncNode
->
vgId
);
...
...
@@ -664,7 +665,6 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) {
atomic_add_fetch_64
(
&
pSyncTimer
->
logicClock
,
1
);
taosTmrStop
(
pSyncTimer
->
pTimer
);
pSyncTimer
->
pTimer
=
NULL
;
// taosMemoryFree(pSyncTimer->pData);
return
ret
;
}
...
...
@@ -1086,15 +1086,8 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
int32_t
ret
=
0
;
if
(
syncIsInit
())
{
pSyncNode
->
electTimerMS
=
ms
;
SElectTimer
*
pElectTimer
=
taosMemoryMalloc
(
sizeof
(
SElectTimer
));
pElectTimer
->
logicClock
=
pSyncNode
->
electTimerLogicClock
;
pElectTimer
->
pSyncNode
=
pSyncNode
;
pElectTimer
->
pData
=
NULL
;
taosTmrReset
(
pSyncNode
->
FpElectTimerCB
,
pSyncNode
->
electTimerMS
,
pElectTimer
,
syncEnv
()
->
pTimerManager
,
taosTmrReset
(
pSyncNode
->
FpElectTimerCB
,
pSyncNode
->
electTimerMS
,
pSyncNode
,
syncEnv
()
->
pTimerManager
,
&
pSyncNode
->
pElectTimer
);
}
else
{
sError
(
"vgId:%d, start elect timer error, sync env is stop"
,
pSyncNode
->
vgId
);
}
...
...
@@ -1827,20 +1820,17 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
}
static
void
syncNodeEqElectTimer
(
void
*
param
,
void
*
tmrId
)
{
if
(
!
syncIsInit
())
return
;
SElectTimer
*
pElectTimer
=
param
;
SSyncNode
*
pNode
=
pElectTimer
->
pSyncNode
;
SSyncNode
*
pNode
=
param
;
if
(
!
syncIsInit
())
return
;
if
(
pNode
==
NULL
)
return
;
if
(
pNode
->
syncEqMsg
==
NULL
)
return
;
SRpcMsg
rpcMsg
=
{
0
};
int32_t
code
=
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_ELECTION
,
pElectTimer
->
logicClock
,
pNode
->
electTimerMS
,
pNode
);
int32_t
code
=
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_ELECTION
,
pNode
->
electTimerLogicClock
,
pNode
->
electTimerMS
,
pNode
);
if
(
code
!=
0
)
{
sError
(
"failed to build elect msg"
);
taosMemoryFree
(
pElectTimer
);
return
;
}
...
...
@@ -1851,12 +1841,8 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
if
(
code
!=
0
)
{
sError
(
"failed to sync enqueue elect msg since %s"
,
terrstr
());
rpcFreeCont
(
rpcMsg
.
pCont
);
taosMemoryFree
(
pElectTimer
);
return
;
}
taosMemoryFree
(
pElectTimer
);
#if 0
// reset timer ms
if (syncIsInit() && pNode->electBaseLine > 0) {
...
...
tests/parallel_test/cases.task
浏览文件 @
3f038205
...
...
@@ -242,8 +242,8 @@
,,y,script,./test.sh -f tsim/stream/fillIntervalValue.sim
,,y,script,./test.sh -f tsim/trans/lossdata1.sim
,,y,script,./test.sh -f tsim/trans/create_db.sim
,,,script,./test.sh -f tsim/tmq/basic1.sim
,,,script,./test.sh -f tsim/tmq/basic2.sim
,,
y
,script,./test.sh -f tsim/tmq/basic1.sim
,,
y
,script,./test.sh -f tsim/tmq/basic2.sim
,,,script,./test.sh -f tsim/tmq/basic3.sim
,,,script,./test.sh -f tsim/tmq/basic4.sim
,,,script,./test.sh -f tsim/tmq/basic1Of2Cons.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录