Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33d1440e
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看板
提交
33d1440e
编写于
6月 28, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): adjust trace log
上级
feb2a0f7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
16 deletion
+30
-16
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+2
-2
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+23
-10
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+4
-3
未找到文件。
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
33d1440e
...
...
@@ -15,7 +15,6 @@
#define _DEFAULT_SOURCE
#include "mndAcct.h"
#include "mndPrivilege.h"
#include "mndBnode.h"
#include "mndCluster.h"
#include "mndConsumer.h"
...
...
@@ -27,6 +26,7 @@
#include "mndMnode.h"
#include "mndOffset.h"
#include "mndPerfSchema.h"
#include "mndPrivilege.h"
#include "mndProfile.h"
#include "mndQnode.h"
#include "mndQuery.h"
...
...
@@ -416,7 +416,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
char
*
syncNodeStr
=
sync2SimpleStr
(
pMgmt
->
sync
);
static
int64_t
mndTick
=
0
;
if
(
++
mndTick
%
10
==
1
)
{
mTrace
(
"vgId:%d, sync
heartbeat
msg:%s, %s"
,
syncGetVgId
(
pMgmt
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
mTrace
(
"vgId:%d, sync
trace
msg:%s, %s"
,
syncGetVgId
(
pMgmt
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
}
if
(
gRaftDetailLog
)
{
char
logBuf
[
512
]
=
{
0
};
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
33d1440e
...
...
@@ -243,7 +243,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
char
*
syncNodeStr
=
sync2SimpleStr
(
pVnode
->
sync
);
static
int64_t
vndTick
=
0
;
if
(
++
vndTick
%
10
==
1
)
{
vGTrace
(
"vgId:%d, sync
heartbeat
msg:%s, %s"
,
syncGetVgId
(
pVnode
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
vGTrace
(
"vgId:%d, sync
trace
msg:%s, %s"
,
syncGetVgId
(
pVnode
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
}
if
(
gRaftDetailLog
)
{
char
logBuf
[
512
]
=
{
0
};
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
33d1440e
...
...
@@ -698,7 +698,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak) {
}
else
{
ret
=
-
1
;
terrno
=
TSDB_CODE_SYN_NOT_LEADER
;
sError
(
"sync
P
ropose not leader, %s"
,
syncUtilState2String
(
pSyncNode
->
state
));
sError
(
"sync
p
ropose not leader, %s"
,
syncUtilState2String
(
pSyncNode
->
state
));
goto
_END
;
}
...
...
@@ -1414,46 +1414,59 @@ void syncNodeErrorLog(const SSyncNode* pSyncNode, char* str) {
int32_t
userStrLen
=
strlen
(
str
);
SSnapshot
snapshot
=
{.
data
=
NULL
,
.
lastApplyIndex
=
-
1
,
.
lastApplyTerm
=
0
};
if
(
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
)
{
if
(
pSyncNode
->
pFsm
!=
NULL
&&
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
!=
NULL
)
{
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
(
pSyncNode
->
pFsm
,
&
snapshot
);
}
SyncIndex
logLastIndex
=
pSyncNode
->
pLogStore
->
syncLogLastIndex
(
pSyncNode
->
pLogStore
);
SyncIndex
logBeginIndex
=
pSyncNode
->
pLogStore
->
syncLogBeginIndex
(
pSyncNode
->
pLogStore
);
SyncIndex
logLastIndex
=
SYNC_INDEX_INVALID
;
SyncIndex
logBeginIndex
=
SYNC_INDEX_INVALID
;
if
(
pSyncNode
->
pLogStore
!=
NULL
)
{
logLastIndex
=
pSyncNode
->
pLogStore
->
syncLogLastIndex
(
pSyncNode
->
pLogStore
);
logBeginIndex
=
pSyncNode
->
pLogStore
->
syncLogBeginIndex
(
pSyncNode
->
pLogStore
);
}
char
*
pCfgStr
=
syncCfg2SimpleStr
(
&
(
pSyncNode
->
pRaftCfg
->
cfg
));
char
*
printStr
=
""
;
if
(
pCfgStr
!=
NULL
)
{
printStr
=
pCfgStr
;
}
if
(
userStrLen
<
256
)
{
char
logBuf
[
128
+
256
];
char
logBuf
[
256
+
256
];
if
(
pSyncNode
!=
NULL
&&
pSyncNode
->
pRaftCfg
!=
NULL
&&
pSyncNode
->
pRaftStore
!=
NULL
)
{
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, "
"replica-num:%d, "
"lconfig:%ld, changing:%d"
,
"lconfig:%ld, changing:%d
, restore:%d, %s
"
,
pSyncNode
->
vgId
,
syncUtilState2String
(
pSyncNode
->
state
),
str
,
pSyncNode
->
pRaftStore
->
currentTerm
,
pSyncNode
->
commitIndex
,
logBeginIndex
,
logLastIndex
,
snapshot
.
lastApplyIndex
,
pSyncNode
->
pRaftCfg
->
isStandBy
,
pSyncNode
->
replicaNum
,
pSyncNode
->
pRaftCfg
->
lastConfigIndex
,
pSyncNode
->
changing
);
pSyncNode
->
changing
,
pSyncNode
->
restoreFinish
,
printStr
);
}
else
{
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"%s"
,
str
);
}
sError
(
"%s"
,
logBuf
);
}
else
{
int
len
=
128
+
userStrLen
;
int
len
=
256
+
userStrLen
;
char
*
s
=
(
char
*
)
taosMemoryMalloc
(
len
);
if
(
pSyncNode
!=
NULL
&&
pSyncNode
->
pRaftCfg
!=
NULL
&&
pSyncNode
->
pRaftStore
!=
NULL
)
{
snprintf
(
s
,
len
,
"vgId:%d, sync %s %s, term:%lu, commit:%ld, beginlog:%ld, lastlog:%ld, lastsnapshot:%ld, standby:%d, "
"replica-num:%d, "
"lconfig:%ld, changing:%d"
,
"lconfig:%ld, changing:%d
, restore:%d, %s
"
,
pSyncNode
->
vgId
,
syncUtilState2String
(
pSyncNode
->
state
),
str
,
pSyncNode
->
pRaftStore
->
currentTerm
,
pSyncNode
->
commitIndex
,
logBeginIndex
,
logLastIndex
,
snapshot
.
lastApplyIndex
,
pSyncNode
->
pRaftCfg
->
isStandBy
,
pSyncNode
->
replicaNum
,
pSyncNode
->
pRaftCfg
->
lastConfigIndex
,
pSyncNode
->
changing
);
pSyncNode
->
changing
,
pSyncNode
->
restoreFinish
,
printStr
);
}
else
{
snprintf
(
s
,
len
,
"%s"
,
str
);
}
sError
(
"%s"
,
s
);
taosMemoryFree
(
s
);
}
taosMemoryFree
(
pCfgStr
);
}
char
*
syncNode2SimpleStr
(
const
SSyncNode
*
pSyncNode
)
{
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
33d1440e
...
...
@@ -363,8 +363,9 @@ char *snapshotSender2SimpleStr(SSyncSnapshotSender *pSender, char *event) {
uint16_t
port
;
syncUtilU642Addr
(
destId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
snprintf
(
s
,
len
,
"%s %p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d"
,
event
,
pSender
,
pSender
->
snapshot
.
lastApplyIndex
,
pSender
->
snapshot
.
lastApplyTerm
,
snprintf
(
s
,
len
,
"%s {%p laindex:%ld laterm:%lu lcindex:%ld seq:%d ack:%d finish:%d pterm:%lu replica-index:%d %s:%d}"
,
event
,
pSender
,
pSender
->
snapshot
.
lastApplyIndex
,
pSender
->
snapshot
.
lastApplyTerm
,
pSender
->
snapshot
.
lastConfigIndex
,
pSender
->
seq
,
pSender
->
ack
,
pSender
->
finish
,
pSender
->
privateTerm
,
pSender
->
replicaIndex
,
host
,
port
);
...
...
@@ -629,7 +630,7 @@ char *snapshotReceiver2SimpleStr(SSyncSnapshotReceiver *pReceiver, char *event)
uint16_t
port
;
syncUtilU642Addr
(
fromId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
snprintf
(
s
,
len
,
"%s
%p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld
"
,
event
,
snprintf
(
s
,
len
,
"%s
{%p start:%d ack:%d term:%lu pterm:%lu from:%s:%d laindex:%ld laterm:%lu lcindex:%ld}
"
,
event
,
pReceiver
,
pReceiver
->
start
,
pReceiver
->
ack
,
pReceiver
->
term
,
pReceiver
->
privateTerm
,
host
,
port
,
pReceiver
->
snapshot
.
lastApplyIndex
,
pReceiver
->
snapshot
.
lastApplyTerm
,
pReceiver
->
snapshot
.
lastConfigIndex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录