Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f5bebc53
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,发现更多精彩内容 >>
提交
f5bebc53
编写于
12月 01, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): add traceId log
上级
f0fdc58c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
25 addition
and
15 deletion
+25
-15
source/libs/sync/inc/syncUtil.h
source/libs/sync/inc/syncUtil.h
+4
-3
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+10
-2
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+11
-10
未找到文件。
source/libs/sync/inc/syncUtil.h
浏览文件 @
f5bebc53
...
...
@@ -94,11 +94,12 @@ void syncLogRecvLocalCmd(SSyncNode* pSyncNode, const SyncLocalCmd* pMsg, const c
void
syncLogSendAppendEntriesReply
(
SSyncNode
*
pSyncNode
,
const
SyncAppendEntriesReply
*
pMsg
,
const
char
*
s
);
void
syncLogRecvAppendEntriesReply
(
SSyncNode
*
pSyncNode
,
const
SyncAppendEntriesReply
*
pMsg
,
const
char
*
s
);
void
syncLogSendHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
bool
printX
,
int64_t
timerElapsed
,
int64_t
execTime
);
void
syncLogRecvHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
int64_t
timeDiff
);
void
syncLogSendHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
bool
printX
,
int64_t
timerElapsed
,
int64_t
execTime
);
void
syncLogRecvHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
int64_t
timeDiff
,
const
char
*
s
);
void
syncLogSendHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
const
char
*
s
);
void
syncLogRecvHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
int64_t
timeDiff
);
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
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
f5bebc53
...
...
@@ -2266,9 +2266,13 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) {
int32_t
syncNodeOnHeartbeat
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pRpcMsg
)
{
SyncHeartbeat
*
pMsg
=
pRpcMsg
->
pCont
;
const
STraceId
*
trace
=
&
pRpcMsg
->
info
.
traceId
;
char
tbuf
[
40
]
=
{
0
};
TRACE_TO_STR
(
trace
,
tbuf
);
int64_t
tsMs
=
taosGetTimestampMs
();
int64_t
timeDiff
=
tsMs
-
pMsg
->
timeStamp
;
syncLogRecvHeartbeat
(
ths
,
pMsg
,
timeDiff
);
syncLogRecvHeartbeat
(
ths
,
pMsg
,
timeDiff
,
tbuf
);
SRpcMsg
rpcMsg
=
{
0
};
(
void
)
syncBuildHeartbeatReply
(
&
rpcMsg
,
ths
->
vgId
);
...
...
@@ -2343,9 +2347,13 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
int32_t
syncNodeOnHeartbeatReply
(
SSyncNode
*
ths
,
const
SRpcMsg
*
pRpcMsg
)
{
SyncHeartbeatReply
*
pMsg
=
pRpcMsg
->
pCont
;
const
STraceId
*
trace
=
&
pRpcMsg
->
info
.
traceId
;
char
tbuf
[
40
]
=
{
0
};
TRACE_TO_STR
(
trace
,
tbuf
);
int64_t
tsMs
=
taosGetTimestampMs
();
int64_t
timeDiff
=
tsMs
-
pMsg
->
timeStamp
;
syncLogRecvHeartbeatReply
(
ths
,
pMsg
,
timeDiff
);
syncLogRecvHeartbeatReply
(
ths
,
pMsg
,
timeDiff
,
tbuf
);
// update last reply time, make decision whether the other node is alive or not
syncIndexMgrSetRecvTime
(
ths
->
pMatchIndex
,
&
pMsg
->
srcId
,
tsMs
);
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
f5bebc53
...
...
@@ -464,7 +464,7 @@ void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, bool
}
}
void
syncLogRecvHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
int64_t
timeDiff
)
{
void
syncLogRecvHeartbeat
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeat
*
pMsg
,
int64_t
timeDiff
,
const
char
*
s
)
{
if
(
timeDiff
>
SYNC_HEARTBEAT_SLOW_MS
)
{
pSyncNode
->
hbSlowNum
++
;
...
...
@@ -473,8 +473,8 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNInfo
(
pSyncNode
,
"recv sync-heartbeat from %s:%d slow {term:%"
PRId64
", cmt:%"
PRId64
", min-match:%"
PRId64
", ts:%"
PRId64
"}, net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
commitIndex
,
pMsg
->
minMatchIndex
,
pMsg
->
timeStamp
,
timeDiff
);
"},
%s,
net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
commitIndex
,
pMsg
->
minMatchIndex
,
pMsg
->
timeStamp
,
s
,
timeDiff
);
}
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
...
...
@@ -484,8 +484,8 @@ void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-heartbeat from %s:%d {term:%"
PRId64
", cmt:%"
PRId64
", min-match:%"
PRId64
", ts:%"
PRId64
"}, net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
commitIndex
,
pMsg
->
minMatchIndex
,
pMsg
->
timeStamp
,
timeDiff
);
"},
%s,
net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
commitIndex
,
pMsg
->
minMatchIndex
,
pMsg
->
timeStamp
,
s
,
timeDiff
);
}
void
syncLogSendHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
const
char
*
s
)
{
...
...
@@ -499,7 +499,7 @@ void syncLogSendHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
pMsg
->
term
,
pMsg
->
timeStamp
,
s
);
}
void
syncLogRecvHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
int64_t
timeDiff
)
{
void
syncLogRecvHeartbeatReply
(
SSyncNode
*
pSyncNode
,
const
SyncHeartbeatReply
*
pMsg
,
int64_t
timeDiff
,
const
char
*
s
)
{
if
(
timeDiff
>
SYNC_HEARTBEAT_REPLY_SLOW_MS
)
{
pSyncNode
->
hbrSlowNum
++
;
...
...
@@ -507,8 +507,8 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-heartbeat-reply from %s:%d slow {term:%"
PRId64
", ts:%"
PRId64
"},
net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
timeStamp
,
timeDiff
);
"recv sync-heartbeat-reply from %s:%d slow {term:%"
PRId64
", ts:%"
PRId64
"},
%s, net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
timeStamp
,
s
,
timeDiff
);
}
if
(
!
(
sDebugFlag
&
DEBUG_TRACE
))
return
;
...
...
@@ -516,8 +516,9 @@ void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* p
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
sNTrace
(
pSyncNode
,
"recv sync-heartbeat-reply from %s:%d {term:%"
PRId64
", ts:%"
PRId64
"}, net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
timeStamp
,
timeDiff
);
sNTrace
(
pSyncNode
,
"recv sync-heartbeat-reply from %s:%d {term:%"
PRId64
", ts:%"
PRId64
"}, %s, net elapsed:%"
PRId64
,
host
,
port
,
pMsg
->
term
,
pMsg
->
timeStamp
,
s
,
timeDiff
);
}
void
syncLogSendSyncPreSnapshot
(
SSyncNode
*
pSyncNode
,
const
SyncPreSnapshot
*
pMsg
,
const
char
*
s
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录