Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b6b0b343
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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,发现更多精彩内容 >>
提交
b6b0b343
编写于
2月 02, 2023
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: rename syncNodeOnSnapshotPre to syncNodeOnSnapshotPrep
上级
043fc8d9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
14 deletion
+14
-14
source/libs/sync/inc/syncSnapshot.h
source/libs/sync/inc/syncSnapshot.h
+1
-1
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+13
-13
未找到文件。
source/libs/sync/inc/syncSnapshot.h
浏览文件 @
b6b0b343
...
...
@@ -24,7 +24,7 @@ extern "C" {
#define SYNC_SNAPSHOT_SEQ_INVALID -2
#define SYNC_SNAPSHOT_SEQ_FORCE_CLOSE -3
#define SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT -1
#define SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT -1
#define SYNC_SNAPSHOT_SEQ_BEGIN 0
#define SYNC_SNAPSHOT_SEQ_END 0x7FFFFFFF
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
b6b0b343
...
...
@@ -112,7 +112,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) {
pMsg
->
lastConfigIndex
=
pSender
->
snapshot
.
lastConfigIndex
;
pMsg
->
lastConfig
=
pSender
->
lastConfig
;
pMsg
->
startTime
=
pSender
->
startTime
;
pMsg
->
seq
=
SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
;
pMsg
->
seq
=
SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT
;
// event log
syncLogSendSyncSnapshotSend
(
pSender
->
pSyncNode
,
pMsg
,
"snapshot sender start"
);
...
...
@@ -379,7 +379,7 @@ void snapshotReceiverStart(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *p
}
pReceiver
->
start
=
true
;
pReceiver
->
ack
=
SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
;
pReceiver
->
ack
=
SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT
;
pReceiver
->
term
=
pReceiver
->
pSyncNode
->
raftStore
.
currentTerm
;
pReceiver
->
fromId
=
pPreMsg
->
srcId
;
pReceiver
->
startTime
=
pPreMsg
->
startTime
;
...
...
@@ -527,7 +527,7 @@ SyncIndex syncNodeGetSnapBeginIndex(SSyncNode *ths) {
return
snapStart
;
}
static
int32_t
syncNodeOnSnapshotPre
(
SSyncNode
*
pSyncNode
,
SyncSnapshotSend
*
pMsg
)
{
static
int32_t
syncNodeOnSnapshotPre
p
(
SSyncNode
*
pSyncNode
,
SyncSnapshotSend
*
pMsg
)
{
SSyncSnapshotReceiver
*
pReceiver
=
pSyncNode
->
pNewNodeReceiver
;
int64_t
timeNow
=
taosGetTimestampMs
();
int32_t
code
=
0
;
...
...
@@ -565,7 +565,7 @@ _START_RECEIVER:
}
else
{
// waiting for clock match
while
(
timeNow
<
pMsg
->
startTime
)
{
sRInfo
(
pReceiver
,
"snapshot receiver pre waitting for true time, now:%"
PRId64
", stime:%"
PRId64
,
timeNow
,
sRInfo
(
pReceiver
,
"snapshot receiver pre waitting for true time, now:%"
PRId64
", st
artT
ime:%"
PRId64
,
timeNow
,
pMsg
->
startTime
);
taosMsleep
(
10
);
timeNow
=
taosGetTimestampMs
();
...
...
@@ -765,7 +765,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs
// receiver on message
//
// condition 1, recv SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
// condition 1, recv SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT
// if receiver already start
// if sender.start-time > receiver.start-time, restart receiver(reply snapshot start)
// if sender.start-time = receiver.start-time, maybe duplicate msg
...
...
@@ -809,9 +809,9 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
int32_t
code
=
0
;
if
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_FOLLOWER
)
{
if
(
pMsg
->
term
==
pSyncNode
->
raftStore
.
currentTerm
)
{
if
(
pMsg
->
seq
==
SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
)
{
if
(
pMsg
->
seq
==
SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT
)
{
syncLogRecvSyncSnapshotSend
(
pSyncNode
,
pMsg
,
"process seq pre-snapshot"
);
code
=
syncNodeOnSnapshotPre
(
pSyncNode
,
pMsg
);
code
=
syncNodeOnSnapshotPre
p
(
pSyncNode
,
pMsg
);
}
else
if
(
pMsg
->
seq
==
SYNC_SNAPSHOT_SEQ_BEGIN
)
{
syncLogRecvSyncSnapshotSend
(
pSyncNode
,
pMsg
,
"process seq begin"
);
code
=
syncNodeOnSnapshotBegin
(
pSyncNode
,
pMsg
);
...
...
@@ -848,7 +848,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
return
code
;
}
static
int32_t
syncNodeOnSnapshotPreRsp
(
SSyncNode
*
pSyncNode
,
SSyncSnapshotSender
*
pSender
,
SyncSnapshotRsp
*
pMsg
)
{
static
int32_t
syncNodeOnSnapshotPre
p
Rsp
(
SSyncNode
*
pSyncNode
,
SSyncSnapshotSender
*
pSender
,
SyncSnapshotRsp
*
pMsg
)
{
SSnapshot
snapshot
=
{
0
};
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
(
pSyncNode
->
pFsm
,
&
snapshot
);
...
...
@@ -945,8 +945,8 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
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
);
sSError
(
pSender
,
"sender:%"
PRId64
" receiver:%"
PRId64
" time not match,
error:%s
0x%x"
,
pMsg
->
startTime
,
pSender
->
startTime
,
tstrerror
(
pMsg
->
code
),
pMsg
->
code
);
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
goto
_ERROR
;
}
...
...
@@ -961,15 +961,15 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
if
(
pMsg
->
code
!=
0
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"receive error code"
);
sSError
(
pSender
,
"snapshot sender receive error
code:0x%x and stop sender"
,
pMsg
->
code
);
sSError
(
pSender
,
"snapshot sender receive error
:%s 0x%x and stop sender"
,
tstrerror
(
pMsg
->
code
)
,
pMsg
->
code
);
terrno
=
pMsg
->
code
;
goto
_ERROR
;
}
// prepare <begin, end>, send begin msg
if
(
pMsg
->
ack
==
SYNC_SNAPSHOT_SEQ_PRE_SNAPSHOT
)
{
if
(
pMsg
->
ack
==
SYNC_SNAPSHOT_SEQ_PRE
P
_SNAPSHOT
)
{
syncLogRecvSyncSnapshotRsp
(
pSyncNode
,
pMsg
,
"process seq pre-snapshot"
);
return
syncNodeOnSnapshotPreRsp
(
pSyncNode
,
pSender
,
pMsg
);
return
syncNodeOnSnapshotPre
p
Rsp
(
pSyncNode
,
pSender
,
pMsg
);
}
if
(
pSender
->
pReader
==
NULL
||
pSender
->
finish
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录