Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b59bee66
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
b59bee66
编写于
12月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: restart snapshot sender on receiver is restart
上级
773423a6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
29 deletion
+38
-29
source/libs/sync/src/syncPipeline.c
source/libs/sync/src/syncPipeline.c
+1
-1
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+12
-12
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+25
-16
未找到文件。
source/libs/sync/src/syncPipeline.c
浏览文件 @
b59bee66
...
...
@@ -112,7 +112,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
return
prevLogTerm
;
}
s
Error
(
"vgId:%d, failed to get log term since %s. index: %"
PRId64
""
,
pNode
->
vgId
,
terrstr
(),
prevIndex
);
s
Info
(
"vgId:%d, failed to get log term since %s. index:%"
PRId64
,
pNode
->
vgId
,
terrstr
(),
prevIndex
);
terrno
=
TSDB_CODE_WAL_LOG_NOT_EXIST
;
return
-
1
;
}
...
...
source/libs/sync/src/syncRaftLog.c
浏览文件 @
b59bee66
...
...
@@ -115,8 +115,8 @@ static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncI
const
char
*
sysErrStr
=
strerror
(
errno
);
sNError
(
pData
->
pSyncNode
,
"wal restore from snapshot error, index:%"
PRId64
", err:
%d %X, msg:%s, syserr:%d, sysmsg:%s"
,
snapshotIndex
,
err
,
err
,
errStr
,
sysErr
,
sysErrStr
);
"wal restore from snapshot error, index:%"
PRId64
", err:
0x%x, msg:%s, syserr:%d, sysmsg:%s"
,
snapshotIndex
,
err
,
errStr
,
sysErr
,
sysErrStr
);
return
-
1
;
}
...
...
@@ -212,8 +212,8 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
int32_t
sysErr
=
errno
;
const
char
*
sysErrStr
=
strerror
(
errno
);
sNError
(
pData
->
pSyncNode
,
"wal write error, index:%"
PRId64
", err:
%d %X
, msg:%s, syserr:%d, sysmsg:%s"
,
pEntry
->
index
,
err
,
err
,
err
Str
,
sysErr
,
sysErrStr
);
sNError
(
pData
->
pSyncNode
,
"wal write error, index:%"
PRId64
", err:
0x%x
, msg:%s, syserr:%d, sysmsg:%s"
,
pEntry
->
index
,
err
,
errStr
,
sysErr
,
sysErrStr
);
return
-
1
;
}
...
...
@@ -257,11 +257,11 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR
const
char
*
sysErrStr
=
strerror
(
errno
);
if
(
terrno
==
TSDB_CODE_WAL_LOG_NOT_EXIST
)
{
sNTrace
(
pData
->
pSyncNode
,
"wal read not exist, index:%"
PRId64
", err:
%d %X
, msg:%s, syserr:%d, sysmsg:%s"
,
index
,
err
,
err
,
err
Str
,
sysErr
,
sysErrStr
);
sNTrace
(
pData
->
pSyncNode
,
"wal read not exist, index:%"
PRId64
", err:
0x%x
, msg:%s, syserr:%d, sysmsg:%s"
,
index
,
err
,
errStr
,
sysErr
,
sysErrStr
);
}
else
{
sNTrace
(
pData
->
pSyncNode
,
"wal read error, index:%"
PRId64
", err:
%d %X, msg:%s, syserr:%d, sysmsg:%s"
,
index
,
err
,
err
,
err
Str
,
sysErr
,
sysErrStr
);
sNTrace
(
pData
->
pSyncNode
,
"wal read error, index:%"
PRId64
", err:
0x%x, msg:%s, syserr:%d, sysmsg:%s"
,
index
,
err
,
errStr
,
sysErr
,
sysErrStr
);
}
/*
...
...
@@ -341,8 +341,8 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn
const
char
*
errStr
=
tstrerror
(
err
);
int32_t
sysErr
=
errno
;
const
char
*
sysErrStr
=
strerror
(
errno
);
sError
(
"vgId:%d, wal truncate error, from-index:%"
PRId64
", err:
%d %X
, msg:%s, syserr:%d, sysmsg:%s"
,
pData
->
pSyncNode
->
vgId
,
fromIndex
,
err
,
err
,
err
Str
,
sysErr
,
sysErrStr
);
sError
(
"vgId:%d, wal truncate error, from-index:%"
PRId64
", err:
0x%x
, msg:%s, syserr:%d, sysmsg:%s"
,
pData
->
pSyncNode
->
vgId
,
fromIndex
,
err
,
errStr
,
sysErr
,
sysErrStr
);
}
// event log
...
...
@@ -392,8 +392,8 @@ int32_t raftLogUpdateCommitIndex(SSyncLogStore* pLogStore, SyncIndex index) {
const
char
*
errStr
=
tstrerror
(
err
);
int32_t
sysErr
=
errno
;
const
char
*
sysErrStr
=
strerror
(
errno
);
sError
(
"vgId:%d, wal update commit index error, index:%"
PRId64
", err:
%d %X
, msg:%s, syserr:%d, sysmsg:%s"
,
pData
->
pSyncNode
->
vgId
,
index
,
err
,
err
,
err
Str
,
sysErr
,
sysErrStr
);
sError
(
"vgId:%d, wal update commit index error, index:%"
PRId64
", err:
0x%x
, msg:%s, syserr:%d, sysmsg:%s"
,
pData
->
pSyncNode
->
vgId
,
index
,
err
,
errStr
,
sysErr
,
sysErrStr
);
return
-
1
;
}
return
0
;
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
b59bee66
...
...
@@ -747,7 +747,7 @@ static int32_t syncNodeOnSnapshotTransfering(SSyncNode *pSyncNode, SyncSnapshotS
pRspMsg
->
snapBeginIndex
=
pReceiver
->
snapshotParam
.
start
;
// send msg
syncLogSendSyncSnapshotRsp
(
pSyncNode
,
pRspMsg
,
"snapshot receiver receiv
ing
"
);
syncLogSendSyncSnapshotRsp
(
pSyncNode
,
pRspMsg
,
"snapshot receiver receiv
ed
"
);
if
(
syncNodeSendMsgById
(
&
pRspMsg
->
destId
,
pSyncNode
,
&
rpcMsg
)
!=
0
)
{
sRError
(
pReceiver
,
"snapshot receiver send resp failed since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -979,32 +979,31 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
return
-
1
;
}
if
(
pMsg
->
startTime
!=
pSender
->
startTime
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"sender:% "
PRId64
" receiver:%"
PRId64
" time not match"
);
return
-
1
;
}
// state, term, seq/ack
if
(
pSyncNode
->
state
!=
TAOS_SYNC_STATE_LEADER
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"snapshot sender not leader"
);
sSError
(
pSender
,
"snapshot sender not leader"
);
return
-
1
;
goto
_ERROR
;
}
if
(
pMsg
->
startTime
!=
pSender
->
startTime
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"snapshot sender and receiver time not match"
);
sSError
(
pSender
,
"sender:%"
PRId64
" receiver:%"
PRId64
" time not match, code:0x%x"
,
pMsg
->
startTime
,
pSender
->
startTime
,
pMsg
->
code
);
goto
_ERROR
;
}
if
(
pMsg
->
term
!=
pSyncNode
->
pRaftStore
->
currentTerm
)
{
sSError
(
pSender
,
"snapshot sender term not equal"
);
return
-
1
;
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"snapshot sender and receiver term not match"
);
sSError
(
pSender
,
"snapshot sender term not equal, msg term:%"
PRId64
" currentTerm:%"
PRId64
,
pMsg
->
term
,
pSyncNode
->
pRaftStore
->
currentTerm
);
goto
_ERROR
;
}
if
(
pMsg
->
code
!=
0
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"receive error code"
);
sSError
(
pSender
,
"snapshot sender receive error code:0x%x and stop sender"
,
pMsg
->
code
);
snapshotSenderStop
(
pSender
,
true
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pSyncNode
,
&
pMsg
->
srcId
);
if
(
pMgr
)
{
syncLogReplMgrReset
(
pMgr
);
}
return
-
1
;
goto
_ERROR
;
}
// prepare <begin, end>, send begin msg
...
...
@@ -1068,4 +1067,14 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
}
return
0
;
_ERROR:
snapshotSenderStop
(
pSender
,
true
);
SSyncLogReplMgr
*
pMgr
=
syncNodeGetLogReplMgr
(
pSyncNode
,
&
pMsg
->
srcId
);
if
(
pMgr
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"reset repl mgr"
);
syncLogReplMgrReset
(
pMgr
);
}
return
-
1
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录