Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f1a41f5a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
f1a41f5a
编写于
11月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: sync message headfile
上级
f2191363
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
31 deletion
+21
-31
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+13
-2
source/libs/sync/inc/syncMessage.h
source/libs/sync/inc/syncMessage.h
+3
-20
source/libs/sync/inc/syncTimeout.h
source/libs/sync/inc/syncTimeout.h
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-4
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+2
-3
source/libs/sync/src/syncTimeout.c
source/libs/sync/src/syncTimeout.c
+1
-1
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
f1a41f5a
...
...
@@ -239,11 +239,22 @@ void syncNodeClose(SSyncNode* pSyncNode);
void
syncNodePreClose
(
SSyncNode
*
pSyncNode
);
int32_t
syncNodePropose
(
SSyncNode
*
pSyncNode
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
// option
bool
syncNodeSnapshotEnable
(
SSyncNode
*
pSyncNode
);
ESyncStrategy
syncNodeStrategy
(
SSyncNode
*
pSyncNode
);
SyncIndex
syncNodeGetSnapshotConfigIndex
(
SSyncNode
*
pSyncNode
,
SyncIndex
snapshotLastApplyIndex
);
// on message ---------------------
int32_t
syncNodeOnTimeout
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnClientRequest
(
SSyncNode
*
ths
,
SRpcMsg
*
pMsg
,
SyncIndex
*
pRetIndex
);
int32_t
syncNodeOnRequestVote
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnRequestVoteReply
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnAppendEntries
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshot
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshotReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnHeartbeat
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnHeartbeatReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnLocalCmd
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
// timer control --------------
int32_t
syncNodeStartPingTimer
(
SSyncNode
*
pSyncNode
);
int32_t
syncNodeStopPingTimer
(
SSyncNode
*
pSyncNode
);
...
...
source/libs/sync/inc/syncMessage.h
浏览文件 @
f1a41f5a
...
...
@@ -236,26 +236,6 @@ typedef struct SyncLocalCmd {
SyncIndex
fcIndex
;
// follower commit index
}
SyncLocalCmd
;
// on message ----------------------
int32_t
syncNodeOnRequestVote
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnRequestVoteReply
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnAppendEntries
(
SSyncNode
*
pNode
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshot
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshotReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnHeartbeat
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnHeartbeatReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnLocalCmd
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnClientRequest
(
SSyncNode
*
ths
,
SRpcMsg
*
pMsg
,
SyncIndex
*
pRetIndex
);
// option ----------------------------------
bool
syncNodeSnapshotEnable
(
SSyncNode
*
pSyncNode
);
ESyncStrategy
syncNodeStrategy
(
SSyncNode
*
pSyncNode
);
const
char
*
syncTimerTypeStr
(
ESyncTimeoutType
timerType
);
const
char
*
syncLocalCmdGetStr
(
ESyncLocalCmd
cmd
);
int32_t
syncBuildTimeout
(
SRpcMsg
*
pMsg
,
ESyncTimeoutType
ttype
,
uint64_t
logicClock
,
int32_t
ms
,
SSyncNode
*
pNode
);
int32_t
syncBuildClientRequest
(
SRpcMsg
*
pMsg
,
const
SRpcMsg
*
pOriginal
,
uint64_t
seq
,
bool
isWeak
,
int32_t
vgId
);
int32_t
syncBuildClientRequestFromNoopEntry
(
SRpcMsg
*
pMsg
,
const
SSyncRaftEntry
*
pEntry
,
int32_t
vgId
);
...
...
@@ -273,6 +253,9 @@ int32_t syncBuildSnapshotSendRsp(SRpcMsg* pMsg, int32_t vgId);
int32_t
syncBuildLeaderTransfer
(
SRpcMsg
*
pMsg
,
int32_t
vgId
);
int32_t
syncBuildLocalCmd
(
SRpcMsg
*
pMsg
,
int32_t
vgId
);
const
char
*
syncTimerTypeStr
(
ESyncTimeoutType
timerType
);
const
char
*
syncLocalCmdGetStr
(
ESyncLocalCmd
cmd
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/sync/inc/syncTimeout.h
浏览文件 @
f1a41f5a
...
...
@@ -34,7 +34,7 @@ extern "C" {
// /\ voterLog' = [voterLog EXCEPT ![i] = [j \in {} |-> <<>>]]
// /\ UNCHANGED <<messages, leaderVars, logVars>>
//
int32_t
syncNodeOnTime
r
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnTime
out
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
f1a41f5a
...
...
@@ -138,7 +138,7 @@ int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) {
}
else
if
(
pMsg
->
msgType
==
TDMT_SYNC_HEARTBEAT_REPLY
)
{
code
=
syncNodeOnHeartbeatReply
(
pSyncNode
,
pMsg
);
}
else
if
(
pMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
code
=
syncNodeOnTime
r
(
pSyncNode
,
pMsg
);
code
=
syncNodeOnTime
out
(
pSyncNode
,
pMsg
);
}
else
if
(
pMsg
->
msgType
==
TDMT_SYNC_CLIENT_REQUEST
)
{
code
=
syncNodeOnClientRequest
(
pSyncNode
,
pMsg
,
NULL
);
}
else
if
(
pMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE
)
{
...
...
@@ -1034,9 +1034,6 @@ void syncNodeClose(SSyncNode* pSyncNode) {
taosMemoryFree
(
pSyncNode
);
}
// option
// bool syncNodeSnapshotEnable(SSyncNode* pSyncNode) { return pSyncNode->pRaftCfg->snapshotEnable; }
ESyncStrategy
syncNodeStrategy
(
SSyncNode
*
pSyncNode
)
{
return
pSyncNode
->
pRaftCfg
->
snapshotStrategy
;
}
// timer control --------------
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
f1a41f5a
...
...
@@ -15,10 +15,7 @@
#define _DEFAULT_SOURCE
#include "syncMessage.h"
#include "syncRaftCfg.h"
#include "syncRaftEntry.h"
#include "syncUtil.h"
#include "tcoding.h"
int32_t
syncBuildTimeout
(
SRpcMsg
*
pMsg
,
ESyncTimeoutType
timeoutType
,
uint64_t
logicClock
,
int32_t
timerMS
,
SSyncNode
*
pNode
)
{
...
...
@@ -189,6 +186,7 @@ int32_t syncBuildHeartbeatReply(SRpcMsg* pMsg, int32_t vgId) {
return
0
;
}
#if 0
int32_t syncBuildPreSnapshot(SRpcMsg* pMsg, int32_t vgId) {
int32_t bytes = sizeof(SyncPreSnapshot);
pMsg->pCont = rpcMallocCont(bytes);
...
...
@@ -222,6 +220,7 @@ int32_t syncBuildPreSnapshotReply(SRpcMsg* pMsg, int32_t vgId) {
pPreSnapshotReply->vgId = vgId;
return 0;
}
#endif
int32_t
syncBuildSnapshotSend
(
SRpcMsg
*
pMsg
,
int32_t
dataLen
,
int32_t
vgId
)
{
int32_t
bytes
=
sizeof
(
SyncSnapshotSend
)
+
dataLen
;
...
...
source/libs/sync/src/syncTimeout.c
浏览文件 @
f1a41f5a
...
...
@@ -85,7 +85,7 @@ static int32_t syncNodeTimerRoutine(SSyncNode* ths) {
return
0
;
}
int32_t
syncNodeOnTime
r
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pRpc
)
{
int32_t
syncNodeOnTime
out
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pRpc
)
{
int32_t
ret
=
0
;
SyncTimeout
*
pMsg
=
pRpc
->
pCont
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录