Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b9e4543a
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看板
提交
b9e4543a
编写于
5月 30, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(sync): add SyncSnapshotRsp SyncSnapshotSend
上级
c5526ef9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
9 deletion
+20
-9
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+2
-2
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+5
-1
source/libs/sync/src/syncCommit.c
source/libs/sync/src/syncCommit.c
+5
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+8
-5
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
b9e4543a
...
@@ -162,8 +162,8 @@ typedef struct SSyncNode {
...
@@ -162,8 +162,8 @@ typedef struct SSyncNode {
// restore state
// restore state
// sem_t restoreSem;
// sem_t restoreSem;
bool
restoreFinish
;
bool
restoreFinish
;
SSnapshot
*
pSnapshot
;
//
SSnapshot* pSnapshot;
SSyncSnapshotSender
*
senders
[
TSDB_MAX_REPLICA
];
SSyncSnapshotSender
*
senders
[
TSDB_MAX_REPLICA
];
SSyncSnapshotReceiver
*
receivers
[
TSDB_MAX_REPLICA
];
SSyncSnapshotReceiver
*
receivers
[
TSDB_MAX_REPLICA
];
...
...
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
b9e4543a
...
@@ -335,8 +335,12 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
...
@@ -335,8 +335,12 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
cbMeta
.
currentTerm
=
ths
->
pRaftStore
->
currentTerm
;
cbMeta
.
currentTerm
=
ths
->
pRaftStore
->
currentTerm
;
cbMeta
.
flag
=
0x11
;
cbMeta
.
flag
=
0x11
;
SSnapshot
snapshot
;
ASSERT
(
ths
->
pFsm
->
FpGetSnapshot
!=
NULL
);
ths
->
pFsm
->
FpGetSnapshot
(
ths
->
pFsm
,
&
snapshot
);
bool
needExecute
=
true
;
bool
needExecute
=
true
;
if
(
ths
->
pSnapshot
!=
NULL
&&
cbMeta
.
index
<=
ths
->
pSnapshot
->
lastApplyIndex
)
{
if
(
cbMeta
.
index
<=
snapshot
.
lastApplyIndex
)
{
needExecute
=
false
;
needExecute
=
false
;
}
}
...
...
source/libs/sync/src/syncCommit.c
浏览文件 @
b9e4543a
...
@@ -113,8 +113,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
...
@@ -113,8 +113,12 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
cbMeta
.
currentTerm
=
pSyncNode
->
pRaftStore
->
currentTerm
;
cbMeta
.
currentTerm
=
pSyncNode
->
pRaftStore
->
currentTerm
;
cbMeta
.
flag
=
0x1
;
cbMeta
.
flag
=
0x1
;
SSnapshot
snapshot
;
ASSERT
(
pSyncNode
->
pFsm
->
FpGetSnapshot
!=
NULL
);
pSyncNode
->
pFsm
->
FpGetSnapshot
(
pSyncNode
->
pFsm
,
&
snapshot
);
bool
needExecute
=
true
;
bool
needExecute
=
true
;
if
(
pSyncNode
->
pSnapshot
!=
NULL
&&
cbMeta
.
index
<=
pSyncNode
->
pSnapshot
->
lastApplyIndex
)
{
if
(
cbMeta
.
index
<=
snapshot
.
lastApplyIndex
)
{
needExecute
=
false
;
needExecute
=
false
;
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
b9e4543a
...
@@ -575,11 +575,12 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
...
@@ -575,11 +575,12 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
// restore state
// restore state
pSyncNode
->
restoreFinish
=
false
;
pSyncNode
->
restoreFinish
=
false
;
pSyncNode
->
pSnapshot
=
NULL
;
if
(
pSyncNode
->
pFsm
->
FpGetSnapshot
!=
NULL
)
{
// pSyncNode->pSnapshot = NULL;
pSyncNode
->
pSnapshot
=
taosMemoryMalloc
(
sizeof
(
SSnapshot
));
// if (pSyncNode->pFsm->FpGetSnapshot != NULL) {
pSyncNode
->
pFsm
->
FpGetSnapshot
(
pSyncNode
->
pFsm
,
pSyncNode
->
pSnapshot
);
// pSyncNode->pSnapshot = taosMemoryMalloc(sizeof(SSnapshot));
}
// pSyncNode->pFsm->FpGetSnapshot(pSyncNode->pFsm, pSyncNode->pSnapshot);
// }
// tsem_init(&(pSyncNode->restoreSem), 0, 0);
// tsem_init(&(pSyncNode->restoreSem), 0, 0);
// start in syncNodeStart
// start in syncNodeStart
...
@@ -673,9 +674,11 @@ void syncNodeClose(SSyncNode* pSyncNode) {
...
@@ -673,9 +674,11 @@ void syncNodeClose(SSyncNode* pSyncNode) {
taosMemoryFree
(
pSyncNode
->
pFsm
);
taosMemoryFree
(
pSyncNode
->
pFsm
);
}
}
/*
if (pSyncNode->pSnapshot != NULL) {
if (pSyncNode->pSnapshot != NULL) {
taosMemoryFree(pSyncNode->pSnapshot);
taosMemoryFree(pSyncNode->pSnapshot);
}
}
*/
// tsem_destroy(&pSyncNode->restoreSem);
// tsem_destroy(&pSyncNode->restoreSem);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录