Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6bb8a9ad
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看板
提交
6bb8a9ad
编写于
7月 08, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: adjust logs
上级
de644c7d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
92 addition
and
92 deletion
+92
-92
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-1
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+53
-53
source/libs/sync/src/syncRaftCfg.c
source/libs/sync/src/syncRaftCfg.c
+2
-2
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+3
-3
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+10
-10
source/libs/sync/src/syncRaftStore.c
source/libs/sync/src/syncRaftStore.c
+10
-10
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+11
-11
source/libs/sync/src/syncVoteMgr.c
source/libs/sync/src/syncVoteMgr.c
+2
-2
未找到文件。
source/libs/sync/src/syncMain.c
浏览文件 @
6bb8a9ad
...
...
@@ -1391,7 +1391,7 @@ cJSON* syncNode2Json(const SSyncNode* pSyncNode) {
cJSON_AddItemToObject
(
pRoot
,
"leaderCache"
,
pLaderCache
);
// life cycle
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pSyncNode
->
rid
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pSyncNode
->
rid
);
cJSON_AddStringToObject
(
pRoot
,
"rid"
,
u64buf
);
// tla+ server vars
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
6bb8a9ad
...
...
@@ -242,7 +242,7 @@ cJSON* syncTimeout2Json(const SyncTimeout* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"vgId"
,
pMsg
->
vgId
);
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON_AddNumberToObject
(
pRoot
,
"timeoutType"
,
pMsg
->
timeoutType
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
logicClock
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
logicClock
);
cJSON_AddStringToObject
(
pRoot
,
"logicClock"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"timerMS"
,
pMsg
->
timerMS
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%p"
,
pMsg
->
data
);
...
...
@@ -472,7 +472,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -487,7 +487,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -734,7 +734,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -749,7 +749,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -902,7 +902,7 @@ cJSON* syncClientRequest2Json(const SyncClientRequest* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"vgId"
,
pMsg
->
vgId
);
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON_AddNumberToObject
(
pRoot
,
"originalRpcType"
,
pMsg
->
originalRpcType
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
seqNum
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
seqNum
);
cJSON_AddStringToObject
(
pRoot
,
"seqNum"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"isWeak"
,
pMsg
->
isWeak
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
...
...
@@ -1201,7 +1201,7 @@ cJSON* syncRequestVote2Json(const SyncRequestVote* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -1229,11 +1229,11 @@ cJSON* syncRequestVote2Json(const SyncRequestVote* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
lastLogIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
lastLogIndex
);
cJSON_AddStringToObject
(
pRoot
,
"lastLogIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
lastLogTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
lastLogTerm
);
cJSON_AddStringToObject
(
pRoot
,
"lastLogTerm"
,
u64buf
);
}
...
...
@@ -1352,7 +1352,7 @@ cJSON* syncRequestVoteReply2Json(const SyncRequestVoteReply* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -1380,7 +1380,7 @@ cJSON* syncRequestVoteReply2Json(const SyncRequestVoteReply* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"vote_granted"
,
pMsg
->
voteGranted
);
}
...
...
@@ -1502,7 +1502,7 @@ cJSON* syncAppendEntries2Json(const SyncAppendEntries* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -1517,7 +1517,7 @@ cJSON* syncAppendEntries2Json(const SyncAppendEntries* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -1531,19 +1531,19 @@ cJSON* syncAppendEntries2Json(const SyncAppendEntries* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
prevLogIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
prevLogIndex
);
cJSON_AddStringToObject
(
pRoot
,
"prevLogIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
prevLogTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
prevLogTerm
);
cJSON_AddStringToObject
(
pRoot
,
"pre_log_term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
commitIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
commitIndex
);
cJSON_AddStringToObject
(
pRoot
,
"commitIndex"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
...
...
@@ -1714,7 +1714,7 @@ cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -1729,7 +1729,7 @@ cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -1743,19 +1743,19 @@ cJSON* syncAppendEntriesBatch2Json(const SyncAppendEntriesBatch* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
prevLogIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
prevLogIndex
);
cJSON_AddStringToObject
(
pRoot
,
"prevLogIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
prevLogTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
prevLogTerm
);
cJSON_AddStringToObject
(
pRoot
,
"prevLogTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
commitIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
commitIndex
);
cJSON_AddStringToObject
(
pRoot
,
"commitIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"dataCount"
,
pMsg
->
dataCount
);
...
...
@@ -1910,7 +1910,7 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -1925,7 +1925,7 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -1939,13 +1939,13 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"success"
,
pMsg
->
success
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
matchIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
matchIndex
);
cJSON_AddStringToObject
(
pRoot
,
"matchIndex"
,
u64buf
);
}
...
...
@@ -2083,13 +2083,13 @@ cJSON* syncApplyMsg2Json(const SyncApplyMsg* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON_AddNumberToObject
(
pRoot
,
"originalRpcType"
,
pMsg
->
originalRpcType
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
fsmMeta
.
index
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
fsmMeta
.
index
);
cJSON_AddStringToObject
(
pRoot
,
"fsmMeta.index"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"fsmMeta.isWeak"
,
pMsg
->
fsmMeta
.
isWeak
);
cJSON_AddNumberToObject
(
pRoot
,
"fsmMeta.code"
,
pMsg
->
fsmMeta
.
code
);
cJSON_AddNumberToObject
(
pRoot
,
"fsmMeta.state"
,
pMsg
->
fsmMeta
.
state
);
cJSON_AddStringToObject
(
pRoot
,
"fsmMeta.state.str"
,
syncUtilState2String
(
pMsg
->
fsmMeta
.
state
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
fsmMeta
.
seqNum
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
fsmMeta
.
seqNum
);
cJSON_AddStringToObject
(
pRoot
,
"fsmMeta.seqNum"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
...
...
@@ -2219,7 +2219,7 @@ cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -2234,7 +2234,7 @@ cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -2248,23 +2248,23 @@ cJSON* syncSnapshotSend2Json(const SyncSnapshotSend* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
beginIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
beginIndex
);
cJSON_AddStringToObject
(
pRoot
,
"beginIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
lastIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
lastIndex
);
cJSON_AddStringToObject
(
pRoot
,
"lastIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
lastConfigIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
lastConfigIndex
);
cJSON_AddStringToObject
(
pRoot
,
"lastConfigIndex"
,
u64buf
);
cJSON_AddItemToObject
(
pRoot
,
"lastConfig"
,
syncCfg2Json
((
SSyncCfg
*
)
&
(
pMsg
->
lastConfig
)));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
lastTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
lastTerm
);
cJSON_AddStringToObject
(
pRoot
,
"lastTerm"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"seq"
,
pMsg
->
seq
);
...
...
@@ -2394,7 +2394,7 @@ cJSON* syncSnapshotRsp2Json(const SyncSnapshotRsp* pMsg) {
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pMsg
->
msgType
);
cJSON
*
pSrcId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
srcId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
srcId
.
addr
);
cJSON_AddStringToObject
(
pSrcId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
srcId
.
addr
;
...
...
@@ -2409,7 +2409,7 @@ cJSON* syncSnapshotRsp2Json(const SyncSnapshotRsp* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"srcId"
,
pSrcId
);
cJSON
*
pDestId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
destId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
destId
.
addr
);
cJSON_AddStringToObject
(
pDestId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
destId
.
addr
;
...
...
@@ -2423,16 +2423,16 @@ cJSON* syncSnapshotRsp2Json(const SyncSnapshotRsp* pMsg) {
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"destId"
,
pDestId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
lastIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
lastIndex
);
cJSON_AddStringToObject
(
pRoot
,
"lastIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
lastTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
lastTerm
);
cJSON_AddStringToObject
(
pRoot
,
"lastTerm"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"ack"
,
pMsg
->
ack
);
...
...
@@ -2555,7 +2555,7 @@ cJSON* syncLeaderTransfer2Json(const SyncLeaderTransfer* pMsg) {
/*
cJSON* pSrcId = cJSON_CreateObject();
snprintf(u64buf, sizeof(u64buf), PRIu64, pMsg->srcId.addr);
snprintf(u64buf, sizeof(u64buf),
"%"
PRIu64, pMsg->srcId.addr);
cJSON_AddStringToObject(pSrcId, "addr", u64buf);
{
uint64_t u64 = pMsg->srcId.addr;
...
...
@@ -2570,7 +2570,7 @@ cJSON* syncLeaderTransfer2Json(const SyncLeaderTransfer* pMsg) {
cJSON_AddItemToObject(pRoot, "srcId", pSrcId);
cJSON* pDestId = cJSON_CreateObject();
snprintf(u64buf, sizeof(u64buf), PRIu64, pMsg->destId.addr);
snprintf(u64buf, sizeof(u64buf),
"%"
PRIu64, pMsg->destId.addr);
cJSON_AddStringToObject(pDestId, "addr", u64buf);
{
uint64_t u64 = pMsg->destId.addr;
...
...
@@ -2586,7 +2586,7 @@ cJSON* syncLeaderTransfer2Json(const SyncLeaderTransfer* pMsg) {
*/
cJSON
*
pNewerId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
newLeaderId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
newLeaderId
.
addr
);
cJSON_AddStringToObject
(
pNewerId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pMsg
->
newLeaderId
.
addr
;
...
...
@@ -2720,13 +2720,13 @@ cJSON* syncReconfigFinish2Json(const SyncReconfigFinish* pMsg) {
cJSON_AddItemToObject
(
pRoot
,
"oldCfg"
,
pOldCfg
);
cJSON_AddItemToObject
(
pRoot
,
"newCfg"
,
pNewCfg
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
pMsg
->
newCfgIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
pMsg
->
newCfgIndex
);
cJSON_AddStringToObject
(
pRoot
,
"newCfgIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
newCfgTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
newCfgTerm
);
cJSON_AddStringToObject
(
pRoot
,
"newCfgTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pMsg
->
newCfgSeqNum
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pMsg
->
newCfgSeqNum
);
cJSON_AddStringToObject
(
pRoot
,
"newCfgSeqNum"
,
u64buf
);
}
...
...
source/libs/sync/src/syncRaftCfg.c
浏览文件 @
6bb8a9ad
...
...
@@ -186,14 +186,14 @@ cJSON *raftCfg2Json(SRaftCfg *pRaftCfg) {
cJSON_AddNumberToObject
(
pRoot
,
"batchSize"
,
pRaftCfg
->
batchSize
);
char
buf64
[
128
];
snprintf
(
buf64
,
sizeof
(
buf64
),
PRId64
,
pRaftCfg
->
lastConfigIndex
);
snprintf
(
buf64
,
sizeof
(
buf64
),
"%"
PRId64
,
pRaftCfg
->
lastConfigIndex
);
cJSON_AddStringToObject
(
pRoot
,
"lastConfigIndex"
,
buf64
);
cJSON_AddNumberToObject
(
pRoot
,
"configIndexCount"
,
pRaftCfg
->
configIndexCount
);
cJSON
*
pIndexArr
=
cJSON_CreateArray
();
cJSON_AddItemToObject
(
pRoot
,
"configIndexArr"
,
pIndexArr
);
for
(
int
i
=
0
;
i
<
pRaftCfg
->
configIndexCount
;
++
i
)
{
snprintf
(
buf64
,
sizeof
(
buf64
),
PRId64
,
(
pRaftCfg
->
configIndexArr
)[
i
]);
snprintf
(
buf64
,
sizeof
(
buf64
),
"%"
PRId64
,
(
pRaftCfg
->
configIndexArr
)[
i
]);
cJSON
*
pIndexObj
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
pIndexObj
,
"index"
,
buf64
);
cJSON_AddItemToArray
(
pIndexArr
,
pIndexObj
);
...
...
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
6bb8a9ad
...
...
@@ -130,12 +130,12 @@ cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry) {
cJSON_AddNumberToObject
(
pRoot
,
"bytes"
,
pEntry
->
bytes
);
cJSON_AddNumberToObject
(
pRoot
,
"msgType"
,
pEntry
->
msgType
);
cJSON_AddNumberToObject
(
pRoot
,
"originalRpcType"
,
pEntry
->
originalRpcType
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pEntry
->
seqNum
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pEntry
->
seqNum
);
cJSON_AddStringToObject
(
pRoot
,
"seqNum"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"isWeak"
,
pEntry
->
isWeak
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pEntry
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pEntry
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pEntry
->
index
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pEntry
->
index
);
cJSON_AddStringToObject
(
pRoot
,
"index"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pEntry
->
dataLen
);
...
...
source/libs/sync/src/syncRaftLog.c
浏览文件 @
6bb8a9ad
...
...
@@ -546,25 +546,25 @@ cJSON* logStore2Json(SSyncLogStore* pLogStore) {
cJSON_AddStringToObject
(
pRoot
,
"pWal"
,
u64buf
);
SyncIndex
beginIndex
=
raftLogBeginIndex
(
pLogStore
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
beginIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
beginIndex
);
cJSON_AddStringToObject
(
pRoot
,
"beginIndex"
,
u64buf
);
SyncIndex
endIndex
=
raftLogEndIndex
(
pLogStore
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
endIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
endIndex
);
cJSON_AddStringToObject
(
pRoot
,
"endIndex"
,
u64buf
);
int32_t
count
=
raftLogEntryCount
(
pLogStore
);
cJSON_AddNumberToObject
(
pRoot
,
"entryCount"
,
count
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
raftLogWriteIndex
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
raftLogWriteIndex
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"WriteIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%d"
,
raftLogIsEmpty
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"IsEmpty"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
raftLogLastIndex
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
raftLogLastIndex
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"LastIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
raftLogLastTerm
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
raftLogLastTerm
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"LastTerm"
,
u64buf
);
cJSON
*
pEntries
=
cJSON_CreateArray
();
...
...
@@ -603,25 +603,25 @@ cJSON* logStoreSimple2Json(SSyncLogStore* pLogStore) {
cJSON_AddStringToObject
(
pRoot
,
"pWal"
,
u64buf
);
SyncIndex
beginIndex
=
raftLogBeginIndex
(
pLogStore
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
beginIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
beginIndex
);
cJSON_AddStringToObject
(
pRoot
,
"beginIndex"
,
u64buf
);
SyncIndex
endIndex
=
raftLogEndIndex
(
pLogStore
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
endIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
endIndex
);
cJSON_AddStringToObject
(
pRoot
,
"endIndex"
,
u64buf
);
int32_t
count
=
raftLogEntryCount
(
pLogStore
);
cJSON_AddNumberToObject
(
pRoot
,
"entryCount"
,
count
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
raftLogWriteIndex
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
raftLogWriteIndex
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"WriteIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%d"
,
raftLogIsEmpty
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"IsEmpty"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRId64
,
raftLogLastIndex
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRId64
,
raftLogLastIndex
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"LastIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
raftLogLastTerm
(
pLogStore
));
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
raftLogLastTerm
(
pLogStore
));
cJSON_AddStringToObject
(
pRoot
,
"LastTerm"
,
u64buf
);
}
...
...
source/libs/sync/src/syncRaftStore.c
浏览文件 @
6bb8a9ad
...
...
@@ -108,10 +108,10 @@ int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) {
cJSON
*
pRoot
=
cJSON_CreateObject
();
char
u64Buf
[
128
]
=
{
0
};
snprintf
(
u64Buf
,
sizeof
(
u64Buf
),
PRIu64
,
pRaftStore
->
currentTerm
);
snprintf
(
u64Buf
,
sizeof
(
u64Buf
),
"%lu"
,
pRaftStore
->
currentTerm
);
cJSON_AddStringToObject
(
pRoot
,
"current_term"
,
u64Buf
);
snprintf
(
u64Buf
,
sizeof
(
u64Buf
),
PRIu64
,
pRaftStore
->
voteFor
.
addr
);
snprintf
(
u64Buf
,
sizeof
(
u64Buf
),
"%lu"
,
pRaftStore
->
voteFor
.
addr
);
cJSON_AddStringToObject
(
pRoot
,
"vote_for_addr"
,
u64Buf
);
cJSON_AddNumberToObject
(
pRoot
,
"vote_for_vgid"
,
pRaftStore
->
voteFor
.
vgId
);
...
...
@@ -142,11 +142,11 @@ int32_t raftStoreDeserialize(SRaftStore *pRaftStore, char *buf, size_t len) {
cJSON
*
pCurrentTerm
=
cJSON_GetObjectItem
(
pRoot
,
"current_term"
);
ASSERT
(
cJSON_IsString
(
pCurrentTerm
));
sscanf
(
pCurrentTerm
->
valuestring
,
PRIu64
,
&
(
pRaftStore
->
currentTerm
));
sscanf
(
pCurrentTerm
->
valuestring
,
"%lu"
,
&
(
pRaftStore
->
currentTerm
));
cJSON
*
pVoteForAddr
=
cJSON_GetObjectItem
(
pRoot
,
"vote_for_addr"
);
ASSERT
(
cJSON_IsString
(
pVoteForAddr
));
sscanf
(
pVoteForAddr
->
valuestring
,
PRIu64
,
&
(
pRaftStore
->
voteFor
.
addr
));
sscanf
(
pVoteForAddr
->
valuestring
,
"%lu"
,
&
(
pRaftStore
->
voteFor
.
addr
));
cJSON
*
pVoteForVgid
=
cJSON_GetObjectItem
(
pRoot
,
"vote_for_vgid"
);
pRaftStore
->
voteFor
.
vgId
=
pVoteForVgid
->
valueint
;
...
...
@@ -188,11 +188,11 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) {
cJSON
*
pRoot
=
cJSON_CreateObject
();
if
(
pRaftStore
!=
NULL
)
{
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pRaftStore
->
currentTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%lu"
,
pRaftStore
->
currentTerm
);
cJSON_AddStringToObject
(
pRoot
,
"currentTerm"
,
u64buf
);
cJSON
*
pVoteFor
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pRaftStore
->
voteFor
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%lu"
,
pRaftStore
->
voteFor
.
addr
);
cJSON_AddStringToObject
(
pVoteFor
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pRaftStore
->
voteFor
.
addr
;
...
...
@@ -224,25 +224,25 @@ char *raftStore2Str(SRaftStore *pRaftStore) {
// for debug -------------------
void
raftStorePrint
(
SRaftStore
*
pObj
)
{
char
*
serialized
=
raftStore2Str
(
pObj
);
printf
(
"raftStorePrint | len:%
"
PRIu64
"
| %s
\n
"
,
strlen
(
serialized
),
serialized
);
printf
(
"raftStorePrint | len:%
lu
| %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
raftStorePrint2
(
char
*
s
,
SRaftStore
*
pObj
)
{
char
*
serialized
=
raftStore2Str
(
pObj
);
printf
(
"raftStorePrint2 | len:%
"
PRIu64
"
| %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
printf
(
"raftStorePrint2 | len:%
lu
| %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
taosMemoryFree
(
serialized
);
}
void
raftStoreLog
(
SRaftStore
*
pObj
)
{
char
*
serialized
=
raftStore2Str
(
pObj
);
sTrace
(
"raftStoreLog | len:%
"
PRIu64
"
| %s"
,
strlen
(
serialized
),
serialized
);
sTrace
(
"raftStoreLog | len:%
lu
| %s"
,
strlen
(
serialized
),
serialized
);
taosMemoryFree
(
serialized
);
}
void
raftStoreLog2
(
char
*
s
,
SRaftStore
*
pObj
)
{
char
*
serialized
=
raftStore2Str
(
pObj
);
sTrace
(
"raftStoreLog2 | len:%
"
PRIu64
"
| %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
sTrace
(
"raftStoreLog2 | len:%
lu
| %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
taosMemoryFree
(
serialized
);
}
source/libs/sync/src/syncSnapshot.c
浏览文件 @
6bb8a9ad
...
...
@@ -350,19 +350,19 @@ cJSON *snapshotSender2Json(SSyncSnapshotSender *pSender) {
}
cJSON
*
pSnapshot
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pSender
->
snapshot
.
lastApplyIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pSender
->
snapshot
.
lastApplyIndex
);
cJSON_AddStringToObject
(
pSnapshot
,
"lastApplyIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pSender
->
snapshot
.
lastApplyTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pSender
->
snapshot
.
lastApplyTerm
);
cJSON_AddStringToObject
(
pSnapshot
,
"lastApplyTerm"
,
u64buf
);
cJSON_AddItemToObject
(
pRoot
,
"snapshot"
,
pSnapshot
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pSender
->
sendingMS
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pSender
->
sendingMS
);
cJSON_AddStringToObject
(
pRoot
,
"sendingMS"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%p"
,
pSender
->
pSyncNode
);
cJSON_AddStringToObject
(
pRoot
,
"pSyncNode"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"replicaIndex"
,
pSender
->
replicaIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pSender
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pSender
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pSender
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pSender
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"finish"
,
pSender
->
finish
);
}
...
...
@@ -640,7 +640,7 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) {
cJSON_AddStringToObject
(
pRoot
,
"pSyncNode"
,
u64buf
);
cJSON
*
pFromId
=
cJSON_CreateObject
();
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
fromId
.
addr
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
fromId
.
addr
);
cJSON_AddStringToObject
(
pFromId
,
"addr"
,
u64buf
);
{
uint64_t
u64
=
pReceiver
->
fromId
.
addr
;
...
...
@@ -654,19 +654,19 @@ cJSON *snapshotReceiver2Json(SSyncSnapshotReceiver *pReceiver) {
cJSON_AddNumberToObject
(
pFromId
,
"vgId"
,
pReceiver
->
fromId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"fromId"
,
pFromId
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
snapshot
.
lastApplyIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
snapshot
.
lastApplyIndex
);
cJSON_AddStringToObject
(
pRoot
,
"snapshot.lastApplyIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
snapshot
.
lastApplyTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
snapshot
.
lastApplyTerm
);
cJSON_AddStringToObject
(
pRoot
,
"snapshot.lastApplyTerm"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
snapshot
.
lastConfigIndex
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
snapshot
.
lastConfigIndex
);
cJSON_AddStringToObject
(
pRoot
,
"snapshot.lastConfigIndex"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pReceiver
->
privateTerm
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pReceiver
->
privateTerm
);
cJSON_AddStringToObject
(
pRoot
,
"privateTerm"
,
u64buf
);
}
...
...
source/libs/sync/src/syncVoteMgr.c
浏览文件 @
6bb8a9ad
...
...
@@ -109,7 +109,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
cJSON_AddItemToObject
(
pRoot
,
"isGranted"
,
pIsGranted
);
cJSON_AddNumberToObject
(
pRoot
,
"votes"
,
pVotesGranted
->
votes
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pVotesGranted
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pVotesGranted
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
cJSON_AddNumberToObject
(
pRoot
,
"quorum"
,
pVotesGranted
->
quorum
);
cJSON_AddNumberToObject
(
pRoot
,
"toLeader"
,
pVotesGranted
->
toLeader
);
...
...
@@ -243,7 +243,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
cJSON_AddItemToObject
(
pRoot
,
"isRespond"
,
pIsRespond
);
cJSON_AddNumberToObject
(
pRoot
,
"respondNum"
,
respondNum
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
PRIu64
,
pVotesRespond
->
term
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%"
PRIu64
,
pVotesRespond
->
term
);
cJSON_AddStringToObject
(
pRoot
,
"term"
,
u64buf
);
snprintf
(
u64buf
,
sizeof
(
u64buf
),
"%p"
,
pVotesRespond
->
pSyncNode
);
cJSON_AddStringToObject
(
pRoot
,
"pSyncNode"
,
u64buf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录