Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac8eeb87
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
ac8eeb87
编写于
11月 14, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): modify error log
上级
8f55e007
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
17 deletion
+18
-17
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+4
-4
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+6
-6
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+8
-7
未找到文件。
source/libs/sync/src/syncMain.c
浏览文件 @
ac8eeb87
...
...
@@ -1806,7 +1806,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
int32_t
code
=
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_PING
,
atomic_load_64
(
&
pNode
->
pingTimerLogicClock
),
pNode
->
pingTimerMS
,
pNode
);
if
(
code
!=
0
)
{
s
N
Error
(
pNode
,
"failed to build ping msg"
);
sError
(
pNode
,
"failed to build ping msg"
);
rpcFreeCont
(
rpcMsg
.
pCont
);
return
;
}
...
...
@@ -1814,7 +1814,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
sNTrace
(
pNode
,
"enqueue ping msg"
);
code
=
pNode
->
syncEqMsg
(
pNode
->
msgcb
,
&
rpcMsg
);
if
(
code
!=
0
)
{
s
N
Error
(
pNode
,
"failed to sync enqueue ping msg since %s"
,
terrstr
());
sError
(
pNode
,
"failed to sync enqueue ping msg since %s"
,
terrstr
());
rpcFreeCont
(
rpcMsg
.
pCont
);
return
;
}
...
...
@@ -1839,7 +1839,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
int32_t
code
=
syncBuildTimeout
(
&
rpcMsg
,
SYNC_TIMEOUT_ELECTION
,
pElectTimer
->
logicClock
,
pNode
->
electTimerMS
,
pNode
);
if
(
code
!=
0
)
{
s
N
Error
(
pNode
,
"failed to build elect msg"
);
sError
(
pNode
,
"failed to build elect msg"
);
taosMemoryFree
(
pElectTimer
);
return
;
}
...
...
@@ -1849,7 +1849,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
code
=
pNode
->
syncEqMsg
(
pNode
->
msgcb
,
&
rpcMsg
);
if
(
code
!=
0
)
{
s
N
Error
(
pNode
,
"failed to sync enqueue elect msg since %s"
,
terrstr
());
sError
(
pNode
,
"failed to sync enqueue elect msg since %s"
,
terrstr
());
rpcFreeCont
(
rpcMsg
.
pCont
);
taosMemoryFree
(
pElectTimer
);
return
;
...
...
source/libs/sync/src/syncRaftLog.c
浏览文件 @
ac8eeb87
...
...
@@ -198,9 +198,9 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr
syncMeta
.
seqNum
=
pEntry
->
seqNum
;
syncMeta
.
term
=
pEntry
->
term
;
int64_t
tsWriteBegin
=
taosGetTimestamp
M
s
();
int64_t
tsWriteBegin
=
taosGetTimestamp
N
s
();
index
=
walAppendLog
(
pWal
,
pEntry
->
originalRpcType
,
syncMeta
,
pEntry
->
data
,
pEntry
->
dataLen
);
int64_t
tsWriteEnd
=
taosGetTimestamp
M
s
();
int64_t
tsWriteEnd
=
taosGetTimestamp
N
s
();
int64_t
tsElapsed
=
tsWriteEnd
-
tsWriteBegin
;
if
(
index
<
0
)
{
...
...
@@ -239,12 +239,12 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR
return
-
1
;
}
int64_t
ts1
=
taosGetTimestamp
M
s
();
int64_t
ts1
=
taosGetTimestamp
N
s
();
taosThreadMutexLock
(
&
(
pData
->
mutex
));
int64_t
ts2
=
taosGetTimestamp
M
s
();
int64_t
ts2
=
taosGetTimestamp
N
s
();
code
=
walReadVer
(
pWalHandle
,
index
);
int64_t
ts3
=
taosGetTimestamp
M
s
();
int64_t
ts3
=
taosGetTimestamp
N
s
();
// code = walReadVerCached(pWalHandle, index);
if
(
code
!=
0
)
{
...
...
@@ -289,7 +289,7 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR
*/
taosThreadMutexUnlock
(
&
(
pData
->
mutex
));
int64_t
ts4
=
taosGetTimestamp
M
s
();
int64_t
ts4
=
taosGetTimestamp
N
s
();
int64_t
tsElapsed
=
ts4
-
ts1
;
int64_t
tsElapsedLock
=
ts2
-
ts1
;
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
ac8eeb87
...
...
@@ -194,6 +194,7 @@ static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
void
syncPrintNodeLog
(
const
char
*
flags
,
ELogLevel
level
,
int32_t
dflag
,
SSyncNode
*
pNode
,
const
char
*
format
,
...)
{
if
(
pNode
==
NULL
||
pNode
->
pRaftCfg
!=
NULL
&&
pNode
->
pRaftStore
==
NULL
||
pNode
->
pLogStore
==
NULL
)
return
;
int64_t
currentTerm
=
pNode
->
pRaftStore
->
currentTerm
;
// save error code, otherwise it will be overwritten
int32_t
errCode
=
terrno
;
...
...
@@ -235,8 +236,8 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
", tm:%"
PRIu64
", cmt:%"
PRId64
", fst:%"
PRId64
", lst:%"
PRId64
", min:%"
PRId64
", snap:%"
PRId64
", snap-tm:%"
PRIu64
", sby:%d, aq:%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
,
pNode
->
pRaftStore
->
currentTerm
,
pNode
->
commit
Index
,
log
BeginIndex
,
log
LastIndex
,
pNode
->
minMatchIndex
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
,
pNode
->
vgId
,
syncStr
(
pNode
->
state
),
eventLog
,
currentTerm
,
pNode
->
commitIndex
,
logBegin
Index
,
logLastIndex
,
pNode
->
minMatchIndex
,
snapshot
.
lastApplyIndex
,
snapshot
.
lastApplyTerm
,
pNode
->
pRaftCfg
->
isStandBy
,
aqItems
,
pNode
->
pRaftCfg
->
batchSize
,
pNode
->
replicaNum
,
pNode
->
pRaftCfg
->
lastConfigIndex
,
pNode
->
changing
,
pNode
->
restoreFinish
,
quorum
,
pNode
->
electTimerLogicClock
,
pNode
->
heartbeatTimerLogicClockUser
,
peerStr
,
cfgStr
);
...
...
@@ -374,9 +375,9 @@ void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntries
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-append-entries-reply from %s:%d {term:%"
PRId64
", pterm:%"
PRId64
", success:%d, match:%"
PRId64
"}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
privateTerm
,
pMsg
->
success
,
pMsg
->
matchIndex
,
s
);
"recv sync-append-entries-reply from %s:%d {term:%"
PRId64
", pterm:%"
PRId64
"
, success:%d, lsend-index:%"
PRId64
", match:%"
PRId64
"
}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
privateTerm
,
pMsg
->
success
,
pMsg
->
lastSendIndex
,
pMsg
->
matchIndex
,
s
);
}
void
syncLogSendHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
const
char
*
s
)
{
...
...
@@ -511,8 +512,8 @@ void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMs
syncUtilU642Addr
(
pMsg
->
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"send sync-append-entries to %s:%d, {term:%"
PRId64
", pre-index:%"
PRId64
", pre-term:%"
PRId64
",
pterm
:%"
PRId64
", cmt:%"
PRId64
", datalen:%d}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
,
pMsg
->
privateTerm
,
pMsg
->
commitIndex
,
",
lsend-index
:%"
PRId64
", cmt:%"
PRId64
", datalen:%d}, %s"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
,
(
pMsg
->
prevLogIndex
+
1
)
,
pMsg
->
commitIndex
,
pMsg
->
dataLen
,
s
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录