Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93c9b2a4
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看板
未验证
提交
93c9b2a4
编写于
12月 20, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19050 from taosdata/fix/TD-21176
refact: update sync log
上级
a4301cc9
d674c837
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
387 addition
and
311 deletion
+387
-311
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+1
-1
source/libs/sync/inc/syncSnapshot.h
source/libs/sync/inc/syncSnapshot.h
+1
-1
source/libs/sync/inc/syncUtil.h
source/libs/sync/inc/syncUtil.h
+0
-6
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+5
-5
source/libs/sync/src/syncRespMgr.c
source/libs/sync/src/syncRespMgr.c
+12
-12
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+336
-213
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+30
-71
source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
+2
-2
未找到文件。
source/libs/sync/inc/syncInt.h
浏览文件 @
93c9b2a4
...
...
@@ -227,7 +227,7 @@ 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
syncNodeOnSnapshotR
eply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshotR
sp
(
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
);
...
...
source/libs/sync/inc/syncSnapshot.h
浏览文件 @
93c9b2a4
...
...
@@ -86,7 +86,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceive
// on message
int32_t
syncNodeOnSnapshot
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshotR
eply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
int32_t
syncNodeOnSnapshotR
sp
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pMsg
);
SyncIndex
syncNodeGetSnapshotConfigIndex
(
SSyncNode
*
pSyncNode
,
SyncIndex
snapshotLastApplyIndex
);
...
...
source/libs/sync/inc/syncUtil.h
浏览文件 @
93c9b2a4
...
...
@@ -100,12 +100,6 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64
void
syncLogSendHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
const
char
*
s
);
void
syncLogRecvHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
int64_t
timeDiff
,
const
char
*
s
);
void
syncLogSendSyncPreSnapshot
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshot
*
pMsg
,
const
char
*
s
);
void
syncLogRecvSyncPreSnapshot
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshot
*
pMsg
,
const
char
*
s
);
void
syncLogSendSyncPreSnapshotReply
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshotReply
*
pMsg
,
const
char
*
s
);
void
syncLogRecvSyncPreSnapshotReply
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshotReply
*
pMsg
,
const
char
*
s
);
void
syncLogSendSyncSnapshotSend
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotSend
*
pMsg
,
const
char
*
s
);
void
syncLogRecvSyncSnapshotSend
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotSend
*
pMsg
,
const
char
*
s
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
93c9b2a4
...
...
@@ -194,7 +194,7 @@ int32_t syncProcessMsg(int64_t rid, SRpcMsg* pMsg) {
code
=
syncNodeOnSnapshot
(
pSyncNode
,
pMsg
);
break
;
case
TDMT_SYNC_SNAPSHOT_RSP
:
code
=
syncNodeOnSnapshotR
eply
(
pSyncNode
,
pMsg
);
code
=
syncNodeOnSnapshotR
sp
(
pSyncNode
,
pMsg
);
break
;
case
TDMT_SYNC_LOCAL_CMD
:
code
=
syncNodeOnLocalCmd
(
pSyncNode
,
pMsg
);
...
...
@@ -705,7 +705,7 @@ int32_t syncPropose(int64_t rid, SRpcMsg* pMsg, bool isWeak, int64_t* seq) {
int32_t
syncNodePropose
(
SSyncNode
*
pSyncNode
,
SRpcMsg
*
pMsg
,
bool
isWeak
,
int64_t
*
seq
)
{
if
(
pSyncNode
->
state
!=
TAOS_SYNC_STATE_LEADER
)
{
terrno
=
TSDB_CODE_SYN_NOT_LEADER
;
sNError
(
pSyncNode
,
"sync propose not leader,
%s, type:%s"
,
syncStr
(
pSyncNode
->
state
)
,
TMSG_INFO
(
pMsg
->
msgType
));
sNError
(
pSyncNode
,
"sync propose not leader,
type:%s"
,
TMSG_INFO
(
pMsg
->
msgType
));
return
-
1
;
}
...
...
@@ -890,10 +890,10 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
// init by SSyncInfo
pSyncNode
->
vgId
=
pSyncInfo
->
vgId
;
SSyncCfg
*
pCfg
=
&
pSyncInfo
->
syncCfg
;
s
Debug
(
"vgId:%d
, replica:%d selfIndex:%d"
,
pSyncNode
->
vgId
,
pCfg
->
replicaNum
,
pCfg
->
myIndex
);
s
Info
(
"vgId:%d, start to open sync node
, replica:%d selfIndex:%d"
,
pSyncNode
->
vgId
,
pCfg
->
replicaNum
,
pCfg
->
myIndex
);
for
(
int32_t
i
=
0
;
i
<
pCfg
->
replicaNum
;
++
i
)
{
SNodeInfo
*
pNode
=
&
pCfg
->
nodeInfo
[
i
];
s
Debug
(
"vgId:%d, index:%d ep:%s:%u"
,
pSyncNode
->
vgId
,
i
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
s
Info
(
"vgId:%d, index:%d ep:%s:%u"
,
pSyncNode
->
vgId
,
i
,
pNode
->
nodeFqdn
,
pNode
->
nodePort
);
}
memcpy
(
pSyncNode
->
path
,
pSyncInfo
->
path
,
sizeof
(
pSyncNode
->
path
));
...
...
@@ -1086,7 +1086,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
SSyncSnapshotSender
*
pSender
=
snapshotSenderCreate
(
pSyncNode
,
i
);
// ASSERT(pSender != NULL);
(
pSyncNode
->
senders
)[
i
]
=
pSender
;
sS
Trace
(
pSender
,
"snapshot sender create new while open, data:%p"
,
pSender
);
sS
Debug
(
pSender
,
"snapshot sender create new while open, data:%p"
,
pSender
);
}
// snapshot receivers
...
...
source/libs/sync/src/syncRespMgr.c
浏览文件 @
93c9b2a4
...
...
@@ -36,21 +36,21 @@ SSyncRespMgr *syncRespMgrCreate(void *data, int64_t ttl) {
taosThreadMutexInit
(
&
(
pObj
->
mutex
),
NULL
);
SSyncNode
*
pNode
=
pObj
->
data
;
s
Trace
(
"vgId:%d, create resp manager
"
,
pNode
->
vgId
);
s
Debug
(
"vgId:%d, resp manager create
"
,
pNode
->
vgId
);
return
pObj
;
}
void
syncRespMgrDestroy
(
SSyncRespMgr
*
pObj
)
{
if
(
pObj
!=
NULL
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, destroy resp manager"
,
pNode
->
vgId
);
if
(
pObj
==
NULL
)
return
;
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosHashCleanup
(
pObj
->
pRespHash
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexDestroy
(
&
(
pObj
->
mutex
));
taosMemoryFree
(
pObj
);
}
SSyncNode
*
pNode
=
pObj
->
data
;
sDebug
(
"vgId:%d, resp manager destroy"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosHashCleanup
(
pObj
->
pRespHash
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexDestroy
(
&
(
pObj
->
mutex
));
taosMemoryFree
(
pObj
);
}
uint64_t
syncRespMgrAdd
(
SSyncRespMgr
*
pObj
,
const
SRespStub
*
pStub
)
{
...
...
@@ -174,7 +174,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
void
syncRespCleanRsp
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean all rsp"
,
pNode
->
vgId
);
sTrace
(
"vgId:%d, clean all r
e
sp"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
-
1
,
true
);
...
...
@@ -183,7 +183,7 @@ void syncRespCleanRsp(SSyncRespMgr *pObj) {
void
syncRespClean
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean rsp by ttl"
,
pNode
->
vgId
);
sTrace
(
"vgId:%d, clean r
e
sp by ttl"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
pObj
->
ttl
,
false
);
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
93c9b2a4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncUtil.c
浏览文件 @
93c9b2a4
...
...
@@ -277,14 +277,12 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
if
(
pNode
!=
NULL
&&
pNode
->
pRaftCfg
!=
NULL
)
{
taosPrintLog
(
flags
,
level
,
dflag
,
"vgId:%d, sync %s "
"%s"
", term:%"
PRIu64
", commit-index:%"
PRId64
", first-ver:%"
PRId64
", last-ver:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", snap-term:%"
PRIu64
"vgId:%d, %s, sync:%s, term:%"
PRIu64
", commit-index:%"
PRId64
", first-ver:%"
PRId64
", last-ver:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", snap-term:%"
PRIu64
", elect-times:%d, as-leader-times:%d, cfg-ch-times:%d, hit:%d, mis:%d, hb-slow:%d, hbr-slow:%d, "
"aq-items:%d, snaping:%"
PRId64
", replicas:%d, last-cfg:%"
PRId64
", chging:%d, restore:%d, quorum:%d, elect-lc-timer:%"
PRId64
", hb:%"
PRId64
", %s, %s, %s, %s"
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
pNode
->
vgId
,
eventLog
,
syncStr
(
pNode
->
state
)
,
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
logLastIndex
,
pNode
->
minMatchIndex
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
,
pNode
->
electNum
,
pNode
->
becomeLeaderNum
,
pNode
->
configChangeNum
,
cacheHit
,
cacheMiss
,
pNode
->
hbSlowNum
,
pNode
->
hbrSlowNum
,
aqItems
,
pNode
->
snapshottingIndex
,
pNode
->
replicaNum
,
...
...
@@ -330,13 +328,13 @@ void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dfla
va_end
(
argpointer
);
taosPrintLog
(
flags
,
level
,
dflag
,
"vgId:%d,
sync %s "
"
%s {%p s-param:%"
PRId64
" e-param:%"
PRId64
" laindex:%"
PRId64
" laterm:%"
PRIu64
"
lcindex:%"
PRId64
"vgId:%d,
%s, sync:%s, {%p s-param:%"
PRId64
" e-param:%"
PRId64
" laindex:%"
PRId64
" laterm:%"
PRIu64
" lcindex:%"
PRId64
" seq:%d ack:%d finish:%d replica-index:%d %s:%d}"
", tm:%"
PRIu64
", cmt:%"
PRId64
", fst:%"
PRId64
", lst:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", snap-tm:%"
PRIu64
", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%"
PRId64
", chging:%d, rsto:%d, dquorum:%d, elt:%"
PRId64
", hb:%"
PRId64
", %s, %s"
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
pSender
,
pSender
->
snapshotParam
.
start
,
pNode
->
vgId
,
eventLog
,
syncStr
(
pNode
->
state
)
,
pSender
,
pSender
->
snapshotParam
.
start
,
pSender
->
snapshotParam
.
end
,
pSender
->
snapshot
.
lastApplyIndex
,
pSender
->
snapshot
.
lastApplyTerm
,
pSender
->
snapshot
.
lastConfigIndex
,
pSender
->
seq
,
pSender
->
ack
,
pSender
->
finish
,
pSender
->
replicaIndex
,
host
,
port
,
pNode
->
pRaftStore
->
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
logLastIndex
,
...
...
@@ -382,14 +380,14 @@ void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t df
va_end
(
argpointer
);
taosPrintLog
(
flags
,
level
,
dflag
,
"vgId:%d,
sync %s
"
"
%s
{%p start:%d ack:%d term:%"
PRIu64
" start-time:%"
PRId64
" from:%s:%d s-param:%"
PRId64
"vgId:%d,
%s, sync:%s,
"
" {%p start:%d ack:%d term:%"
PRIu64
" start-time:%"
PRId64
" from:%s:%d s-param:%"
PRId64
" e-param:%"
PRId64
" laindex:%"
PRId64
" laterm:%"
PRIu64
" lcindex:%"
PRId64
"}"
", tm:%"
PRIu64
", cmt:%"
PRId64
", fst:%"
PRId64
", lst:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", snap-tm:%"
PRIu64
", sby:%d, stgy:%d, bch:%d, r-num:%d, lcfg:%"
PRId64
", chging:%d, rsto:%d, dquorum:%d, elt:%"
PRId64
", hb:%"
PRId64
", %s, %s"
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
pReceiver
,
pReceiver
->
start
,
pReceiver
->
ack
,
pNode
->
vgId
,
eventLog
,
syncStr
(
pNode
->
state
)
,
pReceiver
,
pReceiver
->
start
,
pReceiver
->
ack
,
pReceiver
->
term
,
pReceiver
->
startTime
,
host
,
port
,
pReceiver
->
snapshotParam
.
start
,
pReceiver
->
snapshotParam
.
end
,
pReceiver
->
snapshot
.
lastApplyIndex
,
pReceiver
->
snapshot
.
lastApplyTerm
,
pReceiver
->
snapshot
.
lastConfigIndex
,
pNode
->
pRaftStore
->
currentTerm
,
pNode
->
commitIndex
,
logBeginIndex
,
...
...
@@ -520,95 +518,56 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
port
,
pMsg
->
term
,
pMsg
->
timeStamp
,
s
,
timeDiff
);
}
void
syncLogSendSyncPreSnapshot
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshot
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"send sync-pre-snapshot to %s:%d {term:%"
PRId64
"}, %s"
,
host
,
port
,
pMsg
->
term
,
s
);
}
void
syncLogRecvSyncPreSnapshot
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshot
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-pre-snapshot from %s:%d {term:%"
PRId64
"}, %s"
,
host
,
port
,
pMsg
->
term
,
s
);
}
void
syncLogSendSyncPreSnapshotReply
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshotReply
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"send sync-pre-snapshot-reply to %s:%d {term:%"
PRId64
", snap-start:%"
PRId64
"}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
snapStart
,
s
);
}
void
syncLogRecvSyncPreSnapshotReply
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshotReply
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-pre-snapshot-reply from %s:%d {term:%"
PRId64
", snap-start:%"
PRId64
"}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
snapStart
,
s
);
}
void
syncLogSendSyncSnapshotSend
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotSend
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_
TRACE
))
return
;
if
(
!
(
sDebugFlag
&
DEBUG_
DEBUG
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sN
Trace
(
pSyncNode
,
"send sync-snapshot-send to %s:%
d {term:%"
PRId64
", begin:%"
PRId64
", end:%"
PRId64
", lterm
:%"
PRId64
",
stime:%"
PRId64
", seq:%d}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
beginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
,
pMsg
->
seq
,
s
);
sN
Debug
(
pSyncNode
,
"send sync-snapshot-send to %s:%
u, %s, seq:%d, term:%"
PRId64
", begin:%"
PRId64
", end
:%"
PRId64
",
lterm:%"
PRId64
", stime:%"
PRId64
,
host
,
port
,
s
,
pMsg
->
seq
,
pMsg
->
term
,
pMsg
->
beginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
);
}
void
syncLogRecvSyncSnapshotSend
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotSend
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_
TRACE
))
return
;
if
(
!
(
sDebugFlag
&
DEBUG_
DEBUG
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sN
Trace
(
pSyncNode
,
"recv sync-snapshot-send from %s:%
d {term:%"
PRId64
", begin:%"
PRId64
", lst:%"
PRId64
", lterm
:%"
PRId64
",
stime:%"
PRId64
", seq:%d, len:%u}, %s
"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
beginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
,
pMsg
->
seq
,
pMsg
->
dataLen
,
s
);
sN
Debug
(
pSyncNode
,
"recv sync-snapshot-send from %s:%
u, %s, seq:%d, term:%"
PRId64
", begin:%"
PRId64
", lst
:%"
PRId64
",
lterm:%"
PRId64
", stime:%"
PRId64
", len:%u
"
,
host
,
port
,
s
,
pMsg
->
seq
,
pMsg
->
term
,
pMsg
->
beginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
,
pMsg
->
dataLen
);
}
void
syncLogSendSyncSnapshotRsp
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotRsp
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
if
(
!
(
sDebugFlag
&
DEBUG_DEBUG
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sN
Trace
(
pSyncNode
,
"send sync-snapshot-rsp to %s:%
d {term:%"
PRId64
", begin:%"
PRId64
", lst:%"
PRId64
", lterm
:%"
PRId64
",
stime:%"
PRId64
", ack:%d}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
snapBeginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
,
pMsg
->
ack
,
s
);
sN
Debug
(
pSyncNode
,
"send sync-snapshot-rsp to %s:%
u, %s, ack:%d, term:%"
PRId64
", begin:%"
PRId64
", lst
:%"
PRId64
",
lterm:%"
PRId64
", stime:%"
PRId64
,
host
,
port
,
s
,
pMsg
->
ack
,
pMsg
->
term
,
pMsg
->
snapBeginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
);
}
void
syncLogRecvSyncSnapshotRsp
(
SSyncNode
*
pSyncNode
,
const
SyncSnapshotRsp
*
pMsg
,
const
char
*
s
)
{
if
(
!
(
sDebugFlag
&
DEBUG_
TRACE
))
return
;
if
(
!
(
sDebugFlag
&
DEBUG_
DEBUG
))
return
;
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sN
Trace
(
pSyncNode
,
"recv sync-snapshot-rsp from %s:%
d {term:%"
PRId64
", begin:%"
PRId64
", lst:%"
PRId64
", lterm
:%"
PRId64
",
stime:%"
PRId64
", ack:%d}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
snapBeginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
,
pMsg
->
ack
,
s
);
sN
Debug
(
pSyncNode
,
"recv sync-snapshot-rsp from %s:%
u, %s, ack:%d, term:%"
PRId64
", begin:%"
PRId64
", lst
:%"
PRId64
",
lterm:%"
PRId64
", stime:%"
PRId64
,
host
,
port
,
s
,
pMsg
->
ack
,
pMsg
->
term
,
pMsg
->
snapBeginIndex
,
pMsg
->
lastIndex
,
pMsg
->
lastTerm
,
pMsg
->
startTime
);
}
void
syncLogRecvAppendEntries
(
SSyncNode
*
pSyncNode
,
const
SyncAppendEntries
*
pMsg
,
const
char
*
s
)
{
...
...
source/libs/sync/test/sync_test_lib/src/syncSnapshotDebug.c
浏览文件 @
93c9b2a4
...
...
@@ -132,7 +132,7 @@ char *snapshotReceiver2Str(SSyncSnapshotReceiver *pReceiver) {
}
int32_t
syncNodeOnPreSnapshot
(
SSyncNode
*
ths
,
SyncPreSnapshot
*
pMsg
)
{
syncLogRecvSyncPreSnapshot
(
ths
,
pMsg
,
""
);
//
syncLogRecvSyncPreSnapshot(ths, pMsg, "");
SyncPreSnapshotReply
*
pMsgReply
=
syncPreSnapshotReplyBuild
(
ths
->
vgId
);
pMsgReply
->
srcId
=
ths
->
myRaftId
;
...
...
@@ -181,7 +181,7 @@ _IGNORE:
}
int32_t
syncNodeOnPreSnapshotReply
(
SSyncNode
*
ths
,
SyncPreSnapshotReply
*
pMsg
)
{
syncLogRecvSyncPreSnapshotReply
(
ths
,
pMsg
,
""
);
//
syncLogRecvSyncPreSnapshotReply(ths, pMsg, "");
// start snapshot
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录