Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bc60b00d
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,发现更多精彩内容 >>
提交
bc60b00d
编写于
3月 16, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync refactor
上级
5ab55c65
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
16 deletion
+22
-16
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+2
-1
source/libs/sync/src/syncEnv.c
source/libs/sync/src/syncEnv.c
+12
-10
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+3
-3
source/libs/sync/src/syncRequestVoteReply.c
source/libs/sync/src/syncRequestVoteReply.c
+2
-1
source/libs/sync/test/syncElectTest.cpp
source/libs/sync/test/syncElectTest.cpp
+3
-1
未找到文件。
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
bc60b00d
...
...
@@ -39,7 +39,8 @@ int32_t syncNodeOnAppendEntriesReplyCb(SSyncNode* ths, SyncAppendEntriesReply* p
syncAppendEntriesReplyLog2
(
"==syncNodeOnAppendEntriesReplyCb=="
,
pMsg
);
if
(
pMsg
->
term
<
ths
->
pRaftStore
->
currentTerm
)
{
sTrace
(
"DropStaleResponse, receive term:%"
PRIu64
", current term:%"
PRIu64
""
,
pMsg
->
term
,
ths
->
pRaftStore
->
currentTerm
);
sTrace
(
"DropStaleResponse, receive term:%"
PRIu64
", current term:%"
PRIu64
""
,
pMsg
->
term
,
ths
->
pRaftStore
->
currentTerm
);
return
ret
;
}
...
...
source/libs/sync/src/syncEnv.c
浏览文件 @
bc60b00d
...
...
@@ -54,20 +54,22 @@ static void syncEnvTick(void *param, void *tmrId) {
SSyncEnv
*
pSyncEnv
=
(
SSyncEnv
*
)
param
;
if
(
atomic_load_64
(
&
pSyncEnv
->
envTickTimerLogicClockUser
)
<=
atomic_load_64
(
&
pSyncEnv
->
envTickTimerLogicClock
))
{
++
(
pSyncEnv
->
envTickTimerCounter
);
sTrace
(
"syncEnvTick do ... envTickTimerLogicClockUser:%"
PRIu64
", envTickTimerLogicClock:%"
PRIu64
", envTickTimerCounter:%"
PRIu64
", "
"envTickTimerMS:%d, tmrId:%p"
,
pSyncEnv
->
envTickTimerLogicClockUser
,
pSyncEnv
->
envTickTimerLogicClock
,
pSyncEnv
->
envTickTimerCounter
,
pSyncEnv
->
envTickTimerMS
,
tmrId
);
sTrace
(
"syncEnvTick do ... envTickTimerLogicClockUser:%"
PRIu64
", envTickTimerLogicClock:%"
PRIu64
", envTickTimerCounter:%"
PRIu64
", "
"envTickTimerMS:%d, tmrId:%p"
,
pSyncEnv
->
envTickTimerLogicClockUser
,
pSyncEnv
->
envTickTimerLogicClock
,
pSyncEnv
->
envTickTimerCounter
,
pSyncEnv
->
envTickTimerMS
,
tmrId
);
// do something, tick ...
taosTmrReset
(
syncEnvTick
,
pSyncEnv
->
envTickTimerMS
,
pSyncEnv
,
pSyncEnv
->
pTimerManager
,
&
pSyncEnv
->
pEnvTickTimer
);
}
else
{
sTrace
(
"syncEnvTick pass ... envTickTimerLogicClockUser:%"
PRIu64
", envTickTimerLogicClock:%"
PRIu64
", envTickTimerCounter:%"
PRIu64
", "
"envTickTimerMS:%d, tmrId:%p"
,
pSyncEnv
->
envTickTimerLogicClockUser
,
pSyncEnv
->
envTickTimerLogicClock
,
pSyncEnv
->
envTickTimerCounter
,
pSyncEnv
->
envTickTimerMS
,
tmrId
);
sTrace
(
"syncEnvTick pass ... envTickTimerLogicClockUser:%"
PRIu64
", envTickTimerLogicClock:%"
PRIu64
", envTickTimerCounter:%"
PRIu64
", "
"envTickTimerMS:%d, tmrId:%p"
,
pSyncEnv
->
envTickTimerLogicClockUser
,
pSyncEnv
->
envTickTimerLogicClock
,
pSyncEnv
->
envTickTimerCounter
,
pSyncEnv
->
envTickTimerMS
,
tmrId
);
}
}
...
...
source/libs/sync/src/syncIO.c
浏览文件 @
bc60b00d
...
...
@@ -29,7 +29,7 @@ static int32_t syncIODestroy(SSyncIO *io);
static
int32_t
syncIOStartInternal
(
SSyncIO
*
io
);
static
int32_t
syncIOStopInternal
(
SSyncIO
*
io
);
static
void
*
syncIOConsumerFunc
(
void
*
param
);
static
void
*
syncIOConsumerFunc
(
void
*
param
);
static
void
syncIOProcessRequest
(
void
*
pParent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
void
syncIOProcessReply
(
void
*
pParent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
int32_t
syncIOAuth
(
void
*
parent
,
char
*
meterId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
...
...
@@ -234,9 +234,9 @@ static int32_t syncIOStopInternal(SSyncIO *io) {
}
static
void
*
syncIOConsumerFunc
(
void
*
param
)
{
SSyncIO
*
io
=
param
;
SSyncIO
*
io
=
param
;
STaosQall
*
qall
;
SRpcMsg
*
pRpcMsg
,
rpcMsg
;
SRpcMsg
*
pRpcMsg
,
rpcMsg
;
qall
=
taosAllocateQall
();
while
(
1
)
{
...
...
source/libs/sync/src/syncRequestVoteReply.c
浏览文件 @
bc60b00d
...
...
@@ -41,7 +41,8 @@ int32_t syncNodeOnRequestVoteReplyCb(SSyncNode* ths, SyncRequestVoteReply* pMsg)
syncRequestVoteReplyLog2
(
"==syncNodeOnRequestVoteReplyCb=="
,
pMsg
);
if
(
pMsg
->
term
<
ths
->
pRaftStore
->
currentTerm
)
{
sTrace
(
"DropStaleResponse, receive term:%"
PRIu64
", current term:%"
PRIu64
""
,
pMsg
->
term
,
ths
->
pRaftStore
->
currentTerm
);
sTrace
(
"DropStaleResponse, receive term:%"
PRIu64
", current term:%"
PRIu64
""
,
pMsg
->
term
,
ths
->
pRaftStore
->
currentTerm
);
return
ret
;
}
...
...
source/libs/sync/test/syncElectTest.cpp
浏览文件 @
bc60b00d
...
...
@@ -116,7 +116,9 @@ int main(int argc, char** argv) {
//---------------------------
while
(
1
)
{
sTrace
(
"while 1 sleep, state: %d, %s, electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d"
,
gSyncNode
->
state
,
syncUtilState2String
(
gSyncNode
->
state
),
gSyncNode
->
electTimerLogicClock
,
gSyncNode
->
electTimerLogicClockUser
,
gSyncNode
->
electTimerMS
);
sTrace
(
"while 1 sleep, state: %d, %s, electTimerLogicClock:%lu, electTimerLogicClockUser:%lu, electTimerMS:%d"
,
gSyncNode
->
state
,
syncUtilState2String
(
gSyncNode
->
state
),
gSyncNode
->
electTimerLogicClock
,
gSyncNode
->
electTimerLogicClockUser
,
gSyncNode
->
electTimerMS
);
taosMsleep
(
1000
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录