Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3ada61c3
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看板
提交
3ada61c3
编写于
11月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
restore some invalid code modify
上级
4b4f8eac
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
33 addition
and
8 deletion
+33
-8
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
+32
-7
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
3ada61c3
...
@@ -70,7 +70,7 @@ typedef struct SSyncTimer {
...
@@ -70,7 +70,7 @@ typedef struct SSyncTimer {
uint64_t
counter
;
uint64_t
counter
;
int32_t
timerMS
;
int32_t
timerMS
;
SRaftId
destId
;
SRaftId
destId
;
SSyncHbTimerData
hb
Data
;
void
*
p
Data
;
}
SSyncTimer
;
}
SSyncTimer
;
typedef
struct
SElectTimer
{
typedef
struct
SElectTimer
{
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
3ada61c3
...
@@ -665,12 +665,13 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa
...
@@ -665,12 +665,13 @@ static int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRa
static
int32_t
syncHbTimerStart
(
SSyncNode
*
pSyncNode
,
SSyncTimer
*
pSyncTimer
)
{
static
int32_t
syncHbTimerStart
(
SSyncNode
*
pSyncNode
,
SSyncTimer
*
pSyncTimer
)
{
int32_t
ret
=
0
;
int32_t
ret
=
0
;
if
(
syncIsInit
())
{
if
(
syncIsInit
())
{
SSyncHbTimerData
*
pData
=
&
pSyncTimer
->
hbData
;
SSyncHbTimerData
*
pData
=
taosMemoryMalloc
(
sizeof
(
SSyncHbTimerData
))
;
pData
->
pSyncNode
=
pSyncNode
;
pData
->
pSyncNode
=
pSyncNode
;
pData
->
pTimer
=
pSyncTimer
;
pData
->
pTimer
=
pSyncTimer
;
pData
->
destId
=
pSyncTimer
->
destId
;
pData
->
destId
=
pSyncTimer
->
destId
;
pData
->
logicClock
=
pSyncTimer
->
logicClock
;
pData
->
logicClock
=
pSyncTimer
->
logicClock
;
pSyncTimer
->
pData
=
pData
;
taosTmrReset
(
pSyncTimer
->
timerCb
,
pSyncTimer
->
timerMS
,
pData
,
syncEnv
()
->
pTimerManager
,
&
pSyncTimer
->
pTimer
);
taosTmrReset
(
pSyncTimer
->
timerCb
,
pSyncTimer
->
timerMS
,
pData
,
syncEnv
()
->
pTimerManager
,
&
pSyncTimer
->
pTimer
);
}
else
{
}
else
{
sError
(
"vgId:%d, start ctrl hb timer error, sync env is stop"
,
pSyncNode
->
vgId
);
sError
(
"vgId:%d, start ctrl hb timer error, sync env is stop"
,
pSyncNode
->
vgId
);
...
@@ -1104,8 +1105,15 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
...
@@ -1104,8 +1105,15 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
int32_t
ret
=
0
;
int32_t
ret
=
0
;
if
(
syncIsInit
())
{
if
(
syncIsInit
())
{
pSyncNode
->
electTimerMS
=
ms
;
pSyncNode
->
electTimerMS
=
ms
;
taosTmrReset
(
pSyncNode
->
FpElectTimerCB
,
pSyncNode
->
electTimerMS
,
pSyncNode
,
syncEnv
()
->
pTimerManager
,
SElectTimer
*
pElectTimer
=
taosMemoryMalloc
(
sizeof
(
SElectTimer
));
pElectTimer
->
logicClock
=
pSyncNode
->
electTimerLogicClock
;
pElectTimer
->
pSyncNode
=
pSyncNode
;
pElectTimer
->
pData
=
NULL
;
taosTmrReset
(
pSyncNode
->
FpElectTimerCB
,
pSyncNode
->
electTimerMS
,
pElectTimer
,
syncEnv
()
->
pTimerManager
,
&
pSyncNode
->
pElectTimer
);
&
pSyncNode
->
pElectTimer
);
}
else
{
}
else
{
sError
(
"vgId:%d, start elect timer error, sync env is stop"
,
pSyncNode
->
vgId
);
sError
(
"vgId:%d, start elect timer error, sync env is stop"
,
pSyncNode
->
vgId
);
}
}
...
@@ -1855,28 +1863,45 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
...
@@ -1855,28 +1863,45 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
}
}
static
void
syncNodeEqElectTimer
(
void
*
param
,
void
*
tmrId
)
{
static
void
syncNodeEqElectTimer
(
void
*
param
,
void
*
tmrId
)
{
SSyncNode
*
pNode
=
param
;
if
(
!
syncIsInit
())
return
;
if
(
!
syncIsInit
())
return
;
SElectTimer
*
pElectTimer
=
param
;
SSyncNode
*
pNode
=
pElectTimer
->
pSyncNode
;
if
(
pNode
==
NULL
)
return
;
if
(
pNode
==
NULL
)
return
;
if
(
pNode
->
syncEqMsg
==
NULL
)
return
;
if
(
pNode
->
syncEqMsg
==
NULL
)
return
;
SRpcMsg
rpcMsg
=
{
0
};
SRpcMsg
rpcMsg
=
{
0
};
int32_t
code
=
int32_t
code
=
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_ELECTION
,
pElectTimer
->
logicClock
,
pNode
->
electTimerMS
,
pNode
);
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_ELECTION
,
pNode
->
electTimerLogicClock
,
pNode
->
electTimerMS
,
pNode
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sError
(
"failed to build elect msg"
);
sError
(
"failed to build elect msg"
);
taosMemoryFree
(
pElectTimer
);
return
;
return
;
}
}
SyncTimeout
*
pTimeout
=
rpcMsg
.
pCont
;
SyncTimeout
*
pTimeout
=
rpcMsg
.
pCont
;
s
Trace
(
"enqueue elect msg lc:%"
PRId64
,
pTimeout
->
logicClock
);
s
NTrace
(
pNode
,
"enqueue elect msg lc:%"
PRId64
,
pTimeout
->
logicClock
);
code
=
pNode
->
syncEqMsg
(
pNode
->
msgcb
,
&
rpcMsg
);
code
=
pNode
->
syncEqMsg
(
pNode
->
msgcb
,
&
rpcMsg
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sError
(
"failed to sync enqueue elect msg since %s"
,
terrstr
());
sError
(
"failed to sync enqueue elect msg since %s"
,
terrstr
());
rpcFreeCont
(
rpcMsg
.
pCont
);
rpcFreeCont
(
rpcMsg
.
pCont
);
taosMemoryFree
(
pElectTimer
);
return
;
}
}
taosMemoryFree
(
pElectTimer
);
#if 0
// reset timer ms
if (syncIsInit() && pNode->electBaseLine > 0) {
pNode->electTimerMS = syncUtilElectRandomMS(pNode->electBaseLine, 2 * pNode->electBaseLine);
taosTmrReset(syncNodeEqElectTimer, pNode->electTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pElectTimer);
} else {
sError("sync env is stop, syncNodeEqElectTimer");
}
#endif
}
}
static
void
syncNodeEqHeartbeatTimer
(
void
*
param
,
void
*
tmrId
)
{
static
void
syncNodeEqHeartbeatTimer
(
void
*
param
,
void
*
tmrId
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录