Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
143a2e85
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看板
提交
143a2e85
编写于
11月 25, 2022
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: start snapshot replication to rollback in recovery mode
上级
68f8ebac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
6 deletion
+20
-6
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+1
-1
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+0
-1
source/libs/sync/src/syncPipeline.c
source/libs/sync/src/syncPipeline.c
+19
-4
未找到文件。
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
143a2e85
...
@@ -188,7 +188,7 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
...
@@ -188,7 +188,7 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
goto
_IGNORE
;
goto
_IGNORE
;
}
}
if
(
pMsg
->
prevLogIndex
+
1
!=
pEntry
->
index
)
{
if
(
pMsg
->
prevLogIndex
+
1
!=
pEntry
->
index
||
pEntry
->
term
<
0
)
{
sError
(
"vgId:%d, invalid previous log index in msg. index:%"
PRId64
", term:%"
PRId64
", prevLogIndex:%"
PRId64
sError
(
"vgId:%d, invalid previous log index in msg. index:%"
PRId64
", term:%"
PRId64
", prevLogIndex:%"
PRId64
", prevLogTerm:%"
PRId64
,
", prevLogTerm:%"
PRId64
,
ths
->
vgId
,
pEntry
->
index
,
pEntry
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
);
ths
->
vgId
,
pEntry
->
index
,
pEntry
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
);
...
...
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
143a2e85
...
@@ -85,7 +85,6 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
...
@@ -85,7 +85,6 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
sError
(
"vgId:%d, failed to get log repl mgr for src addr: 0x%016"
PRIx64
,
ths
->
vgId
,
pMsg
->
srcId
.
addr
);
sError
(
"vgId:%d, failed to get log repl mgr for src addr: 0x%016"
PRIx64
,
ths
->
vgId
,
pMsg
->
srcId
.
addr
);
return
-
1
;
return
-
1
;
}
}
ASSERT
(
pMgr
!=
NULL
);
(
void
)
syncLogReplMgrProcessReply
(
pMgr
,
ths
,
pMsg
);
(
void
)
syncLogReplMgrProcessReply
(
pMgr
,
ths
,
pMsg
);
}
}
return
0
;
return
0
;
...
...
source/libs/sync/src/syncPipeline.c
浏览文件 @
143a2e85
...
@@ -90,7 +90,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
...
@@ -90,7 +90,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
return
prevLogTerm
;
return
prevLogTerm
;
}
}
if
(
pMgr
->
startIndex
<=
prevIndex
&&
prevIndex
<
pMgr
->
endIndex
)
{
if
(
pMgr
&&
pMgr
->
startIndex
<=
prevIndex
&&
prevIndex
<
pMgr
->
endIndex
)
{
int64_t
timeMs
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
timeMs
;
int64_t
timeMs
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
timeMs
;
ASSERT
(
timeMs
!=
0
&&
"no log entry found"
);
ASSERT
(
timeMs
!=
0
&&
"no log entry found"
);
prevLogTerm
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
term
;
prevLogTerm
=
pMgr
->
states
[(
prevIndex
+
pMgr
->
size
)
%
pMgr
->
size
].
term
;
...
@@ -277,7 +277,11 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
...
@@ -277,7 +277,11 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
" %"
PRId64
" %"
PRId64
", %"
PRId64
")"
,
" %"
PRId64
" %"
PRId64
", %"
PRId64
")"
,
pNode
->
vgId
,
pEntry
->
index
,
pEntry
->
term
,
pBuf
->
startIndex
,
pBuf
->
commitIndex
,
pBuf
->
matchIndex
,
pNode
->
vgId
,
pEntry
->
index
,
pEntry
->
term
,
pBuf
->
startIndex
,
pBuf
->
commitIndex
,
pBuf
->
matchIndex
,
pBuf
->
endIndex
);
pBuf
->
endIndex
);
ret
=
0
;
SyncTerm
term
=
syncLogReplMgrGetPrevLogTerm
(
NULL
,
pNode
,
index
+
1
);
ASSERT
(
pEntry
->
term
>=
0
);
if
(
term
==
pEntry
->
term
)
{
ret
=
0
;
}
goto
_out
;
goto
_out
;
}
}
...
@@ -655,7 +659,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
...
@@ -655,7 +659,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
pMgr
->
states
[
pMsg
->
lastSendIndex
%
pMgr
->
size
].
acked
=
true
;
pMgr
->
states
[
pMsg
->
lastSendIndex
%
pMgr
->
size
].
acked
=
true
;
if
(
pMsg
->
matchIndex
==
pMsg
->
lastSendIndex
)
{
if
(
pMsg
->
success
&&
pMsg
->
matchIndex
==
pMsg
->
lastSendIndex
)
{
pMgr
->
restored
=
true
;
pMgr
->
restored
=
true
;
sInfo
(
"vgId:%d, sync log repl mgr restored. peer: %s:%d (%"
PRIx64
"), repl mgr(rs:%d): [%"
PRId64
" %"
PRId64
sInfo
(
"vgId:%d, sync log repl mgr restored. peer: %s:%d (%"
PRIx64
"), repl mgr(rs:%d): [%"
PRId64
" %"
PRId64
", %"
PRId64
"), log buffer: [%"
PRId64
" %"
PRId64
" %"
PRId64
", %"
PRId64
")"
,
", %"
PRId64
"), log buffer: [%"
PRId64
" %"
PRId64
" %"
PRId64
", %"
PRId64
")"
,
...
@@ -664,6 +668,17 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
...
@@ -664,6 +668,17 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
return
0
;
return
0
;
}
}
if
(
pMsg
->
success
==
false
&&
pMsg
->
matchIndex
>=
pMsg
->
lastSendIndex
)
{
sError
(
"vgId:%d, failed to rollback match index. peer: %s:%d, match index: %"
PRId64
", last sent: %"
PRId64
,
pNode
->
vgId
,
host
,
port
,
pMsg
->
matchIndex
,
pMsg
->
lastSendIndex
);
if
(
syncNodeStartSnapshot
(
pNode
,
&
destId
)
<
0
)
{
sError
(
"vgId:%d, failed to start snapshot for peer %s:%d"
,
pNode
->
vgId
,
host
,
port
);
return
-
1
;
}
sInfo
(
"vgId:%d, snapshot replication to rollback. peer: %s:%d"
,
pNode
->
vgId
,
host
,
port
);
return
0
;
}
(
void
)
syncLogReplMgrReset
(
pMgr
);
(
void
)
syncLogReplMgrReset
(
pMgr
);
}
}
...
@@ -681,7 +696,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
...
@@ -681,7 +696,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
sError
(
"vgId:%d, failed to start snapshot for peer %s:%d"
,
pNode
->
vgId
,
host
,
port
);
sError
(
"vgId:%d, failed to start snapshot for peer %s:%d"
,
pNode
->
vgId
,
host
,
port
);
return
-
1
;
return
-
1
;
}
}
sInfo
(
"vgId:%d, snapshot replication to peer %s:%d
started
"
,
pNode
->
vgId
,
host
,
port
);
sInfo
(
"vgId:%d, snapshot replication to peer %s:%d"
,
pNode
->
vgId
,
host
,
port
);
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录