Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b7be0389
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
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,发现更多精彩内容 >>
提交
b7be0389
编写于
5月 27, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(sync) snapshot sender, receiver
上级
8141c430
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
15 deletion
+35
-15
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+6
-2
source/libs/sync/inc/syncSnapshot.h
source/libs/sync/inc/syncSnapshot.h
+13
-6
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+2
-2
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+12
-4
source/libs/sync/test/syncConfigChangeTest.cpp
source/libs/sync/test/syncConfigChangeTest.cpp
+2
-1
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
b7be0389
...
...
@@ -55,6 +55,8 @@ typedef struct SVotesRespond SVotesRespond;
typedef
struct
SSyncIndexMgr
SSyncIndexMgr
;
typedef
struct
SRaftCfg
SRaftCfg
;
typedef
struct
SSyncRespMgr
SSyncRespMgr
;
typedef
struct
SSyncSnapshotSender
SSyncSnapshotSender
;
typedef
struct
SSyncSnapshotReceiver
SSyncSnapshotReceiver
;
typedef
struct
SSyncNode
{
// init by SSyncInfo
...
...
@@ -148,9 +150,11 @@ typedef struct SSyncNode {
SSyncRespMgr
*
pSyncRespMgr
;
// restore state
bool
restoreFinish
;
// sem_t restoreSem;
SSnapshot
*
pSnapshot
;
bool
restoreFinish
;
SSnapshot
*
pSnapshot
;
SSyncSnapshotSender
*
pSender
;
SSyncSnapshotReceiver
*
pReceiver
;
}
SSyncNode
;
...
...
source/libs/sync/inc/syncSnapshot.h
浏览文件 @
b7be0389
...
...
@@ -23,6 +23,7 @@ extern "C" {
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "cJSON.h"
#include "syncInt.h"
#include "taosdef.h"
...
...
@@ -32,11 +33,14 @@ typedef struct SSyncSnapshotSender {
void
*
pCurrentBlock
;
int32_t
len
;
SSnapshot
*
pSnapshot
;
SSyncNode
*
pSyncNode
;
}
SSyncSnapshotSender
;
int32_t
snapshotSenderStart
(
SSyncSnapshotSender
*
pSender
);
int32_t
snapshotSenderStop
(
SSyncSnapshotSender
*
pSender
);
int32_t
snapshotSend
(
SSyncSnapshotSender
*
pSender
);
SSyncSnapshotSender
*
snapshotSenderCreate
(
SSyncNode
*
pSyncNode
);
void
snapshotSenderDestroy
(
SSyncSnapshotSender
*
pSender
);
int32_t
snapshotSend
(
SSyncSnapshotSender
*
pSender
);
cJSON
*
snapshotSender2Json
(
SSyncSnapshotSender
*
pSender
);
char
*
snapshotSender2Str
(
SSyncSnapshotSender
*
pSender
);
typedef
struct
SSyncSnapshotReceiver
{
bool
isStart
;
...
...
@@ -44,11 +48,14 @@ typedef struct SSyncSnapshotReceiver {
void
*
pCurrentBlock
;
int32_t
len
;
SSnapshot
*
pSnapshot
;
SSyncNode
*
pSyncNode
;
}
SSyncSnapshotReceiver
;
int32_t
snapshotReceiverStart
(
SSyncSnapshotReceiver
*
pReceiver
);
int32_t
snapshotReceiverStop
(
SSyncSnapshotReceiver
*
pReceiver
);
int32_t
snapshotReceive
(
SSyncSnapshotReceiver
*
pReceiver
);
SSyncSnapshotReceiver
*
snapshotReceiverCreate
(
SSyncNode
*
pSyncNode
);
void
snapshotReceiverDestroy
(
SSyncSnapshotReceiver
*
pReceiver
);
int32_t
snapshotReceive
(
SSyncSnapshotReceiver
*
pReceiver
);
cJSON
*
snapshotReceiver2Json
(
SSyncSnapshotReceiver
*
pReceiver
);
char
*
snapshotReceiver2Str
(
SSyncSnapshotReceiver
*
pReceiver
);
#ifdef __cplusplus
}
...
...
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
b7be0389
...
...
@@ -365,7 +365,7 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
}
SReConfigCbMeta
cbMeta
=
{
0
};
bool
isDrop
;
bool
isDrop
;
// I am in newConfig
if
(
hit
)
{
...
...
@@ -388,7 +388,7 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
}
// always call FpReConfigCb
if
(
ths
->
pFsm
->
FpReConfigCb
!=
NULL
)
{
if
(
ths
->
pFsm
->
FpReConfigCb
!=
NULL
)
{
cbMeta
.
code
=
0
;
cbMeta
.
currentTerm
=
ths
->
pRaftStore
->
currentTerm
;
cbMeta
.
index
=
pEntry
->
index
;
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
b7be0389
...
...
@@ -15,14 +15,22 @@
#include "syncSnapshot.h"
int32_t
snapshotSenderStart
(
SSyncSnapshotSender
*
pSender
)
{
return
0
;
}
SSyncSnapshotSender
*
snapshotSenderCreate
(
SSyncNode
*
pSyncNode
)
{
return
NULL
;
}
int32_t
snapshotSenderStop
(
SSyncSnapshotSender
*
pSender
)
{
return
0
;
}
void
snapshotSenderDestroy
(
SSyncSnapshotSender
*
pSender
)
{
}
int32_t
snapshotSend
(
SSyncSnapshotSender
*
pSender
)
{
return
0
;
}
int32_t
snapshotReceiverStart
(
SSyncSnapshotReceiver
*
pReceiver
)
{
return
0
;
}
cJSON
*
snapshotSender2Json
(
SSyncSnapshotSender
*
pSender
)
{
return
NULL
;
}
int32_t
snapshotReceiverStop
(
SSyncSnapshotReceiver
*
pReceiver
)
{
return
0
;
}
char
*
snapshotSender2Str
(
SSyncSnapshotSender
*
pSender
)
{
return
NULL
;
}
SSyncSnapshotReceiver
*
snapshotReceiverCreate
(
SSyncNode
*
pSyncNode
)
{
return
NULL
;
}
void
snapshotReceiverDestroy
(
SSyncSnapshotReceiver
*
pReceiver
)
{}
int32_t
snapshotReceive
(
SSyncSnapshotReceiver
*
pReceiver
)
{
return
0
;
}
cJSON
*
snapshotReceiver2Json
(
SSyncSnapshotReceiver
*
pReceiver
)
{
return
NULL
;
}
char
*
snapshotReceiver2Str
(
SSyncSnapshotReceiver
*
pReceiver
)
{
return
NULL
;
}
source/libs/sync/test/syncConfigChangeTest.cpp
浏览文件 @
b7be0389
...
...
@@ -78,7 +78,8 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
void
RestoreFinishCb
(
struct
SSyncFSM
*
pFsm
)
{
sTrace
(
"==callback== ==RestoreFinishCb=="
);
}
void
ReConfigCb
(
struct
SSyncFSM
*
pFsm
,
SSyncCfg
newCfg
,
SReConfigCbMeta
cbMeta
)
{
sTrace
(
"==callback== ==ReConfigCb== flag:0x%lX, isDrop:%d, index:%ld, code:%d, currentTerm:%lu, term:%lu"
,
cbMeta
.
flag
,
cbMeta
.
isDrop
,
cbMeta
.
index
,
cbMeta
.
code
,
cbMeta
.
currentTerm
,
cbMeta
.
term
);
sTrace
(
"==callback== ==ReConfigCb== flag:0x%lX, isDrop:%d, index:%ld, code:%d, currentTerm:%lu, term:%lu"
,
cbMeta
.
flag
,
cbMeta
.
isDrop
,
cbMeta
.
index
,
cbMeta
.
code
,
cbMeta
.
currentTerm
,
cbMeta
.
term
);
}
SSyncFSM
*
createFsm
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录