Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7ce5fb11
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,发现更多精彩内容 >>
提交
7ce5fb11
编写于
7月 29, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): speed up sync point
上级
0f3e244e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
2 deletion
+13
-2
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+5
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+8
-2
未找到文件。
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
7ce5fb11
...
@@ -213,6 +213,11 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie
...
@@ -213,6 +213,11 @@ int32_t syncNodeOnAppendEntriesReplySnapshot2Cb(SSyncNode* ths, SyncAppendEntrie
if
(
nextIndex
>
SYNC_INDEX_BEGIN
)
{
if
(
nextIndex
>
SYNC_INDEX_BEGIN
)
{
--
nextIndex
;
--
nextIndex
;
// speed up
if
(
nextIndex
>
pMsg
->
matchIndex
+
1
)
{
nextIndex
=
pMsg
->
matchIndex
+
1
;
}
bool
needStartSnapshot
=
false
;
bool
needStartSnapshot
=
false
;
if
(
nextIndex
>=
SYNC_INDEX_BEGIN
&&
!
ths
->
pLogStore
->
syncLogExist
(
ths
->
pLogStore
,
nextIndex
))
{
if
(
nextIndex
>=
SYNC_INDEX_BEGIN
&&
!
ths
->
pLogStore
->
syncLogExist
(
ths
->
pLogStore
,
nextIndex
))
{
needStartSnapshot
=
true
;
needStartSnapshot
=
true
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
7ce5fb11
...
@@ -2222,13 +2222,18 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
...
@@ -2222,13 +2222,18 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
SyncIndex
preIndex
=
index
-
1
;
SyncIndex
preIndex
=
index
-
1
;
SSyncRaftEntry
*
pPreEntry
=
NULL
;
SSyncRaftEntry
*
pPreEntry
=
NULL
;
int32_t
code
=
pSyncNode
->
pLogStore
->
syncLogGetEntry
(
pSyncNode
->
pLogStore
,
preIndex
,
&
pPreEntry
);
int32_t
code
=
pSyncNode
->
pLogStore
->
syncLogGetEntry
(
pSyncNode
->
pLogStore
,
preIndex
,
&
pPreEntry
);
SSnapshot
snapshot
=
{.
data
=
NULL
,
.
lastApplyIndex
=
SYNC_INDEX_INVALID
,
.
lastApplyTerm
=
SYNC_TERM_INVALID
,
.
lastConfigIndex
=
SYNC_INDEX_INVALID
};
if
(
code
==
0
)
{
if
(
code
==
0
)
{
ASSERT
(
pPreEntry
!=
NULL
);
ASSERT
(
pPreEntry
!=
NULL
);
preTerm
=
pPreEntry
->
term
;
preTerm
=
pPreEntry
->
term
;
taosMemoryFree
(
pPreEntry
);
taosMemoryFree
(
pPreEntry
);
return
preTerm
;
return
preTerm
;
}
else
{
}
else
{
SSnapshot
snapshot
=
{.
data
=
NULL
,
.
lastApplyIndex
=
-
1
,
.
lastApplyTerm
=
0
,
.
lastConfigIndex
=
-
1
};
if
(
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
)
{
if
(
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
)
{
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
(
pSyncNode
->
pFsm
,
&
snapshot
);
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
(
pSyncNode
->
pFsm
,
&
snapshot
);
if
(
snapshot
.
lastApplyIndex
==
preIndex
)
{
if
(
snapshot
.
lastApplyIndex
==
preIndex
)
{
...
@@ -2239,7 +2244,8 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
...
@@ -2239,7 +2244,8 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
do
{
do
{
char
logBuf
[
128
];
char
logBuf
[
128
];
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"sync node get pre term error, index:%"
PRId64
,
index
);
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"sync node get pre term error, index:%ld, snap-index:%ld, snap-term:%lu"
,
index
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
);
syncNodeErrorLog
(
pSyncNode
,
logBuf
);
syncNodeErrorLog
(
pSyncNode
,
logBuf
);
}
while
(
0
);
}
while
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录